Docs

API documentation

Everything you need to integrate. Speak Anthropic or OpenAI — same key, same rules.

1. Get an API key

Sign up, then go to Dashboard → API Keys → Create new key. You'll get a string that starts with cc_user_. Copy it — we won't show it again.

2. Use the gateway

The base URL is https://api.your-domain.com (or whatever your operator told you).

Anthropic-native

curl https://api.your-domain.com/v1/messages \
  -H "x-api-key: $YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 512,
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ]
  }'

OpenAI-compatible

curl https://api.your-domain.com/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ]
  }'

Streaming (SSE)

curl https://api.your-domain.com/v1/messages \
  -H "x-api-key: $YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"claude-sonnet-4-6","stream":true,"max_tokens":1024,
       "messages":[{"role":"user","content":"Tell me a haiku."}]}'

3. Vision (images)

Inline base64-encoded images:

{
  "model": "claude-sonnet-4-6",
  "max_tokens": 512,
  "messages": [{
    "role": "user",
    "content": [
      {"type": "image", "source": {
        "type": "base64",
        "media_type": "image/png",
        "data": "iVBORw0KG..."
      }},
      {"type": "text", "text": "What's in this image?"}
    ]
  }]
}

4. Prompt caching

Mark message blocks with cache_control to keep them in cache and pay 10% on subsequent reads:

{
  "role": "user",
  "content": [
    {"type": "text", "text": "Large system context...",
     "cache_control": {"type": "ephemeral"}},
    {"type": "text", "text": "User question goes here"}
  ]
}

5. Tools (function calling)

{
  "model": "claude-sonnet-4-6",
  "max_tokens": 1024,
  "tools": [{
    "name": "get_weather",
    "description": "Look up current weather",
    "input_schema": {
      "type": "object",
      "properties": {"city": {"type": "string"}},
      "required": ["city"]
    }
  }],
  "messages": [{"role":"user","content":"Weather in Tokyo?"}]
}

6. Usage telemetry

Every successful request returns:

To retrieve usage for any past request:

GET /v1/usage/{request_id}
→ {
  "input_tokens": 781,
  "output_tokens": 921,
  "cache_read_input_tokens": 0,
  "cache_creation": {"ephemeral_5m_input_tokens": 0, ...},
  "cost_micro": 18234,
  "model": "claude-sonnet-4-6"
}

7. Error codes

CodeMeaning
401Missing or invalid API key.
402Insufficient credit — top up to continue.
429Rate limited (per-key RPM or upstream account RPM).
502Upstream Anthropic error. Our cooldown system reroutes.
503No healthy upstream account. Retry shortly.

8. SDKs

Use any existing SDK; just swap the base URL.

# Python (anthropic-sdk-python)
client = anthropic.Anthropic(
    api_key="cc_user_...",
    base_url="https://api.your-domain.com",
)

# Python (openai-python)
client = openai.OpenAI(
    api_key="cc_user_...",
    base_url="https://api.your-domain.com/v1",
)

# Node.js (@anthropic-ai/sdk)
const client = new Anthropic({ apiKey: process.env.YOUR_KEY,
                                baseURL: 'https://api.your-domain.com' });

Need something not listed here? Email support@example.com and we'll help.