
OpenRouter API Base URL and OpenAI-Compatible APIs: One Endpoint for Claude, GPT and Mistral
The OpenRouter API base URL is https://openrouter.ai/api/v1, and the chat completions endpoint is https://openrouter.ai/api/v1/chat/completions. OpenRouter accepts the OpenAI Chat Completions format, so the official OpenAI SDKs work once you set the base URL to that address, send your OpenRouter key as a Bearer token and name a model such as anthropic/claude-sonnet-5.5. Change the model string to openai/gpt-6.1-sol or mistralai/mistral-large-4-0 and the same request goes to OpenAI or Mistral. Vercel AI Gateway, Portkey and the self-hosted LiteLLM Proxy also put Anthropic, OpenAI and Mistral behind one OpenAI-compatible endpoint; they're compared below.
Every URL, model ID and price on this page was checked against the vendors' own documentation and APIs in November 2026.
OpenRouter API base URL and chat completions endpoint
Setting | Value |
|---|---|
Base URL |
|
Chat completions endpoint |
|
Auth header (required) |
|
Content type |
|
Optional headers |
|
Model ID format |
|
API keys |
The optional headers only attribute your app: HTTP-Referer is your site URL and is required for attribution, X-OpenRouter-Title is the name shown in OpenRouter's rankings and goes together with HTTP-Referer, and X-OpenRouter-Categories assigns marketplace categories. Requests work without them.
curl example
curl https://openrouter.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"messages": [
{"role": "user", "content": "Explain what an OpenAI-compatible API is in one sentence."}
]
}'
Python example with the official openai SDK
Install the SDK with pip install openai, export OPENROUTER_API_KEY, then run:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
)
completion = client.chat.completions.create(
model="anthropic/claude-sonnet-5.5",
messages=[
{"role": "user", "content": "Explain what an OpenAI-compatible API is in one sentence."}
],
extra_headers={
"HTTP-Referer": "https://example.com", # optional: your site URL
"X-OpenRouter-Title": "My App", # optional: your app name
},
)
print(completion.model)
print(completion.choices[0].message.content)
The base URL stops at /v1. The SDK appends /chat/completions itself, so if you paste the full endpoint as base_url, the request goes to .../chat/completions/chat/completions and OpenRouter answers with a 404.
Model IDs and switching between Claude, GPT and Mistral
OpenRouter model IDs are author/model slugs. Current examples are openai/gpt-6.1-sol, anthropic/claude-sonnet-5.5 and mistralai/mistral-large-4-0 (the Mistral prefix is mistralai/, not mistral/). The endpoint, key and payload stay the same, so switching vendors is a loop over strings, reusing the client from above:
for model in ["openai/gpt-6.1-sol", "anthropic/claude-sonnet-5.5", "mistralai/mistral-large-4-0"]:
r = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Name one risk of vendor lock-in."}],
)
print(f"{r.model}: {r.choices[0].message.content}")
Two OpenRouter features help once you switch often. Aliases of the form ~author/family-latest, such as ~anthropic/claude-sonnet-latest, resolve to the newest model in that family, and the response's model field names the model that actually ran. A models array lists fallbacks that OpenRouter tries in order when the first model fails with any error, such as a rate limit, downtime, context length or a moderation flag. The OpenAI SDK has no argument for it, so pass it as extra_body={"models": [...]}; you are billed for the model that answered.
The full catalog, with the parameters each model supports, is at GET https://openrouter.ai/api/v1/models, which needs no key. If you're still choosing what to route to, our comparison of frontier AI models covers the main options.
On pricing, OpenRouter bills inference at the provider's list price with no markup, and takes a fee when you buy credits: 5.5% on the Standard plan and 8% on Business.
Services that let you switch between Anthropic, OpenAI and Mistral with one API
As of November 2026, OpenRouter, Vercel AI Gateway, Cloudflare AI Gateway, Portkey and the self-hosted LiteLLM Proxy each put Anthropic, OpenAI and Mistral models behind one OpenAI-compatible endpoint. Cloudflare's Unified Billing pays for OpenAI, Anthropic and Google models from Cloudflare credits, but not for Mistral: for Mistral models you add your own Mistral key. In every case you switch vendors by changing the model string. The vendors also run their own OpenAI-compatible endpoints, which help when you want one client library and don't mind one key per vendor.
Option | Type | OpenAI-compatible base URL | Good for | Pricing model |
|---|---|---|---|---|
OpenRouter | Hosted router |
| Hundreds of models, one key and bill, fallbacks | Provider price, no markup; 5.5% fee on credit purchases |
Vercel AI Gateway | Hosted gateway |
| Apps on Vercel; budgets per team, project, key or user | Provider list price, no markup; prepaid credits |
Cloudflare AI Gateway | Hosted gateway |
| Caching, rate limits and analytics for OpenAI, Anthropic, Google, Mistral | Core features free; 5% fee on credits |
Portkey | Hosted gateway, open-source core |
| Guardrails, retries, load balancing over your own keys | Free to 10k logs/month; $49/month tier |
LiteLLM Proxy | Self-hosted proxy |
| No third-party gateway in the path; per-key budgets | Open source; you pay providers |
Hugging Face Inference Providers | Hosted router, open-weight models |
| Open models served by Groq, Cerebras, Together and others | No markup on provider rates; PRO includes $2/month in credits |
Together AI | Model host, open-weight models |
| Open models with tools, vision, structured output | Per 1M tokens |
OpenAI | Vendor |
| The reference implementation | Per token |
Anthropic | Vendor compatibility layer |
| Testing Claude with existing OpenAI code | Per token |
Google Gemini | Vendor compatibility layer (beta) |
| Gemini from the OpenAI SDK | Per token |
Mistral | Vendor |
| Mistral models; change only base URL and model | Per 1M tokens |
How to choose
If you don't want an account with every vendor, OpenRouter, Vercel AI Gateway and Cloudflare's Unified Billing sell tokens at provider prices from one prepaid balance. When we checked (November 2026), OpenRouter's models API listed 349 distinct models, not counting aliases and :free or :batch variants, against 324 language models on Vercel's, so it is the pick when you want breadth. Vercel and Cloudflare make more sense when your app already runs on them.
If you already hold vendor keys, Portkey and LiteLLM sit in front of them. Portkey adds retries, fallbacks, load balancing and guardrails, and its free tier covers 10,000 recorded logs a month. LiteLLM tracks spend and sets budgets per virtual key, and it is the option when no third-party gateway may see your traffic.
Model IDs don't carry over between gateways. OpenRouter writes mistralai/mistral-large-4-0, Vercel writes mistral/mistral-large-4, Portkey uses @your-provider-slug/model, and LiteLLM uses whatever model_name you define. The Anthropic and Gemini compatibility layers are the weakest options for production: Anthropic describes its layer as a way to test and compare models, not a long-term or production-ready solution, and Google still labels its layer beta.
Self-hosted: one endpoint with LiteLLM
A LiteLLM config that exposes Claude, GPT and Mistral under short names:
model_list:
- model_name: claude
litellm_params:
model: anthropic/claude-sonnet-5-5
api_key: os.environ/ANTHROPIC_API_KEY
- model_name: gpt
litellm_params:
model: openai/gpt-6.1-sol
api_key: os.environ/OPENAI_API_KEY
- model_name: mistral
litellm_params:
model: mistral/mistral-large-latest
api_key: os.environ/MISTRAL_API_KEY
docker run -v $(pwd)/litellm_config.yaml:/app/config.yaml \
-e ANTHROPIC_API_KEY -e OPENAI_API_KEY -e MISTRAL_API_KEY \
-e LITELLM_MASTER_KEY=sk-change-me \
-p 4000:4000 docker.litellm.ai/berriai/litellm:latest --config /app/config.yaml
Clients then use base URL http://localhost:4000, API key sk-change-me and model claude, gpt or mistral. Without a database, LiteLLM does not enforce budgets.
What "OpenAI-compatible" means, and where it breaks
An OpenAI-compatible API accepts POST {base_url}/chat/completions with OpenAI's JSON body (model, messages with roles, optional tools and stream), authenticates with a Bearer token and returns the same choices[].message shape, or server-sent events when streaming. Plain chat requests work across every endpoint in the table once you change the base URL, key and model name. The differences sit at the edges:
- Tool calling: Anthropic's layer ignores
strict, so tool arguments aren't guaranteed to match your schema, and on recent models such as Claude Sonnet 5.5 atool_choiceof"required"or a named function returns a 400, so use"auto". On OpenRouter, 64 of the 349 distinct models didn't listtoolsinsupported_parameterswhen we checked (November 2026), so check before pointing an agent at one.
-
Structured output: Anthropic's layer accepts
response_formatonly asjson_schemawithstrict: true;json_objectandtextreturn a 400. Together AI and Vercel AI Gateway document it as supported. -
Streaming: OpenRouter sends keep-alive comment lines (
: OPENROUTER PROCESSING). The SDKs skip them, but a hand-written SSE parser has to drop lines starting with:before parsing JSON. An error after the stream starts arrives as a chunk withfinish_reason: "error"inside an HTTP 200. -
Reasoning controls: there is no shared parameter. Anthropic's layer ignores
reasoning_effortand takes athinkingobject throughextra_body; on Claude 5 models thinking is on by default. Gemini acceptsreasoning_effortor its ownthinking_level/thinking_budget, not both. OpenRouter uses areasoningobject with eithereffortormax_tokens. -
Vision and files: Anthropic's layer reads
image_urlparts but rejectsfileandinput_audioparts with a 400. -
System prompts and sampling: Anthropic merges every system and developer message into one system prompt at the start, caps
temperatureat 1 (on Claude 4.7 and later models any value below 1 returns a 400, so leave it out) and requiresnto be 1.
Write against the common subset (messages, streaming, tools without strict or a forced tool_choice) and keep vendor-specific parameters in extra_body, set per provider.
Using any OpenAI-compatible model in BrowseWiz
BrowseWiz is an AI side-panel assistant, a Chrome extension, and its custom models accept any model behind an OpenAI API-compatible chat completions endpoint. The form asks for the same values as the SDK:
-
In the side panel, open the model menu and choose Add model at the bottom. It opens Options → Models.
-
In the Custom OpenAI API-compatible Model Endpoints form, enter the Model Name exactly as the provider expects it in the request, for example
anthropic/claude-sonnet-5.5for OpenRouter. -
Enter the Endpoint Base URL, for example
https://openrouter.ai/api/v1. BrowseWiz appends/chat/completions, so stop at/v1here too. -
Paste the API Key (optional, for endpoints that need none). It's sent as the Bearer token and stored encrypted in the extension's local storage.
-
Under Headers (optional), add any extra request headers, such as OpenRouter's
HTTP-RefererandX-OpenRouter-Title: type a name and a value, then click +. A header added with the lock on is stored encrypted; with the lock off, in plain text. -
Click Add Endpoint. The model is then listed under Custom models in the model menu, where you pick it for a chat.

