AiRouter Docs

API Reference

AiRouter API documentation

πŸ“‘ API Reference

AiRouter supports two API formats β€” choose the one that fits your needs:

OpenAI-Compatible Format

For all clients and frameworks that support the OpenAI API (e.g., Cursor, ChatBox, OpenAI SDK).

curl https://airouter.one/v1/chat/completions \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant"},
      {"role": "user", "content": "Write a quicksort in Python"}
    ],
    "max_tokens": 2048,
    "stream": true
  }'

Claude Native Format

For native clients like Claude Code and the Anthropic SDK.

curl https://airouter.one/v1/messages \
  -H "x-api-key: your-api-key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "max_tokens": 2048,
    "messages": [
      {"role": "user", "content": "Write a quicksort in Python"}
    ]
  }'

Authentication

API FormatAuth HeaderExample
OpenAI-compatibleAuthorizationBearer your-api-key
Claude nativex-api-keyyour-api-key

On this page