@reminix/anthropic
v0.0.18
Published
Reminix adapter for Anthropic - serve agents as REST APIs
Downloads
886
Maintainers
Readme
@reminix/anthropic
Reminix Runtime adapter for the Anthropic API. Serve Claude models as a REST API.
Ready to go live? Deploy to Reminix Cloud for zero-config hosting, or self-host on your own infrastructure.
Installation
npm install @reminix/anthropic @anthropic-ai/sdkThis will also install @reminix/runtime as a dependency.
Quick Start
import Anthropic from '@anthropic-ai/sdk';
import { serveAgent } from '@reminix/anthropic';
const client = new Anthropic();
serveAgent(client, { name: 'my-claude', model: 'claude-sonnet-4-20250514', port: 8080 });For more flexibility (e.g., serving multiple agents), use wrapAgent and serve separately:
import Anthropic from '@anthropic-ai/sdk';
import { wrapAgent } from '@reminix/anthropic';
import { serve } from '@reminix/runtime';
const client = new Anthropic();
const agent = wrapAgent(client, { name: 'my-claude', model: 'claude-sonnet-4-20250514' });
serve({ agents: [agent], port: 8080 });Your agent is now available at:
POST /agents/my-claude/invoke- Execute the agent
API Reference
serveAgent(client, options)
Wrap an Anthropic client and serve it immediately. Combines wrapAgent and serve for single-agent setups.
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| client | Anthropic | required | An Anthropic client |
| options.name | string | "anthropic-agent" | Name for the agent (used in URL path) |
| options.model | string | "claude-sonnet-4-20250514" | Model to use |
| options.maxTokens | number | 4096 | Maximum tokens in response |
| options.port | number | 8080 | Port to serve on |
| options.hostname | string | "0.0.0.0" | Hostname to bind to |
wrapAgent(client, options)
Wrap an Anthropic client for use with Reminix Runtime. Use this with serve from @reminix/runtime for multi-agent setups.
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| client | Anthropic | required | An Anthropic client |
| options.name | string | "anthropic-agent" | Name for the agent (used in URL path) |
| options.model | string | "claude-sonnet-4-20250514" | Model to use |
| options.maxTokens | number | 4096 | Maximum tokens in response |
Returns: AnthropicAgentAdapter - A Reminix adapter instance
System Messages
The adapter automatically handles Anthropic's system message format. System messages in your request are extracted and passed as the system parameter to the API.
// This works automatically:
const request = {
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Hello!' },
],
};Endpoint Input/Output Formats
POST /agents/{name}/invoke
Execute the agent with a prompt or messages.
Request with prompt:
{
"prompt": "Summarize this text: ..."
}Request with messages:
{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}Response:
{
"output": "Hello! How can I help you today?"
}Streaming
For streaming responses, set stream: true in the request:
{
"prompt": "Tell me a story",
"stream": true
}The response will be sent as Server-Sent Events (SSE).
Runtime Documentation
For information about the server, endpoints, request/response formats, and more, see the @reminix/runtime package.
Deployment
Ready to go live?
- Deploy to Reminix Cloud - Zero-config cloud hosting
- Self-host - Run on your own infrastructure
Links
License
Apache-2.0