Each entry is one model. To use Claude, Mistral and Gemini models through OpenRouter, add one entry per model with the same base URL and key and a different model name. Direct vendor endpoints work the same way:
Provider | Base URL | Model name example |
|---|---|---|
OpenRouter |
|
|
Google Gemini |
|
|
Mistral |
|
|
Anthropic |
|
|
Custom models answer chat only. The browser agent and its safety check, scheduled tasks and monitors run on BrowseWiz's own models and use your BrowseWiz credits, whatever model the chat uses. Every tool you have turned on is sent to the model, so for a model without tool calling, turn tools off in the Tools menu. The Models settings docs cover the form in full.
If you only need OpenAI models, the Bring Your Own Key field on the same page takes an OpenAI key directly. Without any key, the built-in BrowseWiz Chat model works on the free plan with limited usage. The settings page also takes custom API and webhook tools; our n8n invoice and receipt workflow walks through one.
FAQ
What is the OpenRouter API base URL?
https://openrouter.ai/api/v1. The chat completions endpoint is https://openrouter.ai/api/v1/chat/completions, authenticated with Authorization: Bearer <OPENROUTER_API_KEY>.
Is OpenRouter OpenAI compatible?
Yes. OpenRouter calls itself a drop-in replacement for OpenAI, and any SDK that lets you set a base URL works with it. OpenRouter-only options such as models, provider and reasoning go in extra_body when you use the OpenAI Python SDK.
Can I switch between Anthropic, OpenAI and Mistral with one API key?
Yes. OpenRouter and Vercel AI Gateway bill Claude, GPT and Mistral models against one key and one prepaid balance. Cloudflare AI Gateway routes all three, but its Unified Billing covers Claude and GPT, not Mistral, so Mistral needs your own Mistral key. Portkey and LiteLLM also give you one gateway key, but you store your own vendor keys behind it.
Should the base URL include /chat/completions?
No. The OpenAI SDKs and BrowseWiz both append /chat/completions to the base URL. Including it yourself doubles the path, and OpenRouter answers with a 404.
Is the Anthropic API OpenAI compatible?
Partly. Anthropic offers an OpenAI SDK compatibility layer at https://api.anthropic.com/v1/. It ignores reasoning_effort and the strict flag on tool schemas, accepts response_format only as json_schema with strict: true, and returns a 400 for other response formats and for file and input_audio parts. Anthropic describes the layer as meant for testing and comparing models, not as a long-term or production-ready solution. OpenRouter lists response_format, structured_outputs and reasoning as supported parameters for Claude 4.5 and later models, so it is the simpler path if you need those through the OpenAI format.

About Tom
I'm a software engineer and solutions architect specializing in AI-driven tools and productivity software, passionate about helping users reclaim their valuable time through intelligent automation.