Skip to content

An OpenAI-compatible API for every model

Router One exposes an OpenAI-compatible endpoint at https://api.router.one/v1. Change one base URL, keep the OpenAI SDK you already use, and get instant access to Claude, GPT, Gemini, Grok and 40+ models through a single endpoint — with fixed-priority exact-model routing (preserving upstream prompt cache), same-model failover across provider routes, and a usage and billing trace for each request the gateway forwards to a model.

Protocol & endpoint specification

EndpointBase URLModel families servedTypical clients
POST /v1/chat/completionshttps://api.router.one/v1All listed chat models (GPT, Claude, Gemini, Grok, DeepSeek)OpenAI Python/Node SDKs, Cursor, Cline, Chatbox (Cherry Studio takes the host root https://api.router.one instead)
POST /v1/responseshttps://api.router.one/v1GPT family, DeepSeek V4 and Grok chat model IDsOpenAI Codex CLI (wire_api = "responses"), Responses SDKs
POST /v1/messageshttps://api.router.oneClaude and DeepSeek V4 model IDsClaude Code (ANTHROPIC_BASE_URL), Anthropic SDK

One Router One sk-... key authenticates all three endpoints, routes named-model calls in a fixed-priority sticky order (preserving upstream prompt caching) with same-model failover, and supports per-key maxSpend wallet caps.

Drop in by changing one base URL

Router One speaks the OpenAI Chat Completions API. Point your client at the Router One base URL, swap in your Router One key, and the rest of your code is unchanged — no new SDK, no rewrite.

terminal
# Keep your OpenAI SDK — just point it at Router One
export OPENAI_BASE_URL=https://api.router.one/v1
export OPENAI_API_KEY=sk-your-router-one-key

Call any model through the OpenAI SDK

Because the endpoint is OpenAI-compatible, the same SDK call reaches non-OpenAI models too. Set the model field to a Claude or Gemini model ID and the request routes through Router One — no separate client per provider.

example.py
from openai import OpenAI

# Same OpenAI SDK, calling a Claude model
client = OpenAI(base_url="https://api.router.one/v1", api_key="sk-...")

resp = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{"role": "user", "content": "Hello from the OpenAI SDK"}],
)
print(resp.choices[0].message.content)

Works with the tools you already use

Any client that accepts a custom OpenAI-compatible base URL works with Router One. Set the base URL and key, and keep your existing workflow.

OpenAI SDKs

The official Python and Node OpenAI libraries — set base_url / OPENAI_BASE_URL and your Router One key.

Claude Code

Router One also exposes an Anthropic-compatible endpoint at https://api.router.one so Claude Code works natively.

OpenAI Codex CLI

