Model providers
Using Kilocode with OpenClaw
Browse more in Model providers.
All model providers guides →This guide shows you how to wire Kilocode’s Kilo Gateway into OpenClaw so your agents can call many upstream models through a single provider. You’ll configure the `kilocode` provider, set the API key, and point your default agent model at Kilo’s smart-routing endpoint.
By the end, OpenClaw will talk to Kilo Gateway using `kilocode/kilo/auto` or any other Kilo-backed model ref.
Prerequisites
- ✓An active Kilo Gateway account at https://app.kilo.ai with access to API Keys.
- ✓A generated Kilo Gateway API key from the API Keys section in the Kilo dashboard.
- ✓An existing OpenClaw setup where you can run the `openclaw` CLI and edit its config (for example, `~/.openclaw` or your app’s config file).
Steps
- 1
Create a Kilo Gateway account and API key
Start by getting a Kilo Gateway API key, since every OpenClaw call to the `kilocode` provider authenticates with it. You do this once per Kilo account, and you’ll reuse the same key across your OpenClaw environments.
textGo to https://app.kilo.ai/, sign in or create an account, then navigate to API Keys and generate a new key. - 2
Run OpenClaw onboarding for the Kilocode API key
Use the OpenClaw onboarding command to register your Kilo API key with the `kilocode` provider. This is the most straightforward way to get the key into OpenClaw’s environment without hand-editing config.
bashopenclaw onboard --auth-choice kilocode-api-key - 3
Export KILOCODE_API_KEY manually (alternative to onboarding)
If you prefer to manage secrets yourself or you run OpenClaw in a non-interactive environment, set `KILOCODE_API_KEY` directly. Make sure you export it in whatever shell or process manager actually runs OpenClaw so the provider can authenticate.
bashexport KILOCODE_API_KEY="<your-kilocode-api-key>" # pragma: allowlist secret - 4
Verify Kilocode models are visible to OpenClaw
Once the API key is in place, confirm that OpenClaw can talk to Kilo Gateway and discover models. This step catches auth or networking issues before you wire models into agents.
bashopenclaw models list --provider kilocode - 5
Set kilocode/kilo/auto as your default agent model
Point your default agent at Kilo’s smart-routing model so new agents automatically use Kilo Gateway. You can still override the model per agent, but this keeps your global default on `kilocode/kilo/auto`.
json{ env: { KILOCODE_API_KEY: "<your-kilocode-api-key>" }, // pragma: allowlist secret agents: { defaults: { model: { primary: "kilocode/kilo/auto" }, }, }, } - 6
Choose specific Kilocode-backed models when you need control
When you want explicit control over the upstream model or reasoning behavior, use a concrete Kilo model ref instead of `kilocode/kilo/auto`. OpenClaw discovers these from Kilo Gateway and you can reference them directly in your agent configs.
textkilocode/kilo/auto kilocode/anthropic/claude-sonnet-4 kilocode/openai/gpt-5.4 kilocode/google/gemini-3-pro-preview
Configuration
| Option | Description | Example |
|---|---|---|
| KILOCODE_API_KEY | API key used by OpenClaw to authenticate requests to Kilo Gateway for the `kilocode` provider. | sk-kilo-1234567890abcdef |
| env.KILOCODE_API_KEY | Config key in your OpenClaw config that passes the Kilo Gateway API key into the runtime environment. | sk-kilo-1234567890abcdef |
| agents.defaults.model.primary | Sets the default primary model for all agents, which you can point at a Kilo Gateway model ref like `kilocode/kilo/auto`. | kilocode/kilo/auto |
Troubleshooting
Kilocode models do not appear when you run `openclaw models list --provider kilocode`.
Model discovery can fail if OpenClaw cannot reach Kilo Gateway or your API key is missing or invalid. OpenClaw then falls back to the bundled static catalog that only includes `kilocode/kilo/auto`, so double-check `KILOCODE_API_KEY` and that your Kilo account has the desired models enabled.
openclaw models list --provider kilocodeYour OpenClaw daemon cannot call Kilo Gateway even though `KILOCODE_API_KEY` works in your shell.
When OpenClaw runs as a daemon, it may not inherit your interactive shell environment. shellEnv` in the process manager configuration.
export KILOCODE_API_KEY="<your-kilocode-api-key>" # pragma: allowlist secretFrequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.