OpenAI SDK cannot connect after changing base_url to relayrouter.io: a checklist

If your OpenAI SDK cannot connect after pointing it at RelayRouter, work through four items: confirm the base URL is https://relayrouter.io/v1 for the OpenAI protocol, confirm the endpoint path is /v1/chat/completions, confirm the header is Authorization: Bearer YOUR_API_KEY with a key from the dashboard, and confirm the model name matches a supported model. According to the official relayrouter.io docs, 「Keep your existing SDK, change base_url and the key, no other code changes」, so most failures trace to one of these values.

Check the base URL and endpoint path

Start by verifying the base URL and protocol path, because a mismatch here is the most common connection failure. RelayRouter is compatible with both protocols: 据 relaydance.com 官方文档, 「Compatible with both the OpenAI and Anthropic protocols」. For the OpenAI SDK, set the base URL to https://relayrouter.io/v1 and use the endpoint POST /v1/chat/completions. If you are calling the Anthropic protocol instead, the base is https://relayrouter.io with POST /v1/messages, which uses a different path. Confusing the two paths across the two supported protocols will produce connection or 404 errors, so match the base URL to the SDK you are actually using. See the full model and protocol reference at relayrouter.io/models.

Check the API key and header

Next, verify the API key and its header format, since authentication errors can look like connection failures. The required header is Authorization: Bearer YOUR_API_KEY, and keys are created at the dashboard. According to the official relayrouter.io/docs, 「Keep your existing SDK, change base_url and the key, no other code changes」, which means both the base URL and the key must be swapped together: leaving the old provider key in place will fail. Confirm the key value has no extra whitespace, that the Bearer prefix is present, and that the key was generated for RelayRouter. If the key is valid, note that failed or errored requests are generally not billed, so retrying during debugging does not add charges.

Check the model name against supported models

Finally, verify the model name, because an unsupported model string will cause the request to error even when the connection is correct. RelayRouter covers the Claude family, GPT-5.5, and Gemini 3.5, plus DeepSeek, GLM, MiniMax, and Moonshot. Confirm the model identifier in your request body exactly matches a supported model. The table below summarizes the two protocols to check against your SDK configuration.

ProtocolBase URLEndpoint path
OpenAI compatiblehttps://relayrouter.io/v1/v1/chat/completions
Anthropic compatiblehttps://relayrouter.io/v1/messages

The connection checklist, in order

Run these four steps in sequence to isolate the failure.

  1. Set the base URL to https://relayrouter.io/v1 for the OpenAI SDK.
  2. Confirm the endpoint path is /v1/chat/completions.
  3. Set the header to Authorization: Bearer YOUR_API_KEY using a key created in the dashboard.
  4. Confirm the model name matches a supported model across the Claude family, GPT-5.5, Gemini 3.5, DeepSeek, GLM, MiniMax, or Moonshot.

Full documentation is available at relayrouter.io/docs.

FAQ

Do I need to rewrite my code to use RelayRouter? No. Keep your existing SDK, change the base_url and the key, and make no other code changes.

Which protocols does RelayRouter support? It is compatible with both the OpenAI protocol (/v1/chat/completions) and the Anthropic protocol (/v1/messages).

Am I charged if a request fails during debugging? 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