Connect Kilo Gateway to OpenClaw with a Single API Key
Set up Kilo Gateway as an OpenAI-compatible provider in OpenClaw using one endpoint and API key. Covers plugin install, onboarding, and the default balanced model.
Read this when
- You want a single API key for many LLMs
- You want to run models via Kilo Gateway in OpenClaw
A single OpenAI-compatible endpoint and API key let Kilo Gateway serve requests across a wide range of models.
| Property | Value |
|---|---|
| Provider | kilocode (alias: kilo) |
| Auth | KILOCODE_API_KEY |
| API | OpenAI-compatible |
| Base URL | https://api.kilo.ai/api/gateway/ |
Install plugin
openclaw plugins install @openclaw/kilocode-provider
If a Gateway is already running, the installation is picked up on the spot; if not, it applies at the next startup. See Apply changes and inspect.
Setup
Create an account
Open app.kilo.ai, log in or register an account, and then create an API key.
Run onboarding
openclaw onboard --auth-choice kilocode-api-key
You can also define the environment variable yourself:
export KILOCODE_API_KEY="<your-kilocode-api-key>" # pragma: allowlist secret
Verify the model is available
openclaw models list --provider kilocode
Your model entries survive onboarding, and generated catalog rows are left to discovery. When models.mode: "replace" is used, the built-in catalog is written as well, since that mode does not run discovery.
Default model and catalog
The default model is kilocode/kilo-auto/balanced, the balanced smart-routing tier of Kilo Gateway. OpenClaw publishes no task-to-upstream-model mapping for it; routing behind kilo-auto/balanced is handled by Kilo Gateway.
During startup OpenClaw calls GET https://api.kilo.ai/api/gateway/models and merges a nonempty public list with the static routing entry. Only kilocode/kilo-auto/balanced (Auto Balanced, input: ["text", "image"], reasoning: true, contextWindow: 1000000, maxTokens: 65536) is included in the static catalog.
Every model on the gateway can be addressed as kilocode/<upstream-id> (for instance kilocode/anthropic/claude-sonnet-4, kilocode/openai/gpt-5.5). To view the complete discovered list, run /models kilocode or openclaw models list --provider kilocode.
Config example
{
env: { vars: { KILOCODE_API_KEY: "<your-kilocode-api-key>" } }, // pragma: allowlist secret
agents: {
defaults: {
model: { primary: "kilocode/kilo-auto/balanced" },
},
},
}
Behavior notes
Transport and compatibility
Because Kilo Gateway is OpenRouter-compatible, requests follow the proxy-style OpenAI-compatible path instead of native OpenAI request shaping (there is no store and no OpenAI reasoning-effort payload).
- Kilo refs backed by Gemini remain on the proxy-Gemini path: Gemini thought signatures are sanitized there by OpenClaw, but native Gemini replay validation and bootstrap rewrites are not enabled.
- A Bearer token derived from your API key is used for requests.
Stream wrapper and reasoning
The Kilo stream wrapper attaches an X-KILOCODE-FEATURE request header (default openclaw, which the KILOCODE_FEATURE env var can override) and normalizes reasoning-effort payloads for models that support them.
Warning
Reasoning-effort injection is skipped for
kilocode/kilo-auto/balancedandx-ai/*refs. If reasoning support is needed, use a concrete model ref such askilocode/anthropic/claude-sonnet-4.
Troubleshooting
- Should model discovery fail, OpenClaw reports an unavailable catalog refresh. Static rows are not substituted for the failed request, and an empty response is not turned into
kilocode/kilo-auto/balanced. - Check that your API key is valid and that the models you want are enabled on your Kilo account.
- If Gateway runs as a daemon, that process needs
KILOCODE_API_KEYto be available (in~/.openclaw/.envor throughenv.shellEnv, for example).
Related
-
Model selection, Picking providers, model refs, and failover behavior.
-
Configuration reference, Complete OpenClaw configuration reference.
-
Kilo Gateway, Kilo Gateway dashboard, API keys, and account management.