HomeOpenRouter API URL
OpenRouter API URL
Set the OpenAI SDK base URL to https://openrouter.ai/api/v1. Claude Code uses https://openrouter.ai/api, without the /v1 suffix.
Updated 2026-09-27
Most OpenAI-compatible clients want the versioned base URL. Chat completions are POST https://openrouter.ai/api/v1/chat/completions. The model list is GET https://openrouter.ai/api/v1/models. Key limits are GET https://openrouter.ai/api/v1/key. Generation stats are GET https://openrouter.ai/api/v1/generation?id=…
A minimal chat call
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openrouter/free","messages":[{"role":"user","content":"Reply in one sentence."}]}'In the official OpenAI SDKs, set baseURL or base_url to https://openrouter.ai/api/v1 and pass the OpenRouter key as the API key. Optional headers HTTP-Referer and X-OpenRouter-Title are how OpenRouter attributes the call on public app rankings.
Which URL goes in which client
| Client | Value |
|---|---|
| OpenAI SDK, Janitor, most proxies | https://openrouter.ai/api/v1 |
| Claude Code ANTHROPIC_BASE_URL | https://openrouter.ai/api |
| OpenRouter MCP | https://mcp.openrouter.ai/mcp |
| EU or US regional API | Business and Enterprise only |
Claude Code’s cookbook tells you to include the scheme and to stop at /api. Adding /v1 there breaks that client. The OpenAI SDK wants the opposite: include /v1.
How to use it the first time
- Create an account at openrouter.ai/sign-in.
- Add credits if you will call a paid slug. Free slugs work at a $0 balance that is not negative.
- Create a key. It begins with sk-or-v1-.
- Put the base URL and key in the client, then set a model slug from the catalog.
Questions
What is the OpenRouter base URL?
https://openrouter.ai/api/v1 for OpenAI-compatible clients. https://openrouter.ai/api for Claude Code.
Does the API URL include /v1/chat/completions?
The base URL stops at /v1. The SDK appends /chat/completions. If you call fetch yourself, use the full path.
Where is the key created?
https://openrouter.ai/settings/keys after you sign in on openrouter.ai.
Related
- OpenRouter login
OpenRouter login is only on openrouter.ai/sign-in. API keys are created after that, at settings/keys. This site cannot sign you in.
- Claude Code on OpenRouter
Point Claude Code at https://openrouter.ai/api, put the OpenRouter key in ANTHROPIC_AUTH_TOKEN, and set ANTHROPIC_API_KEY to an empty string.
- OpenRouter MCP
The OpenRouter MCP server is https://mcp.openrouter.ai/mcp. It lets a coding agent read models, prices, and your credits after an OAuth login.
- OpenRouter free models
openrouter/free routes to a $0 model at random. On 27 Sep 2026 the catalog also listed 17 slugs ending in :free, with rate limits.