Setup
Set your API key as an environment variable:Usage
Available Models
OpenRouter provides access to models from many providers. Model IDs follow the patternprovider/model-name:
See the OpenRouter models page for a full list.
Provider Options
Customize parameters:Streaming
Why OpenRouter?
- Single API: Access models from OpenAI, Anthropic, Google, Meta, and more through one API
- Fallback routing: Automatically fall back to alternative models if one is unavailable
- Cost optimization: Compare prices across providers
- No vendor lock-in: Easily switch between models without code changes