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

  1. Create an OpenRouter account and generate an API key.
  2. Export the API key in your shell or add it to a local .env file:
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

SymptomResolution
HTTP 403 or 401 errorsConfirm OPENROUTER_API_KEY is set and active for the chosen model.
Model not foundDouble-check the model slug in the OpenRouter catalog and your workspace config.
Tool calls ignoredEnsure 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.