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

# Kilo Code

> 配置 Kilo Code 使用 Capriole AI。

## Kilo Code 是什么

Kilo Code 是用于 IDE 和终端的 AI 编程助手。它可以通过 Kilo 的 OpenAI 兼容提供商使用 Capriole AI，并把请求发送到 Capriole AI 的 Chat Completions 兼容 API。

## 前置条件

开始前请确保你已经拥有以下内容。

* Capriole AI 账户，可在[此处注册](https://capriole.ai)
* Capriole AI API Key，可在[此处获取](https://capriole.ai?view=api)
* 已在 VS Code 中安装 Kilo Code，或已安装 Kilo CLI

## 安装

### VS Code 扩展

从 VS Code Extensions 视图安装 Kilo Code。搜索 `Kilo Code`，然后安装 Pre-release 版本。

### Kilo CLI

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

## 配置

创建或更新 Kilo 配置文件。

* 全局配置 `~/.config/kilo/kilo.jsonc`
* 项目配置位于项目根目录中的 `kilo.jsonc` 或 `.kilo/kilo.jsonc`

使用以下 OpenAI 兼容提供商配置。

```jsonc theme={null}
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "openai-compatible/openai-latest",
  "enabled_providers": ["openai-compatible"],
  "provider": {
    "openai-compatible": {
      "options": {
        "apiKey": "{env:CAPRIOLE_AI_API_KEY}",
        "baseURL": "https://api.caprioletech.com/v1"
      },
      "models": {
        "openai-latest": {
          "name": "Capriole OpenAI Latest",
          "tool_call": true,
          "reasoning": true
        },
        "claude-latest": {
          "name": "Capriole Claude Latest",
          "tool_call": true,
          "reasoning": true
        },
        "anthropic/claude-fable-5": {
          "name": "Capriole Fable 5",
          "tool_call": true,
          "reasoning": true
        },
        "anthropic/claude-opus-5": {
          "name": "Capriole Opus 5",
          "tool_call": true,
          "reasoning": true
        },
        "google-latest": {
          "name": "Capriole Google Latest",
          "tool_call": true,
          "reasoning": true
        },
        "openai/gpt-5.6-terra": {
          "name": "Capriole GPT 5.6 Thinking",
          "tool_call": true,
          "reasoning": true
        },
        "openai/gpt-5.6-luna": {
          "name": "Capriole GPT 5.6",
          "tool_call": true,
          "reasoning": true
        },
        "openai/gpt-5.5": {
          "name": "Capriole GPT 5.5",
          "tool_call": true,
          "reasoning": true
        },
        "openai/gpt-5.4-mini": {
          "name": "Capriole GPT 5.4 Mini",
          "tool_call": true,
          "reasoning": true
        },
        "xai/grok-4.5": {
          "name": "Capriole Grok 4.5",
          "tool_call": true,
          "reasoning": true
        },
        "zai/glm-5.2": {
          "name": "Capriole GLM 5.2",
          "tool_call": true,
          "reasoning": true
        },
        "moonshot/kimi-k3": {
          "name": "Capriole Kimi K3",
          "tool_call": true,
          "reasoning": true
        },
        "anthropic/claude-opus-4-8": {
          "name": "Capriole Opus 4.8",
          "tool_call": true
        },
        "anthropic/claude-opus-4-7": {
          "name": "Capriole Opus 4.7",
          "tool_call": true
        },
        "anthropic/claude-opus-4-6": {
          "name": "Capriole Opus 4.6",
          "tool_call": true
        },
        "anthropic/claude-sonnet-4-6": {
          "name": "Capriole Sonnet 4.6",
          "tool_call": true
        },
        "google/gemini-3.1-pro-preview": {
          "name": "Capriole Gemini 3.1 Pro Preview",
          "tool_call": true,
          "reasoning": true
        },
        "google/gemini-3.5-flash": {
          "name": "Capriole Gemini 3.5 Flash",
          "tool_call": false,
          "reasoning": true
        }
      }
    }
  }
}
```

## 运行 Kilo Code

设置 API Key，然后在项目目录中启动 Kilo。

```bash theme={null}
export CAPRIOLE_AI_API_KEY="YOUR_CAPRIOLE_AI_API_KEY"
kilo
```

使用指定模型启动。

```bash theme={null}
kilo -m openai-compatible/openai-latest
kilo -m openai-compatible/claude-latest
kilo -m openai-compatible/google-latest
kilo -m openai-compatible/openai/gpt-5.5
kilo -m openai-compatible/openai/gpt-5.4-mini
kilo -m openai-compatible/anthropic/claude-fable-5
kilo -m openai-compatible/anthropic/claude-opus-5
kilo -m openai-compatible/anthropic/claude-opus-4-8
kilo -m openai-compatible/anthropic/claude-opus-4-7
kilo -m openai-compatible/google/gemini-3.1-pro-preview
kilo -m openai-compatible/google/gemini-3.5-flash
kilo -m openai-compatible/moonshot/kimi-k3
```

使用 Gemini 3.5 Flash 发送一次性请求。

```bash theme={null}
kilo run --agent ask -m openai-compatible/google/gemini-3.5-flash "Summarize this project."
```

发送一次性 CLI 请求时，把 Prompt 传给 `kilo run`。

```bash theme={null}
export CAPRIOLE_AI_API_KEY="YOUR_CAPRIOLE_AI_API_KEY"
kilo run -m openai-compatible/openai-latest "Explain this repository structure."
```

## 支持的模型

新的 Kilo Code 配置请先使用 `openai-latest`。需要让 Capriole AI 路由到我们推荐的旗舰 Claude 或 Gemini 模型时，请使用 `claude-latest` 或 `google-latest`；需要准确的模型版本时，请使用具体模型 ID。

Kilo 文档采用与 Capriole AI 模型选择器相同的模型系列顺序，依次为 OpenAI、Anthropic 和 Google。公共 API 集成不包含 Fable 5 Thinking 和 Opus 5 Thinking 等仅用于 Browser Chat 的预设。

* `openai-latest`
* `openai/gpt-5.6-terra`
* `openai/gpt-5.6-luna`
* `openai/gpt-5.5`
* `openai/gpt-5.4-mini`
* `claude-latest`
* `anthropic/claude-fable-5`
* `anthropic/claude-opus-5`
* `anthropic/claude-opus-4-8`
* `anthropic/claude-opus-4-7`
* `anthropic/claude-opus-4-6`
* `anthropic/claude-sonnet-4-6`
* `google-latest`
* `google/gemini-3.1-pro-preview`
* `google/gemini-3.5-flash`
* `xai/grok-4.5`
* `zai/glm-5.2`
* `moonshot/kimi-k3`

在 Kilo Code 中使用 Gemini 3.5 Flash 时，请保留 `"tool_call": false`。Capriole AI 支持该模型的简单 Chat Completions 工具调用，Kilo Code 也能在此设置下运行本地工具工作流，但启用原生 Gemini 函数声明仍可能遇到 Gemini 较窄的 OpenAPI Schema 子集限制。

需要测试其他模型时，也可以配置 `GET /v1/models` 返回的公共 Chat Completions 兼容模型 ID。将模型用于代码编辑工作流前，请先验证工具调用。

## 故障排除

### 为什么 Kilo Code 返回身份验证错误

运行 `kilo` 前，确认已在同一个 Shell 中导出 `CAPRIOLE_AI_API_KEY`。

### 应该编辑哪个配置文件

当前 Kilo CLI 和 VS Code 扩展使用 `~/.config/kilo/kilo.jsonc`。编辑后运行 `kilo config check`。

### 为什么请求出现端点错误

确认 `baseURL` 是 `https://api.caprioletech.com/v1`。Kilo 会向 `/v1/chat/completions` 发送 Chat Completions 请求。

### 为什么 Kilo Code 提示缺少模型

确认所选模型使用 `openai-compatible/<model-id>` 格式，并且 `provider.openai-compatible.models` 包含对应的模型条目。例如，`openai-compatible/openai-latest` 映射到 `openai-latest` 配置 Key。

### 为什么工具调用失败

对于 GPT、Claude、Gemini 3.1 Pro 和 latest 别名条目，请确认模型条目包含 `"tool_call": true`。Kilo Code 在本地执行工具，并向 Capriole AI 发送后续 Chat Completions 请求。

对于 Gemini 3.5 Flash，请保留 `"tool_call": false`。Gemini 支持函数调用，但函数声明只能使用受支持的 OpenAPI Schema 子集。部分原生工具 Schema 超出了该子集。

## 说明

* Capriole AI 通过 `POST /v1/chat/completions` 支持 Kilo Code。
* Kilo Code 在本地执行编程工具。Capriole AI 只处理模型请求。
* Kilo Code 7.3.16 可以使用 Kimi K3 完成流式 Bash 工具调用和后续助手轮次。
* 先保持提供商配置精简。只有确实需要客户端侧上下文管理时，才添加 Kilo 模型限制或其他模型选项。
* 官方参考资料包括 [Kilo OpenAI Compatible 提供商](https://kilo.ai/docs/ai-providers/openai-compatible)、[Kilo 设置](https://kilo.ai/docs/getting-started/settings)、[Kilo 自定义模型](https://kilo.ai/docs/code-with-ai/agents/custom-models)、[Kilo CLI](https://kilo.ai/docs/cli)和 [Gemini 函数调用](https://ai.google.dev/gemini-api/docs/function-calling)。
