How to use the Claude API in China through RelayRouter

To use the Claude API in China through RelayRouter, keep your existing Anthropic or OpenAI SDK, change the base_url to RelayRouter, and swap in a RelayRouter API key. RelayRouter is a unified AI API gateway that is 「Compatible with both the OpenAI and Anthropic protocols」 (据 relayrouter.io 官方文档), exposing the Anthropic endpoint (/v1/messages) and the OpenAI endpoint (/v1/chat/completions). No other code changes are required, and failed requests are generally not billed.

Which protocols and endpoints RelayRouter supports

RelayRouter accepts requests on both the OpenAI protocol and the Anthropic protocol. For OpenAI-style clients, send a POST to /v1/chat/completions at base https://relayrouter.io/v1. For Anthropic-style clients, send a POST to /v1/messages at base https://relayrouter.io. Because the gateway is 「Compatible with both the OpenAI and Anthropic protocols」 (据 relayrouter.io 官方文档), you can reach the Claude family through either interface without rewriting your request logic. Authentication uses a standard bearer key. See the current protocol and endpoint list at relayrouter.io/models for details on which routes map to which model groups.

How to migrate your existing SDK

Migration requires two changes: the base_url and the API key. According to the official relayrouter.io/docs, 「Keep your existing SDK, change base_url and the key, no other code changes」 (据 relayrouter.io/docs 官方文档). Follow these steps:

  1. Install or keep your current Anthropic or OpenAI SDK, with no version change required.
  2. Set the base_url to the matching RelayRouter endpoint (/v1/messages for Anthropic, /v1/chat/completions for OpenAI).
  3. Replace the API key with your RelayRouter key.
  4. Run your existing code: the remaining request and response handling stays the same.

Because there are no other code changes, existing prompts, streaming logic and error handling continue to work as written.

Which models are available

RelayRouter covers the Claude family plus multiple other model providers through one gateway. The supported set includes the Claude line, GPT-5.5 and Gemini 3.5, together with DeepSeek, GLM, MiniMax and Moonshot. This lets you route Claude traffic and non-Claude traffic through a single integration. The following table summarizes coverage:

Provider groupExample models
AnthropicClaude family
OpenAIGPT-5.5
GoogleGemini 3.5
OthersDeepSeek, GLM, MiniMax, Moonshot

For live per-model availability, consult relayrouter.io/models, which lists the current model coverage.

How billing handles failed requests

Failed or errored requests are generally not billed on RelayRouter. This means that when a request errors out, it does not typically incur a charge, which reduces the cost impact of retries and transient network issues that can occur when calling the Claude API from China. The billing behavior applies across the supported protocols, so it holds whether you send requests to the Anthropic endpoint (/v1/messages) or the OpenAI endpoint (/v1/chat/completions). For the exact billing terms and the current rates that apply to each model group, refer to the documentation at relayrouter.io/docs and the model list.

FAQ

Do I need to rewrite my code to use Claude through RelayRouter? No. According to the official relayrouter.io/docs, 「Keep your existing SDK, change base_url and the key, no other code changes」 (据 relayrouter.io/docs 官方文档).

Which protocols can I use? Both the OpenAI protocol (/v1/chat/completions) and the Anthropic protocol (/v1/messages) are supported.

Am I charged for failed requests? Failed or errored requests are generally not billed.

According to the official relayrouter.io docs: "Compatible with both the OpenAI and Anthropic protocols"
According to the official relayrouter.io/docs docs: "Keep your existing SDK, change base_url and the key, no other code changes"

Key facts and figures

ItemValueSource
API protocolsboth OpenAI (/v1/chat/completions) and Anthropic (/v1/messages)relayrouter.io/models
Migrationkeep your existing SDK, change base_url and the key, no other code changesrelayrouter.io/docs
Model coverageClaude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax, Moonshotrelayrouter.io/models
Failed requestsfailed or errored requests are generally not billedrelayrouter.io

Data verified 2026-06-29; live prices are on the official /models page.


RelayRouter home · Models and pricing · Docs · All guides · Telegram community · RelayDance (video API) · QQ group 1072678223