Coding agents
Use Libremodel in Kilo Code
Kilo Code takes any OpenAI-compatible provider in kilo.jsonc. Add us with the context window and prices of each model, and Kilo tracks the context you use and estimates what each request costs.
1. Install Kilo Code
In VS Code, open Extensions (Ctrl+Shift+X, or Cmd+Shift+X), search for Kilo Code, open the arrow next to Install and choose Install Pre-Release Version. For the terminal, install the CLI:
npm install -g @kilocode/cli2. Set your API key
Create a key in API keys and save it as LIBREMODEL_API_KEY. On macOS and Linux, add the line to ~/.zshrc or ~/.bashrc so every new terminal has it.
export LIBREMODEL_API_KEY="sk-libremodel-..."[Environment]::SetEnvironmentVariable("LIBREMODEL_API_KEY", "sk-libremodel-...", "User")3. Add Libremodel
Paste this into the global config file: ~/.config/kilo/kilo.jsonc on macOS and Linux, or %USERPROFILE%\.config\kilo\kilo.jsonc on Windows. The VS Code extension, the JetBrains plugin and the CLI read the same file. If it already has settings, add the libremodel provider next to the ones you have.
{
"$schema": "https://app.kilo.ai/config.json",
"model": "libremodel/deepseek-v4.1-flash-1017",
"provider": {
"libremodel": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://api.libremodel.ai/v1",
"apiKey": "{env:LIBREMODEL_API_KEY}"
},
"models": {
"kimi-k3.1-pro-uncensored": {
"name": "Kimi K3.1 Pro Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 3,
"output": 9,
"cache_read": 0.3
}
},
"deepseek-v4.1-flash-1017-uncensored": {
"name": "DeepSeek V4.1 Flash Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.25,
"output": 0.9,
"cache_read": 0.04
}
},
"glm-5.3-flash-uncensored": {
"name": "GLM 5.3 Flash Uncensored",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.3,
"output": 1.2,
"cache_read": 0.06
}
},
"kimi-k3.1-pro": {
"name": "Kimi K3.1 Pro",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 1,
"output": 6,
"cache_read": 0.25
}
},
"deepseek-v4.1-flash-1017": {
"name": "DeepSeek V4.1 Flash",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 262144
},
"cost": {
"input": 0.04,
"output": 0.3,
"cache_read": 0.004
}
},
"minimax-m3.1-flash": {
"name": "MiniMax M3.1 Flash",
"tool_call": true,
"reasoning": true,
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 1048576,
"output": 131072
},
"cost": {
"input": 0.05,
"output": 0.2,
"cache_read": 0.005
}
}
}
}
}
}limit gives Kilo the context window of each model, so it tracks the context you use and compacts the conversation before it fills up. cost is the price per million tokens that Kilo uses to estimate each request.
Keep it in the global file: Kilo reads {env:...} only there, so in a project kilo.jsonc the key would not load. If you use the CLI, restart it after editing the file. On Windows the folder can vary: /about in the CLI shows the paths it reads.
In VS Code, Custom provider, at the bottom of Settings → Providers, also adds a provider and fetches its models, but the context window and prices are set only in the file.
4. Open it and pick a model
The default model is deepseek-v4.1-flash-1017; for the hardest tasks, pick kimi-k3.1-pro. In VS Code, switch models in the selector under the chat box or with /models. In the terminal, start Kilo and switch with /models or Ctrl+X m.
kiloThe chat history shows the estimated cost of each request.
Troubleshooting
Run this in the same terminal you start the tool from. It costs nothing. A list of models means the key is fine. A 401 means LIBREMODEL_API_KEY is empty or wrong in that terminal; open a new one after saving it.
curl -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $LIBREMODEL_API_KEY"curl.exe -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $env:LIBREMODEL_API_KEY"If the key is fine and the tool gets a 402, your balance does not cover the request. See Billing and credits.
If our models do not show up, run kilo models, which lists every model Kilo can use. Check that the config is in the global file and, in the CLI, that you restarted it.
Notes
Agents that run subagents send several requests at once. When capacity is busy, the extra ones wait in a short queue instead of failing. See Limits and errors.
Kilo caps each response at 32,000 tokens by default, even when the model allows more. The KILO_EXPERIMENTAL_OUTPUT_TOKEN_MAX environment variable changes that cap.
The prices in the file are each model's starting price. What each request was charged is in Activity.
In Kilo Desktop, add us from Settings → AI Providers → Add AI Provider → Add a Custom AI Provider: choose OpenAI Compatible, the base URL https://api.libremodel.ai/v1, your key and the model IDs. That screen has no fields for the context window or prices.