# Kilo Code setup: add a custom OpenAI-compatible provider

> Add our gateway to Kilo Code as a custom OpenAI Compatible provider in VS Code or in kilo.jsonc for the CLI, with model ids, auto-fetched models and fixes.

Source: https://oneaiapikey.com/docs/guides/kilo-code

Base URL: `https://api.oneaiapikey.com/v1`

Kilo Code is an open-source coding agent available as a VS Code extension and a CLI. It has first-class support for custom providers, including any endpoint that speaks the OpenAI Chat Completions format. Add our gateway once and every model in the catalogue becomes available in Kilo, billed from one prepaid balance.

## What you need

- Kilo Code installed (the VS Code extension, the CLI, or both).
- A funded account; top-ups start at $3: [create an account](https://oneaiapikey.com/console/sign-up).
- An API key from the [API keys page](https://oneaiapikey.com/console/keys) (it starts with `sk-`).

## Option A: VS Code extension

1. Open Kilo Code’s **Settings** (gear icon) and go to the **Providers** tab.
2. Scroll to the bottom and click **Custom provider**.
3. Fill in the dialog:

Custom provider dialog:

```text
Provider ID:   relaykit
Display name:  Relaykit
Provider API:  OpenAI Compatible
Base URL:      https://api.oneaiapikey.com/v1
API key:       sk-your-key-here
Models:        pick from the fetched list, or add ids manually
```

4. Click **Submit** to save.

A few details matter here:

- **Provider API** must be **OpenAI Compatible**. Kilo also offers “OpenAI Responses” and “Anthropic Messages” options; stick with OpenAI Compatible for this setup, since it works for every model we serve, Claude included.
- **Base URL** is the `/v1` root, not a full endpoint such as `/v1/chat/completions`.
- Once the URL and key are valid, Kilo **fetches the model list** from our `/v1/models` endpoint automatically. If the list stays empty, fix the key or URL and click **Fetch models** again.

## Option B: CLI and config file

The CLI (and any extra model tuning) uses a `kilo.jsonc` config file. Put the provider in your **global** config at `~/.config/kilo/kilo.jsonc`:

~/.config/kilo/kilo.jsonc:

```jsonc
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "relaykit/claude-sonnet-5",
  "provider": {
    "relaykit": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Relaykit",
      "options": {
        "baseURL": "https://api.oneaiapikey.com/v1",
        "apiKey": "{env:RELAYKIT_API_KEY}"
      },
      "models": {
        "claude-sonnet-5": { "name": "Claude Sonnet 5", "tool_call": true },
        "gpt-6.1-sol": { "name": "GPT-6.1 Sol", "tool_call": true },
        "deepseek-v4-flash": { "name": "DeepSeek V4 Flash", "tool_call": true }
      }
    }
  }
}
```

Then store the key in the environment variable the config refers to:

macOS / Linux / Git Bash:

```bash
export RELAYKIT_API_KEY="sk-your-key-here"
```

Windows (open a new terminal afterwards):

```powershell
setx RELAYKIT_API_KEY "sk-your-key-here"
```

The `model` key uses the `provider-id/model-id` format. Keep the `{env:...}` reference in the global file: Kilo doesn’t resolve environment references in a project-level `kilo.jsonc`, and you should never commit a raw key to a repository anyway.

## Recommended models

Prices are USD per 1M tokens and come straight from our catalogue:

| Model id | Good for | Input | Output |
| --- | --- | --- | --- |
| `claude-sonnet-5` | Daily coding, Code review, Writing | $2.20 | $11 |
| `claude-opus-5-5` | Agentic coding, Large refactors, Complex reasoning | $4.40 | $22 |
| `gpt-6.1-sol` | Codex CLI, Tool calling, Long context | $2.20 | $11 |
| `grok-4.6` | Fast answers, Research, Chat | $2.20 | $6.60 |
| `deepseek-v4-flash` | Budget coding, Sub-agents, Batch jobs | $0.24 | $0.96 |

Kilo’s agents lean on tool calls, so mark models with `"tool_call": true` in the config file. `claude-sonnet-5` is a dependable default; `deepseek-v4-flash` is the budget pick for sub-tasks. The full list lives on the [models page](https://oneaiapikey.com/models).

## Verify it works

In VS Code, select one of the gateway’s models in the Kilo model picker and ask a simple question about your project. On the CLI, start Kilo and send a short prompt. A normal reply, plus a matching entry in your console’s usage log, confirms the setup.

To test the key on its own:

curl:

```bash
curl -sS https://api.oneaiapikey.com/v1/models -H "Authorization: Bearer sk-your-key-here"
```

## Troubleshooting

**401 Unauthorized.** The key is wrong, disabled, or (in the CLI) the environment variable isn’t set in the terminal that launched Kilo. Re-copy the key and open a fresh terminal after `setx`.

**No models appear in the picker.** Auto-fetch failed, which nearly always means a bad key or base URL. Fix it and click **Fetch models**, or add the ids manually.

**404 Not Found.** Check the base URL is exactly `https://api.oneaiapikey.com/v1`, with no trailing slash.

**“Model not found” or “no available channel”.** The model id doesn’t match the catalogue. In the config file the key under `models` must be the exact id, such as `claude-sonnet-5`.

**Request timed out.** Kilo streams responses, so long generations normally stay alive. For your own scripts, use `"stream": true` on long outputs, because proxies cut idle non-streaming requests at roughly 100 seconds.

**Wrong provider API selected.** If you picked “OpenAI Responses” or “Anthropic Messages” by mistake, requests go to the wrong path. Edit the provider and switch it to OpenAI Compatible.

## Next steps

See the [Cline](https://oneaiapikey.com/docs/guides/cline) and [OpenCode](https://oneaiapikey.com/docs/guides/opencode) guides for similar tools, or browse every [tool guide](https://oneaiapikey.com/docs/guides). Current per-model rates are on the [pricing page](https://oneaiapikey.com/pricing).

## Other OpenAI format tools

- [Codex CLI CLI](https://oneaiapikey.com/docs/guides/codex-cli)
- [Cursor IDE](https://oneaiapikey.com/docs/guides/cursor)
- [Cline Extension](https://oneaiapikey.com/docs/guides/cline)
