Connect Kilo CLI to NixAPI: Global Config and Custom Models
Configure NixAPI in Kilo CLI's global kilo.json, load a key from the environment, and verify model discovery and file-reading tools.
This guide uses custom models in Kilo CLI 1.0 and later, checked against the official CLI documentation on October 30, 2026. It adapts the documented compatible-provider interface to NixAPI; live compatibility still depends on your key and model.
1. Install Kilo
With Node.js and npm available, run:
npm install -g @kilocode/cli
Create a key in the NixAPI console and choose a tool-capable chat model from models and pricing.
2. Set the key
On macOS or Linux:
export NIXAPI_API_KEY='YOUR_NIXAPI_API_KEY'
On Windows PowerShell:
$env:NIXAPI_API_KEY = 'YOUR_NIXAPI_API_KEY'
Replace the placeholder and launch Kilo from that terminal.
3. Use global configuration
Edit ~/.config/kilo/kilo.json, merging with existing settings. Current {env:VAR} interpolation requires trusted/global configuration; an ordinary repository configuration cannot use this secret interpolation in the same way. See the custom model guide.
{
"$schema": "https://app.kilo.ai/config.json",
"model": "nixapi/NIXAPI_MODEL_ID",
"provider": {
"nixapi": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://api.nixapi.com/v1",
"apiKey": "{env:NIXAPI_API_KEY}"
},
"models": {
"NIXAPI_MODEL_ID": {
"name": "NixAPI coding model",
"tool_call": true,
"limit": { "context": 32768, "output": 4096 }
}
}
}
}
}
Replace both occurrences of NIXAPI_MODEL_ID. The token limits illustrate configuration structure; set them to actual model limits. tool_call: true declares support rather than adding tool capability.
Kilo uses uppercase URL in baseURL and {env:NIXAPI_API_KEY} for the key. These differ from Pi’s syntax. The official compatible-provider reference documents the provider structure.
4. Verify the model and tools
List configured models and launch Kilo:
kilo models
kilo
Start in a test project with a package.json. First request one short text reply, then ask:
Read package.json and summarize its scripts. Do not change files or execute commands.
Inspect the actual tool call and result. Once reading works, try a reversible edit and review the diff.
5. Editor setup and troubleshooting
For the Kilo editor extension, choose a custom OpenAI Compatible provider and enter the same endpoint, key, and model ID. Verify extension settings separately rather than assuming they synchronize with CLI configuration.
- Provider absent: check global config location, JSON syntax, and the model map.
- 401: check the environment in the launching terminal and whether configuration is trusted/global.
- Token-limit errors: use real
limit.contextandlimit.outputvalues. - Text works but tools fail: verify streaming and tool calls for the chosen Chat Completions route before adjusting compatibility flags.