OpenRouter
Roder exposes OpenRouter as the provider id openrouter. The default
built-in model route is x-ai/grok-build-0.1, surfaced in Roder as
openrouter/x-ai/grok-build-0.1 when selected from provider/model shorthand.
The route has a 256k context window, auto-compacts near 230k tokens, and advertises
tool use, structured outputs, image input, compaction, and patch-style edits.
API key setup
OpenRouter uses API-key auth. Paste a key through the TUI provider prompt,
providers/configure, or one of the supported environment variables.
export OPENROUTER_API_KEY="..."
export RODER_PROVIDER=openrouter
export RODER_MODEL=x-ai/grok-build-0.1
cargo run -p roder-cli # ~/.roder/config.toml
provider = "openrouter"
model = "x-ai/grok-build-0.1"
[providers.openrouter]
api_key = "..."
api_key_env = "OPENROUTER_API_KEY"
Roder also checks RODER_OPENROUTER_API_KEY. OpenRouter-compatible
endpoints can be pointed at another base URL with OPENROUTER_BASE_URL,
RODER_OPENROUTER_BASE_URL, or providers.openrouter.base_url.
Attribution headers
Optional OpenRouter attribution headers are configured outside the app-server
providers/configure API. Roder only sends them when values are present.
[providers.openrouter]
http_referer = "https://example.com"
app_title = "Roder"
Equivalent environment variables are OPENROUTER_HTTP_REFERER,
RODER_OPENROUTER_HTTP_REFERER, OPENROUTER_APP_TITLE, and
RODER_OPENROUTER_APP_TITLE.
Model discovery
Roder returns built-in OpenRouter models immediately, refreshes stale discovery
in the background with GET /models, and caches successful results in
~/.roder/models-cache.json. Discovery is keyed by provider id and base URL.
RODER_MODELS_REFRESH=1 cargo run -p roder-cli
RODER_MODELS_CACHE_TTL_SECONDS=0 cargo run -p roder-cli
RODER_MODELS_CACHE_PATH=/tmp/roder-models-cache.json cargo run -p roder-cli Request behavior
OpenRouter runs through Roder's Responses-compatible transport at
POST /responses. Requests send the OpenRouter model slug exactly,
including provider-prefixed ids such as x-ai/grok-build-0.1.
Roder does not send OpenAI encrypted reasoning replay fields to OpenRouter by
default.
RODER_OPENROUTER_LIVE=1 OPENROUTER_LIVE_MODEL=x-ai/grok-build-0.1 cargo test -p roder-ext-openrouter --test live_openrouter -- --ignored grok-build-0.1. OpenRouter uses slugs such as
x-ai/grok-build-0.1, and Roder preserves that slug.