Omni.Providers.OpenRouter (Omni v1.3.0)

Copy Markdown View Source

Provider for the OpenRouter API, using the Omni.Dialects.OpenAICompletions dialect.

Not loaded by default — must be explicitly enabled. Either add it to your provider list in application config:

config :omni, :providers, [:anthropic, :openai, :google, :openrouter]

Or load it at runtime:

Omni.Provider.load([:openrouter])

Reads the API key from the OPENROUTER_API_KEY environment variable — no further configuration is needed if the variable is set.

Configuration

Override the default API key or base URL via application config:

config :omni, Omni.Providers.OpenRouter,
  api_key: {:system, "MY_OPENROUTER_KEY"}

Any key from the provider's config/0 can be overridden: :api_key, :base_url. See Omni.Provider for details.

OpenRouter wraps reasoning model output in a reasoning_details format rather than standard thinking blocks. This is handled automatically — reasoning data round-trips through Omni.Message.private in multi-turn conversations without any special handling.