multi-router.aidocs

Agents & Editors

Kilo Code

Connecting Kilo Code to an Adaptive Router through an OpenAI-compatible custom provider.

Kilo Code is a coding agent for VS Code, JetBrains and the terminal. It connects to Multi-Router through a custom provider with the OpenAI Compatible API, which sends Chat Completions requests to an Adaptive Router with the router header.

Creating the router

Kilo Code connects through an Adaptive Router, which accepts OpenAI Chat Completions requests and serves each one with the model it names, using the organization's provider key for that model's provider. Kilo Code holds only the Multi-Router API key. See Adaptive Router. To set it up:

  1. In Model Groups, create or choose a model group with the models Kilo Code should use. See Model Group.
  2. In Routers, choose New router, then Adaptive Router. Name it, choose the model group, and switch on the models to serve.
  3. Choose the organization's provider key for each provider in the group, and create the router. Its id, such as rt_XXXXXXXX, is on the router's page.
  4. In API Keys, create a key with the inference scope. It can be limited to this router. See API Key.

Every request carries the router id in the X-MR-Router header and the API key as a Bearer token, both set in Kilo Code's settings below.

Settings

In VS Code, open Kilo Code's settings, choose the Providers tab, then Custom provider. Enter a provider id and display name, choose OpenAI Compatible, enter the base URL and API key, add the models, and add the header X-MR-Router with the router id. The same provider can be written in Kilo's config file, which the extension, the JetBrains plugin and the command line share:

~/.config/kilo/kilo.jsonjson
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "multi-router/anthropic/claude-sonnet-4.6",
  "provider": {
    "multi-router": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Multi-Router",
      "options": {
        "baseURL": "https://api.multi-router.ai/v1",
        "apiKey": "{env:MR_API_KEY}",
        "headers": { "X-MR-Router": "rt_XXXXXXXX" }
      },
      "models": {
        "anthropic/claude-sonnet-4.6": {
          "name": "Claude Sonnet 4.6 (Multi-Router)",
          "tool_call": true,
          "limit": { "context": 200000, "output": 64000 }
        }
      }
    }
  }
}

Keep the key in the global config or an environment variable. Kilo does not read {env:...} references in a project's own config file. Set limit.context and limit.output, which Kilo uses to manage the context window.

Models

An Adaptive Router names models by their Multi-Router catalog id, provider/model, such as anthropic/claude-sonnet-4.6, openai/gpt-5 or google/gemini-2.5-flash. The model must be switched on in the router's model group; a request for any other model is refused with a message listing the models the router serves. The settings on this page list each model id explicitly.

Kilo names a model as the provider id followed by the model id, so anthropic/claude-sonnet-4.6 on the multi-router provider is multi-router/anthropic/claude-sonnet-4.6.

Checking the setup

Choose the model in Kilo Code and say hello.

The request then appears in Traffic with the Adaptive Router in the Router column and the model, tokens and cost in the request detail. A reply with the requested model or router was not found means the router id is wrong, or the API key is not allowed to use that router. See Traffic and Troubleshooting.

ClineClaude Desktop
Was this helpful?