Connect
API
Call Arena from any OpenAI- or Anthropic-compatible SDK or client.
The Arena API speaks both the OpenAI and the Anthropic formats. Any SDK or tool that lets you set a base URL and an API key can use it. For Claude Code, Codex and OpenCode, the Quickstart sets everything up for you.
At a glance
| OpenAI-compatible base URL | https://api.arena.ai/v1 |
| Anthropic-compatible base URL | https://api.arena.ai |
| Authentication | Authorization: Bearer <key> (Anthropic format also accepts x-api-key) |
| Router model | coding-router-preview |
Make your first request
1. Create an API key
Create a key on the Keys page. You can only copy it once, so store it in an environment variable or a secrets manager. Never commit it to version control.
export ARENA_API_KEY=<your-arena-key>2. Set the base URL
OpenAI-compatible clients:
https://api.arena.ai/v1. Send the key asAuthorization: Bearer.Anthropic-compatible clients:
https://api.arena.ai, the gateway root without/v1. Send the key asx-api-keyorAuthorization: Bearer.Method Path Format POST /v1/chat/completionsOpenAI Chat Completions POST /v1/responsesOpenAI Responses (also /v1/responses/compact) POST /v1/messagesAnthropic Messages (alias: /anthropic/v1/messages) GET /v1/modelsModels your key can call 3. Choose a model
coding-router-previewlets Arena Router pick a model for each request. Responses report"model": "arena-router"and theX-Arena-Routing-Mode: routerheader. The model that served the request is not shown.- To call one model directly, use its ID from the Models page or from
GET /v1/models. Direct models need paid or promotional (all models) funds. coding-router-previewis tuned for coding tools such as Claude Code, Codex and OpenCode. Outside a coding tool it may give unexpected results; if it does, call a direct model instead.
curl https://api.arena.ai/v1/models \ -H "Authorization: Bearer $ARENA_API_KEY"4. Send a request
OpenAI format
curl https://api.arena.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ARENA_API_KEY" \ -d '{ "model": "coding-router-preview", "messages": [{"role": "user", "content": "Hello!"}] }'Anthropic format
curl https://api.arena.ai/v1/messages \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -H "x-api-key: $ARENA_API_KEY" \ -d '{ "model": "coding-router-preview", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}] }'5. Stream responses
Add
"stream": trueto receive tokens as they are generated. The SDK examples reuse the client from step 4.curl https://api.arena.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ARENA_API_KEY" \ -d '{ "model": "coding-router-preview", "messages": [{"role": "user", "content": "Tell me a joke"}], "stream": true }'
Good to know
- All of your keys share one rate limit. A 429 response includes a
Retry-Afterheader; see rate limits. - Arena does not fall back to another model when a request fails. Retry, or choose a different model.
- Each request is charged to your workspace's balance. See your spend on Usage.
- To switch models in a coding tool, see Switching models.