Prompt
Test request
model field.Output
Response
No request yet.
Access
API keys
Catalog
Model pricing
Ledger
Recent usage
Documentation
API quick reference
Connection
Use your customer API key as a bearer token. Full keys are shown once when created and cannot be recovered later.
- API base:
https://api.canaryllm.com - Header:
Authorization: Bearer CUSTOMER_KEY - Content type:
application/json - Request ID header:
X-Provider-Request-ID
Supported API styles
- OpenAI-compatible:
/v1/chat/completions - Anthropic-compatible:
/v1/messages - Streaming is supported on both routes with
"stream": true. - Model access depends on the key and can be changed per request.
Model access
Available models depend on the key. Switch models in the UI dropdown or programmatically by changing the request model field.
- Blank or
allchild-key models inherit parent access. - Restricted keys reject unavailable models.
- The same session can use different allowed models.
List available models
curl https://api.canaryllm.com/v1/models \ -H "Authorization: Bearer CUSTOMER_KEY"
Create a chat completion
curl https://api.canaryllm.com/v1/chat/completions \
-H "Authorization: Bearer CUSTOMER_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "Reply with OK only."}
],
"max_tokens": 80,
"metadata": {
"session_id": "sess_123",
"user_id": "customer_user_123",
"turn_index": 1
}
}'
Switch models
Change only the model ID on the next request.
{
"model": "claude-opus",
"messages": [
{"role": "user", "content": "Use this model for this request."}
],
"max_tokens": 200
}
Credits and limits
- Requests require an active key and enough prepaid credits.
- Each key can have its own monthly credit cap.
- Usage and billing refresh from this portal.
- Streaming is supported with
"stream": true. - Default gateway guardrails are 180 requests/minute and 500,000 tokens/minute per key, plus 1,000 requests/minute and 2,000,000 tokens/minute per organization unless a custom limit is configured.
- Committed TPM, RPM, TPD, and SLA numbers must be confirmed for the specific account, model, and route before production commitments.
Anthropic-compatible Messages
Use this endpoint for Anthropic SDKs or clients that expect /v1/messages and x-api-key.
curl https://api.canaryllm.com/v1/messages \
-H "x-api-key: CUSTOMER_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
--data '{
"model": "claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "Reply with OK only."}
],
"max_tokens": 8,
"stream": true
}'
Claude Code CLI
Point Anthropic-compatible CLI clients at the CanaryLLM gateway with your customer key.
export ANTHROPIC_BASE_URL="https://api.canaryllm.com" export ANTHROPIC_AUTH_TOKEN="CUSTOMER_KEY" claude
Prompt caching
Claude prompt caching is enabled automatically for repeated stable context. For better cache hits, keep large reusable instructions, tools, and reference text at the beginning of the conversation and put changing user input near the end.
- Cache hits reduce cached input-token cost and usually lower latency.
- Changing timestamps, random IDs, or reordered context inside the reusable prefix can break cache hits.
- Usage rows show normal input, cache write, cache read, and output tokens separately.
- Advanced clients may send
"cache_control": {"type": "ephemeral"}; otherwise the platform applies automatic caching for Claude requests. - For very large single text blocks, the gateway may split a stable prefix into a cached text block and leave the changing suffix uncached. This happens within the same model request; requests are not decomposed into multiple model calls.
- For best results, still send stable context as separate system/message blocks when possible.
Performance guidance
- Use
"stream": truefor interactive chat so the first tokens appear as soon as generation starts. - Keep stable system prompts, tool definitions, examples, and reference text at the beginning of each request.
- Avoid changing timestamps, random IDs, request IDs, or ordering inside the stable prefix because that can reset cache hits.
- Set
max_tokensclose to the expected answer size to avoid unnecessary reservation and tail latency. - Usage rows show latency, time to first token, output tokens/sec, cache write tokens, and cache read tokens when reported.
Support facts
- Current primary gateway location: Helsinki, Finland.
- Prompt and response traces are retained under the configured platform retention policy. Current raw trace retention is 120 days.
- Use request IDs, timestamps, model IDs, route style, and visible key prefix when reporting issues. Do not send full API keys.