CanaryLLM API

Customer API docs

Use the customer API key issued to your account. The API supports OpenAI-compatible chat completions and Anthropic-compatible Messages for approved models.

Connection details

API base
https://api.canaryllm.com
Dashboard
https://app.canaryllm.com/customer-ui
Auth
Authorization: Bearer CUSTOMER_KEY
Content type
application/json

Current support matrix

List available models

curl https://api.canaryllm.com/v1/models \
  -H "Authorization: Bearer CUSTOMER_KEY"

The response includes the models allowed for the key and customer-visible pricing fields where configured.

Switch models

Each request chooses its model with the model field. To switch models, send another request with a different allowed model ID.

{
  "model": "claude-opus",
  "messages": [
    {"role": "user", "content": "Use this model for this request."}
  ],
  "max_tokens": 200
}

The customer portal also has a model dropdown for test requests. If a key is restricted, unavailable models are rejected with a model-permission error.

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": 8,
    "metadata": {
      "session_id": "sess_123",
      "user_id": "customer_user_123",
      "turn_index": 1
    }
  }'

Metadata fields are optional, but using stable session and user IDs makes usage and traces easier to review in the customer dashboard.

Anthropic-compatible Messages

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
  }'

Use this route for Anthropic SDKs or clients that expect /v1/messages and x-api-key.

Claude Code CLI

For Anthropic-compatible CLI clients, use the CanaryLLM gateway as the base URL and your customer API key as the auth token.

export ANTHROPIC_BASE_URL="https://api.canaryllm.com"
export ANTHROPIC_AUTH_TOKEN="CUSTOMER_KEY"

claude

Credits and limits

Prompt caching

Claude prompt caching is enabled automatically for repeated stable context. To improve cache hit rate, keep large reusable instructions, tools, examples, and reference text at the beginning of the conversation, then place changing user input near the end.

Performance guidance

What you need from us

Support facts