
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@elizaos/api-client
Advanced tools
Type-safe API client for ElizaOS server.
bun add @elizaos/api-client
import { ElizaClient } from '@elizaos/api-client';
// Create client instance
const client = ElizaClient.create({
baseUrl: 'http://localhost:3000',
apiKey: 'your-api-key', // optional
});
// List all agents
const { agents } = await client.agents.listAgents();
// Create a new agent
const agent = await client.agents.createAgent({
name: 'My Agent',
description: 'A helpful assistant',
});
// Send a message
const message = await client.messaging.postMessage(channelId, 'Hello, world!');
// Create a session for user-agent conversation
const session = await client.sessions.createSession({
agentId: agent.id,
userId: 'user-123',
metadata: { platform: 'web' },
});
// Send a message in the session
const sessionMessage = await client.sessions.sendMessage(session.sessionId, {
content: 'Hello, agent!',
});
// Upload media
const upload = await client.media.uploadAgentMedia(agentId, {
file: myFile,
filename: 'image.png',
});
// Quick one-off message with automatic polling (Jobs API)
const response = await client.jobs.ask('user-123', 'What is Bitcoin?');
console.log('Agent response:', response);
Example:
// Simple ask pattern - returns the response directly
const response = await client.jobs.ask('user-id', 'What is Bitcoin?');
// Create and poll manually for more control
const result = await client.jobs.createAndPoll({
userId: 'user-id',
content: 'Complex analysis query',
agentId: 'specific-agent-id', // Optional
timeoutMs: 60000, // Optional
});
if (result.success) {
console.log('Response:', result.job.result?.message.content);
console.log('Processing time:', result.job.result?.processingTimeMs, 'ms');
}
// Poll with exponential backoff for long-running queries
const backoffResult = await client.jobs.createAndPollWithBackoff({
userId: 'user-id',
content: 'Long running task',
}, {
initialInterval: 500,
maxInterval: 5000,
multiplier: 1.5,
});
// Get job status manually
const job = await client.jobs.getJob('job-id');
console.log('Status:', job.status);
// List all jobs
const { jobs } = await client.jobs.list({
status: JobStatus.COMPLETED,
limit: 10
});
// Check health metrics
const health = await client.jobs.health();
console.log('Success rate:', health.metrics.successRate);
import { ApiError } from '@elizaos/api-client';
try {
await client.agents.getAgent(agentId);
} catch (error) {
if (error instanceof ApiError) {
console.error(`Error ${error.code}: ${error.message}`);
if (error.details) {
console.error('Details:', error.details);
}
}
}
This package is written in TypeScript and provides full type definitions for all API endpoints, request parameters, and responses.
FAQs
Type-safe API client for ElizaOS server
The npm package @elizaos/api-client receives a total of 2,535 weekly downloads. As such, @elizaos/api-client popularity was classified as popular.
We found that @elizaos/api-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.