openai-completions-style transport used for other proxy providers.
Getting started
- OAuth
- API key
Run OAuth onboarding
Config example
Model references
Model refs follow the pattern
openrouter/<provider>/<model>. For the full list of
available providers and models, see /concepts/model-providers.| Model ref | Notes |
|---|---|
openrouter/auto | OpenRouter automatic routing |
openrouter/moonshotai/kimi-k2.6 | Kimi K2.6 via MoonshotAI |
openrouter/moonshotai/kimi-k2.5 | Kimi K2.5 via MoonshotAI |
openrouter/<provider>/<model> ref, including
openrouter/openrouter/fusion (see Fusion router), resolves
dynamically against OpenRouter’s live model catalog.
Image generation
OpenRouter can back theimage_generate tool. Set an OpenRouter image model
under agents.defaults.imageGenerationModel:
modalities: ["image", "text"]. Gemini image models additionally receive
aspectRatio and resolution hints through OpenRouter’s image_config; other
image models do not. Use agents.defaults.imageGenerationModel.timeoutMs for
slower models; the image_generate tool’s per-call timeoutMs still wins.
Video generation
OpenRouter can back thevideo_generate tool through its asynchronous
/videos API. Set an OpenRouter video model under
agents.defaults.videoGenerationModel:
polling_url, and downloads the finished video from OpenRouter’s
unsigned_urls or the job content endpoint. Reference images default to
first/last-frame images; images tagged reference_image are sent as input
references instead. The bundled google/veo-3.1-fast default supports 4/6/8
second durations, 720P/1080P resolutions, and 16:9/9:16 aspect ratios.
Video-to-video is not supported: the upstream API only accepts text and image
references.
Music generation
OpenRouter can back themusic_generate tool through chat-completions audio
output. Set an OpenRouter audio model under
agents.defaults.musicGenerationModel:
google/lyria-3-pro-preview
and also exposes google/lyria-3-clip-preview. OpenClaw sends modalities: ["text", "audio"], streams the response, collects the audio chunks, and saves
the result as generated media for channel delivery. Lyria models accept one
reference image through the shared music_generate image=... parameter.
Text-to-speech
OpenRouter can act as a TTS provider through its OpenAI-compatible/audio/speech endpoint.
messages.tts.providers.openrouter.apiKey is omitted, TTS falls back to
models.providers.openrouter.apiKey, then OPENROUTER_API_KEY.
Speech-to-text (inbound audio)
OpenRouter can transcribe inbound voice/audio attachments through the sharedtools.media.audio path, using its STT endpoint (/audio/transcriptions).
This applies to any channel plugin that forwards inbound voice/audio into
media understanding preflight.
input_audio (OpenRouter’s STT contract), not as multipart OpenAI form
uploads.
Fusion router
OpenRouter Fusion sends one OpenClaw model ref to several OpenRouter models in parallel, has OpenRouter judge their answers, and returns one final response through the normal OpenRouter endpoint. The upstream model slug isopenrouter/fusion, so the OpenClaw model ref carries both the OpenClaw
provider prefix and the upstream OpenRouter namespace:
params.extraBody;
those fields forward directly into the OpenRouter chat-completions request
body. Fusion works with either OAuth or API-key onboarding; if you use OAuth,
omit the env.OPENROUTER_API_KEY line below.
analysis_models is the parallel panel; model inside the Fusion plugin
config is the judge model. Do not set top-level tool_choice to "required"
in normal agent/chat turns to try to force Fusion: OpenClaw turns can include
its own tool definitions, and a top-level required tool choice may pick one of
those instead of the Fusion router. When this Fusion plugin config is present,
OpenClaw adds a sanitized system-prompt note listing the configured analysis
models and judge model, so the agent can answer questions about its own Fusion
panel. Other extraBody fields are not copied into the prompt.
Fusion is slower by design: OpenRouter fans the prompt out to multiple
analysis models, then runs a judge/synthesis step, so latency runs higher than
a direct single-model request. Use it for deliberate, high-quality answers or
escalation paths, not as a latency-sensitive default. Keep the panel small and
pick faster analysis/judge models for quicker responses.
Test a configured ref with a one-shot local call:
Authentication and headers
OpenRouter uses a Bearer token from your API key. OpenRouter OAuth is a PKCE login flow that issues an OpenRouter API key, so OpenClaw stores the result in the sameopenrouter:default API-key auth profile used by manual API-key
setup.
To sign in or rotate the stored key on an existing install without rerunning
full onboarding:
https://openrouter.ai/api/v1), OpenClaw adds
OpenRouter’s documented app-attribution headers:
| Header | Value |
|---|---|
HTTP-Referer | https://openclaw.ai |
X-OpenRouter-Title | OpenClaw |
X-OpenRouter-Categories | cli-agent,cloud-agent,programming-app,creative-writing,writing-assistant,general-chat,personal-agent |
Advanced configuration
Response caching
Response caching
OpenRouter response caching is opt-in. Enable it per model:OpenClaw sends
X-OpenRouter-Cache: true and, when configured,
X-OpenRouter-Cache-TTL. responseCacheClear: true forces a refresh for
the current request and stores the replacement response. Snake_case
aliases (response_cache, response_cache_ttl_seconds,
response_cache_clear) are accepted, as is responseCacheTtl /
response_cache_ttl without the Seconds suffix.This is separate from provider prompt caching and from OpenRouter’s
Anthropic cache_control markers. It only applies on verified
openrouter.ai routes, not custom proxy base URLs.Anthropic cache markers
Anthropic cache markers
On verified OpenRouter routes, Anthropic model refs keep OpenRouter’s
Anthropic
cache_control markers for better prompt-cache reuse on
system/developer prompt blocks.Anthropic reasoning prefill
Anthropic reasoning prefill
On verified OpenRouter routes, Anthropic model refs with reasoning enabled
drop trailing assistant prefill turns before the request reaches
OpenRouter, matching Anthropic’s requirement that reasoning conversations
end with a user turn.
Thinking / reasoning injection
Thinking / reasoning injection
On supported non-
auto routes, OpenClaw maps the selected thinking level
to OpenRouter proxy reasoning payloads. openrouter/auto and unsupported
model hints skip that injection. Stale openrouter/hunter-alpha refs also
skip it, because OpenRouter could return final answer text in reasoning
fields on that retired route.DeepSeek V4 reasoning replay
DeepSeek V4 reasoning replay
On verified OpenRouter routes,
openrouter/deepseek/deepseek-v4-flash and
openrouter/deepseek/deepseek-v4-pro fill missing reasoning_content on
replayed assistant turns, keeping thinking/tool conversations in DeepSeek
V4’s required follow-up shape. OpenClaw sends OpenRouter-supported
reasoning.effort values for these routes: xhigh/max map to xhigh,
every other non-off level maps to high.OpenAI-only request shaping
OpenAI-only request shaping
OpenRouter runs through the proxy-style OpenAI-compatible path, so native
OpenAI-only request shaping such as
serviceTier, Responses store,
OpenAI reasoning-compat payloads, and prompt-cache hints is not forwarded.Gemini-backed routes
Gemini-backed routes
Gemini-backed OpenRouter refs stay on the proxy-Gemini path: OpenClaw keeps
Gemini thought-signature sanitation there, but does not enable native
Gemini replay validation or bootstrap rewrites.
Provider routing metadata
Provider routing metadata
OpenRouter supports a OpenClaw forwards that object to OpenRouter as the request This only applies on OpenRouter chat-completions routes. Direct Anthropic,
Google, OpenAI, or custom provider routes ignore OpenRouter routing params.
provider request object for underlying provider
routing. Configure a default policy for all OpenRouter text-model requests
with models.providers.openrouter.params.provider:provider
payload. Use OpenRouter’s documented snake_case fields, including sort,
only, ignore, order, allow_fallbacks, require_parameters,
data_collection, quantizations, max_price, preferred_max_latency,
preferred_min_throughput, zdr, and enforce_distillable_text.Per-model params override the provider-wide routing object:Related
Model selection
Choosing providers, model refs, and failover behavior.
Configuration reference
Full config reference for agents, models, and providers.