OpenRouter Integration Guide
June 3, 2026 ยท View on GitHub
OpenRouter expands VT Code with access to the full model marketplace. This guide covers configuration, CLI usage, and tips for working with custom OpenRouter model IDs.
Prerequisites
- Create an OpenRouter account and generate an API key.
- Export the API key in your shell or add it to a local
.envfile:
export OPENROUTER_API_KEY="your-openrouter-key"
# or
cat <<'ENV' > .env
OPENROUTER_API_KEY=your-openrouter-key
ENV
Quickstart
Run VT Code against the Xiaomi MiMo V2.5 Pro model (the default OpenRouter model):
vtcode --provider openrouter --model xiaomi/mimo-v2.5-pro chat
Or use the lightweight MiMo V2.5:
vtcode --provider openrouter --model xiaomi/mimo-v2.5 chat
Both commands stream responses using the OpenRouter Responses API and support VT Code tooling out of the box.
Persisting configuration
Add OpenRouter to your workspace vtcode.toml (MiMo V2.5 Pro is the default):
[agent]
provider = "openrouter"
default_model = "xiaomi/mimo-v2.5-pro"
Custom model IDs are accepted. If you reference a model not listed in docs/models.json, ensure it is enabled for your
OpenRouter account.
Runtime behaviour
- Tool calling: VT Code maps OpenRouter conversations to the OpenAI-compatible function calling format.
- Streaming: Streaming is fully supported for OpenRouter providers (VT Code uses the standard streaming interface).
- Prompt refinement: The prompt refiner automatically reuses your OpenRouter key and respects any custom model overrides.
- Routing: When the LLM router is enabled, VT Code honours the configured provider and model combination for routing tasks.
Troubleshooting
| Symptom | Resolution |
|---|---|
HTTP 403 or 401 errors | Confirm OPENROUTER_API_KEY is set and active for the chosen model. |
| Model not found | Double-check the model slug in the OpenRouter catalog and your workspace config. |
| Tool calls ignored | Ensure the model you selected advertises tool support. Many third-party providers expose read-only models. |
For additional details, consult the OpenRouter API reference and the streaming documentation.