Getting started with
Point any OpenAI-compatible client at 27Arena and use arena/champion. The router picks a tested profile for your harness and pins it for your session.
Getting Started
Base URL: https://api.27arena.ai/v1. The same API is also served same-origin at /v1 on the 27Arena web app, which is handy for local development.
- Step 1: Subscribe (Founder plan) and sign in.
- Step 2: Create an API key in the dashboard. The secret is shown once.
- Step 3: Set the base URL and key in your agent or SDK and use model
arena/champion.
export ARENA_API_KEY="arena_..."Quickstart
Stream a chat completion. Responses follow OpenAI chat-completions semantics, including SSE streaming.
curl https://api.27arena.ai/v1/chat/completions \
-H "Authorization: Bearer $ARENA_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Arena-Session-Id: project-123-opaque-session" \
-d '{
"model": "arena/champion",
"stream": true,
"messages": [
{"role": "user", "content": "Fix failing tests and summarize the changes."}
]
}'Authentication
Send your key as a bearer token: Authorization: Bearer arena_.... Keys carry scopes — inference for completions, usage:read for account endpoints, keys:manage for key management. Rotate or revoke keys from the dashboard at any time.
Keys are personal. Sharing a key with many people, reselling access, or running a public inference proxy is not allowed on consumer plans.
API Reference
| Method | Path | Notes |
|---|---|---|
| POST | /v1/chat/completions | OpenAI-compatible subset; stream supported; n must be 1. |
| GET | /v1/models | Public aliases that currently have an active profile. |
| GET | /v1/account/usage | Your usage. Scope usage:read. |
| GET | /v1/account/subscription | Your plan and billing state. Scope usage:read. |
| GET | /health | Liveness, no auth: {status, time}. |
Model aliases
arena/champion— auto-selects a compatible Champion profile (recommended).arena/27b— Dense 27B division Champion.arena/pi,arena/opencode— pick your harness through the model id. Uses the profile tested with that harness once it passes its compatibility POC; until then it routes to the generic Champion (seeX-Arena-Profile).arena/moe,arena/loop— experimental divisions. Check/v1/modelsfor what's active.
curl https://api.27arena.ai/v1/models \
-H "Authorization: Bearer $ARENA_API_KEY"Optional request headers
X-Arena-Session-Id— opaque, ≤128 chars. Pins the Champion revision for a session so models never switch mid-task.
Response headers
Every response tells you exactly which profile served it — useful for debugging.
X-Arena-Route: arena/champion
X-Arena-Champion-Revision: 2026-11-19-r1
X-Arena-Profile: pi-v1
X-Arena-Queue-Ms: 142
X-Request-Id: req_...curl https://api.27arena.ai/v1/account/usage \
-H "Authorization: Bearer $ARENA_API_KEY" # key needs scope usage:readPiHarness
Add 27Arena as an OpenAI-compatible provider in Pi's custom models file (for example ~/.pi/agent/models.json), then select the model inside Pi. Field names can differ between Pi versions — check Pi's own documentation if a key isn't recognised.
{
"providers": {
"27arena": {
"baseUrl": "https://api.27arena.ai/v1",
"api": "openai-completions",
"apiKey": "ARENA_API_KEY",
"models": [
{ "id": "arena/pi", "name": "Arena Champion (Pi)" }
]
}
}
}Once the Pi profile passes its compatibility suite you can use arena/pi to pin the Pi-tuned profile explicitly.
OpenCodeHarness
Add a custom provider to opencode.json (project root or global config) using the OpenAI-compatible adapter. Export ARENA_API_KEY in your shell first.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"27arena": {
"npm": "@ai-sdk/openai-compatible",
"name": "27Arena",
"options": {
"baseURL": "https://api.27arena.ai/v1",
"apiKey": "{env:ARENA_API_KEY}"
},
"models": {
"arena/opencode": { "name": "Arena Champion (OpenCode)" }
}
}
},
"model": "27arena/arena/opencode"
}Custom agents
Any agent that speaks OpenAI chat completions works. Tool calling uses the standard tools / tool_choice schema. Send one X-Arena-Session-Id per task so the whole task stays on one Champion revision.
import OpenAI from "openai";
const arena = new OpenAI({
baseURL: "https://api.27arena.ai/v1",
apiKey: process.env.ARENA_API_KEY,
defaultHeaders: {
// Optional hints. Omit them and everything still works.
"X-Arena-Session-Id": crypto.randomUUID(), // one per agent session/task
},
});
const res = await arena.chat.completions.create({
model: "arena/champion",
messages,
tools, // OpenAI function-tool schema
tool_choice: "auto",
parallel_tool_calls: false,
});- Cancel by closing the stream — the slot is released when the client disconnects.
- Handle 429 by waiting
retry_after_ms; don't open more parallel requests than your plan's concurrency. - Long-running and overnight agents are allowed; fair scheduling applies like everyone else.
Errors
Every error uses the same body. 429 is always about concurrency or queue protection — never a monthly token limit.
{
"error": {
"type": "concurrency_or_queue_limit",
"message": "Per-account concurrent generation limit reached.",
"retry_after_ms": 2000
}
}| HTTP | type | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_request | Payload invalid, unsupported parameter/feature, or context too large. | Fix the request; don't retry unchanged. |
| 401 | unauthorized | API key missing or invalid. | Check the Authorization header. |
| 403 | forbidden | Account disabled or plan not entitled. | Check your subscription in the dashboard. |
| 409 | session_profile_conflict | Session is pinned to an incompatible profile. | Start a new X-Arena-Session-Id. |
| 429 | concurrency_or_queue_limit | Per-account in-flight cap or queue maximum reached. Never a monthly token limit. | Retry after retry_after_ms. |
| 502 | upstream_error | The inference worker returned an error. | Retry with backoff. |
| 503 | capacity_unavailable | No healthy capacity within the bounded wait. | Retry with backoff; check /status. |
| 504 | upstream_timeout | Inference or stream timed out. | Retry; consider a smaller request. |
OpenAI compatibility matrix
27Arena implements a documented subset of the OpenAI Chat Completions API. Anything not listed as supported is rejected with 400.
Supported
- model
- messages
- stream
- stream_options
- temperature
- top_p
- max_tokens
- max_completion_tokens
- stop
- tools
- tool_choice
- parallel_tool_calls
- response_format
- seed
- presence_penalty
- frequency_penalty
- user
- reasoning_effort
- n (must be 1)
Streaming (SSE) with stream_options.include_usage, tool calls and JSON response format depend on the active profile's parser — verified per profile.
Not supported
- n > 1 — Multiple choices per request (each would need its own slot).
- logprobs / top_logprobs — Not exposed in the MVP.
- logit_bias — Not in the parameter allowlist.
- Any other parameter — Unknown parameters are rejected with 400 — never silently passed through.
- /v1/responses — Not offered until a compatibility suite passes.
- /v1/completions (legacy) — Use chat completions.
- /v1/embeddings, images, audio — Not offered.
- Assistants, Batch, Files, Fine-tuning — Not offered.