The Channeling API is a drop-in replacement for the Anthropic Messages API. Use your existing Anthropic SDK or HTTP calls, but authenticate with Chucky JWT tokens instead of Anthropic API keys.
Endpoint
https://channeling.chucky.cloud/v1/messages
Authentication
Replace the Anthropic API key with your Chucky JWT token in the x-api-key header:
curl -X POST https://channeling.chucky.cloud/v1/messages \
-H "x-api-key: YOUR_CHUCKY_JWT" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}'
Creating Tokens
Tokens are created server-side with your HMAC secret:
import { createToken, createBudget } from '@chucky.cloud/sdk';
const token = await createToken({
userId: 'user-123',
projectId: process.env.CHUCKY_PROJECT_ID,
secret: process.env.CHUCKY_HMAC_SECRET,
budget: createBudget({
aiDollars: 5.00,
computeHours: 1,
window: 'day',
}),
});
See Authentication for full token creation guide.
Supported Endpoints
| Endpoint | Method | Description |
|---|
/v1/messages | POST | Create a message (Anthropic Messages API) |
The request body follows the Anthropic Messages API format exactly:
{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Explain quantum computing"}
],
"system": "You are a helpful assistant.",
"stream": false
}
Responses match the Anthropic API format:
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Quantum computing is..."
}
],
"model": "claude-sonnet-4-5-20250929",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 150
}
}
Streaming
Enable streaming by setting "stream": true:
curl -X POST https://channeling.chucky.cloud/v1/messages \
-H "x-api-key: YOUR_CHUCKY_JWT" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Write a poem"}],
"stream": true
}'
Streaming uses Server-Sent Events (SSE) matching the Anthropic format.
Multi-Provider Support
The Channeling API supports multiple AI providers through model routing:
Anthropic (Default)
{"model": "claude-sonnet-4-5-20250929"}
{"model": "claude-opus-4-5-20251101"}
{"model": "claude-3-5-haiku-20241022"}
OpenAI
{"model": "gpt-5.2"}
{"model": "gpt-5"}
{"model": "o4-mini"}
Requires OpenAI API key configured in your project settings.
OpenRouter
Use the or: prefix for explicit routing, or any unknown model name:
{"model": "or:mistralai/mistral-large"}
{"model": "or:deepseek/deepseek-chat"}
{"model": "or:mistralai/devstral-2512:free"}
Requires OpenRouter API key configured in your project settings.
See Models & Providers for full provider documentation.
Using with Anthropic SDKs
TypeScript/JavaScript
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: CHUCKY_JWT_TOKEN,
baseURL: 'https://channeling.chucky.cloud',
});
const message = await client.messages.create({
model: 'claude-sonnet-4-5-20250929',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello!' }],
});
Python
import anthropic
client = anthropic.Anthropic(
api_key=CHUCKY_JWT_TOKEN,
base_url='https://channeling.chucky.cloud',
)
message = client.messages.create(
model='claude-sonnet-4-5-20250929',
max_tokens=1024,
messages=[{'role': 'user', 'content': 'Hello!'}],
)
Budget Enforcement
The Channeling API enforces budgets embedded in JWT tokens:
- AI Budget: Limits total AI spend per user
- Compute Budget: Not applicable (no sandbox execution)
When budget is exceeded, requests return a 429 error:
{
"error": {
"type": "rate_limit_error",
"message": "AI budget exceeded for user"
}
}
Cost Tracking
Every request is tracked against the user’s budget. Costs are calculated based on:
- Model used
- Input/output tokens
- Custom pricing (if configured)
View usage in the dashboard.
Use Cases
Direct API Access
Use HTTP calls without the Chucky SDK:
# From any language or tool that can make HTTP requests
curl -X POST https://channeling.chucky.cloud/v1/messages ...
Existing Anthropic Integrations
Point existing Anthropic SDK code to Chucky by changing the base URL:
// Before
const client = new Anthropic({ apiKey: ANTHROPIC_API_KEY });
// After
const client = new Anthropic({
apiKey: CHUCKY_JWT_TOKEN,
baseURL: 'https://channeling.chucky.cloud',
});
Any tool that supports custom Anthropic endpoints can use Channeling:
- VS Code extensions
- CLI tools
- Automation platforms
Error Handling
| Status | Error Type | Description |
|---|
| 400 | invalid_request_error | Malformed request body |
| 401 | authentication_error | Invalid or expired JWT |
| 429 | rate_limit_error | Budget exceeded |
| 500 | api_error | Upstream provider error |
Next Steps