
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@embedapi/core
Advanced tools
🔥 ONE API KEY TO RULE THEM ALL! Access ANY AI model instantly through our game-changing unified API. Build AI apps in minutes, not months! The ultimate all-in-one AI agent solution you've been waiting for! 🚀
🚀 The ULTIMATE Node.js client that gives you SUPERPOWERS! Connect to 100+ AI models with ONE line of code! Build the next unicorn startup in minutes, not months! 🦄✨
Transform your boring apps into AI-powered MONSTERS that users can't stop talking about! 🔥💪
🔥 ONE API KEY TO RULE THEM ALL! Access ANY AI model instantly through our game-changing unified API. Build AI apps in minutes, not months! The ultimate all-in-one AI agent solution you've been waiting for! 🚀
Visit embedapi.com to get your API key and start building!
npm install @embedapi/core
Using yarn:
yarn add @embedapi/core
Using pnpm:
pnpm add @embedapi/core
const EmbedAPIClient = require('@embedapi/core');
# Regular API client
const client = new EmbedAPIClient('your-api-key');
# Agent mode client
const agentClient = new EmbedAPIClient('your-agent-id', { isAgent: true });
# Debug mode client
const debugClient = new EmbedAPIClient('your-api-key', { debug: true });
# Agent and debug mode client
const debugAgentClient = new EmbedAPIClient('your-agent-id', {
isAgent: true,
debug: true
});
apiKey (string): Your API key for regular mode, or agent ID for agent modeoptions (object, optional): Configuration options
isAgent (boolean, optional): Set to true to use agent mode. Defaults to falsedebug (boolean, optional): Set to true to enable debug logging. Defaults to falsegenerate(options)Generates text using AI models.
service (string): AI service provider (openai, anthropic, vertexai, etc.)model (string): Model namemessages (array): Array of message objectsmaxTokens (number, optional): Maximum tokens to generatetemperature (number, optional): Temperature (0-1)topP (number, optional): Top P samplingfrequencyPenalty (number, optional): Frequency penaltypresencePenalty (number, optional): Presence penaltystopSequences (array, optional): Stop sequencestools (array, optional): Tools to usetoolChoice (string, optional): Tool choiceenabledTools (array, optional): Enabled toolsuserId (string, optional): User ID (for agent mode)// Regular mode
const response = await client.generate({
service: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
});
// Agent mode
const agentResponse = await agentClient.generate({
service: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
});
stream({ service, model, messages, ...options })Streams text generation using the specified AI service and model.
Same as generate(), plus:
streamOptions (object, optional): Stream-specific configuration optionsThe stream emits Server-Sent Events (SSE) with two types of messages:
{
"content": "Generated text chunk",
"role": "assistant"
}
{
"type": "done",
"tokenUsage": 17,
"cost": 0.000612
}
// Regular mode
const streamResponse = await client.stream({
service: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
});
// Agent mode
const agentStreamResponse = await agentClient.stream({
service: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
});
// Process the stream
const reader = streamResponse.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n');
for (const line of lines) {
if (line.startsWith('data: ')) {
const data = JSON.parse(line.slice(6));
if (data.type === 'done') {
console.log('Stream stats:', {
tokenUsage: data.tokenUsage,
cost: data.cost
});
} else {
console.log('Content:', data.content);
}
}
}
}
listModels()Lists all available models.
const models = await client.listModels();
testAPIConnection()Tests the connection to the API.
const isConnected = await client.testAPIConnection();
genImage(options)Generates images using AI models.
prompt (string): Image descriptionwidth (number, optional): Image widthheight (number, optional): Image heightmaxTokens (number, optional): Maximum tokenstemperature (number, optional): Temperature (0-1)steps (number, optional): Generation stepsguidance (number, optional): Guidance scaleseed (number, optional): Random seedimage_count (number, optional): Number of images to generateimage_quality (string, optional): Image qualityimage_format (string, optional): Image formatmodel (string, optional): Model name ('stability.stable-image-ultra-v1:1' or 'imagen')// Stability AI example
const stabilityResponse = await client.genImage({
prompt: 'A beautiful sunset over mountains',
width: 512,
height: 512,
model: 'stability.stable-image-ultra-v1:1',
steps: 30,
guidance: 7.5
});
// Imagen example
const imagenResponse = await client.genImage({
prompt: 'A futuristic cityscape at night',
width: 1024,
height: 1024,
model: 'imagen',
steps: 50,
guidance: 8.5,
image_quality: 'high',
image_format: 'png'
});
isNSFW(image)Checks if an image is NSFW (Not Safe For Work).
image (object): Image data object
data (string): Base64 encoded image datamimeType (string): MIME type of the image (e.g., 'image/png', 'image/jpeg')const nsfwResult = await client.isNSFW({
data: base64ImageData,
mimeType: 'image/png'
});
textToSpeech(text)Converts text to speech.
text (string): Text to convert to speechconst audioBlob = await client.textToSpeech('Hello, world!');
speechToText(audioBase64)Converts speech to text.
audioBase64 (string): Base64 encoded audio fileconst transcription = await client.speechToText(base64AudioData);
processImages(options)Processes images using Vision AI.
prompt (string): Description of what to analyzeimages (string[]): Array of base64 encoded imagesconst analysis = await client.processImages({
prompt: 'Describe what you see in this image',
images: [base64ImageData]
});
The EmbedAPI client provides comprehensive agent management capabilities for creating, listing, updating, and deleting AI agents.
createAgent(agentData)Creates a new AI agent.
agentData (object): Agent configuration data
name (string): Agent namedescription (string): Agent descriptionservice (string): AI service provider (openai, anthropic, vertexai, etc.)model (string): Specific model to useinstructions (string): System instructions for the agenttheme (object, optional): Theme configurationcustomTheme (boolean, optional): Whether to use custom themecustomColors (object, optional): Custom color configurationfeatures (string[], optional): Agent featuressecurity (object, optional): Security configurationisPublic (boolean, optional): Whether the agent is publicconst agentData = {
name: 'Customer Service Bot',
description: 'A helpful customer service assistant',
service: 'openai',
model: 'gpt-4o',
instructions: 'You are a helpful customer service representative. Be polite and professional.',
theme: {
name: 'Classic Light',
colors: {
primary: '#1976d2',
background: '#ffffff',
text: '#1A1A1A'
}
},
customTheme: false,
customColors: {
primary: '#1976d2',
background: '#ffffff',
text: '#1A1A1A'
},
features: ['Knowledge Base', 'Function Calling'],
security: {
embedEnabled: false,
allowedDomains: [],
rateLimit: 60,
maxTokensPerDay: 10000
},
isPublic: false
};
const response = await client.createAgent(agentData);
console.log('Created agent:', response.agent);
listAgents(options)Lists agents owned by the authenticated user.
options (object, optional): Query options
limit (number, optional): Number of agents to return (default: 50, max: 100)offset (number, optional): Number of agents to skip (default: 0)status (string, optional): Filter by status (active, inactive)isPublic (boolean, optional): Filter by public status// List all agents
const allAgents = await client.listAgents();
// List with pagination and filters
const filteredAgents = await client.listAgents({
limit: 10,
offset: 0,
status: 'active',
isPublic: false
});
console.log('Total agents:', allAgents.total);
console.log('Agents:', allAgents.agents);
getAgent(agentId)Retrieves a specific agent by ID.
agentId (string): The agent IDconst agent = await client.getAgent('agent-id-123');
console.log('Agent details:', agent.agent);
updateAgent(agentId, updateData)Updates an existing agent. Only fields provided in the request body will be updated.
agentId (string): The agent IDupdateData (object): Fields to updateconst updateData = {
name: 'Updated Customer Service Bot',
description: 'An improved customer service assistant',
instructions: 'You are an improved customer service representative.',
isPublic: true
};
const response = await client.updateAgent('agent-id-123', updateData);
console.log('Updated agent:', response.agent);
deleteAgent(agentId)Deletes an agent.
agentId (string): The agent IDconst response = await client.deleteAgent('agent-id-123');
console.log('Deletion result:', response.message);
const EmbedAPIClient = require('@embedapi/core');
const client = new EmbedAPIClient('your-api-key');
async function manageAgents() {
try {
// Create a new agent
const newAgent = await client.createAgent({
name: 'Sales Assistant',
description: 'AI sales assistant for product recommendations',
service: 'anthropic',
model: 'claude-3-opus',
instructions: 'You are a knowledgeable sales assistant...',
features: ['Knowledge Base', 'Function Calling'],
isPublic: false
});
console.log('Created agent:', newAgent.agentId);
// List all agents
const agents = await client.listAgents({ limit: 10 });
console.log('Found', agents.total, 'agents');
// Get specific agent
const agent = await client.getAgent(newAgent.agentId);
console.log('Agent details:', agent.agent.name);
// Update agent
const updated = await client.updateAgent(newAgent.agentId, {
name: 'Enhanced Sales Assistant',
isPublic: true
});
console.log('Updated agent:', updated.agent.name);
// Delete agent
const deleted = await client.deleteAgent(newAgent.agentId);
console.log('Agent deleted:', deleted.message);
} catch (error) {
console.error('Error managing agents:', error.message);
}
}
manageAgents();
Generated images are temporarily stored on the server and will be automatically deleted after a period of time. It is recommended to:
Generated audio files from Text-to-Speech are also temporarily stored. Make sure to:
All methods throw errors if the API request fails:
try {
const response = await client.generate({
service: 'openai',
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
});
} catch (error) {
console.error('Error:', error.message);
}
The client supports two authentication modes:
Regular Mode (default)
new EmbedAPIClient('your-api-key')Agent Mode
new EmbedAPIClient('your-agent-id', { isAgent: true })userId parameter available for request trackingLooking for creative ways to use EmbedAPI? From AI story visualizers and comic creators to intelligent business solutions and interactive art galleries, the possibilities are endless! Check out INFINITE_POSSIBILITIES.md for innovative use cases and complete code examples that will spark your imagination. 🚀✨
Built something amazing? Share it with the community!
Remember: The only limit is your imagination! 🚀
MIT
FAQs
🔥 ONE API KEY TO RULE THEM ALL! Access ANY AI model instantly through our game-changing unified API. Build AI apps in minutes, not months! The ultimate all-in-one AI agent solution you've been waiting for! 🚀
We found that @embedapi/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.