Kilo Code is an open-source agentic coding extension for VS Code and JetBrains, with a CLI as well. It connects to Tokens as a custom provider using the OpenAI Compatible API, which talks Chat Completions to https://tokens.bd/v1. You can set it up in the settings UI or in a kilo.json file.
This guide was checked against Kilo Code v7.8.3 (October 2026).
Add Tokens as a custom provider in the UI#
- Click the gear icon, open the Providers tab, then click Custom provider.
- Fill in the fields:
| Field | Value |
|---|---|
| Provider ID | tokens |
| Display name | Tokens |
| Provider API | OpenAI Compatible |
| Base URL | https://tokens.bd/v1 |
| API key | tok_live_your_key |
| Models | Fetched from /v1/models, or add deepseek/deepseek-v4.1-flash by hand |
| Headers | Leave empty |
- Save, then pick the model from Kilo Code's model selector.
Because Kilo Code reads GET /v1/models, the model list shows only the models your key is allowed to use. If the list comes back empty, your account has no plan or wallet balance yet, or the key's allow-list is narrow.
The Connect Your Agent page shows the same fields with your key filled in. Create a key first if you don't have one; see API keys.
Configure Kilo Code with kilo.json#
For a setup you can copy between machines, use a config file. Kilo Code reads ~/.config/kilo/kilo.json globally, or ./kilo.json in a project. kilo.jsonc also works if you want comments. The format follows OpenCode's.
{
"provider": {
"tokens": {
"npm": "@ai-sdk/openai-compatible",
"env": ["TOKENS_API_KEY"],
"options": { "baseURL": "https://tokens.bd/v1" },
"models": {
"deepseek/deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash",
"limit": { "context": 128000, "output": 8192 }
}
}
}
},
"model": "tokens/deepseek/deepseek-v4.1-flash"
}Then export the key in the shell or profile Kilo Code starts from:
export TOKENS_API_KEY=tok_live_your_keyThe env entry keeps the key out of the file, which matters for a project kilo.json you commit. Don't put a literal key in a committed config.
Set real limits#
The limit values above are examples. Replace them with the model's context window and output limit from the model catalog. Kilo Code's docs say that an omitted limit.context or limit.output defaults to 0, which limits context management. In practice that means the agent can't tell when to compact a long conversation.
Which npm package to use#
The npm field selects the protocol:
| Package | Protocol | Tokens endpoint |
|---|---|---|
@ai-sdk/openai-compatible | Chat Completions | /v1/chat/completions |
@ai-sdk/openai | Responses | /v1/responses |
@ai-sdk/anthropic | Anthropic Messages | /v1/messages |
Stick with @ai-sdk/openai-compatible. Tokens serves /v1/responses too, but whether it works for a given model depends on the upstream provider behind it, and Chat Completions is the path every model supports.
Switch models#
Add more entries under models, each keyed by the exact Tokens ID, and change the top-level model to tokens/<model-id>. The model reference is the provider ID, a slash, then the full model ID, so tokens/deepseek/deepseek-v4.1-flash contains two slashes. That follows the same pattern as other gateway IDs, though Kilo Code's docs don't state it explicitly. In the UI, pick a different model from the selector.
To list the IDs your key can use:
curl -s https://tokens.bd/v1/models -H "Authorization: Bearer $TOKENS_API_KEY"Choosing a model covers which models suit agent work.
Verify it works#
curl -s https://tokens.bd/v1/chat/completions \
-H "Authorization: Bearer $TOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-v4.1-flash", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}'If that returns a completion, open Kilo Code, select the Tokens model, and ask it to read a file in your project. The request appears in your dashboard usage analytics shortly after.
Troubleshooting#
Model list is empty. GET /v1/models returns nothing for keys without a plan or wallet balance. Subscribe or add funds in billing, or add the model by hand.
401 missing_api_key with kilo.json. TOKENS_API_KEY isn't set in the environment Kilo Code was launched from. Editors started from a desktop launcher may not see variables exported in your shell profile. Restart the editor from a terminal, or enter the key in the UI.
404 model_not_found. The model key under models must be the exact Tokens ID with its provider prefix.
Base URL format. Kilo Code also accepts a full endpoint URL in the Base URL field, but https://tokens.bd/v1 is the form to use. Don't add /chat/completions twice.
Context errors on long tasks. Check that limit.context is set and matches the model.
429 errors. See Retry-After; Troubleshooting explains rate_limited, concurrency_limit and window_exhausted.
Kilo Code's file format is close to OpenCode, so that guide is useful if you run both.
Source: Kilo Code docs, OpenAI Compatible provider, checked October 2026.