Skip to content
xrouters
documentation

One endpoint. Both protocols.

Point any OpenAI or Anthropic client at the gateway and keep your model ids. Streaming, tool calls and vision pass through untouched — billing is metered from the provider's own usage block.

https://xrouters.xyz/v1https://xrouters.xyzanthropic uses the host
documentation

Wire it up in one line.

The gateway speaks both OpenAI and Anthropic wire formats. Change the base URL, keep your SDK, keep your types. Everything below assumes a key from the dashboard.

Quickstart

Create a key under API keys, then pick whichever client you already use.

curl https://xrouters.xyz/v1/chat/completions \
  -H "Authorization: Bearer $XROUTERS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v3.2",
    "messages": [{"role":"user","content":"hello"}],
    "stream": true
  }'

Authentication

A single bearer token authenticates every endpoint. There is no project id, no organisation header, no second signature.

Authorization: Bearer xr_live_xxxxxxxxxxxxxxxxxxxx

Keys are hashed at rest. If you lose one, revoke it and create another — the original cannot be recovered, only replaced.

OpenAI protocol

Fully compatible with the Chat Completions shape, including stream, tools, temperature and max_tokens.

POST https://xrouters.xyz/v1/chat/completions
Content-Type: application/json

{
  "model": "claude-sonnet-4.5",
  "messages": [{ "role": "user", "content": "hi" }],
  "max_tokens": 512
}

Python SDK: base_url="https://xrouters.xyz/v1". Node SDK: baseURL: "https://xrouters.xyz/v1".

Anthropic protocol

The Messages API is served at the root path. Send x-api-key and an anthropic-version header, or reuse your bearer token.

POST https://xrouters.xyz/v1/messages
x-api-key: xr_live_xxxxxxxxxxxx
anthropic-version: 2023-06-01

{
  "model": "claude-opus-4.1",
  "max_tokens": 1024,
  "messages": [{ "role": "user", "content": "hi" }]
}

Streaming

Add "stream": true and read server-sent events as they arrive. The proxy forwards chunks unbuffered in both protocols, so first-token latency is the provider's own.

for await (const part of stream) {
  process.stdout.write(part.choices[0]?.delta?.content ?? "");
}

Usage & billing

Each response carries the provider's own usage block. Quota is debited from that block multiplied by the model's multiplier, and the request is written to your log with tokens, latency and status.

  • 1× models debit one quota token per token used.
  • 2× models debit two — the multiplier is printed in the catalog.
  • Upstream failures are refunded: nothing is debited when no usage block is returned.
  • Quota never expires and is shared across every key on the account.

Errors

statusmeaningwhat to do
401missing or revoked keycreate a new key in the dashboard
402quota exhaustedtop up — the pool is shared per account
404unknown model idcheck the catalog for the exact id
429rate limit for your packageback off and retry, or upgrade the package
502upstream provider errorretry; nothing was debited
503maintenance modewait for the switch to clear

Rate limits

Limits are per account, counted in requests per minute, and scale with the package you bought. They apply to both protocols together — there is no separate budget per endpoint.

starter
60rpm
pro
100rpm
ultimate
200rpm
enterprise
customrpm

Need a key first?

Registration includes starter quota — no card needed to test.