> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openference.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kilo CLI

> Configure Kilo CLI — the terminal AI coding tool — with Openference.

# Kilo CLI

Kilo CLI is an open source, terminal-based AI coding tool. Connect it to Openference to use high-quality models directly from your terminal.

With Kilo CLI, you can:

* Edit code across multiple files without leaving the terminal
* Generate, explain, and refactor code with AI assistance
* Automate repetitive tasks such as writing unit tests, fixing bugs, and reviewing changes
* Switch between models based on task complexity

## Prerequisites

Before you begin:

* An Openference account and API key (create one at [openference.com](https://openference.com))
* Node.js 18.0 or later

## Install Kilo CLI

Install Kilo CLI globally:

```bash theme={null}
npm install -g @kilocode/cli
```

Verify the installation:

```bash theme={null}
kilo --version
```

A version number confirms successful installation.

## Get your API key

Create an API key in the Openference dashboard. Copy it — it is shown only once.

You will use the `OPENFERENCE_API_KEY` environment variable.

## Configure the connection

Edit the Kilo CLI configuration file:

```bash theme={null}
mkdir -p ~/.config/kilo
```

Create or edit `~/.config/kilo/kilo.jsonc`:

```json theme={null}
{
  "$schema": "https://app.kilo.ai/config.json",
  "provider": {
    "openference": {
      "name": "Openference",
      "options": {
        "baseURL": "https://api.openference.com/v1",
        "apiKey": "{env:OPENFERENCE_API_KEY}"
      },
      "models": {
        "GLM-5.2": {
          "name": "GLM-5.2 (via Openference)",
          "limit": { "context": 850000, "output": 128000 }
        },
        "Kimi K2.6": {
          "name": "Kimi K2.6 (via Openference)",
          "limit": { "context": 254000, "output": 98304 }
        },
        "DeepSeek-V4-Pro": {
          "name": "DeepSeek-V4-Pro (via Openference)",
          "limit": { "context": 850000, "output": 131072 }
        },
        "Qwen3.7 Plus": {
          "name": "Qwen3.7 Plus (via Openference)",
          "limit": { "context": 915000, "output": 65536 }
        },
        "DeepSeek-V4-Flash": {
          "name": "DeepSeek-V4-Flash (via Openference)",
          "limit": { "context": 850000, "output": 131072 }
        }
      }
    }
  }
}
```

> **Tip:** the `limit` block tells Kilo each model's real context window and max
> output. Without it, coding agents assume a small default (\~128k) and start
> compacting the session around \~100k tokens. Current values are advertised as
> `context_length` and `max_output_tokens` in `GET /v1/models`.

Export your API key in the shell (add to your profile for persistence):

```bash theme={null}
export OPENFERENCE_API_KEY="YOUR_API_KEY"
```

## Select a model and start coding

1. Run `/models` in Kilo CLI and select the Openference provider.
2. Pick a model (e.g. `openference/GLM-5.2`).

Example prompts:

```bash theme={null}
what does this project do?
find and fix any bugs in the main module
write unit tests for the auth module
```

## Recommended models

When configuring or picking a default model, use the models in this order:

1. **GLM-5.2** — top tier (most capable for complex reasoning, agents, and architecture)
2. **Kimi K2.6** — all rounder (strong general-purpose choice for most tasks)
3. **DeepSeek-V4-Pro** — medium (balanced performance and value)
4. **Qwen3.7 Plus** — Vision (use when you need image / multimodal understanding)
5. **DeepSeek-V4-Flash** — instant (fast and lightweight responses)

| Task                                         | Recommended model | Reason                                    |
| -------------------------------------------- | ----------------- | ----------------------------------------- |
| Complex algorithms, architecture, core logic | GLM-5.2           | Top-tier reasoning and agent capabilities |
| General coding, refactoring, daily work      | Kimi K2.6         | Excellent all-rounder                     |
| Balanced quality/speed, good value           | DeepSeek-V4-Pro   | Strong medium-tier option                 |
| Tasks involving images or vision             | Qwen3.7 Plus      | Multimodal support                        |
| Quick iterations, explanations, simple edits | DeepSeek-V4-Flash | Instant / lightweight                     |

Always verify the exact IDs available to your key:

```bash theme={null}
curl https://api.openference.com/v1/models \
  -H "Authorization: Bearer $OPENFERENCE_API_KEY"
```

## FAQ

### I get an error or no response after connecting

* Verify that `OPENFERENCE_API_KEY` is exported in the current shell.
* Confirm the model name exactly matches an ID from `GET /v1/models` (including spaces and casing).
* Check JSON syntax in `config.json` (missing commas are a common cause).

### How do I switch models?

Run `/models` inside Kilo CLI, search for Openference, and select a different model. You can also edit the `models` block in `config.json` and restart.

### Can I use the same key for other tools?

Yes. The same Openference API key works in Cursor, Claude Code, Codex, OpenCode, Cline, Python/Node SDKs, and Kilo CLI.

See the [Compatibility Matrix](/integrations/compatibility-matrix).

## Next steps

* [CLI & IDE Compatibility Matrix](/integrations/compatibility-matrix)
* [Chinese LLM Models](/integrations/chinese-models)
* [Base URL & Authentication](/getting-started/base-url-auth)
