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

# Kilo Code

> 將 Kilo Code 和 Kilo CLI 連接至 TokenLab

## 概覽

<Note>
  **類型**：IDE 與 CLI 程式代理

  **主要路徑**：OpenAI 相容 Chat Completions

  **支援級別**：官方自訂供應商路徑
</Note>

[Kilo Code](https://kilo.ai/docs/ai-providers/openai-compatible) 的 VS Code 擴充套件與 Kilo CLI 都支援 OpenAI 相容供應商。

## 安裝與介面設定

在 VS Code 安裝 **Kilo Code** 預發佈通道，或安裝 CLI：

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

開啟 **Settings → Providers → Custom provider**：

| 欄位           | 值                            |
| ------------ | ---------------------------- |
| Provider ID  | `tokenlab`                   |
| Display name | `TokenLab`                   |
| Provider API | **OpenAI Compatible**        |
| Base URL     | `https://api.tokenlab.sh/v1` |
| API key      | 你的 TokenLab API Key          |
| Model        | `kimi-k3`                    |

Kilo 會從 `/v1/models` 自動發現模型。儲存後選擇 `tokenlab/kimi-k3`。

## CLI 設定

將 Key 放在環境變數，並把以下內容加入受信任的全域檔案 `~/.config/kilo/kilo.jsonc`：

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

```jsonc theme={null}
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "openai-compatible/kimi-k3",
  "provider": {
    "openai-compatible": {
      "options": {
        "apiKey": "{env:TOKENLAB_API_KEY}",
        "baseURL": "https://api.tokenlab.sh/v1"
      },
      "models": {
        "kimi-k3": {
          "name": "Kimi K3",
          "tool_call": true,
          "reasoning": true,
          "limit": { "context": 1048576, "output": 131072 }
        }
      }
    }
  }
}
```

重新啟動後執行 `kilo models`。`{env:...}` 只會在受信任的全域或託管設定中解析，請勿將真實 Key 寫入可能提交到 Git 的專案設定。
