Getting Started
Make your first API call in under a minute. The Arena API is OpenAI-compatible — use any OpenAI SDK.
1. Create an API key
- Go to the Keys page in the dashboard.
- Click Create Key and give it a name.
- Copy the key — you won't be able to see it again.
- Set it as an environment variable:
export GATEWAY_API_KEY=<your-key>
2. Make your first API call
Point any OpenAI SDK at https://api.preview.arena.ai/v1 and use your Arena API key. Setting model to "auto" lets Arena pick the best model for your request.
curl https://api.preview.arena.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-d '{
"model": "auto",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'3. Try streaming
Add "stream": true to receive tokens as they are generated. Works with all routing modes and direct models.
curl https://api.preview.arena.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-d '{
"model": "auto",
"messages": [
{"role": "user", "content": "Tell me a joke"}
],
"stream": true
}'4. Try audio routes
Audio support is currently limited to newly created audio-enabled keys. GPT speech models use dedicated audio endpoints, while GPT audio chat models stay on /v1/chat/completions.
curl https://api.preview.arena.ai/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "Hello from Arena API.",
"voice": "alloy",
"response_format": "mp3"
}' \
--output speech.mp3curl https://api.preview.arena.ai/v1/audio/transcriptions \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-F "model=gpt-4o-transcribe" \
-F "[email protected]"curl https://api.preview.arena.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-d '{
"model": "gpt-audio",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "mp3" },
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize this clip." },
{
"type": "input_audio",
"input_audio": { "data": "<base64-audio>", "format": "wav" }
}
]
}
]
}'5. Use Claude Code
Claude Code and Anthropic SDK clients use /v1/messages. Point the Anthropic base URL at the gateway root, not /v1. /anthropic/v1/messages is also available as a compatibility alias.
export ANTHROPIC_BASE_URL=https://api.preview.arena.ai
export ANTHROPIC_AUTH_TOKEN=$GATEWAY_API_KEY
export ANTHROPIC_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6
claude --model "$ANTHROPIC_MODEL"curl https://api.preview.arena.ai/v1/messages \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-H "x-api-key: $GATEWAY_API_KEY" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Next steps
- Routing Modes — use auto, max, fast, or cheap to control model selection.
- Browse Models — explore all available models, pricing, and latency.
- API Reference — full OpenAPI documentation for all endpoints.