OpenRouter

Configure OpenRouter, Agno's model class for unified access to language models via OpenRouter's Chat Completions API.

The OpenRouter model provides unified access to various language models through OpenRouter.

Parameters

ParameterTypeDefaultDescription
idstr"gpt-5.4-mini"The id of the OpenRouter model to use
namestr"OpenRouter"The name of the model
providerstr"OpenRouter"The provider of the model
api_keyOptional[str]NoneThe API key for OpenRouter (defaults to OPENROUTER_API_KEY env var)
base_urlstr"https://openrouter.ai/api/v1"The base URL for the OpenRouter API
max_tokensint1024Maximum number of tokens to generate
modelsOptional[List[str]]NoneFallback model IDs for dynamic model routing when the primary model fails

OpenRouter extends OpenAILike and accepts all of its parameters.