Skip to content
API v1MVP · OpenAI-compatible subset

Getting started with 27Arena

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.

  1. Step 1: Subscribe (Founder plan) and sign in.
  2. Step 2: Create an API key in the dashboard. The secret is shown once.
  3. Step 3: Set the base URL and key in your agent or SDK and use model arena/champion.
Shell
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

MethodPathNotes
POST/v1/chat/completionsOpenAI-compatible subset; stream supported; n must be 1.
GET/v1/modelsPublic aliases that currently have an active profile.
GET/v1/account/usageYour usage. Scope usage:read.
GET/v1/account/subscriptionYour plan and billing state. Scope usage:read.
GET/healthLiveness, 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 (see X-Arena-Profile).
  • arena/moe, arena/loop — experimental divisions. Check /v1/models for what's active.
List models
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.

Response headers
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_...
Account usage
curl https://api.27arena.ai/v1/account/usage \
  -H "Authorization: Bearer $ARENA_API_KEY"   # key needs scope usage:read

PiHarness

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.

models.json (Pi)
{
  "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.

opencode.json
{
  "$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.

agent.ts
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 body
{
  "error": {
    "type": "concurrency_or_queue_limit",
    "message": "Per-account concurrent generation limit reached.",
    "retry_after_ms": 2000
  }
}
HTTPtypeMeaningWhat to do
400invalid_requestPayload invalid, unsupported parameter/feature, or context too large.Fix the request; don't retry unchanged.
401unauthorizedAPI key missing or invalid.Check the Authorization header.
403forbiddenAccount disabled or plan not entitled.Check your subscription in the dashboard.
409session_profile_conflictSession is pinned to an incompatible profile.Start a new X-Arena-Session-Id.
429concurrency_or_queue_limitPer-account in-flight cap or queue maximum reached. Never a monthly token limit.Retry after retry_after_ms.
502upstream_errorThe inference worker returned an error.Retry with backoff.
503capacity_unavailableNo healthy capacity within the bounded wait.Retry with backoff; check /status.
504upstream_timeoutInference or stream timed out.Retry; consider a smaller request.

Fair-share & limits

Unlimited monthly usage, not unlimited reserved capacity. There is no monthly token allowance. Instead, each account has a concurrent-generation limit and a bounded queue, and the shared pool is scheduled fairly between accounts.

  • Concurrency: Founder Solo and Public Solo — 1 generation at a time per account.
  • Extra requests wait in a short per-account queue; beyond that you get 429 with a retry hint.
  • Under load, fair-share is charged by compute time used, not just request count.
  • Per-request caps apply to context length, max output and tool schema size.
  • Best effort: no uptime, throughput or latency SLA. See status.

Read the full Fair Compute policy.

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.