Skip to content

OpenRouter

provider: 'openrouter'

OpenRouter is an aggregator: it reaches every maat-supported model through a single API key and a single OpenAI-compatible endpoint. Use it to try models from different vendors without provisioning each first-party account.

Authentication

Get an API key from OpenRouter and pass it through extra.apiKey:

ts
{
  provider: 'openrouter',
  model: 'claude-opus-4-8',
  extra: { apiKey: process.env.OPENROUTER_API_KEY },
}

maat sends the HTTP-Referer and X-Title headers OpenRouter uses for attribution automatically.

Configuration

FieldRequiredDescription
extra.apiKeyRecommendedOpenRouter API key.
extra.baseUrlOptionalOverride the endpoint. Defaults to https://openrouter.ai/api/v1.

Models

Every supported model is available. maat maps the model id to the OpenRouter slug automatically:

modelOpenRouter slug
gemini-3-5-flashgoogle/gemini-3.5-flash
gemini-3-1-pro-previewgoogle/gemini-3.1-pro-preview
claude-sonnet-4-6anthropic/claude-sonnet-4.6
claude-opus-4-8anthropic/claude-opus-4.8
claude-haiku-4-5anthropic/claude-haiku-4.5
grok-4-3x-ai/grok-4.3
gpt-5-4openai/gpt-5.4
gpt-5-5openai/gpt-5.5

JSON output

OpenRouter routes JSON enrichers through response_format: json_schema (strict: true). Schema enforcement ultimately depends on the upstream model's support. See JSON output and schemas. temperature is sent only for Gemini models.