Skip to content
Docs

Kilo Code with AI Gateway

Kilo Code is a terminal coding agent with its own provider registry. Add AI Gateway as an OpenAI-compatible provider to reach every model in the gateway catalog with one key.

Run the Vercel CLI setup command for Kilo Code:

terminal
npx vercel ai-gateway setup --agent kilo

The command provisions a key, adds the provider to ~/.config/kilo/kilo.json, and exports AI_GATEWAY_API_KEY from a managed block in your shell startup file.

If you can't use the Vercel CLI, configure Kilo Code manually:

  1. Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.

  2. Add the key to your shell configuration file, for example ~/.zshrc or ~/.bashrc:

    Terminal
    export AI_GATEWAY_API_KEY="your-ai-gateway-api-key"
  3. Kilo Code reads a global config at ~/.config/kilo/kilo.json, or under $XDG_CONFIG_HOME when that variable is set. Add the gateway as an openai-compatible provider:

    ~/.config/kilo/kilo.json
    {
      "provider": {
        "openai-compatible": {
          "options": {
            "apiKey": "{env:AI_GATEWAY_API_KEY}",
            "baseURL": "https://ai-gateway.vercel.sh/coding-agent/v1"
          }
        }
      }
    }

    The {env:...} reference is Kilo Code's own substitution syntax. It resolves the value at runtime for configs in trusted locations, which includes the global config, so your key stays in the environment instead of in the file.

    https://ai-gateway.vercel.sh/coding-agent/v1 is the coding agent surface, the default base URL for agents that have no dedicated endpoint. It's the same URL the setup command writes.

    If you keep your configuration in kilo.jsonc instead of kilo.json, add the provider block there. The Vercel CLI only writes kilo.json, so merge the block by hand in that case.

  4. Kilo Code fetches the catalog from the gateway's /models endpoint, so no per-model declarations are needed. Start a session and run /models to choose one. IDs are namespaced by the provider, for example openai-compatible/anthropic/claude-opus-5.

Last updated September 13, 2026

Was this helpful?

supported.