Skip to content

Setting up Kilo Gateway

I find it exhausting to manage multiple API keys and update base URLs every time I want to test a new model. It is a distraction when I just want to focus on my code and get things moving.

Kilo Gateway fixes this by providing one endpoint and one API key for many different models. It is OpenAI-compatible, so I can use most OpenAI SDKs just by changing the base URL.

  • A Kilo account created at app.kilo.ai.
  • An API key generated from the API Keys section of the dashboard.

I can get everything running in just a few steps. First, I use the CLI to onboard my key, or I set an environment variable.

Run the onboard command:

Terminal window
openclaw onboard --kilocode-api-key <key>

Or set the environment variable:

Terminal window
export KILOCODE_API_KEY="<your-kilocode-api-key>" # pragma: allowlist secret

Next, I add this config snippet to my project. This sets kilocode/kilo/auto as the primary model, which automatically handles routing.

{
env: { KILOCODE_API_KEY: "<your-kilocode-api-key>" }, // pragma: allowlist secret
agents: {
defaults: {
model: { primary: "kilocode/kilo/auto" },
},
},
}

This smart routing model picks the best underlying model for me:

  • Planning, debugging, and orchestration tasks go to Claude Opus.
  • Code writing and exploration tasks go to Claude Sonnet.

If I am unsure which models are available for my account, I run a simple command. OpenClaw discovers models at startup, and I can view them all at once.

To see the full list, I use:

/models kilocode

If my model requests are failing, I check my model references. I must ensure I am using the kilocode/ prefix for any model on the gateway. I also verify that my configuration points to the correct base URL: https://api.kilo.ai/api/gateway/.

Need help with your specific setup? Check out the AI Setup Assistant.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.