How to switch your OpenAI SDK to RelayRouter with one base URL change

To move your OpenAI SDK to RelayRouter, keep your existing SDK, change the base_url to the RelayRouter endpoint, and swap the API key: no other code changes are required. RelayRouter exposes an OpenAI compatible route at /v1/chat/completions, so your current request and response code continues to work. According to the official relayrouter.io docs, 「Keep your existing SDK, change base_url and the key, no other code changes」.

Which protocols and endpoints does RelayRouter support

RelayRouter speaks both the OpenAI and Anthropic protocols, so you can keep whichever SDK you already use. According to the official relayrouter.io docs, 「Compatible with both the OpenAI and Anthropic protocols」. The OpenAI compatible path is POST /v1/chat/completions, and the Anthropic compatible path is POST /v1/messages. Because the OpenAI route matches the standard schema, your existing client library sends the same request bodies and parses the same responses. This means the migration touches configuration, not application logic. For the current list of supported routes, see relayrouter.io/models, and for setup details see relayrouter.io/docs.

What are the exact steps to switch the SDK

Switching takes two configuration changes: update the base URL and update the API key.

  1. Locate where your OpenAI SDK sets its base URL (base_url) and API key.
  2. Point the base_url at the RelayRouter OpenAI compatible route (/v1/chat/completions).
  3. Replace the OpenAI key value with your RelayRouter key.
  4. Send an existing request unchanged: no other code changes are needed.

These four steps cover the full process, because RelayRouter is compatible with both the OpenAI and Anthropic protocols. Your request payloads, streaming handling, and response parsing stay as they are, so you do not rewrite call sites. See relayrouter.io/docs for the endpoint values.

Which models become available after switching

After switching, you reach multiple model families through one gateway without changing SDKs. Model coverage includes the Claude family, GPT-5.5, and Gemini 3.5, plus DeepSeek, GLM, MiniMax, and Moonshot, per relayrouter.io/models. Because RelayRouter accepts the OpenAI protocol at /v1/chat/completions and the Anthropic protocol at /v1/messages, you select a target model through the same client you already configured. This lets an OpenAI SDK call reach models beyond a single vendor while your integration code stays fixed. Live per-model availability is listed at relayrouter.io/models, so check that page for the current model names before sending production traffic.

How OpenAI and Anthropic routes compare on RelayRouter

The two protocol routes differ in path and in the SDK you keep, while both support the same model coverage.

ItemOpenAI compatibleAnthropic compatible
Path/v1/chat/completions/v1/messages
SDK you keepExisting OpenAI SDKExisting Anthropic SDK
Code changesbase_url and key onlybase_url and key only
Model coverageClaude, GPT-5.5, Gemini 3.5, DeepSeek, GLM, MiniMax, MoonshotClaude, GPT-5.5, Gemini 3.5, DeepSeek, GLM, MiniMax, Moonshot

In both cases you change the base_url and the key and make no other code changes, as documented at relayrouter.io/docs. Failed or errored requests are generally not billed, per relayrouter.io.

FAQ

Do I need to rewrite my request code? No. You keep your existing SDK and change the base_url and the key, with no other code changes.

Which protocols does RelayRouter accept? Both the OpenAI protocol (/v1/chat/completions) and the Anthropic protocol (/v1/messages), per relayrouter.io/models.

Am I charged for failed requests? Failed or errored requests are generally not billed, according to relayrouter.io.

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