Add Router One as a provider in ~/.codex/config.toml (base_url https://api.router.one/v1, wire_api = "responses", env_key) and set the top-level model line to a model whose page lists POST /v1/responses — GPT, DeepSeek V4 and Grok chat models.

Cursor, Cline & Aider

Editor and CLI coding agents that allow a custom OpenAI-compatible base URL connect the same way.

TRAE

TRAE's custom-model form takes Router One in OpenAI Chat Completions format — base URL https://api.router.one/v1 — for every chat model.

Qoder

Qoder's bring-your-own-key models accept an OpenAI-compatible base URL, https://api.router.one/v1, over Chat Completions — or Responses for GPT, DeepSeek V4 and Grok chat models.

CodeBuddy

CodeBuddy reads custom models from models.json, which supports OpenAI-compatible APIs only — set url to the full https://api.router.one/v1/chat/completions.

Hermes Agent

Hermes Agent's hermes model wizard takes Router One as a Custom endpoint — API base URL https://api.router.one/v1 with Chat Completions for every chat model.

GitHub Copilot CLI

Copilot CLI's bring-your-own-key variables point it at https://api.router.one/v1; with COPILOT_PROVIDER_WIRE_API=completions it uses Chat Completions (responses for GPT-6 IDs).

Cherry Studio

Cherry Studio's custom provider takes the host root https://api.router.one for its OpenAI endpoint and appends /v1/chat/completions itself.

Chatbox

Chatbox's custom provider in OpenAI API Compatible mode takes the API host https://api.router.one/v1 for every chat model.

Routing, fallback, and traces come for free

The same OpenAI-compatible endpoint gives you exact-model routing and same-model failover without extra integration work.

  • Production traffic uses model_name by default, so a request is served by the model you name: requests are not load-balanced across routes — every request starts at the top of the same priority order so consecutive turns stay on the top-priority healthy route to preserve upstream prompt caching. Set model to "auto" and the gateway picks a low, medium or high tier and serves it from that tier's server-owned model list.
  • On a retryable upstream error (429, 5xx, timeout), a named-model request may try the next healthy provider serving that same model; routes with a sustained upstream-error rate are moved to the back of the order until they recover.
  • Customer Logs shows the model, request ID, tokens, wallet charge or plan quota used, total time (plus time to first token on streamed requests that produced output), status, and any sanitized error for recorded calls, while https://router.one/benchmarks/model-reliability publishes rolling 7-day and 30-day live 2xx, 429 and 5xx rates and https://router.one/llm-api-authenticity documents reproducible verification checks. When a request failed over, its detail lists each attempt's anonymous line number, outcome and duration; upstream provider identities and service routes are not disclosed.
  • In the China latency benchmark of 2026-11-15 (43 probes in 25 mainland cities on China Telecom, China Unicom, China Mobile and cloud networks), api.router.one answered 85 of 86 requests, with a median first byte 395ms after the request was sent; api.openai.com connected from none of the same probes. Individual networks may vary. Full benchmark: https://router.one/benchmarks/china-latency.

FAQ

Is it truly OpenAI-compatible?

Router One is a drop-in OpenAI-compatible API: it implements the OpenAI Chat Completions API at https://api.router.one/v1, and libraries and tools built for OpenAI work after changing the base URL and key. It also serves the Responses API at /v1/responses for GPT, DeepSeek V4 and Grok chat models (the path Codex CLI uses).

How do I call GPT, Claude, and Gemini with one API key?

Create one sk-... key in Dashboard → API Keys, set your OpenAI SDK base_url (or OPENAI_BASE_URL) to https://api.router.one/v1, and pass the catalog model ID in the model field — for example an openai/gpt-*, anthropic/claude-*, or google/gemini-* ID from /models. POST /v1/chat/completions serves all listed chat models through that single client; Codex CLI uses POST /v1/responses and Claude Code uses POST /v1/messages at https://api.router.one with the same key.

Do my existing OpenAI integrations work unchanged?

In most cases, yes. You change the base URL and API key; your request and response handling stays the same. The main difference is that you can now set the model field to models from other families.

Can I call Claude or Gemini through the OpenAI SDK?

Yes. Set the model field to a Claude, Gemini, Grok, or other supported model ID and the OpenAI SDK call routes through Router One to that model. Browse the full catalog on the models page.

What about the Anthropic-compatible endpoint for Claude Code?

Claude Code expects the Anthropic API shape, so Router One also exposes an Anthropic-compatible endpoint at https://api.router.one. Set ANTHROPIC_BASE_URL there and Claude Code works natively.

Do streaming, tool calls, and structured outputs work?

Router One follows the OpenAI Chat Completions contract: streaming responses, tool/function calling, and response_format (json_object, or json_schema with a named schema) all travel on the same request shape, with support varying by underlying model. The gateway checks the response_format envelope and forwards it to the model; schema enforcement is the model's. See the docs and the streaming, tool calling, and structured outputs guides for the current per-feature details.

Should I send max_tokens or max_completion_tokens?

Per OpenAI's API reference (checked 2026-11-30), max_tokens on Chat Completions is deprecated in favor of max_completion_tokens and is not compatible with o-series models; max_completion_tokens is an upper bound on the tokens a completion can generate, counting visible output tokens and reasoning tokens. The Responses API (POST /v1/responses) names its cap max_output_tokens, which also counts reasoning tokens. Because reasoning counts toward the cap, leave room for it when you set a limit on a reasoning model. On Router One's POST /v1/chat/completions, max_tokens and max_completion_tokens set the same output cap: send either one, and when both are sent, max_completion_tokens wins.

Is there a single OpenAI-compatible endpoint that routes to Claude and Gemini too?

Yes. Router One serves every listed chat model — GPT, Claude, Gemini, Grok, and DeepSeek — on one OpenAI-compatible Chat Completions endpoint at https://api.router.one/v1 (POST /v1/chat/completions) behind one sk-... key. Pass the exact catalog ID from /models (for example anthropic/claude-sonnet-5, google/gemini-3.8-flash, or openai/gpt-6.2-sol) in the model field. Tool-calling requests on GPT-6 Astra, GPT-6.1, and GPT-6.2 models go to POST /v1/responses on the same /v1 base URL, and Anthropic SDKs or Claude Code can use POST /v1/messages at https://api.router.one with the same key.

How do I switch an app from the OpenAI API to another compatible provider?

Four changes move most apps over: (1) set your SDK's base_url or OPENAI_BASE_URL to https://api.router.one/v1 (omit /v1 only for clients such as Cherry Studio that append /v1/chat/completions themselves); (2) swap the API key to a key from Dashboard → API Keys; (3) set the model field to a live catalog ID from /models (such as openai/gpt-6.2-sol, anthropic/claude-sonnet-5, or deepseek-v4.1-flash); and (4) confirm endpoint support before moving traffic (Chat Completions on /v1/chat/completions; Responses on /v1/responses for Codex CLI and GPT-6 Astra, GPT-6.1, and GPT-6.2 tool calls), then verify the first forwarded call in Dashboard → Logs.

How can I replace the OpenAI API with a multi-model router without rewriting my app?

Keep your existing OpenAI Python or Node SDK code and change only the base URL (https://api.router.one/v1) and API key. Because POST /v1/chat/completions keeps the OpenAI request and response shape, streaming included, switching between GPT, Claude, Gemini, Grok, and DeepSeek is mostly a change of the model string in config rather than a new vendor SDK. Two things still depend on the model: tool calls on GPT-6 Astra, GPT-6.1, and GPT-6.2 go to POST /v1/responses, and for Claude IDs response_format on Chat Completions is not a reliable way to get JSON (use output_config.format on /v1/messages; see https://router.one/llm-tool-calling and https://router.one/llm-structured-outputs). You can also send model="auto" to let the gateway classify the request into a low, medium, or high tier from its server-owned model list, while named model IDs always stay on the exact model you request.

Which AI gateways support fallback between OpenAI and Anthropic?

Some self-hosted or configurable proxies let you define custom cross-provider fallback chains from an OpenAI model to an Anthropic model. On Router One, automatic failover on a named model stays strictly on the same requested model across healthy provider routes serving that model — the gateway does not silently swap an OpenAI model to Claude or vice versa, so prompt formatting, tool schemas, and billing stay predictable. Only the explicit model="auto" mode lets the gateway pick from server-owned tier lists that may span vendors. If your app needs deterministic cross-model fallback (such as openai/gpt-6.2-sol to anthropic/claude-sonnet-5), write that retry branch in your own code against the same Router One base URL and key. Without tools only the model string changes; with tools the branch also changes the endpoint, because GPT-6.2 takes tool calls only on POST /v1/responses, which does not serve Claude IDs. See https://router.one/llm-fallback for the exact failover contract.

Choose the next step for your OpenAI-compatible integration

Once the base URL is switched: confirm the request format, pick a current model ID, open the guide for your client or framework, add streaming or tool calling, and check the first call in a trace.

API referenceConfirm the Chat Completions requestCheck the exact fields, response shape, streaming behavior, and errors after changing the base URL.Model selectionChoose a current model ID and rateReview available model IDs, capabilities, context windows, and posted pricing before setting the model field.Client setupOpen a client-specific integration guideCheck each client's URL field, request protocol, and model support before configuring its Router One key.Connection errorsFix Invalid URL, DNS, and TLS failuresCheck the client URL field and the failing network layer when there is no HTTP response or request log to inspect.Key errorsFix Incorrect API key provided and other 401sFind which server refused the key, fix the Authorization header value, and tell a 401 from a billing-limit 402 or an allowlist 403.StreamingStream responses over SSEEnable stream on the same endpoint, read the chunk format, and handle timeouts and cancellation for long generations.Tool callingRun tool calling across modelsDeclare tools once in the OpenAI-compatible shape, follow the call loop, and debug per-model differences in a trace.Structured outputsGet JSON mode or JSON Schema repliesSend response_format on the same request, see the 400 envelope checks the gateway runs first, and keep enforcement expectations per model.Responses APIChoose a current model for /v1/responsesThe Responses endpoint family, the request features it accepts and rejects, and the Codex CLI wiring that depends on it.Wire formatsCompare Responses, Chat Completions and MessagesHow the three request formats differ, when to use which, and which endpoint each model family is served on.VerificationVerify the request in a traceConfirm the model and request ID, token usage, latency, status, and the wallet charge or plan quota used after the first call.Gateway layerSee what the gateway layer doesRouting, automatic fallback, spend caps, and a trace for each request the gateway forwards to a model — the controls behind the compatible endpoint.BackgroundStart from what an AI API gateway isThe category explained from scratch: what the gateway layer does, and when one endpoint for every model pays off.
Framework and agent SDK setup guides(12)
FrameworkConfigure LlamaIndexPoint LlamaIndex's OpenAI-compatible LLM class at the gateway base URL and switch models by string.Python agentsConfigure Pydantic AI and typed outputSelect Chat Completions explicitly, test text output, then choose a typed-output mode your model supports.Agent SDKConfigure the OpenAI Agents SDKBuild OpenAIChatCompletionsModel on a Router One AsyncOpenAI client, switch off trace upload, and bound each run with max_turns and maxSpend.FrameworkConfigure HaystackPoint OpenAIChatGenerator's api_base_url at the gateway, read replies as ChatMessage, then add streaming and tools; embeddings stay elsewhere.Agent frameworkConfigure Google ADKBuild a LiteLlm model with the openai/ prefix, api_base on the /v1 URL and an env-sourced key, then pass it to LlmAgent.Agent libraryConfigure smolagentsConstruct OpenAIModel with model_id, api_base and api_key, run a CodeAgent or ToolCallingAgent, and keep code execution in your own process or sandbox.Agent frameworkConfigure MastraGive a Mastra Agent a model object with id, url and apiKey, keep the custom/ label in front of slash-prefixed IDs, and leave tools, memory and Studio in your own process.LM programming frameworkConfigure DSPyBuild dspy.LM with the openai/ prefix, api_base on the /v1 URL and an env-sourced key, then cap optimizer runs per key and account for DSPy's response cache.Agent frameworkConfigure Microsoft Agent FrameworkBuild OpenAIChatCompletionClient with model, api_key and base_url (or an OpenAI ChatClient in .NET), attach function tools, and bound the tool loop for each run.Agent frameworkConfigure AgnoUse OpenAILike with an explicit model ID and the /v1 base URL; keep tools, memory and agent state in your application.Agent frameworkConfigure Microsoft AutoGenBuild OpenAIChatCompletionClient with the /v1 base_url and a complete model_info for catalog IDs, request streamed usage, and cap team turns per run.Java frameworkConfigure Spring AIPoint Spring AI's OpenAI starter at the gateway: the base-url your release line needs, the model property and an env-sourced key, then check with ChatClient.

Ready to point your OpenAI SDK at every model?

Get your API key