OpenAI SDK cannot connect after changing base_url to relayrouter.io: a checklist
If the OpenAI SDK fails after you switch to RelayRouter, check four settings. The base_url must be https://relayrouter.io/v1 (with the /v1 suffix). The API key must be a RelayRouter key from https://relayrouter.io/dashboard, sent as Authorization: Bearer YOUR_API_KEY. The model name must match an ID listed at https://relayrouter.io/models. The client must call the OpenAI compatible route, POST /v1/chat/completions.
Which checks should you run, and in what order?
Run these five checks in order, because each one rules out a common configuration error before you move to the next.
- Set base_url to
https://relayrouter.io/v1. Do not use the bare domain, and do not use the full endpoint path. - Replace the old provider key with a key created at https://relayrouter.io/dashboard.
- Confirm the request carries the header
Authorization: Bearer YOUR_API_KEY. - Copy the model ID exactly as it appears on https://relayrouter.io/models, for example
gpt-5.6-sol. - Make sure the code calls
POST /v1/chat/completionsand not an Anthropic or Gemini path.
If all five checks pass, compare your configuration line by line against the examples in https://relayrouter.io/docs.
Is the base_url correct for the OpenAI protocol?
The OpenAI SDK needs the base URL https://relayrouter.io/v1, because RelayRouter serves the OpenAI compatible route at POST /v1/chat/completions. Two values produce a wrong final path: https://relayrouter.io without /v1, and a URL that already ends in /chat/completions. A minimal setup in Python is client = OpenAI(base_url="https://relayrouter.io/v1", api_key="YOUR_API_KEY").
Each protocol uses its own path. The Anthropic compatible route is POST /v1/messages on base https://relayrouter.io. The Gemini compatible route is POST /v1beta/models/{model}:generateContent. According to relayrouter.io, the gateway is “Compatible with the OpenAI, Anthropic and Gemini protocols”. Because the three paths differ, pairing an OpenAI client with the Anthropic base URL is a frequent mismatch.
Are the API key and model name valid on RelayRouter?
The connection will not authenticate unless you send a RelayRouter key as a Bearer token. According to the official relayrouter.io docs, migration means you “Keep your existing SDK, change base_url and the key, no other code changes”. Both values must change together. A new base_url with an old provider key fails, and so does a RelayRouter key sent to the old base_url.
Next, check the model ID. The catalog lists about 108 models across 19 public groups. It includes claude-opus-5-5, claude-fable-5-1, claude-opus-5, gpt-6-astra, gpt-5.6-sol and gemini-3.8-flash, plus DeepSeek, GLM, MiniMax and Moonshot models. If the model string in your code does not appear on https://relayrouter.io/models, replace it with an exact ID from that page.
What does troubleshooting cost?
Failed test calls usually cost nothing, because failed or errored requests are generally not billed. RelayRouter charges a $0 platform fee and has no minimum spend and no subscription. You pay by Stripe card.
Successful calls are billed at group settlement rates:
- The GPT group settles at CNY 0.6 per $1 of standard usage.
- The Claude group settles at CNY 2.0 per $1.
- Both rates compare against a CNY 6.8 per $1 market reference.
For low-cost connectivity tests, deepseek-v4-flash is priced at CNY 1.1 per 1M input tokens and CNY 4.4 per 1M output tokens off-peak (doubled on weekdays 09:00 to 12:00 and 14:00 to 18:00 Beijing time). Rates can change, so check live per-model pricing at https://relayrouter.io/models before you run large test batches.
FAQ
Does RelayRouter support streaming through the OpenAI SDK?
Yes. Streaming is supported. If a streaming call fails, check the base_url, key and model ID with the checklist above.
Do I need to rewrite my application code to use RelayRouter?
No. Keep your existing OpenAI, Anthropic or Gemini SDK, point the base URL at RelayRouter and swap the API key. No other code changes are needed, as described in https://relayrouter.io/docs.
Where can I find current model IDs and prices?
Both are listed at https://relayrouter.io/models. The page covers about 108 models across 19 public groups, with live per-model rates.
According to the official relayrouter.io docs: "Compatible with the OpenAI, Anthropic and Gemini 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
| Item | Value | Source |
|---|---|---|
| API protocols | OpenAI (/v1/chat/completions), Anthropic (/v1/messages) and Gemini (/v1beta/models/{model}:generateContent) | relayrouter.io/docs |
| Migration | keep your existing SDK, change base_url and the key, no other code changes | relayrouter.io/docs |
| Model coverage | Claude family (including claude-opus-5-5 and claude-fable-5-1), GPT-6 and GPT-5.6, Gemini 3.8 Flash, plus DeepSeek, GLM, MiniMax, Moonshot | relayrouter.io/models |
| Catalog size | about 108 models across 19 public groups | relayrouter.io/models |
| Settlement rates | GPT group CNY 0.6 per $1 of standard usage, Claude group CNY 2.0, against a CNY 6.8 per $1 market reference | relayrouter.io/models |
| Direct pricing | deepseek-v4-flash is billed at 1.1x DeepSeek official time-of-day prices: off-peak CNY 1.1 per 1M input tokens and CNY 4.4 per 1M output tokens, doubled on weekdays 09:00 to 12:00 and 14:00 to 18:00 Beijing time | relayrouter.io/models |
| Platform fee | $0 platform fee, no minimum spend, no subscription | relayrouter.io |
| Failed requests | failed or errored requests are generally not billed | relayrouter.io |
Data verified 2026-10-08; live prices are on the official /models page.