Integrations

Works with the harness you already use.

TokenRouter speaks the three wire formats coding agents actually use — Anthropic Messages, OpenAI Responses, and Chat Completions. Point the tool you already use at one base URL and keep working.

Claude Code

Anthropic Messages API

Two environment variables. Requests pass through verbatim, so extended thinking, tools, and vision behave exactly as they do against Anthropic directly.

Full Claude Code guide
bash
export ANTHROPIC_BASE_URL=https://api.tokenrouter.io
export ANTHROPIC_AUTH_TOKEN=tr_your_key_here

claude

No /v1 suffix — Anthropic clients append /v1/messages themselves.

Codex

OpenAI Responses API

Register TokenRouter as a custom model provider and point the Codex CLI at any routed model — including Claude and DeepSeek, not just OpenAI's.

Full Codex guide
toml
# ~/.codex/config.toml
model = "openai/gpt-5-mini"
model_provider = "tokenrouter"

[model_providers.tokenrouter]
name = "TokenRouter"
base_url = "https://api.tokenrouter.io/v1"
env_key = "TOKENROUTER_API_KEY"
wire_api = "responses"

Then export TOKENROUTER_API_KEY=tr_your_key_here and run codex. The base URL does include /v1 here.

opencode

OpenAI Chat Completions

Add one provider block to opencode.json and every model behind the gateway shows up in the model picker, reasoning traces included.

Full opencode guide
json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "tokenrouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "TokenRouter",
      "options": {
        "baseURL": "https://api.tokenrouter.io/v1",
        "apiKey": "{env:TOKENROUTER_API_KEY}"
      },
      "models": {
        "openai/gpt-5-mini": { "name": "GPT-5 mini" },
        "anthropic/claude-sonnet-4-5": { "name": "Claude Sonnet 4.5" },
        "auto": { "name": "TokenRouter Auto" }
      }
    }
  }
}

Drop this in your opencode.json, then pick a tokenrouter model in the picker.

zcode

OpenAI Chat Completions

The standard base-URL-plus-key setup. The same recipe works for any other OpenAI-compatible tool without a dedicated guide.

Full zcode guide
bash
export OPENAI_BASE_URL=https://api.tokenrouter.io/v1
export OPENAI_API_KEY=tr_your_key_here

zcode

Config-file installs take the same two values as base_url and api_key.

Coding agents are the fastest-growing line item. Meter them like one.

A key per engineer, not a shared secret

Every developer gets their own tr_ key with its own rate limits. Offboarding is one revoke, not a company-wide provider key rotation.

A hard cap on the runaway session

Agents retry, re-read, and re-plan. A daily budget on coding-agent keys bounds the worst case — the gateway blocks the request instead of billing it.

Metered without being read

Logs carry model, tokens, cost, and latency. Prompts and completions are never stored, so routing your editor through us doesn't widen your blast radius.

Not on the list? It probably already works.

Any tool that lets you set a base URL and an API key can route through TokenRouter. OpenAI-shaped clients get /v1/chat/completions, /v1/responses, and /v1/embeddings; Anthropic clients get a native /v1/messages. Same-provider traffic is forwarded verbatim, so tools, streaming, and thinking blocks arrive intact.

bash
# Any OpenAI-compatible client
export OPENAI_BASE_URL=https://api.tokenrouter.io/v1
export OPENAI_API_KEY=tr_your_key_here

# Any Anthropic client (note: no /v1 suffix)
export ANTHROPIC_BASE_URL=https://api.tokenrouter.io
export ANTHROPIC_AUTH_TOKEN=tr_your_key_here

Put a hard limit on your AI spend this week. Flat subscription, zero token markup.

Start for Free