Claude Code · API access

Use Claude Code with one API key and an Anthropic-compatible endpoint

API Token Router exposes an Anthropic-compatible /v1/messages endpoint plus an OpenAI-compatible /v1 endpoint. Point Claude Code at one key, keep your existing workflow, and pay only for the tokens you use.

Why route Claude Code through a gateway

Claude Code speaks the Anthropic Messages API. A gateway keeps that interface stable while it handles provider credentials, retries, and billing on your behalf. You get one key for Claude, GPT, Gemini and other coding models, a single balance, and usage records you can audit per request.

Anthropic-compatible

Claude Code talks to /v1/messages; no adapter or local proxy is required.

One balance

Top up in USD and spend across model families instead of maintaining separate vendor accounts.

Visible routing

Our upstream status page lists the lines currently connected to the gateway.

Configure Claude Code

Create an API key in the dashboard, then export the two variables Claude Code reads. Use the apex host: Claude Code appends /v1/messages itself.

export ANTHROPIC_BASE_URL="https://apitokenrouter.com"
export ANTHROPIC_AUTH_TOKEN="sk-atr-your-key"
claude

To pin a specific model, pass it with --model or set it in your Claude Code settings. Model ids come from the live catalog; for example claude-fable-5-2.

Keep the key in an environment variable or your shell profile, never in a repository. Revoke and rotate keys from the dashboard at any time.

What you can call

SurfaceEndpointTypical clients
Anthropic Messageshttps://apitokenrouter.com/v1/messagesClaude Code, Anthropic SDKs
OpenAI Chat Completionshttps://apitokenrouter.com/v1/chat/completionsCodex CLI, OpenAI SDKs, most agent frameworks
OpenAI Responseshttps://apitokenrouter.com/v1/responsesClients using the Responses API
Geminihttps://apitokenrouter.com/v1beta/models/{model}:generateContentGoogle SDKs and compatible clients

Authentication accepts x-api-key, Authorization: Bearer, or x-goog-api-key, matching the protocol your client already uses.

Pricing and billing

Prices are per million tokens and follow the live catalog, which shows both the official list price and our current net price. Discounts vary with upstream cost, so the model page is the source of truth. There is no subscription and no minimum commit; unused balance stays on your account.

Operational notes

  • Requests are attempted across the configured upstream lines for the model family, with a circuit breaker that removes a failing line from rotation.
  • Every call produces a usage record tied to the key that made it, so team and personal keys can be reviewed separately.
  • Streaming responses are relayed as they arrive; Claude Code's progress output keeps working.

FAQ

Does Claude Code need a special build?

No. It reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment. Any Anthropic-compatible gateway works with the standard client.

Can I use the same key for GPT and Gemini?

Yes. One key is valid across the OpenAI, Anthropic and Gemini surfaces. The model id selects the family and the gateway picks a compatible upstream line.

What happens when an upstream line is down?

The engine retries the next line in the family's chain and opens the circuit on a line that keeps failing. If every line is unavailable the request returns a clear service error instead of a silent hang.

How do I check which upstreams are connected?

The public upstream lines page lists the vendors, protocols, model counts and last free health check for each published line.