openrouter
The openrouter provider offers native integration with OpenRouter, a unified API gateway providing access to 300+ AI models from OpenAI, Anthropic, Google, Meta, and others through a single interface.
Example:
You can also use openai-generic with OpenRouter by manually setting the base_url. The openrouter provider simplifies this by providing sensible defaults.
OpenRouter-specific options
The openrouter provider extends openai-generic with OpenRouter-specific defaults. See openai-generic for the full list of supported options.
Default: env.OPENROUTER_API_KEY
Default: https://openrouter.ai/api/v1
The model to use, in OpenRouter’s provider/model-name format.
OpenRouter supports model variants for routing preferences (e.g., :nitro for high-throughput):
For the complete list, see OpenRouter Models.
App attribution headers
OpenRouter supports optional headers for app attribution. Pass these via the headers option:
For all other options (temperature, max_tokens, headers, etc.), see openai-generic and the OpenRouter API documentation.