Kilo Code setup: API key, Base URL, and models
Install Kilo Code, configure the BetterToken Base URL and API key, choose an available model, and troubleshoot common errors. Practical guidance.
To connect Kilo Code to BetterToken, prepare an API key, enter the Base URL shown below, and choose a current Model ID from the model plaza.
Three steps to your first request
- Get a BetterToken API key and choose a Model ID in the model plaza.
- Add a Custom provider in Kilo Code’s Providers settings, choose OpenAI Compatible, then enter the API key,
https://bettertoken.ai/v1, and Model ID. - Save the settings, restart the extension, and send a short request in a new chat.
Key settings
| Field | Value |
|---|---|
| API Key | BetterToken API key |
| Base URL | https://bettertoken.ai/v1 |
| Model | A current Model ID from the model plaza |
Prerequisites
- The current version of the tool is installed
- A BetterToken API key: register and get one
- A Model ID from the model plaza
Already have an account? Sign in, top up, then create a key in the console.
Additional requirements
- VS Code installed
Install
If Kilo Code is already installed, go directly to Manual setup to enter your BetterToken API Key, Base URL, and Model ID.
If you still need to install the extension or want the installation and regional-use background, read the Kilo Code installation and custom API guide, then return here for the current setup fields.
Manual setup
Complete this setup in the Kilo Code settings UI. You do not need to edit a configuration file.
| Field | Value |
|---|---|
| API Key | BetterToken API key |
| Base URL | https://bettertoken.ai/v1 |
| Model | A current Model ID from the model plaza |
Setup
Clear conflicting environment variables
unset OPENAI_API_KEYunset OPENAI_BASE_URLOpen Kilo Code settings
Open Settings (gear icon), select Providers, and click Custom provider at the bottom of the list.
Configure the API provider
Fill in:
- Provider ID →
bettertoken - Display name →
BetterToken - Provider API →
OpenAI Compatible - Base URL →
https://bettertoken.ai/v1 - API Key → your BetterToken API Key
- Models → manually add a model ID copied from the model plaza and use the same ID as its display name
Click Submit to save the provider. These are the VS Code extension fields in the official Custom Models guide.
Only configure extra headers when the official docs explicitly require them
The official Kilo Code material we checked mentions optional custom headers for OpenAI-compatible providers, but it does not treat User-Agent as a required BetterToken setup step.
If you are also using a custom gateway, tenant routing, observability, or caching layer, add headers only according to that upstream service’s official docs.
Restart Kilo Code
After changing the config, restart VS Code or reload the Kilo Code extension so the new settings take effect.
Verify the connection
Open a new Kilo Code chat and send a short prompt such as Reply with one word: OK. If the tool responds without an authentication or Model ID error, the first request succeeded. Restart VS Code or the extension after changing the configuration. If it fails, go directly to Common errors.
Kilo CLI
Install the official Kilo CLI separately from the extension. In macOS testing with a GPT model, Kilo CLI 7.8.17 completed text requests and file-reading tool calls through /v1/chat/completions.
Set your BetterToken API Key in the terminal:
export BETTERTOKEN_API_KEY="YOUR_API_KEY"Create kilo.json in your project. Replace every YOUR_MODEL_ID with the exact ID from the model plaza:
{ "provider": { "bettertoken": { "npm": "@ai-sdk/openai-compatible", "name": "BetterToken", "options": { "baseURL": "https://bettertoken.ai/v1", "apiKey": "{env:BETTERTOKEN_API_KEY}" }, "models": { "YOUR_MODEL_ID": { "name": "YOUR_MODEL_ID" } } } }, "model": "bettertoken/YOUR_MODEL_ID", "permission": { "read": "allow", "edit": "deny", "bash": "deny" }, "agent": { "build": { "steps": 4 } }}Point KILO_CONFIG at that file and run a non-interactive text check:
export KILO_CONFIG="$PWD/kilo.json"kilo run --format json -m bettertoken/YOUR_MODEL_ID "Reply with only: OK"Check the final answer for OK. This configuration allows file reads and denies edits and shell commands. Passing the file through KILO_CONFIG makes it a trusted configuration source, where {env:...} references can expand. A project configuration loaded only from the repository does not expand environment variable references; keep the explicit KILO_CONFIG selection above.
Switch models
Open the model selector or change the Model field in the configuration. Use the exact Model ID from the model plaza, then restart the current session.
Common errors
| Error | What to check |
|---|---|
401 or Unauthorized | Check the BetterToken API key and remove leading or trailing spaces. |
404 | Check the Base URL and do not append a specific endpoint path. |
model not found | Copy a current Model ID from the model plaza. |
| Changes do not apply | Save the configuration and fully restart the tool. |
Technical details
Protocol, endpoint, and internal provider fields
This setup uses https://bettertoken.ai/v1. The tool appends the OpenAI-compatible endpoint path. Do not add /chat/completions or /responses unless a specific field explicitly requires it.

