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 30+ models through a single endpoint — with smart routing, automatic provider fallback, and a per-request cost trace for every call.

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 for every chat model.

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 smart routing and resilience without extra integration work.

  • Production traffic uses model_name by default, so a request is served by the model you name. Set model to "auto" and the gateway picks a low, medium or high tier for the request 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, settled cost, total time (plus time to first token on streamed requests that produced output), status, and any sanitized error for recorded calls. Upstream provider identities, routes, and internal attempts are not disclosed.

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).

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.

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.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.VerificationVerify the request in a traceConfirm the model and request ID, token usage, latency, status, and billed cost after the first call.Gateway layerSee what the gateway layer doesRouting, automatic fallback, spend caps, and per-request traces — 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