Skip to content

Unify API

Keep the Responses API. Reach every model.

Use the OpenAI Responses API with typed output items and stored, continuable responses across every model.

POST /api/v1/responses
diff --git a/app.py b/app.pyimport osfrom openai import OpenAIclient = OpenAI(removed:     api_key=os.environ["OPENAI_API_KEY"],added:     base_url="https://anyrouter.dev/api/v1",added:     api_key=os.environ["ANYROUTER_API_KEY"],)resp = client.responses.create(removed:     model="gpt-5-mini",added:     model="anyrouter/free",    input="Hi",)print(resp.output_text)
API access starts on Go ($2/mo, or free when you donate one key to the Pool). anyrouter/free is free on Go; anyrouter/auto uses credits.

What came back

The cURL tab above, run on prod on 2026-10-31 with a Go key. Only the fields shown are kept, and long values are cut with "…".

captured from prod
HTTP 200
x-anyrouter-model: poolside/laguna-s-2.1
x-anyrouter-provider-chain: hagiang
x-anyrouter-credential-source: platform
x-request-id: req_a7e68fe692c24a6c91dc5412

{
  "object": "response",
  "status": "completed",
  "output_text": "Hello! How can I help you today?",
  "usage": {
    "input_tokens": 45,
    "output_tokens": 10,
    "cost": 0
  }
}
x-anyrouter-model
The model that answered. A preset such as anyrouter/free names its pick here; pin a model id and it echoes yours.
x-anyrouter-provider-chain
Each upstream tried, in order. One hop here; when a hop fails the next one answers and the header reads a->b.
x-anyrouter-credential-source
Whose upstream key paid: platform (ours), own_byok (yours) or pool (a donated key).
x-request-id
Quote it to support, or find the request in your logs.
usage.cost
What this request cost you, in USD, in the body. Zero on free models.

Optional: steer the route

Nothing below is required. Each one is a single field or header on the same request, captured on prod.

  • Pick any model id

    Use owner/model from the catalog instead of a preset.

    "model": "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning"
    → HTTP 200, provider-chain: hagiang
  • Pin a provider

    One header, comma-separated in order of preference.

    X-AnyRouter-Provider: hagiang,kilo
    "model": "poolside/laguna-s-2.1"
    → HTTP 200, provider-chain: hagiang
  • Order providers in the body

    The same idea as OpenRouter's provider object.

    "model": "nvidia/nemotron-3-ultra-550b-a55b"
    "provider": {"order": ["hagiang", "kilo"]}
    → HTTP 200, provider-chain: hagiang

What works

  • Streaming (SSE)
  • Tools / function calling
  • Reasoning effort
  • Image input on vision models
  • Stored responses (previous_response_id)

Decisions models

Not a chat. Send a situation and a question with fixed choices, and get a probability for each choice back. Decisions are free on Go and up, with a 5-request trial on Free.

POST /api/v1/decisions
bash
curl https://anyrouter.dev/api/v1/decisions \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "hal-x/thx-01", "state": "My card was charged twice",
    "questions": {"team": {"type": "choice", "criteria": {"billing": "Payments", "tech": "API problems"}}}}'

# {"answers": {"team": {"type": "choice", "choice": "billing", "probabilities": {"billing": 0.97, "tech": 0.03}}}, "model": "hal-x/thx-01", "status": "completed"}

Related docs and use cases

Next