Gateway
OpenRouter
Several hundred models from every major vendor, one key.
Quick start
import polygate response = polygate.chat( provider="openrouter", model="anthropic/claude-sonnet-4.5", messages=[{"role": "user", "content": "Say hi in one word."}],) print(response.content) # "Hi!"print(response.usage) # Usage(prompt_tokens=..., completion_tokens=...)Names
Any of these work as provider. They all reach the same adapter, so pick whichever reads best in your code.
openrouterConfiguration
| Variable | Holds |
|---|---|
| OPENROUTER_API_KEY | your API key |
Any of these may hold a comma-separated list. polygate rotates across them, parks a rate-limited one for its Retry-After, and drops one the provider rejects — so a key pool is configuration, not code.
Endpoint
https://openrouter.ai/api/v1
Pass base_url to point the same wire format somewhere else — a proxy, a regional endpoint, or a gateway in front of it.
Models
Addressed vendor/model. These are examples — the gateway's own catalogue is the authority.
anthropic/claude-sonnet-4.5openai/gpt-4ometa-llama/llama-3.3-70b-instructThings worth knowing
- Models are addressed
vendor/model. OpenRouter picks an upstream provider and fails over between them, which makes it the cheapest way to reach a model polygate has no adapter for.
Batch
OpenRouter has no offline batch API. To run many requests at once, use map_chat — full price, but it works everywhere and returns in seconds. See Batching & concurrency.