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:
npx vercel ai-gateway setup --agent kiloThe 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:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Add the key to your shell configuration file, for example
~/.zshrcor~/.bashrc:Terminalexport AI_GATEWAY_API_KEY="your-ai-gateway-api-key"Kilo Code reads a global config at
~/.config/kilo/kilo.json, or under$XDG_CONFIG_HOMEwhen that variable is set. Add the gateway as anopenai-compatibleprovider:~/.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/v1is the coding agent surface, the default base URL for agents that have no dedicated endpoint. It's the same URL the setup command writes.Kilo Code fetches the catalog from the gateway's
/modelsendpoint, so no per-model declarations are needed. Start a session and run/modelsto choose one. IDs are namespaced by the provider, for exampleopenai-compatible/anthropic/claude-opus-5.
- Browse the models catalog for available models
- Read Kilo Code's OpenAI-compatible provider documentation
- Configure spend limits on your API key
- Connect your other agents with the Vercel CLI
Was this helpful?