Skip to main content

Variable: openrouter

const openrouter: (modelId, config?) => ModelConfig & object

Defined in: packages/core/src/providers/factories.ts:197

OpenRouter (https://openrouter.ai). OpenRouter is a unified gateway over many model vendors. Model IDs use vendor/model form (e.g. anthropic/claude-sonnet-4, openai/gpt-4o, google/gemini-2.5-pro). Because slash-form IDs are ambiguous with other providers, OpenRouter is not auto-detected — you must use this factory or the explicit openrouter: / openrouter| prefix. The API key defaults to OPENROUTER_API_KEY.

Images, video frames, and PDF/file inputs are accepted on the subset of upstream models that support them. Audio input is only supported on a small set of OpenRouter models (notably openai/gpt-4o-audio-preview and Gemini variants).

Type Declaration​

models​

models: (config?) => Promise<ModelInfo[]>

List the OpenRouter catalog (public; key personalizes availability), newest-first.

Parameters​

config?​

ProviderConfig

Returns​

Promise<ModelInfo[]>

Example​

Reasoning

const bot = new Baleybot({
model: openrouter('anthropic/claude-sonnet-4', {
reasoning: { effort: 'high' }
})
});