Connect Kilo Code to relay.fast
Kilo Code is an open-source coding agent for VS Code and the terminal. Current releases use the OpenCode provider format, so relay.fast is added as an OpenAI-compatible provider in a config file while the key stays in an environment variable.
Configuration file
Save this file, for example as ~/.config/kilo/relayfast.json, and list the models you want under models.
{
"$schema": "https://app.kilo.ai/config.json",
"provider": {
"relayfast": {
"npm": "@ai-sdk/openai-compatible",
"name": "relay.fast",
"options": {
"baseURL": "https://relay.fast/v1",
"apiKey": "{env:RELAY_FAST_KILO_API_KEY}"
},
"models": {
"claude-sonnet-5-5": { "name": "claude-sonnet-5-5" },
"glm-5.3": { "name": "glm-5.3" }
}
}
},
"model": "relayfast/claude-sonnet-5-5"
}Then point KILO_CONFIG at the file and put the key in the variable the file references:
# macOS and Linux
export KILO_CONFIG=~/.config/kilo/relayfast.json
export RELAY_FAST_KILO_API_KEY=sk-your-api-key
# Windows (PowerShell), then open a new terminal
setx KILO_CONFIG "$HOME\.config\kilo\relayfast.json"
setx RELAY_FAST_KILO_API_KEY sk-your-api-keyClose Kilo Code completely, in every VS Code window and terminal, and start it again so it reads the new variables.
One-command setup
The script configures Kilo Code for relay.fast. It writes the file with every chat model your key can use, keeps the key in the RELAY_FAST_KILO_API_KEY variable, and adds the provider to an existing KILO_CONFIG file instead of replacing it. It asks for the API key inside the script, so the key never appears in the command or shell history. Every downloaded file is checked against a published SHA-256 checksum, and running it again can restore the previous settings.
Windows (PowerShell):
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://relay.fast/downloads/setup/install-kilo-code-en.ps1 | iex"macOS and Linux:
curl -fsSL https://relay.fast/downloads/setup/install-kilo-code-en.sh | bashYou can read the script before running it by opening the same URL in a browser.
If your version has provider settings in the UI
Some Kilo Code releases configure providers on a settings screen. Choose OpenAI Compatible there and enter the same base URL https://relay.fast/v1, the key and a model ID.
Keep agent costs under control
A coding agent sends the conversation, file contents and tool results with every step, so input tokens make up most of the bill. Use a mid-priced model for routine edits and a frontier model for hard tasks, prefer models with a cache-read price for long sessions, and keep auto-approve limits low until you know what a typical task costs. Current prices are in the live pricing catalog.
Current prices of models for coding agents
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | $0.238 / $1.19 (−88%) | $0.0238 | 1M |
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | $0.111 / $0.556 (−97%) | $0.00556 | 1M |
| GPT-6.1 Sol requests above 272K input tokens cost more | gpt-6.1-sol | $2 / $10 | $0.03 / $0.15 (−98%) | $0.0015 | 1.05M |
| GLM-5.3 | glm-5.3 | $1.4 / $4.4 | $0.035 / $0.11 (−97%) | $0.0065 | 1M |
| Kimi K3 | kimi-k3 | $3 / $15 | $0.15 / $0.75 (−95%) | $0.015 | 1.05M |
| DeepSeek V4.1 Flash price depends on the time of day; the peak-hours price is shown | deepseek-v4.1-flash | $0.3 / $1.2 | $0.03 / $0.12 (−90%) | $0.0006 | 1M |
Frequently asked questions
Why is the key in an environment variable?
The config file refers to {env:RELAY_FAST_KILO_API_KEY}, so the file can be shared or backed up without the key.
Can I use Gemini models in Kilo Code?
Yes. The installer adds them through a separate Gemini-format provider that uses the same key.
How do I undo the setup?
Run the installer again and choose restore, or remove the provider from the file and unset KILO_CONFIG.