# How to use Unlid in Kilo Code

Connect Kilo Code to Unlid: create an API key, point Kilo Code at the base URL below and pick a model id. The same settings work for every Unlid model.

## Use Unlid in your apps

Any app that lets you add an **OpenAI-compatible** provider can use every Unlid model. You always need the same three things:

|  |  |
| --- | --- |
| Base URL | `https://api.unlid.ai/v1` |
| API key | Create one under [Account → API keys](https://unlid.ai/account/keys). It starts with `ul-` and is shown once. |
| Model | An id from [Models](https://unlid.ai/models.md), e.g. `glm-5.3-flash-uncensored`. Most apps fetch the list for you. |

Three rules cover almost every setup problem:

- Enter the base URL **with** `/v1` and **without** `/chat/completions` — the app adds that itself. (Janitor AI and goose are the exceptions, below.)
- When an app asks for the API type, pick **OpenAI Compatible / Chat Completions**. That is Unlid’s native protocol. The Anthropic (`/v1/messages`) and OpenAI Responses (`/v1/responses`) endpoints exist for [Claude Code](https://unlid.ai/docs/clients/claude-code.md) and [Codex](https://unlid.ai/docs/clients/codex-cli.md), which speak nothing else; they are translated to chat completions and cover less.
- If the app has a **context window** setting, fill it in from the model page (glm-5.3-flash-uncensored: 262,144 tokens). A default that is too small cuts long chats; one that is too big ends in `context_length_exceeded`.

Not sure your key works? Run this from the same computer first — it is the fastest way to tell an app problem from a network problem:

```
curl https://api.unlid.ai/v1/models -H "Authorization: Bearer ul-…"
```

## Kilo Code

### VS Code extension

1. Open Kilo’s settings (gear icon) → **Providers** → scroll down to **Custom provider**.
2. Provider ID `unlid`, display name `Unlid`, **Provider API: OpenAI Compatible**.
3. Base URL `https://api.unlid.ai/v1`, API key `ul-…`.
4. Under Models, click **Fetch models** and pick the ones you want, then **Submit**.

The dialog cannot set the context window or tool / reasoning flags. For agent work set them in `kilo.jsonc` as shown for the CLI — the extension runs the same Kilo backend and reads the same file.

### Kilo CLI

Put this in `~/.config/kilo/kilo.jsonc` (global) and export `UNLID_API_KEY`. `{env:…}` works only in the global file; in a project-level `kilo.jsonc` paste the key instead.

```
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "unlid/glm-5.3-flash-uncensored",
  "provider": {
    "unlid": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Unlid",
      "options": {
        "baseURL": "https://api.unlid.ai/v1",
        "apiKey": "{env:UNLID_API_KEY}",
        "chunkTimeout": 120000
      },
      "models": {
        "glm-5.3-flash-uncensored": {
          "name": "GLM 5.3 Flash · Uncensored",
          "tool_call": true, "reasoning": true,
          "limit": { "context": 262144, "output": 32768 }
        }
      }
    }
  }
}
```

`chunkTimeout` makes Kilo abort and retry a stream that goes quiet instead of hanging. Debug logs: `kilo --print-logs --log-level DEBUG` (files in `~/.local/share/kilo/log/`). Getting *Connection reset by server*? See [Troubleshooting](https://unlid.ai/docs/clients.md#reset).

Something not working? See [troubleshooting](https://unlid.ai/docs/clients.md#troubleshooting), or [set up another app](https://unlid.ai/docs/clients.md).
