RelayRouterRelayRouter
HomeModelsPricingDocsGuides
Get API Key →

Protocols

Anthropic-compatible API

Claude clients speak the Anthropic Messages API, and so does RelayRouter. Point the Anthropic SDK at https://relayrouter.io, keep the request shape, the anthropic-version header and the streaming events exactly as they are, and swap in a RelayRouter key. Claude Code works the same way through two environment variables.

Base URL and endpoints

https://relayrouter.io No /v1 suffix: the Anthropic SDK and Claude Code append /v1/messages themselves.

MethodPathNotes
POST/v1/messagesMessages API, streaming with stream: true, tool use and extended thinking passed through
GET/v1/modelsThe models your key can call

Authentication: x-api-key: <your RelayRouter key>, or Authorization: Bearer <key>. Both headers are accepted; keep anthropic-version as your SDK sends it.

Code

Python

main.pypython
import anthropic

client = anthropic.Anthropic(
    api_key="your-relayrouter-key",
    base_url="https://relayrouter.io",
)

msg = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)

TypeScript

index.tstypescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.RELAYROUTER_API_KEY,
  baseURL: "https://relayrouter.io",
});

const msg = await client.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(msg.content[0].type === "text" ? msg.content[0].text : "");

Claude Code

terminalbash
export ANTHROPIC_BASE_URL="https://relayrouter.io"
export ANTHROPIC_AUTH_TOKEN="your-relayrouter-key"
export ANTHROPIC_MODEL="claude-opus-5-5"
claude

Groups that speak this protocol

A key belongs to one group. Create it in the console for one of the groups below; the models page has every group and model with live rates.

GroupRateModels (examples)
DeepSeekdirect per-token pricingdeepseek-v4-flash, deepseek-v4-pro
Kimi K3direct per-token pricingkimi-k3
Claude Fast¥1.2 per $1 of standard usage, about 82% below the ¥6.8/$ referenceclaude-haiku-4-5, claude-haiku-4-5-20251001, claude-haiku-4-5-20251001-thinking, claude-opus-4-1-20250805, claude-opus-4-20250514 and 15 more
Claude¥2 per $1 of standard usage, about 71% below the ¥6.8/$ referenceclaude-fable-5, claude-fable-5-1, claude-haiku-4-5-20251001, claude-opus-4-5-20251101, claude-opus-4-6 and 8 more
Claude Code Fast¥2.3 per $1 of standard usage, about 66% below the ¥6.8/$ referenceclaude-fable-5, claude-fable-5-1, claude-haiku-4-5-20251001, claude-opus-4-5-20251101, claude-opus-4-6 and 6 more
Claude AWS¥5.4 per $1 of standard usage, about 21% below the ¥6.8/$ referenceclaude-3-5-sonnet-20240620, claude-fable-5, claude-fable-5-1, claude-haiku-4-5, claude-haiku-4-5-20251001 and 17 more
Claude Hermes¥5.4 per $1 of standard usage, about 21% below the ¥6.8/$ referenceclaude-3-5-sonnet-20240620, claude-fable-5, claude-fable-5-1, claude-haiku-4-5, claude-haiku-4-5-20251001 and 17 more
Claude Failover¥5.5 per $1 of standard usage, about 19% below the ¥6.8/$ referenceclaude-fable-5, claude-fable-5-1, claude-haiku-4-5, claude-opus-4-6, claude-opus-4-7 and 4 more
Claude Official API¥5.5 per $1 of standard usage, about 19% below the ¥6.8/$ referenceclaude-3-5-sonnet-20240620, claude-fable-5, claude-fable-5-1, claude-haiku-4-5, claude-haiku-4-5-20251001 and 18 more

Tools that work as-is

Questions

Does extended thinking and tool use work through the gateway?

Yes. The request is forwarded as sent, including thinking parameters, tools and tool_choice, and the streamed events come back unchanged.

Which Claude models and groups are available?

Several Claude groups at different rates serve claude-opus-5-5, claude-fable-5-1, claude-sonnet-4-6, claude-haiku-4-5 and the older Opus and Sonnet versions. The group you pick when creating a key decides the rate; the models page lists them all.

Can I use ANTHROPIC_API_KEY instead of ANTHROPIC_AUTH_TOKEN?

Yes. ANTHROPIC_API_KEY sends the key as x-api-key, ANTHROPIC_AUTH_TOKEN sends it as a Bearer token; RelayRouter accepts both.

How is it billed?

Per token at the group's rate from a prepaid balance, no platform fee, failed requests not billed. Cache read and cache creation tokens are reported in usage like the native API.