# Table of Contents - [Kimi Code Overview | Kimi Code Docs](#kimi-code-overview-kimi-code-docs) - [Model Configuration | Kimi Code Docs](#model-configuration-kimi-code-docs) - [Kimi Code 概览 | Kimi Code 文档](#kimi-code-kimi-code-) - [Membership Benefits | Kimi Code Docs](#membership-benefits-kimi-code-docs) - [FAQ | Kimi Code Docs](#faq-kimi-code-docs) - [Kimi Code Community Guidelines | Kimi Code Docs](#kimi-code-community-guidelines-kimi-code-docs) - [What's New | Kimi Code Docs](#what-s-new-kimi-code-docs) - [Error Reference | Kimi Code Docs](#error-reference-kimi-code-docs) - [Changelog | Kimi Code Docs](#changelog-kimi-code-docs) - [Contact and Feedback | Kimi Code Docs](#contact-and-feedback-kimi-code-docs) - [Using the Desktop App | Kimi Code Docs](#using-the-desktop-app-kimi-code-docs) - [Configuration | Kimi Code Docs](#configuration-kimi-code-docs) - [Customization | Kimi Code Docs](#customization-kimi-code-docs) - [Core Operations | Kimi Code Docs](#core-operations-kimi-code-docs) - [Claude Code | Kimi Code Docs](#claude-code-kimi-code-docs) - [Changelog | Kimi Code Docs](#changelog-kimi-code-docs) - [Using Kimi in OpenCode | Kimi Code Docs](#using-kimi-in-opencode-kimi-code-docs) - [Quick Start | Kimi Code Docs](#quick-start-kimi-code-docs) - [Claude Code | Kimi Code Docs](#claude-code-kimi-code-docs) - [在 IDE 中使用 | Kimi Code 文档](#-ide-kimi-code-) - [Using Kimi in OpenCode | Kimi Code Docs](#using-kimi-in-opencode-kimi-code-docs) - [Using Kimi in Codex | Kimi Code Docs](#using-kimi-in-codex-kimi-code-docs) - [Using Kimi in Codex | Kimi Code Docs](#using-kimi-in-codex-kimi-code-docs) - [Using Kimi in Hermes Agent | Kimi Code Docs](#using-kimi-in-hermes-agent-kimi-code-docs) - [开始使用 | Kimi Code 文档](#-kimi-code-) - [快速开始 | Kimi Code 文档](#-kimi-code-) - [从 kimi-cli 迁移 | Kimi Code 文档](#-kimi-cli-kimi-code-) - [常见问题 | Kimi Code 文档](#-kimi-code-) - [Claude Code | Kimi Code 文档](#claude-code-kimi-code-) - [Quick Start | Kimi Code Docs](#quick-start-kimi-code-docs) - [远程控制 | Kimi Code 文档](#-kimi-code-) - [平台与模型 | Kimi Code 文档](#-kimi-code-) - [Membership Benefits | Kimi Code Docs](#membership-benefits-kimi-code-docs) - [在网页中使用 | Kimi Code 文档](#-kimi-code-) - [会话与上下文 | Kimi Code 文档](#-kimi-code-) - [交互与输入 | Kimi Code 文档](#-kimi-code-) - [数据路径 | Kimi Code 文档](#-kimi-code-) - [环境变量 | Kimi Code 文档](#-kimi-code-) - [Kimi Code 社区倡议 | Kimi Code 文档](#kimi-code-kimi-code-) - [错误参考(Error Reference) | Kimi Code 文档](#-error-reference-kimi-code-) - [快速开始 | Kimi Code 文档](#-kimi-code-) - [变更记录 | Kimi Code 文档](#-kimi-code-) - [会员权益 | Kimi Code 文档](#-kimi-code-) - [最新动态 | Kimi Code 文档](#-kimi-code-) - [使用桌面端 | Kimi Code 文档](#-kimi-code-) - [Model Context Protocol | Kimi Code 文档](#model-context-protocol-kimi-code-) - [Agent Skills | Kimi Code 文档](#agent-skills-kimi-code-) - [kimi 命令 | Kimi Code 文档](#kimi-kimi-code-) - [配置文件 | Kimi Code 文档](#-kimi-code-) - [斜杠命令 | Kimi Code 文档](#-kimi-code-) - [内置工具 | Kimi Code 文档](#-kimi-code-) - [键盘快捷键 | Kimi Code 文档](#-kimi-code-) - [配置覆盖 | Kimi Code 文档](#-kimi-code-) - [常见使用案例 | Kimi Code 文档](#-kimi-code-) - [服务 API | Kimi Code 文档](#-api-kimi-code-) - [核心操作 | Kimi Code 文档](#-kimi-code-) - [联系与反馈 | Kimi Code 文档](#-kimi-code-) - [配置 | Kimi Code 文档](#-kimi-code-) - [定制化 | Kimi Code 文档](#-kimi-code-) - [在 OpenCode 中使用 | Kimi Code 文档](#-opencode-kimi-code-) - [在 OpenCode 中使用 | Kimi Code 文档](#-opencode-kimi-code-) - [在 Codex 中使用 | Kimi Code 文档](#-codex-kimi-code-) - [变更记录 | Kimi Code 文档](#-kimi-code-) - [Agent 与 subagent | Kimi Code 文档](#agent-subagent-kimi-code-) - [Hooks | Kimi Code 文档](#hooks-kimi-code-) - [自定义主题 | Kimi Code 文档](#-kimi-code-) - [kimi acp 子命令 | Kimi Code 文档](#kimi-acp-kimi-code-) - [Plugins | Kimi Code 文档](#plugins-kimi-code-) - [Claude Code | Kimi Code 文档](#claude-code-kimi-code-) - [模型配置 | Kimi Code 文档](#-kimi-code-) - [在 Codex 中使用 | Kimi Code 文档](#-codex-kimi-code-) - [在 Hermes Agent 中使用 | Kimi Code 文档](#-hermes-agent-kimi-code-) - [会员权益 | Kimi Code 文档](#-kimi-code-) --- # Kimi Code Overview | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/#VPContent) On this page Kimi Code Overview [​](https://www.kimi.com/code/docs/en/#kimi-code-overview) ============================================================================== What is Kimi Code [​](https://www.kimi.com/code/docs/en/#what-is-kimi-code) ---------------------------------------------------------------------------- Kimi Code is an intelligent programming service for developers included in [Kimi membership benefits](https://www.kimi.com/membership/pricing?from=kfc_docs_overview) . Built on Kimi's latest flagship models, it provides AI-assisted capabilities—such as code reading, file editing, and command execution—through product forms like the Desktop app, CLI, and VS Code extension. Subscribers can also obtain an API Key to integrate Kimi Code's model capabilities into third-party development tools and platforms. Core Advantages [​](https://www.kimi.com/code/docs/en/#core-advantages) ------------------------------------------------------------------------ **1\. Models and inference** Flagship K3 modelPowered by our strongest flagship model K3 — 2.8 trillion parameters — excelling at long-horizon programming, front-end visual design, knowledge work, and complex reasoning. 1M-token context windowA million-token context loads an entire large codebase with cross-module dependencies in one pass, enabling whole-project understanding and refactoring. 260 tokens/s inferenceChoose between the standard K2.8 Preview and the K2.7 Code HighSpeed tier, with output up to 260 tokens/s for a noticeably faster coding loop. **2\. Ecosystem and extensibility** Professional data sourcesPlug in professional-grade data sources to extend what AI coding can do. Works with mainstream toolsCompatible with Kimi Code CLI, Claude Code, VS Code, and other mainstream agent tools — switch models seamlessly. Early access to experimental featuresBe first to try Kimi's latest model and inference capabilities as they land. Getting Started [​](https://www.kimi.com/code/docs/en/#getting-started) ------------------------------------------------------------------------ Kimi Code allows members to use their benefits in both the official client and third-party platforms, covering different development scenarios. ### Using the Official Client [​](https://www.kimi.com/code/docs/en/#using-the-official-client) Choose the client that fits you and install with one click: Kimi Code DesktopKimi Code CLIKimi Code for VS Code For developers who prefer a graphical app. Open a local project folder in Kimi Code Desktop and let the Agent read code, edit files, run commands, and verify results through conversation. Available on macOS and Windows. [Kimi Code DesktopmacOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) [Kimi Code DesktopmacOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) [Kimi Code DesktopWindows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) After installing, open the app and sign in with your Kimi account as prompted—no API Key management needed. See [Desktop Quick Start](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html) for more. For developers who prefer terminal operations. Chat with AI in the terminal, letting it read code, edit files, execute commands, search the web, and autonomously complete development tasks. 📢 CLI Upgraded Kimi Code CLI has gone through a major version upgrade — moving from Python/uv to Node.js, bringing a simpler install experience, faster startup, and a redesigned terminal UI. The legacy version will no longer be maintained. See [Version Upgrade](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html) for details and migration instructions, or refer to the legacy Python-based Kimi Code [docs](https://moonshotai.github.io/kimi-cli/en/) if needed. bash # macOS / Linux curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash powershell # Windows (PowerShell) irm https://code.kimi.com/kimi-code/install.ps1 | iex After installation, run `kimi` in the terminal to start; on first use, log in to the Kimi Code platform with the `/login` command to complete the connection — no need to manually manage an API Key. For developers who prefer the VS Code editor. Collaborate with AI in the editor sidebar, supporting code completion, file editing, web search, and automated tasks. Search for "Kimi Code" in the VS Code Extensions marketplace to install, or visit [Visual Studio Marketplace](vscode:extension/moonshot-ai.kimi-code) . After installation, complete the connection via the login button in the sidebar — no need to manually manage an API Key. > If the extension doesn't appear after installation, restart VS Code or run "Developer: Reload Window" from the Command Palette (Mac: Cmd+Shift+P, Windows/Linux: Ctrl+Shift+P). Other editors such as JetBrains and Zed can connect via CLI's ACP protocol. See [Using Kimi Code CLI in IDEs](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) for details. ### API Access [​](https://www.kimi.com/code/docs/en/#api-access) When integrating Kimi Code into third-party development tools, you need to manually configure an API Key to complete authentication. #### Service Endpoint [​](https://www.kimi.com/code/docs/en/#service-endpoint) The Kimi Code API is compatible with both OpenAI and Anthropic protocols. Different tools have different requirements for address configuration: * **Base URL**: Some tools (e.g., Claude Code) only require the Base URL, and the tool will automatically append the subsequent path. * **Full Endpoint**: Some tools (e.g., Trae) require the complete API request address. Choose the corresponding address as needed: | Protocol | Base URL | Common Endpoint Example | | --- | --- | --- | | OpenAI Compatible | China: `https://api.kimi.com/coding/v1`
Overseas: `https://api.kimi.ai/coding/v1` | `https://api.kimi.com/coding/v1/chat/completions` | | Anthropic Compatible | China: `https://api.kimi.com/coding/`
Overseas: `https://api.kimi.ai/coding/` | `https://api.kimi.com/coding/v1/messages` | #### Model IDs [​](https://www.kimi.com/code/docs/en/#model-ids) Different model IDs correspond to different membership tiers and context windows. See [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) for details. Both protocols accept the following 4 model IDs: | Model ID | Description | | --- | --- | | `k3` | K3 — available to Moderato / Plus members and above; Allegretto / Pro members and above unlock the up-to-1M context window; supports `low` / `high` / `max` thinking effort levels. Best for large codebase analysis, multi-file refactoring, and long-document processing. | | `k3-256k` | K3 256K context version — available to Moderato / Plus members and above; supports `low` / `high` / `max` thinking effort levels. Within 256k context, it delivers the same results as K3. `k3` (1M) consumes about twice as much quota as `k3-256k`. Ideal for everyday Q&A, code completion, routine feature development, and single-file or small-file edits — video input is not supported. | | `kimi-for-coding` | K2.8 Preview — available to Andante / Plus members and above; supports up to 1M context and `low` / `high` / `max` reasoning effort. | | `kimi-for-coding-highspeed` | K2.7 Code HighSpeed — available to Allegretto / Pro members and above. | See [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) for model capabilities and setup details. #### Obtaining an API Key [​](https://www.kimi.com/code/docs/en/#obtaining-an-api-key) Kimi members can create and manage API Keys in the [Kimi Code Console](https://www.kimi.com/code/console) (up to 5 keys; each is shown only once upon creation—please keep it safe). #### Configuring in Third-Party Tools [​](https://www.kimi.com/code/docs/en/#configuring-in-third-party-tools) After obtaining an API Key, configure the corresponding Base URL and API Key in the environment variables of the respective tool to start using it. For detailed setup steps, see the corresponding tool guide: [Claude CodeAnthropic's command-line coding assistant](https://www.kimi.com/code/docs/en/third-party-tools/claude-code) [OpenCodeA terminal-based coding agent](https://www.kimi.com/code/docs/en/third-party-tools/opencode) [CodexOpenAI's coding agent](https://www.kimi.com/code/docs/en/third-party-tools/codex) > **Note**: Please maintain the tool's real identity identifier when using. Tampering with the client identifier (User-Agent) is considered a violation and may result in suspension of membership benefits. Platform Comparison [​](https://www.kimi.com/code/docs/en/#platform-comparison) -------------------------------------------------------------------------------- Kimi Code membership benefits are designed specifically for programming scenarios. If you need to call large model capabilities in your own product, or require team collaboration and usage management, please visit the [Kimi Platform](https://platform.kimi.ai/) . | Comparison Item | Kimi Code Platform | Kimi Platform | | --- | --- | --- | | Base URL | OpenAI Compatible:
China `https://api.kimi.com/coding/v1`
Overseas `https://api.kimi.ai/coding/v1`
Anthropic Compatible:
China `https://api.kimi.com/coding/`
Overseas `https://api.kimi.ai/coding/` | China `https://api.moonshot.cn/v1`
Overseas `https://api.moonshot.ai/v1` | | Billing | Membership subscription, monthly/annual payment, with rate limiting | Pay-as-you-go, top up and use | | Best For | Terminal/IDE Agent programming, multi-file engineering tasks | Product integration, enterprise-level calls, multimodal application development | Next Steps [​](https://www.kimi.com/code/docs/en/#next-steps) -------------------------------------------------------------- * [Kimi Code CLI Quick Start](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html) – Install, log in, and start your first conversation * [Kimi Code for VS Code Quick Start](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html) – Install the extension, log in, and typical workflows * [Using in More Third-Party Tools](https://www.kimi.com/code/docs/third-party-tools/claude-code.html) – Claude Code, OpenCode, Codex, and more * [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) – Quota refresh and rate limits, quota sharing, Extra Usage, and more * [FAQ](https://www.kimi.com/code/docs/kimi-code/faq.html) – Common issues with installation, login, and usage --- # Model Configuration | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/models.html#VPContent) On this page Model Configuration [​](https://www.kimi.com/code/docs/en/kimi-code/models.html#model-configuration) ===================================================================================================== This page covers the models Kimi Code provides and how to switch between them in each client. Model Overview [​](https://www.kimi.com/code/docs/en/kimi-code/models.html#model-overview) ------------------------------------------------------------------------------------------- Kimi Code currently offers three models—K3, K2.8 Preview, and K2.7 Code HighSpeed—across four model IDs, selectable by model ID in clients or third-party tools. Model specs: Recommended model launch **K2.8 Preview** is now fully rolled out in Kimi Code — `kimi-for-coding` is upgraded in place with no configuration changes: performance close to K3, with `low` / `high` / `max` thinking effort levels and up to 1M context. See [What's New](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html) . | Model ID | `k3` | `k3-256k` | `kimi-for-coding` | `kimi-for-coding-highspeed` | | --- | --- | --- | --- | --- | | Model version | K3 | K3 | K2.8 Preview | K2.7 Code HighSpeed | | Description | The most capable flagship coding model: 2.8T parameters, 1M context window | The 256K context version of K3 — `k3` (1M) consumes about twice as much quota as `k3-256k` | Performance close to K3 with more efficient thinking; good at code completion and routine development tasks | The high-speed version of K2.7 Code, with the same coding ability and ~5–6× faster output | | Speed | Regular | Regular | Regular | HighSpeed (6× speed, 3× quota usage) | | Context window | `1048576` (for higher-tier members) | `262144` only | `1048576` | `262144` | | Reasoning | `reasoning_effort:low` / `high` / `max`
(default `high`) | `reasoning_effort:low` / `high` / `max` (default `high`) | `reasoning_effort:low` / `high` / `max`
(default `max`) | `Thinking:ON` | | Availability (new plans) | Plus and above
1M context for Pro and above | Plus and above | Plus and above | Pro and above | | Availability (legacy plans) | Moderato and above
1M context for Allegretto and above | Moderato and above | Andante and above | Allegretto and above | | Multimodal input | Image, video | Image only | Image, video | Image, video | Need a higher membership plan? Different membership plans unlock different models, context windows, and speeds. [**Upgrade your plan →**](https://www.kimi.com/code/#pricing) Why did usage go up after the new model launched? After switching models, the context cache built earlier no longer hits on the new model, so that context has to be re-prefilled. Usage therefore looks higher right after switching. Recommended action: * **Start a new session when using the new model**: this gives better results and lower consumption. Why do I still get a 401 with the correct model ID? When the requested capability exceeds your plan's entitlements, the server returns `401`. Three common cases: * **No K3 access**: your plan is below Moderato / Plus and can't call `k3`, `k3-256k` (the new Go tier has no coding quota) — upgrade to Moderato / Plus or above. * **No 1M access**: on a Moderato / Plus plan, `k3` supports up to 256K context; up to 1M context is available on Allegretto / Pro or above. `k3-256k` has a fixed 256K context limit. * **No HighSpeed access**: some plans don't include HighSpeed — upgrade to Allegretto / Pro or above to call `kimi-for-coding-highspeed`. For the full error text and how to handle it, see the [Error Reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html) . Why isn't HighSpeed noticeably faster? Two common reasons: * **Mistyped model ID**: the HighSpeed ID must be `kimi-for-coding-highspeed`; a wrong value silently falls back to the standard `kimi-for-coding` — no error, no speedup. * **Tools and scripts dominate**: HighSpeed only speeds up **model output**. Tool calls (reading/writing files, running commands, etc.) and script execution are unaffected, so when they take up most of a turn the overall speedup feels small. How to reduce the overhead of switching reasoning effort? Switching reasoning effort invalidates the context cache you've built up, so context that would have hit the cache must be re-prefilled. To avoid triggering re-prefill too often: * Pick an effort that fits the task and keep it consistent within a session; * When you genuinely need a different effort, start a new session rather than switching back and forth in a long session. Switching between K3 (1M) and K3-256k **Switching from K3 (1M) to K3-256k**: if the current session's context already exceeds 256k, some coding tools (such as Kimi Code CLI and Claude Code) will perform a compact on the tool side. Recommendations: 1. Manually run compact once before switching to compress the context to within 256k. This preserves the key points of the task, keeps the session intact, and lets you benefit from more durable quota after switching. 2. If the conversation history includes video files, switching directly will fail because K3-256k does not support video input. Please compact first, then switch. **Switching from K3-256k to K3 (1M)**: if `k3-256k` is close to the 256k limit and you don't want compact to lose information, you can switch directly to 1M. The current version switching from 256k to 1M does not affect the cache. How to Switch Models [​](https://www.kimi.com/code/docs/en/kimi-code/models.html#switch-model) ----------------------------------------------------------------------------------------------- Usage notes * **Start a new session when switching model IDs**: switching models invalidates the context cache you've built up. We recommend starting a new session to get the best experience and avoid extra token consumption. * **Fill in the Model ID, not the model version name**: when calling a model, use one of the Model IDs from the table above (`k3`, `k3-256k`, `kimi-for-coding`, `kimi-for-coding-highspeed`). Entering a model version name like `K3` or `K2.8 Preview` will cause the call to fail. * **Thinking off routes to K2.8 Preview (no thinking)**: with thinking disabled, requests to the K3 series and K2.8 Preview are served by K2.8 Preview with thinking off. Ways to switch to the target model: ### Official clients [​](https://www.kimi.com/code/docs/en/kimi-code/models.html#official-clients) * **Kimi Code Desktop**: switch models in the model picker inside the Composer; if the target model isn't listed yet, restart the app or sign in again. * **Official Kimi Code CLI**: type `/model` to switch models—no config changes needed; if the latest model isn't listed yet, `/logout` and sign in again with `/login`. * **Kimi Code for VS Code**: pick the target model from the dropdown menu in the input bar; if it isn't listed yet, restart VS Code or reinstall the extension. ### Third-party tools [​](https://www.kimi.com/code/docs/en/kimi-code/models.html#third-party-tools) Set the tool's Model ID to the target model. Detailed steps: 1. Create an API Key in the [Kimi Code Console](https://www.kimi.com/code/console) . 2. Fill in the Base URL and the corresponding Model ID in your tool. Kimi Code API supports both OpenAI and Anthropic protocols. Base URLs: | Protocol | Base URL | | --- | --- | | OpenAI compatible | China `https://api.kimi.com/coding/v1`
Overseas `https://api.kimi.ai/coding/v1` | | Anthropic compatible | China `https://api.kimi.com/coding/`
Overseas `https://api.kimi.ai/coding/` | For detailed setup steps, see the corresponding tool guide: [Claude CodeAnthropic's command-line coding assistant](https://www.kimi.com/code/docs/en/third-party-tools/claude-code) [OpenCodeA terminal-based coding agent](https://www.kimi.com/code/docs/en/third-party-tools/opencode) [CodexOpenAI's coding agent](https://www.kimi.com/code/docs/en/third-party-tools/codex) Effort mapping in third-party tools Both K3 and K2.8 Preview support `low` / `high` / `max` thinking effort levels; the effort a tool sends is mapped as below: # default null / undefined → model default (high for K3, max for K2.8 Preview) any other unknown → HTTP 400 error # → max ultra / max / xhigh → max # → high (recommended) high / medium → high # → low low / minimum / light → low # → thinking disabled none → thinking.type disabled --- # Kimi Code 概览 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/#VPContent) On this page Kimi Code 概览 [​](https://www.kimi.com/code/docs/#kimi-code-%E6%A6%82%E8%A7%88) =============================================================================== Kimi Code 是什么 [​](https://www.kimi.com/code/docs/#kimi-code-%E6%98%AF%E4%BB%80%E4%B9%88) ----------------------------------------------------------------------------------------- Kimi Code 是 [Kimi 会员权益](https://www.kimi.com/membership/pricing?from=kfc_docs_overview) 中专为开发者提供的智能编程服务,基于 Kimi 最新旗舰模型,通过桌面端、CLI、VS Code 扩展插件等产品形态,为开发者提供代码阅读、文件编辑、命令执行等 AI 辅助能力。同时,订阅用户可获取 API Key,将 Kimi Code 的模型能力接入到第三方开发工具与平台。 核心优势 [​](https://www.kimi.com/code/docs/#%E6%A0%B8%E5%BF%83%E4%BC%98%E5%8A%BF) ------------------------------------------------------------------------------- **一、模型与推理** 旗舰 K3 模型搭载最强旗舰模型 K3,参数规模高达 2.8 万亿,在长程编程、前端视觉设计、知识工作与复杂推理等核心场景表现卓越。 1M Tokens 超长上下文支持百万级上下文窗口,可一次性完整载入大型代码库及跨模块依赖,实现全局代码理解与项目级重构。 260 Tokens/s 极速推理提供 K2.8 Preview 普速版与 K2.7 Code HighSpeed 高速版双模式,推理速度最高可达 260 Tokens/s,显著加速编码效率。 **二、扩展与生态** 专业知识库(Data Source)支持接入专业级数据源,深度扩展 AI Coding 能力边界。 主流工具无缝兼容全面兼容 Kimi Code CLI、Claude Code、VS Code 等主流 Agent 工具,模型切换丝滑无感。 实验性功能优先开放优先体验 Kimi 在模型与推理领域的最新技术与产品实现,先人一步触达前沿特性。 开始使用 [​](https://www.kimi.com/code/docs/#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------- Kimi Code 支持会员在官方客户端和第三方平台使用权益,覆盖不同的开发场景。 ### 使用官方客户端 [​](https://www.kimi.com/code/docs/#%E4%BD%BF%E7%94%A8%E5%AE%98%E6%96%B9%E5%AE%A2%E6%88%B7%E7%AB%AF) 选择适合你的客户端,一键安装: Kimi Code DesktopKimi Code CLIKimi Code for VS Code 适合希望在图形界面中管理项目和会话的开发者。在桌面端中打开本地项目文件夹,与 AI 对话完成代码阅读、文件编辑、命令执行和结果验证,支持 macOS 与 Windows。 [Kimi Code 桌面版macOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) [Kimi Code 桌面版macOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) [Kimi Code 桌面版Windows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) 安装后打开应用,按页面提示登录 Kimi 账号即可开始使用,无需手动管理 API Key。更多说明见[桌面端快速开始](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html) 。 适合习惯终端操作的开发者。在终端中与 AI 对话,让它阅读代码、编辑文件、执行命令、搜索网页,自主完成开发任务。 📢 CLI 已升级 Kimi Code CLI 已完成重大版本升级,底层从 Python/uv 迁移至 Node.js,带来更简单的安装方式、更快的启动速度和全新的终端界面。旧版将不再维护。查看 [版本升级](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html) 了解详情和迁移方式,如需参考旧版内容,请查阅 Python 版 Kimi Code [文档站](https://moonshotai.github.io/kimi-cli/zh/) 。 bash # macOS / Linux curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash powershell # Windows (PowerShell) irm https://code.kimi.com/kimi-code/install.ps1 | iex 安装完成后,在终端中运行 `kimi` 启动,首次使用通过 `/login` 命令登录 Kimi Code 平台即完成接入,无需手动管理 API Key。 适合偏好使用 VS Code 编辑器的开发者。在编辑器侧边栏与 AI 协同,支持代码补全、文件编辑、网页搜索和自动化任务。 在 VS Code 扩展市场搜索 "Kimi Code" 安装,或访问 [Visual Studio Marketplace](vscode:extension/moonshot-ai.kimi-code) 。安装后通过侧边栏的登录按钮完成接入,无需手动管理 API Key。 > 若安装后未显示扩展,请重启 VS Code 或在命令面板中执行 "Developer: Reload Window" (Mac: Cmd+Shift+P, Windows/Linux: Ctrl+Shift+P)。 其他编辑器如 JetBrains、Zed 可通过 CLI 的 ACP 协议接入使用,详见 [在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) 。 ### API 接入 [​](https://www.kimi.com/code/docs/#api-%E6%8E%A5%E5%85%A5) 将 Kimi Code 接入第三方开发工具时,需要手动配置 API Key 完成认证。 #### 服务地址 [​](https://www.kimi.com/code/docs/#%E6%9C%8D%E5%8A%A1%E5%9C%B0%E5%9D%80) Kimi Code API 同时兼容 OpenAI 和 Anthropic 两种协议。不同工具对地址配置的要求不同: * **Base URL**:部分工具(如 Claude Code)只需填写 Base URL,工具会自动拼接后续路径。 * **完整 Endpoint**:部分工具(如 Trae)需要填写完整的 API 请求地址。 按需选择对应的地址: | 协议 | Base URL | 常用 Endpoint 示例 | | --- | --- | --- | | OpenAI 兼容 | 国内:`https://api.kimi.com/coding/v1`
海外:`https://api.kimi.ai/coding/v1` | `https://api.kimi.com/coding/v1/chat/completions` | | Anthropic 兼容 | 国内:`https://api.kimi.com/coding/`
海外:`https://api.kimi.ai/coding/` | `https://api.kimi.com/coding/v1/messages` | #### 模型 ID [​](https://www.kimi.com/code/docs/#%E6%A8%A1%E5%9E%8B-id) 不同模型 ID 对应不同的会员档位与上下文窗口,具体权益见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) 。 两种协议均可使用以下 4 个模型 ID: | Model ID | 说明 | | --- | --- | | `k3` | K3,Moderato / Plus 及以上会员可调用,Allegretto / Pro 及以上会员可解锁最高 100 万上下文;支持 `low` / `high` / `max` 三档思考强度,适合大型代码库分析、多文件重构、超长文档处理等长上下文任务。 | | `k3-256k` | K3 256K 上下文版,Moderato / Plus 及以上会员可调用;支持 `low` / `high` / `max` 三档思考强度。256k 上下文内效果与 K3 相同,`k3`(1M)消耗约为 `k3-256k` 两倍,适合日常问答、代码补全、常规功能开发、单文件或少量文件修改场景,不支持视频输入。 | | `kimi-for-coding` | K2.8 Preview,Andante / Plus 及以上会员可用;支持最高 1M 上下文与 `low` / `high` / `max` 三档思考强度。 | | `kimi-for-coding-highspeed` | K2.7 Code 高速版,Allegretto / Pro 及以上会员可用。 | 模型能力与配置细节见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) 。 #### 获取 API Key [​](https://www.kimi.com/code/docs/#%E8%8E%B7%E5%8F%96-api-key) Kimi 会员可在 [Kimi Code 控制台](https://www.kimi.com/code/console) 创建和管理(最多 5 个,仅创建时显示一次,请妥善保存)。 #### 配置到第三方工具 [​](https://www.kimi.com/code/docs/#%E9%85%8D%E7%BD%AE%E5%88%B0%E7%AC%AC%E4%B8%89%E6%96%B9%E5%B7%A5%E5%85%B7) 获取 API Key 后,将对应 Base URL 和 API Key 配置到对应工具的环境变量即可使用。详细配置步骤请参考对应工具的接入文档: [Claude CodeAnthropic 的命令行编程助手](https://www.kimi.com/code/docs/third-party-tools/claude-code) [OpenCode终端编程 Agent](https://www.kimi.com/code/docs/third-party-tools/opencode) [CodexOpenAI 的编程 Agent](https://www.kimi.com/code/docs/third-party-tools/codex) > **注意**:使用时请保持工具的真实身份标识,篡改客户端标识(User-Agent)将被视为违规,可能导致会员权益暂停。 平台对比 [​](https://www.kimi.com/code/docs/#%E5%B9%B3%E5%8F%B0%E5%AF%B9%E6%AF%94) ------------------------------------------------------------------------------- Kimi Code 会员权益专为编程场景设计。如需在自己的产品中调用大模型能力,或需要团队协作与用量管理,请访问 [Kimi 开放平台](https://platform.kimi.com/) 。 | 对比项 | Kimi Code 平台 | Kimi 开放平台 | | --- | --- | --- | | Base URL | OpenAI 兼容:
国内 `https://api.kimi.com/coding/v1`
海外 `https://api.kimi.ai/coding/v1`
Anthropic 兼容:
国内 `https://api.kimi.com/coding/`
海外 `https://api.kimi.ai/coding/` | 国内 `https://api.moonshot.cn/v1`
海外 `https://api.moonshot.ai/v1` | | 计费方式 | 会员订阅,按月/年付费,有频控限制 | 按量付费,充值即用 | | 最佳场景 | 终端/IDE Agent 编程、多文件工程任务 | 产品集成、企业级调用、多模态应用开发 | 下一步 [​](https://www.kimi.com/code/docs/#%E4%B8%8B%E4%B8%80%E6%AD%A5) --------------------------------------------------------------------- * [Kimi Code CLI 快速开始](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html) – 安装、登录、第一次对话 * [Kimi Code for VS Code 快速开始](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html) – 安装扩展、登录、典型工作流 * [在更多第三方工具中使用](https://www.kimi.com/code/docs/third-party-tools/claude-code.html) – Claude Code、OpenCode、Codex 等 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) – 额度刷新与频率限制、配额共享、加油包等 * [常见问题](https://www.kimi.com/code/docs/kimi-code/faq.html) – 安装、登录、使用中的常见问题 --- # Membership Benefits | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/membership.html#VPContent) On this page Membership Benefits [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#membership-benefits) ========================================================================================================= 📢 New plans released The new Kimi membership plans are now available, with pricing unchanged — see the [Kimi Code plan page](https://www.kimi.ai/code/#pricing) for plan details and pricing. For new members, **the weekly quota limit is removed**, and only the rolling 5-hour rate window remains. The Go tier has no coding quota; Plus and above can use Kimi Code. Existing subscribers on legacy plans are not affected: the tier name, quota rules, and auto-renewal all remain as they are. See the [plan comparison](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) below for the differences between the legacy and new plans. Overview [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#overview) ----------------------------------------------------------------------------------- Kimi Code is the developer-focused AI coding service within [Kimi membership benefits](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) , provided together with a Kimi membership subscription and sharing the same quota. Requests from the CLI, VS Code, Desktop, and third-party tools all count toward that quota. See the [Kimi membership page](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) for tiers and pricing. Membership Tiers [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) -------------------------------------------------------------------------------------------------- Kimi membership tiers have been renamed, with pricing unchanged. Here is how the new plans compare with the legacy ones: | Item | Legacy plans | New plans | | --- | --- | --- | | Kimi Code availability | Andante and above | Plus and above | | 5-hour rate window | Yes | Yes | | Weekly rate window | Yes | No | | Monthly total quota | Yes | Yes | | K3 access | Moderato and above | Plus and above | | K3 1M context | Allegretto and above | Pro and above | | HighSpeed access | Allegretto and above | Pro and above | **FAQ** Can I keep using my legacy plan? Yes. Legacy plans purchased before the new plans launched remain usable. When the term ends, you can renew or upgrade to a new plan. Do I have to upgrade to a new plan? No — migration is optional. Your legacy plan keeps renewing as long as you stay subscribed; whether to upgrade depends on your needs. How do I upgrade my plan? On the [Kimi Code plan page](https://www.kimi.ai/code/#pricing) , pick the new plan you want and click "Subscribe" to complete payment. Your current plan's remaining days are prorated automatically, and the new plan takes effect immediately. Quota and Limits [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#quota-and-limits) --------------------------------------------------------------------------------------------------- Quota rules differ between new and existing members: * **New members**: the weekly quota limit is removed — quota no longer refreshes every 7 days. The **rolling 5-hour rate window** still applies: too many requests in a short time trigger rate limiting, which recovers automatically once the window rolls over. * **Existing members on legacy plans**: rules are unchanged — quota **refreshes automatically every 7 days** from your subscription date, unused quota does not roll over, and the same 5-hour rolling rate window applies. Both groups share the Kimi membership monthly total quota: if the monthly total is reached, Kimi Code quota is frozen until the monthly quota resets or you upgrade. Monthly usage can be viewed on the [Subscription](https://www.kimi.com/membership/subscription) page. All logged-in devices and API Keys share the same quota; devices inactive for over 30 days are automatically unbound and can be restored by running `/login` again. Log in to the [Kimi Code Console](https://www.kimi.com/code/console) at any time to check remaining quota and rate-limit status and to manage API Keys and devices. Extra Usage [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#extra-usage) ----------------------------------------------------------------------------------------- When your subscription quota runs out, you can keep making requests using your Extra Usage balance without waiting for a refresh. Only subscribed members can enable it, and **Kimi on the web and Kimi Code share the same Extra Usage balance**. See the full terms in the [Extra Usage Agreement](https://www.kimi.com/user/agreement/extra-usage-rules-cn) . ![Extra Usage](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-en.jpeg) **Top-up entry points** * **From the main site**: go to the Kimi [Subscription page](https://www.kimi.com/membership/subscription?tab=quota) , scroll to the "Extra Usage" module at the bottom then choose an amount and complete payment. * **From the Kimi Code Console**: once your weekly quota (existing members on legacy plans) or 5-hour quota reaches over **80%** used, the progress card shows a **Buy Extra Usage** button that takes you to the subscription page to purchase. ![The Extra Usage entry in the Kimi Code Console](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-console-en.png) **Enabling and managing** Turn on the "Extra Usage" toggle, and when your subscription quota runs out, the system automatically deducts from your Extra Usage balance. Click **Settings** in the module to enable a **monthly spending cap** and set the maximum you can spend this month; the progress bar shows this month's Extra Usage consumption in real time. **Billing and rules** * **Billing**: charged by actual usage — the more content read and generated, and the more complex the task, the higher the cost; the balance is shown in RMB, with rates as displayed on the platform. Extra Usage pricing is close to the official API pricing of the [Kimi Open Platform](https://platform.kimi.com/) ; for heavy usage, upgrading your subscription is usually more cost-effective. * **Deduction priority**: time-limited quotas such as the subscription are deducted first; **Extra Usage is deducted last** as a fallback. Once enabled, even if your subscription quota is maxed out, Extra Usage is consumed seamlessly and tasks don't stop or error out. * **Spending cap**: enable a "monthly spending cap" in settings to limit how much Extra Usage can be spent this month; without it, there is no cap. * **Validity and stacking**: the balance does not expire and stacks across top-ups; it remains usable after the subscription lapses, but you can't top up during the lapse — re-subscribe first to top up again. * **Refunds**: generally non-refundable, non-transferable, and non-redeemable. > Billing example (from official examples, for a rough sense of scale; actual rates per the platform): a simple request (e.g. "recommend a rock song") costs about **¥0.03**; a complex multi-step task (e.g. "plan a week-long road trip from Chengdu to western Sichuan") costs about **¥1.6**. > Top-up limits: minimum ¥25 per top-up, up to 10 times and ¥3,000 per day, with a balance cap of ¥10,000. **Checking your usage** * **Kimi web / app**: Settings → Subscription & Invoices → [My Quota](https://www.kimi.com/membership/subscription?tab=quota) . * **Kimi Code Console**: **once Extra Usage is enabled**, log in to the [Console](https://www.kimi.com/code/console) to view your balance and usage. * **Kimi Code CLI**: type `/usage` on the command line to check directly. ![Checking Extra Usage with /usage in the CLI](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-cli.png) **FAQ** Do Kimi on the web and Kimi Code use the same Extra Usage wallet? Yes. The Extra Usage balance is shared between Kimi and Kimi Code — top up once and use it in both; the Extra Usage you top up under "My Quota" and the one in the Kimi Code Console are the same balance. Which is deducted first, Extra Usage or subscription quota? Time-limited quotas such as the subscription are deducted first; Extra Usage is only deducted as a fallback once all time-limited quotas are exhausted. When I hit the monthly / weekly (legacy plans) / hourly limit, or get rate-limited mid-session, can I keep going? Yes. Once Extra Usage is enabled you're not affected by subscription limits — whenever any quota is reached it seamlessly switches to the Extra Usage balance, so tasks don't stop or error out, and only Extra Usage is deducted without affecting your membership quota refresh. How is Extra Usage billed, and how does it compare with a same-priced subscription or Open Platform API? Billing depends on the request's input/output volume and cache hit rate; Extra Usage pricing is close to the [Kimi Open Platform](https://platform.kimi.com/) 's official API, and for heavy usage upgrading your subscription is usually more cost-effective. Can unused balance roll over to next month, and does it stack? Yes — it's credit-based, doesn't expire, and stacks; it stays usable after the subscription lapses, but you can't top up during the lapse and must re-subscribe to top up again. When the balance is nearly used up (e.g. a 25 RMB top-up), will the current request finish? It guarantees the "last model call" completes even if its billing exceeds the limit, but it doesn't guarantee the whole task will finish. Is Extra Usage available for Enterprise? Not yet supported. After I close my account, is the balance refunded? To request a refund, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to reach our support team. Next steps [​](https://www.kimi.com/code/docs/en/kimi-code/membership.html#next-steps) --------------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) — models, context windows, and switching methods available for each tier * [Error reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html) — how to handle errors such as quota exhaustion and insufficient permissions --- # FAQ | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/faq.html#VPContent) On this page FAQ [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#faq) ================================================================== Installation and Authentication [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#installation-and-authentication) -------------------------------------------------------------------------------------------------------------------------- ### Empty model list during `/login` [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#empty-model-list-during-login) If you see the error "No models available for the selected platform" when running the `/login` command, it may be due to: * **Invalid or expired API key**: Check whether the API key you entered is correct and still valid. * **Network connection issues**: Confirm you can access the API service addresses (such as `api.kimi.ai` or `api.moonshot.ai`). **Note: Distinguish Platforms** Kimi Code membership benefits and the [Kimi Platform](https://platform.kimi.com/) have different Base URLs. Please ensure your Base URL and API Key are matched correctly. | Platform | Base URL | Billing | Key Source | | --- | --- | --- | --- | | **Kimi Code** | Anthropic-compatible: China `https://api.kimi.com/coding/`
Overseas `https://api.kimi.ai/coding/` | Membership subscription (quota included) | [Kimi Code Console](https://www.kimi.com/code/console) | | **Kimi Open Platform** | China `https://api.moonshot.cn/v1`
Overseas `https://api.moonshot.ai/v1` | Pay-as-you-go | [Kimi Open Platform](https://platform.kimi.com/) | ### Invalid API key [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#invalid-api-key) Possible reasons: * **Typo**: Check for extra spaces or missing characters. * **Expired or revoked**: Verify the key status in the console. ### Membership expired or quota exhausted [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#membership-expired-or-quota-exhausted) Use the `/usage` command to check your current quota and membership status. If your quota is exhausted or membership has expired, renew or upgrade at [Kimi Code](https://kimi.com/code) . Subscription [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#subscription) ------------------------------------------------------------------------------------ ### How do I request an invoice or upgrade my membership? [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#how-do-i-request-an-invoice-or-upgrade-my-membership) Visit the [Kimi Membership page](https://www.kimi.com/membership/pricing?from=kfc_docs_faq#pricing-faq) and follow the instructions to submit an invoice request or upgrade your plan. Interaction Issues [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#interaction-issues) ------------------------------------------------------------------------------------------------ ### Image paste fails [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#image-paste-fails) If you see "Current model does not support image input" when pasting with `Ctrl-V`, the current model does not support image input. Solutions: * **Switch to a vision-capable model**: Use a model with `image_in` capability. * **Check clipboard content**: Make sure the clipboard contains actual image data, not just a file path. Updates and Upgrades [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#updates-and-upgrades) ---------------------------------------------------------------------------------------------------- ### Slow first launch on macOS [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#slow-first-launch-on-macos) macOS Gatekeeper performs a security check on new programs the first time they run, causing a slow startup. Solutions: * **Wait for the check to complete**: Be patient on first launch; subsequent startups will be normal. * **Add to Developer Tools**: Go to System Settings → Privacy & Security → Developer Tools and add your terminal app. ### How to upgrade Kimi Code CLI [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#how-to-upgrade-kimi-code-cli) Run `kimi upgrade` inside the CLI to automatically check for the latest version and be guided through the upgrade. You can also use the package manager directly: sh npm install -g @moonshot-ai/kimi-code@latest VS Code Extension FAQ [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-extension-faq) ------------------------------------------------------------------------------------------------------ The following are common questions about the Kimi Code VS Code extension. ### VS Code says no workspace is open [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-says-no-workspace-is-open) Open a folder in VS Code — the Kimi Code VS Code extension requires a workspace to function properly. ### VS Code says CLI not found [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-says-cli-not-found) Manually install Kimi Code CLI and configure `kimi.executablePath` in VS Code settings, or ensure the built-in CLI exists. ### VS Code login fails [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-login-fails) Try skipping login and using API key mode instead, check your network connection, or retry later via the extension's action menu. ### VS Code shows no response after sending a message [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-shows-no-response-after-sending-a-message) Confirm that Kimi Code CLI is available, a model is configured, and a workspace folder is open in VS Code. Check error logs via "Kimi Code: Show Logs". ### VS Code connection timeout [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-connection-timeout) Requests time out after 30 seconds with no response. Check your network and retry. ### VS Code shows an error before sending a message [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#vs-code-shows-an-error-before-sending-a-message) Certain errors prevent sending messages in VS Code, such as CLI not found, version too low, not logged in, or session busy. Errors appear as toast notifications; your input is preserved for retry. Feedback and Contact [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#feedback-and-contact) ---------------------------------------------------------------------------------------------------- ### Problem not resolved by this page [​](https://www.kimi.com/code/docs/en/kimi-code/faq.html#problem-not-resolved-by-this-page) If the above content hasn't resolved your issue, please go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to consult our support team. Please describe the problem, steps taken, and any relevant logs — we'll get back to you as soon as possible. --- # Kimi Code Community Guidelines | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#VPContent) On this page Kimi Code Community Guidelines [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#kimi-code-community-guidelines) ========================================================================================================================================= Kimi Code is dedicated to providing intelligent, high-performance AI coding services to users worldwide — through continuous model improvements, relentless pursuit of Agent capabilities, and a flexible Token Plan. Our goal is to shorten the distance between imagination and reality, and make AI agents accessible to everyone. To ensure every Kimi Code user has a better experience, we put forward the following guidelines. Scope of Use [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#scope-of-use) ----------------------------------------------------------------------------------------------------- Kimi Code subscriptions are for interactive use only. We're compatible with mainstream coding tools and agent frameworks (Kimi CLI, VS Code, Claude Code, OpenCode, OpenClaw, etc.), so you can call Kimi Code's AI capabilities from the tools you already use. For enterprise integrations, commercial services, or other platform-related inquiries, visit the [Kimi Platform](https://platform.moonshot.ai/) to explore partnership options. ✧ Usage Guidelines We Need to Highlight [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#%E2%9C%A7-usage-guidelines-we-need-to-highlight) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- To ensure everyone can continue to access stable model services, there are some usage guidelines you need to follow. #### Don't resell your account or API access Your account is a direct connection between you and Kimi Code. Transferring it to others also puts your own data and usage history at risk. #### Don't resell Kimi Code's capabilities as a service Using Kimi Code to support your own work is completely fine. Repackaging it as a product to sell to others bypasses our pricing and service structure — and isn't fair to users who play by the rules. #### Don't spoof or alter client identity information We rely on this information to maintain service quality and security. Impersonating or masking your client identity can make your requests behave unpredictably from the platform's perspective. #### Don't use Kimi Code for non-interactive automation Kimi Code subscriptions are for personal interactive use only. Using it for non-interactive purposes — such as scripted batch execution or data annotation pipelines — goes beyond normal use. If your usage doesn't align with the guidelines above, we'll review the situation first and take appropriate action—such as **limiting concurrent access**—based on the severity. You'll then see a `You've reached your concurrent request limit` error — see the [error reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#concurrent-request-limit) for details. Accordingly, if you purchase through unauthorized channels (such as resold accounts or third-party sellers), your account may be suspended upon verification, and we **will not be liable for any losses**. Think we got it wrong? If your account has been mistakenly suspended, please contact our support email at [support@moonshot.ai](mailto:support@moonshot.ai) . To help us resolve your issue efficiently, please include your account ID, the time of suspension, a description of your use case, and any relevant screenshots. ♡ How We Love to See Kimi Code Used [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#%E2%99%A1-how-we-love-to-see-kimi-code-used) ----------------------------------------------------------------------------------------------------------------------------------------------------------- Kimi Code welcomes every builder who believes code can change the world — whether you're an indie developer, an open source contributor, or someone just getting started turning their first idea into a product. We especially encourage sustained, focused use. For users who maintain longer sessions and make good use of conversation history, the platform dynamically optimizes how your quota is consumed, meaning the same workload uses less of it. Join the Community [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#join-the-community) ----------------------------------------------------------------------------------------------------------------- If you'd like to connect with more like-minded Kimi Coders, join our [Discord community](https://discord.gg/rGSAZtWSZg) and let's build together. Happy Coding! FAQ [​](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html#faq) ----------------------------------------------------------------------------------- **Q1: I'm a heavy user with high daily usage. Will I get flagged by mistake?** No. Our risk detection considers a wide range of signals. Users with normal patterns across IP address, conversation behavior, and usage metrics are not typically flagged, regardless of volume. **Q2: Will using a VPN or corporate proxy get me suspended?** Accessing Kimi through a forward proxy (like a VPN or company network) is fine. Sharing your account with others through a reverse proxy is a violation. **Q3: I use Kimi Code across multiple devices and tools at the same time. Will that get me suspended?** No. Switching between devices (e.g., work laptop, personal machine) or different coding tools (Kimi CLI, VS Code, Claude Code) is a completely normal usage pattern. You won't be mistakenly flagged as long as you don't deliberately spoof or alter your client identity. --- # What's New | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#VPContent) On this page What's New [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#what-s-new) ====================================================================================== A record of new features and key fixes across Kimi Code products — focused on the changes most worth knowing about. LatestKimi Code CLI v2.1.0 September 23, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v2-1-0-september-23-2026) ------------------------------------------------------------------------------------------------------------------- #### Fullscreen mode (experimental) [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#fullscreen-mode-experimental) A new experimental fullscreen interface: the transcript scrolls independently, text can be selected with the mouse, fold blocks expand or collapse on click, and a clickable "Jump to bottom" indicator sits at the bottom. Enable it under `/settings` → TUI mode, or set `tui_mode = "fullscreen"` in `~/.kimi-code/tui.toml`, then restart Kimi Code. → [tui.toml](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#tuitoml) #### Faster startup, lower memory [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#faster-startup-lower-memory) Shorter CLI startup time and reduced memory usage — first paint arrives noticeably sooner in large projects. #### File watching is now off by default [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#file-watching-is-now-off-by-default) Filesystem watching for config and workspace files no longer runs by default; to hot-reload AGENTS.md, skills, or MCP config, set `[watch] enabled = true` or `KIMI_CODE_WATCH=1`. → [watch](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#watch) Also in this release: hardened workspace trust boundaries — file tools can no longer reach outside the working directory through symbolic links, and project-local config only takes effect after the workspace is trusted; new `auto_session_title` config to turn off automatic session title generation by clients. → [Config files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#top-level-fields) Kimi Code Desktop Kimi Code Desktop is here September 17, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-code-desktop-is-here-september-17-2026) --------------------------------------------------------------------------------------------------------------------------------------------------------- The Kimi Code desktop client is officially available: it carries the Agent core of Kimi Code CLI into a graphical interface, where you open a project, talk to the Agent, and ship changes in one window. Available now for macOS (Apple Silicon / Intel) and Windows. → [Quick Start](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html) #### Every step stays visible [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#every-step-stays-visible) Tool calls, thinking, and the files changed in each turn are all presented in the interface; sensitive operations raise approval prompts, and three permission modes (Always Ask / Ask When Needed / Never Ask) keep you in control. → [Handle approvals](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#handle-approvals) #### A complete workflow from conversation to delivery [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#a-complete-workflow-from-conversation-to-delivery) Goal mode keeps long-running objectives moving and can be paused, resumed, or cancelled; plan mode proposes an approach before touching files, and the plan can be reviewed and refined; long tasks can move to the background, where you can check progress or stop them at any time. → [Choose a task mode](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#choose-a-task-mode) #### Built-in browser and visual annotation [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#built-in-browser-and-visual-annotation) The browser lives in the right panel, with tabs that stay with the session and page context shared with the Agent; screenshot annotation, text selection comments, `@` file mentions, and element picking on web pages tell the Agent exactly what to change. → [Verify in the terminal](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#verify-in-the-terminal) Download: [macOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) · [macOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) · [Windows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) Kimi Code CLI v2.0.0 September 17, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v2-0-0-september-17-2026) ------------------------------------------------------------------------------------------------------------------- #### New `/desktop` command [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#new-desktop-command) The new `/desktop` slash command (alias `/install-desktop`) and the `kimi install-desktop` subcommand open the desktop app page in your browser, so you can download and install the desktop client without leaving the terminal. → [`kimi install-desktop`](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) #### Mermaid diagrams in the terminal [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#mermaid-diagrams-in-the-terminal) Mermaid code blocks now render as diagrams in the terminal; turn this off under `/settings` → Mermaid diagrams, or set `mermaid = "off"` in the `[markdown]` section of tui.toml. Also in this release: the built-in browser plugin is renamed to Kimi Browser Extension; when accumulated media in a session exceeds 20 MB, the oldest images and videos are omitted from requests with a warning → [Paste images and videos](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#paste-images-and-videos) . Since v2.0.1, a provider's API key can be read from a named environment variable via `api_key_env` instead of being written into the config file → [Config files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#providers) . Kimi Code CLI v0.43.0 September 14, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-43-0-september-14-2026) --------------------------------------------------------------------------------------------------------------------- #### AI session titles in Web, on by default [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#ai-session-titles-in-web-on-by-default) A title is generated automatically after the first turn, and you can regenerate it from the rename box — no more naming sessions by hand. #### Delete sessions from the session selector [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#delete-sessions-from-the-session-selector) Select a session in the session selector, press `Ctrl-X`, then `y` to confirm — cleaning up old sessions is much easier. #### Fairer time budgets in Goal Mode [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#fairer-time-budgets-in-goal-mode) Time budgets no longer count the time while a session is closed, and the 24-hour cap is gone, so long-running goals no longer burn budget while you are away. → [Goal mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#goal-mode) Also in this release: `kimi upgrade` (alias `kimi update`) gains a `-y, --yes` flag to skip the confirmation prompt; the new `KIMI_CODE_PERMISSION_MODE_REMINDER` environment variable (set to `0`) stops injecting auto-permission-mode reminders into the model context. v0.43.1 fixes pressing `Ctrl-C` while a subagent is running quitting the entire CLI — it now only interrupts the running subagent. Model Release K2.8 Preview September 11, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#k2-8-preview-september-11-2026) ------------------------------------------------------------------------------------------------------------------------------- 🎉 **K2.8 Preview** is now fully rolled out in Kimi Code! The Model ID is unchanged — still `kimi-for-coding` — so clients and third-party tools work with no configuration changes. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) #### Performance close to K3, with more efficient thinking [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#performance-close-to-k3-with-more-efficient-thinking) Coding and agent capabilities are improved across the board, with significantly more efficient thinking than K2.7 Code. #### Adjustable thinking effort [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#adjustable-thinking-effort) Same thinking levels as K3: `low` / `high` / `max` (default `max`). With thinking turned off, requests to the K3 series and K2.8 Preview are served by K2.8 Preview (no thinking). #### 1M ultra-long context [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#_1m-ultra-long-context) A context window of up to 1M is available across all membership tiers. Kimi Code CLI v0.42.0 September 9, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-42-0-september-9-2026) ------------------------------------------------------------------------------------------------------------------- #### Remote Control is now generally available [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#remote-control-is-now-generally-available) Remote Control is out of the experimental stage — no experimental flag needed. Take over a local session from your phone or another computer, anywhere. → [Remote Control](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/remote-control.html) #### Sortable media preview bar in the Web input box [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#sortable-media-preview-bar-in-the-web-input-box) Attachments appear in a sortable preview bar, so you can reference images and videos inline in your text, and previews survive queuing and sending. HEIC, HEIF, and BMP images are now supported too. → [Pasting images and video](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#pasting-images-and-video) #### Completed tool calls collapse into summaries [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#completed-tool-calls-collapse-into-summaries) Finished tool calls now collapse into a title plus a one-line result summary, keeping the transcript clean — press `Ctrl-O` to expand the full output. → [Keyboard shortcuts](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/keyboard.html#tool-output) Also in this release: the `/btw` side-chat subagent gains read-only tools; the subagent model pool (`[secondary_model]`) is now always on and its experimental flag has been removed. Kimi Code CLI v0.41.0 September 4, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-41-0-september-4-2026) ------------------------------------------------------------------------------------------------------------------- #### Tower multi-agent collaboration in Web [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#tower-multi-agent-collaboration-in-web) The web version adds an experimental tower multi-agent mode — enable it with the `/tower` command or the plus menu in the input box, and set the base branch with `/tower `. #### Text selection annotations in Web [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#text-selection-annotations-in-web) Select text in messages, file previews, diff and per-turn change panels, or the terminal to add a comment or quote it into the conversation. #### Dangerous commands no longer blocked [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#dangerous-commands-no-longer-blocked) Auto permission mode no longer blocks dangerous commands or commands that cannot be statically analyzed. → [The three permission modes](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#the-three-permission-modes) Also in this release: a new session rating prompt (can be disabled in config); answers to background questions are now delivered directly to the agent instead of through an output file. Kimi Code CLI v0.40.0 September 2, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-40-0-september-2-2026) ------------------------------------------------------------------------------------------------------------------- #### Renamed permission modes and a new dangerous-command guard [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#renamed-permission-modes-and-a-new-dangerous-command-guard) The former YOLO / Auto modes are now Ask When Needed (`/ask-when-needed`) and Never Ask (`/never-ask`); Manual is Always Ask. A built-in dangerous-command guard also ships in this release: commands such as `shutdown`, `reboot`, or `rm -rf` are blocked outright in Never Ask mode and always require your confirmation in the other modes; disable it with `[permission] dangerous_command_guard = false`. → [Interaction & input](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#the-three-permission-modes) #### Subagent model pool graduates from experimental [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#subagent-model-pool-graduates-from-experimental) The `[secondary_model]` subagent settings are now generally available and enabled by default in every launch mode; you can still opt out with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=0` or `[experimental] secondary-model = false`. → [Config files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#secondary-model) #### Plugins panel in web settings [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#plugins-panel-in-web-settings) The web settings now include a Plugins panel for browsing the plugin marketplace and installing, enabling, disabling, or removing plugins. → [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html) Also in this release: Tower mode (experimental) no longer starts on its own — turn it on explicitly with `/tower on` or `/tower `; the new `kimi session list` command lists sessions from the command line. v0.40.1 fixes the kimi-cli migration prompt reappearing after the migration had completed or been dismissed. Kimi Code CLI v0.39.0 August 27, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-39-0-august-27-2026) --------------------------------------------------------------------------------------------------------------- #### Remote control for local web sessions [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#remote-control-for-local-web-sessions) Set `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL=1`, then run `kimi rc`, `kimi web --remote-control`, or `/remote-control` to access a local web session remotely. → [Remote control](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/remote-control.html) #### Experimental Tower multi-agent orchestration [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#experimental-tower-multi-agent-orchestration) Set `KIMI_CODE_EXPERIMENTAL_TOWER=1`, then use `/tower on` and `/tower ` to start Tower mode and coordinate multiple agents toward an objective. #### Fork subagents from the current conversation [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#fork-subagents-from-the-current-conversation) Set `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK=1`, or `subagent_fork = true` under `[experimental]`, to let the subagent and swarm tools use `fork` to start from a snapshot of the calling agent's conversation history. → [Agents and subagents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html) Also in this release: Configure an independent AgentSwarm timeout with `[swarm] timeout_ms` or `KIMI_CODE_SWARM_TIMEOUT_MS`; file tools and Shell now resolve Git Bash paths correctly on Windows. v0.39.1 fixes the web permission mode leaking across sessions, the first typed character being swallowed in an empty composer, and startup hanging on "Connecting…" with many workspaces, and adds a file mode to the OpenIn menu. Kimi Code CLI v0.38.0 August 20, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-38-0-august-20-2026) --------------------------------------------------------------------------------------------------------------- #### New WaitFor tool [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#new-waitfor-tool) The agent can now wait for a background task to finish within the current turn — no need to end the turn and get woken up again. → [Background Tasks](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/tools.html#background-tasks) #### 13 new data sources in Kimi Datasource [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#_13-new-data-sources-in-kimi-datasource) The official data plugin adds Chinese government data (NDA/NBS) and standards (GB/HB/DB/TT), eight international organization datasets (WHO, FAO, UNSD, ECB, Eurostat, UNICEF, OECD, FRED), Xinhua Finance, and Caixin. Update the plugin from the Official tab in `/plugins`. → [Kimi Datasource](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#kimi-datasource) Also in this release: Edit and Write now require reading an existing file before modifying it; overly long `!` shell command output is collapsed automatically — press ctrl+o to expand it together with tool output. Kimi Code CLI v0.37.0 August 18, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-37-0-august-18-2026) --------------------------------------------------------------------------------------------------------------- #### Activate multiple skills in one prompt [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#activate-multiple-skills-in-one-prompt) Type `/` after whitespace in the input to insert a skill tag — a single prompt can now activate multiple skills. Skill slash commands typed while the agent is busy are also queued instead of rejected. → [Invoking a Skill](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/skills.html#invoking-a-skill) #### Web session management upgrade [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-session-management-upgrade) The sidebar gains Open / Done / Workspaces tabs, sessions can be marked as Done, and there's a new dedicated session management page; the search dialog can now search workspaces and scrolls to the selected entry. → [Using Kimi Code in the browser](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/web.html) #### Auto-update for the native Windows CLI [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#auto-update-for-the-native-windows-cli) The single-file Windows CLI now updates itself — no more manual downloads. Also in this release: @-mentioned files, folders, and skills in chat messages render as icon capsules, and the browser tab title shows the current workspace directory; the web Subagent panel is renamed to Background Agent; 0.37.1 fixes pasted images and videos failing to reach the model. Kimi Code CLI v0.36.0 August 13, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-36-0-august-13-2026) --------------------------------------------------------------------------------------------------------------- #### Subagent model pool [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#subagent-model-pool) The experimental subagent model configuration is now a model pool: list candidate models with descriptions under `[secondary_model]`, and the main agent picks one per spawn based on the task; you can also pin a default with `/secondary-model` or `default_model`. Enable it with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`. → [Subagent model pool](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#subagent-model-pool) #### Experimental fullscreen TUI mode [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#experimental-fullscreen-tui-mode) Set `KIMI_CODE_TUI_FULL_SCREEN=1` to switch to a fullscreen alternate-screen UI: scrollable transcript viewport, mouse text selection, clickable links, and Ctrl-Shift-F search. → [Environment Variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html) #### LaTeX math rendering [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#latex-math-rendering) The TUI now renders LaTeX math formulas (`$…$` / `$$…$$`) in messages as Unicode formulas. Also in this release: the workspace trust prompt now shows project MCP launch targets and defaults to declining trust, and untrusted workspaces can no longer plant same-named `fd`/`stty` executables; fixed Ctrl+C being ignored during automatic retries of failed API requests. Kimi Code CLI v0.35.0 August 12, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-35-0-august-12-2026) --------------------------------------------------------------------------------------------------------------- #### Modern Web Guidance plugin in the bundled marketplace [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#modern-web-guidance-plugin-in-the-bundled-marketplace) Run `/plugins` and select Modern Web Guidance to install it and get modern web development guidance. → [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html) #### Live background-subagent progress in the `/tasks` panel [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#live-background-subagent-progress-in-the-tasks-panel) The `/tasks` panel now shows the live work progress of background subagents, so you can follow along without waiting for them to finish. → [Slash Commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html) Also in this release: fixed the token counts reported after compaction reading far below the real context size — they now match the numbers shown while the session runs; fixed coder subagents spawning further subagents by default. Kimi Code CLI v0.34.0 August 6, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-34-0-august-6-2026) ------------------------------------------------------------------------------------------------------------- #### Kimi Computer Use comes to Windows [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-computer-use-comes-to-windows) Kimi Computer Use now supports Windows x64 (Windows 10 1903+ / Windows 11) — install it from the Official tab in `/plugins`. → [Kimi Computer Use](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#kimi-computer-use) #### Cache-expiry reminder [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#cache-expiry-reminder) Resuming a long-idle session or sending a message after a long idle stretch now shows a reminder that the context cache may have expired, with options to compact or start a new session first; set [`cache_expiry_hint`](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#tui-toml) to `false` to disable it. #### `kimi web` stability and experience improvements [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-web-stability-and-experience-improvements) When a model request fails, a failure card now stays in the session with one-click resume; the sidebar session list adds a flat view; subagent tasks show the model and thinking level they use; and the working status shows retry progress (attempt N of M) during automatic retries. Also in this release: browser extension links and activation steps are shown after installing Kimi WebBridge; UTF-16 text files can now be read; `/feedback` works for all signed-in users; fixed `kimi -p` exiting before background tasks and subagents finish; fixed removing an MCP server breaking open sessions (its tools stay visible, but calls fail with a removal notice). Kimi Code CLI v0.33.0 August 5, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-33-0-august-5-2026) ------------------------------------------------------------------------------------------------------------- #### Official built-in plugins: Kimi Computer Use and Kimi WebBridge [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#official-built-in-plugins-kimi-computer-use-and-kimi-webbridge) The Official tab of the `/plugins` marketplace now lists two official built-in capabilities — press Enter to deploy the managed runtime in one step, with retry after interrupted installs and automatic backup of legacy WebBridge skills on upgrade. → [Installation and Management](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#installation-and-management) #### agent-core-v2 engine enabled by default [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#agent-core-v2-engine-enabled-by-default) The interactive TUI, `kimi -p`, `kimi acp`, and other CLI surfaces now run on the agent-core-v2 engine by default; set `KIMI_CODE_LEGACY_FLAG=1` to fall back to the legacy engine if needed. → [Environment Variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html) #### `kimi web` enhancements [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-web-enhancements) The web UI now supports adding and managing custom providers in settings, pinning sessions in the sidebar, setting emoji session titles, and viewing your signed-in account and plan usage. Also in this release: new `/bug` command as an alias for `/feedback`; startup now asks whether to trust the current folder; fixed MCP OAuth re-authorization always failing with `Invalid redirect URI`. Kimi Code CLI v0.32.0 August 4, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-32-0-august-4-2026) ------------------------------------------------------------------------------------------------------------- #### Four new hook events [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#four-new-hook-events) Four new hook events — `TurnStarted`, `UserPromptQueued`, `TaskStarted`, and `SessionHeartbeat` — let you observe turn starts, queued user input, sub-task launches, and session heartbeats by configuring them under `[[hooks]]` in `config.toml`. → [Event Reference](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/hooks.html#event-reference) #### `loop_control` config keys renamed [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#loop-control-config-keys-renamed) `max_retries_per_step` is now `max_attempts_per_step`, and `max_steps_per_run` is now `max_steps_per_turn`. The old keys no longer take effect — a rename warning is shown at startup, so update your config. → [loop\_control](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#loop-control) #### Local token-usage estimation [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#local-token-usage-estimation) A new `[token_counting]` config section: when the provider doesn't report token usage, the context-size display can switch to a local estimate. → [token\_counting](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#token-counting) Also in this release: when the models.dev catalog is unreachable, Kimi Code falls back to a built-in snapshot so known third-party providers can still be imported offline; fixed auto-compaction retrying an oversized request until failure. Kimi Code CLI v0.31.0 July 30, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-31-0-july-30-2026) ----------------------------------------------------------------------------------------------------------- #### Plugins can contribute custom agents [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#plugins-can-contribute-custom-agents) A plugin can now ship its own agents: declare directories in the manifest's `agents` field, or simply place an `agents/` directory at the plugin root. The agent files are discovered automatically while the plugin is enabled and are available for sub-agent delegation. → [Plugin Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#plugin-agents) #### Plugins can inject system-prompt instructions [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#plugins-can-inject-system-prompt-instructions) `kimi.plugin.json` gains `systemPrompt` and `systemPromptPath` fields, letting an enabled plugin contribute instructions to the agent's system prompt — effective in the TUI, `kimi -p`, and `kimi web`. → [System-prompt instructions](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#system-prompt-instructions) #### Markdown-defined custom agents in the TUI [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#markdown-defined-custom-agents-in-the-tui) Markdown agent files, previously limited to `kimi web`, now work in the TUI as well: frontmatter declares the name, description, and tool permissions, and the body is the system prompt. → [Custom Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html#custom-agents) Also in this release: the new `/secondary_model` slash command configures the secondary model used by sub-agents (experimental — enable it in `/experiments` first); TaskOutput is now always non-blocking, returning an immediate snapshot while completion still arrives via automatic notification. Kimi Code CLI v0.30.0 July 29, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-30-0-july-29-2026) ----------------------------------------------------------------------------------------------------------- #### Customizable footer status line [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#customizable-footer-status-line) `tui.toml` gains a `[status_line]` section: arrange the built-in slots (mode, goal, model, tasks, git, and more) with `items`, or plug in your own status-line command with `command`. → [Configuration files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#tui-toml) #### Fail fast when quota runs out [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#fail-fast-when-quota-runs-out) When your account quota or balance is exhausted, Kimi Code now errors immediately instead of silently retrying for about 3 minutes. Also in this release: installing an official plugin that bills against plan quota (like Kimi Datasource) now shows a quota note, and you're nudged to run `/plugins` when a plugin used in the session has an update; repeated invalid tool calls now stop the turn instead of retrying indefinitely. Kimi Code CLI v0.29.1 July 24, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-29-1-july-24-2026) ----------------------------------------------------------------------------------------------------------- #### Web search and web fetch without OAuth [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-search-and-web-fetch-without-oauth) v0.29.1 adds `KIMI_WEB_SEARCH_*` and `KIMI_WEB_FETCH_*` environment variables so you can configure web search and web fetch services without OAuth login. → [Environment variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html#runtime-switches) #### Global default MCP server timeouts [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#global-default-mcp-server-timeouts) `config.toml` and environment variables now support global default MCP server timeouts, so you don't have to set them per server. → [Configuration files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#mcp) Also in this release: experimental secondary-model bindings for newly spawned subagents; fix loss of thinking content with OpenAI-compatible endpoints that return reasoning under a different field name. Kimi Code CLI v0.29.0 July 22, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-29-0-july-22-2026) ----------------------------------------------------------------------------------------------------------- #### Web: Define agents with Markdown files [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-define-agents-with-markdown-files) You can now define your own agents as Markdown files: frontmatter at the top declares name, description, and tool permissions, and the body is the system prompt. Custom agents are discovered automatically by the main agent and delegated alongside built-in sub-agents. → [Agents and Sub-Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html#custom-agents) #### Web: SYSTEM.md overrides the main agent's system prompt [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-system-md-overrides-the-main-agent-s-system-prompt) Write a plain Markdown `$KIMI_CODE_HOME/SYSTEM.md` to permanently override the default main agent's system prompt without passing `--agent` or `--agent-file` every launch; explicitly passed agent files still take precedence. → [Agents and Sub-Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html#overriding-the-main-agent-s-system-prompt-with-system-md) #### Enable/disable tools globally in config.toml [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#enable-disable-tools-globally-in-config-toml) A new `[tools]` table in `config.toml` lets you enable or disable specific tools across all sessions, so you don't have to adjust them manually each time. → [Configuration files](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#tools) Also in this release: videos attached to prompts are now delivered to the model with the prompt itself; the ACP client supports choosing thinking effort; v0.29.1 adds environment variables for web search and web fetch services without OAuth login, plus global default MCP server timeouts in `config.toml`. Kimi Code CLI v0.28.0 July 20, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-28-0-july-20-2026) ----------------------------------------------------------------------------------------------------------- #### `kimi web` runs in the foreground, `kimi server` deprecated [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-web-runs-in-the-foreground-kimi-server-deprecated) `kimi web` now runs in the current terminal foreground and opens the browser automatically; stop it with `Ctrl+C`. The old `kimi server` command tree is deprecated, its subcommands removed, with only `kimi server kill` retained as a fallback for stopping background services launched before v0.28.0. → [kimi web](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-web) #### Thinking effort persists more conservatively [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#thinking-effort-persists-more-conservatively) Thinking effort is now persisted only for levels below a model's top tier (`max`), so switching models no longer leaves you with an empty or unresponsive effort picker when the old `max` setting isn't supported. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#models) Also in this release: the web model switcher now warns that switching models or thinking effort invalidates the existing prompt cache; the YOLO and Auto permission mode descriptions are corrected — YOLO auto-approves tool actions but may still ask questions, while Auto is fully autonomous and never asks. Kimi Code CLI v0.27.0 July 17, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-27-0-july-17-2026) ----------------------------------------------------------------------------------------------------------- #### `/copy` for the last reply [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#copy-for-the-last-reply) New `/copy` slash command copies the last assistant message to the clipboard — no more manually selecting long answers. → [Slash Commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html) #### Auto-refresh of the model list for API key users [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#auto-refresh-of-the-model-list-for-api-key-users) When calling Kimi coding models with an API key, Kimi Code now automatically fetches the latest model list, so new models are usable without manual config changes. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#models) Also in this release: OAuth connection failures now show the underlying network cause (DNS, refused connection, TLS, timeout) instead of a bare `fetch failed`; the built-in URL fetch tool's network safeguards are hardened so crafted domains and redirect chains can no longer reach loopback or internal network services. Model Release Kimi K3 July 16, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-k3-july-16-2026) ----------------------------------------------------------------------------------------------------------- **Kimi K3**, our most capable model to date, is now released and open-sourced, and available in Kimi Code. #### Model scale & architecture [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#model-scale-architecture) 2.8 trillion parameters, built on KDA hybrid linear attention and Attention Residuals — the first open-source model at the 3-trillion-parameter scale. #### Long context & multimodal [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#long-context-multimodal) Native visual understanding with up to 1M-token context, handling large codebases and extended coherent reasoning. #### Coding & agent strengths [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#coding-agent-strengths) Excels at long-horizon programming, game dev / 3D, and knowledge work; sustains long engineering tasks with minimal human supervision across kernel optimization, GPU compilers, chip design, and scientific computing. #### Benchmark positioning [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#benchmark-positioning) A top-tier model that outperforms Opus 4.8, GPT 5.5, and other mainstream models; on challenging coding tasks such as kernel optimization, it performs close to the strongest proprietary models. #### Membership [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#membership) Moderato members and above can use Kimi K3; Allegretto members and above unlock the 1M context window. K3 now supports `low` / `high` / `max` thinking effort levels, so you can pick the right intensity for each task. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) #### Usage tip [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#usage-tip) Switching models invalidates the existing context cache, so consumption is higher right after switching; start a new session before using Kimi K3 for better results and lower consumption. Kimi Code CLI v0.26.0 July 16, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-26-0-july-16-2026) ----------------------------------------------------------------------------------------------------------- #### Coder sub-agent capabilities aligned with the main agent [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#coder-sub-agent-capabilities-aligned-with-the-main-agent) The coder sub-agent now supports background tasks, todo lists, plan mode, skill invocation, and nested agents, so it can handle more complex coding workflows on its own. → [Agents and Sub-Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html) #### Cache-invalidation hints in `/model` and `/effort` [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#cache-invalidation-hints-in-model-and-effort) Switching the model or effort now warns that the existing prompt cache will be invalidated, and suggests using `/new` to avoid extra token costs. → [Slash Commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html) Also in this release: the context-size indicator no longer under-reports the model's actual context usage; a resumed session without new activity is no longer incorrectly marked as just updated. Kimi Code CLI v0.25.0 July 16, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-25-0-july-16-2026) ----------------------------------------------------------------------------------------------------------- #### Attach any file in web chat [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#attach-any-file-in-web-chat) The built-in web UI now supports attaching files of any type in chat: drop a file anywhere on the window to send it, and files, images, and videos are shown as attachment tags in the message bubble. → [Using Kimi Code CLI in IDEs](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/ides.html) #### Aligned Anthropic effort configuration [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#aligned-anthropic-effort-configuration) Anthropic-compatible providers now apply the official effort configuration, with unknown models falling back to a 128k output limit and custom-named models getting correct thinking-strength controls for new sessions. → [Providers and models](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html) Also in this release: model request failures now show full diagnostics; two security issues were fixed — the web server's bearer-token check could be bypassed via percent-encoded API paths, and the session filesystem API could follow symlinks outside the workspace and access host files. Kimi Code CLI v0.24.2 July 15, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-24-2-july-15-2026) ----------------------------------------------------------------------------------------------------------- #### Built-in docs Q&A skill [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#built-in-docs-q-a-skill) A new built-in `/check-kimi-code-docs` answers Kimi Code product questions (CLI usage, configuration, membership, error codes) straight from the official docs, citing source links in its answers — so you no longer have to leave the terminal to look something up. → [Built-in Skill Commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#built-in-skill-commands) Also in this release: the per-step LLM retry cap has been raised from 3 to 10, so transient provider-side failures (429 / overload) are retried automatically before the whole turn fails; and print mode (`kimi -p`) no longer exits after a single turn — as long as background tasks are pending it stays alive and feeds each result back to the main agent (`print_background_mode` now defaults to `steer`, and background tasks and subagents no longer time out by default). Kimi Code CLI v0.24.0 July 14, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-24-0-july-14-2026) ----------------------------------------------------------------------------------------------------------- #### Session export [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#session-export) The web UI can now export a session: run `/export`, or pick "Export session" from a session's overflow menu, to bundle the conversation and troubleshooting logs into a downloadable ZIP (up to 64 MiB) — handy for archiving or filing a report. → [Exporting a session](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/sessions.html#exporting-a-session) #### Foreground commands background on timeout [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#foreground-commands-background-on-timeout) When a foreground `Bash` command hits its timeout it is no longer killed — it moves to the background and keeps running, reporting its result when it finishes, so long-running commands are no longer lost midway. Set `bash_auto_background_on_timeout = false` under `[background]` to restore the kill-on-timeout behavior. → [Built-in Tools · Shell](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/tools.html#shell) Also in this release: forking a session now fully preserves media attachments, plan files, background task output, and cron jobs, and a failed fork no longer leaves a partial copy behind; `kimi web` now defaults to the rebuilt agent engine. Kimi Code HighSpeed & Extra Usage are live July 9, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#highspeed-extra-usage-are-live-july-9-2026) --------------------------------------------------------------------------------------------------------------------------------------------------------- #### ⚡ HighSpeed is now available [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#%E2%9A%A1-highspeed-is-now-available) Kimi Code now offers two tiers — **Standard** and **HighSpeed** — built on the same model with identical coding ability; HighSpeed delivers roughly **5–6× the output speed** of Standard. Switch instantly with `/model` in the CLI, or set the model ID to `kimi-for-coding-highspeed` in third-party tools. HighSpeed requires an [Allegretto](https://www.kimi.com/membership/pricing?from=kfc_membership_topbar&track_id=a7764d49-73ad-4d08-b2f3-a8d7433917f8) plan or above. → [How to Switch Models](https://www.kimi.com/code/docs/en/kimi-code/models.html#switch-model) #### Extra Usage is now available [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#extra-usage-is-now-available) When your subscription quota runs out, keep making requests with your Extra Usage balance — it **bypasses the monthly / weekly / hourly membership quota limits**, works whenever any limit is reached, only deducts the Extra Usage balance, and doesn't affect your membership quota refresh. Only subscribed members can enable it, at Kimi homepage → Settings → Membership Plan → My Quota. → [About Extra Usage](https://www.kimi.com/code/docs/en/kimi-code/membership.html#extra-usage) Kimi Code CLI v0.23.0 July 6, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-23-0-july-6-2026) --------------------------------------------------------------------------------------------------------- #### Archived sessions [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#archived-sessions) The web UI adds an Archived sessions page where you can browse and restore archived sessions in one click — open Settings → Archived to view them. #### Reasoning preserved across turns [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#reasoning-preserved-across-turns) With Thinking enabled, Kimi models now keep their reasoning across turns by default so the model can build on its earlier thought; set `[thinking] keep = "off"` to disable it. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#thinking) #### Compaction summary at a glance [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#compaction-summary-at-a-glance) After the context is compacted, the TUI shows a summary of what was compacted; press `Ctrl-O` to show or hide it within the compaction block — the same shortcut that collapses tool output. → [Interaction and input](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#during-streaming-output) Also in this release: an experimental on-demand tool loader (`select_tools`) — with the `tool-select` flag enabled, capable models load MCP tools on demand instead of sending them all on every request, preserving the provider's prompt cache; and sessions that existed on disk but were missing from the list or returned 404 on direct access are fixed, as the server now rebuilds the session index on startup. Kimi Code CLI v0.22.0 July 2, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-22-0-july-2-2026) --------------------------------------------------------------------------------------------------------- #### Automatic oversized-image compression [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#automatic-oversized-image-compression) Images that exceed model limits are now automatically downsampled and re-encoded before reaching the model, cutting vision-token cost and avoiding provider image-size errors. #### Model configuration overrides [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#model-configuration-overrides) A new `[models."".overrides]` table lets you override model metadata after provider-catalog refreshes — useful for pinning thinking-effort levels, default effort, and other fields so custom configs survive refreshes. → [Model configuration](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#model-overrides) #### New web UI design system [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#new-web-ui-design-system) The built-in web UI gets a refreshed design system with updated colors, typography, spacing, light and dark palettes, and subtler enter/exit and expand/collapse animations for a more consistent look and feel. Also in this release: a new Cmd/Ctrl+K session-search palette filters by title, workspace, and recent prompt; consecutive tool calls are now grouped into a collapsible stack with diff line counts and inline previews for image, video, and audio results. Kimi Code CLI v0.21.0 July 1, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-21-0-july-1-2026) --------------------------------------------------------------------------------------------------------- #### Plugins can provide slash commands [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#plugins-can-provide-slash-commands) Plugins can now declare slash commands via a `commands` field in their manifest, registered as `:` and invoked with `$ARGUMENTS` expansion — turning common workflows into commands with no extra setup. → [Plugin slash commands](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#plugin-slash-commands) #### Mermaid diagrams in web chat [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#mermaid-diagrams-in-web-chat) Fenced `mermaid` blocks in assistant responses now render as diagrams in the built-in web UI, and KaTeX math and Mermaid parsing run in Web Workers to keep the UI responsive during live streaming. Kimi Code CLI v0.20.2 June 29, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-20-2-june-29-2026) ----------------------------------------------------------------------------------------------------------- #### Video input and Anthropic-compatible protocol [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#video-input-and-anthropic-compatible-protocol) Kimi Code now supports the Anthropic-compatible protocol, and the `ReadMediaFile` tool can send video to the model as multimodal content — availability follows the current model's `image_in` / `video_in` capabilities. → [Built-in tools](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/tools.html#file-tools) #### Web completion sound and notifications [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-completion-sound-and-notifications) The built-in web UI gains a completion sound, a completion notification, and an issue notification, each with its own toggle in settings. Issue notifications are off by default; only after you opt in is the issue text pushed to the desktop. #### Custom outbound request headers [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#custom-outbound-request-headers) A new `KIMI_CODE_CUSTOM_HEADERS` environment variable lets you customize headers on outbound LLM requests (one `Name: Value` per line), and a `User-Agent` header is now sent to non-Kimi providers. Also in this release: a provider 413 context overflow now recovers by compacting and retrying first, and compaction output is capped at 128k tokens by default to avoid provider `max_tokens` errors. Kimi Code CLI v0.20.0 June 26, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-20-0-june-26-2026) ----------------------------------------------------------------------------------------------------------- #### Shell mode [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#shell-mode) Type `!` in the input box to enter shell mode and run terminal commands without leaving the conversation — output is written into the context for later turns. For long-running commands, press `Ctrl+B` to move them into the background. For example, run `!gh auth login` to sign in to the GitHub CLI without opening a new terminal. → [Shell mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#shell-mode) #### Expose the web server to the internet [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#expose-the-web-server-to-the-internet) `kimi web` gains a `--host` option to expose the web server beyond your local machine, hardened with token authentication and rate limiting so you can reach the session UI from a remote box. → [kimi web](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-web) #### Redesigned plugin manager [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#redesigned-plugin-manager) `/plugins` is now a single tabbed panel: **Installed** to manage installed plugins, **Official** for the Kimi-maintained marketplace, **Third-party** for marketplace plugins from other publishers, and **Custom** to install from a GitHub URL, zip, or local path — switch tabs with `Tab` / `Shift-Tab`. A confirmation prompt now appears before installing third-party plugins. → [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#installation-and-management) Also in this release: fixed a startup crash on Linux caused by a native clipboard error, and `/reload` now refreshes plugin Skills so plugin changes take effect in the current session without starting a new one. Kimi Code CLI v0.19.0 June 22, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-19-0-june-22-2026) ----------------------------------------------------------------------------------------------------------- #### Extra workspace directories [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#extra-workspace-directories) You can now add directories beyond your working directory to a session: use `/add-dir ` to add one to the current session, or `kimi --add-dir ` at startup. When you choose to remember a directory, the path is written to the project-level `.kimi-code/local.toml` so it applies automatically in every session of that project. → [Project-local configuration](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#project-local-configuration) #### Background tasks [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#background-tasks) Press `Ctrl+B` to move long-running foreground commands and sub-agents into the background, freeing up the session to continue, and view their status from the `/tasks` panel. → [Session Management](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#session-management) Also in this release: provider safety-policy blocks are now surfaced instead of being silently treated as a completed turn, and the file-mention experience is improved. Kimi Code CLI v0.18.0 June 18, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-18-0-june-18-2026) ----------------------------------------------------------------------------------------------------------- #### Web session filtering and lazy loading [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#web-session-filtering-and-lazy-loading) The web sidebar gains a session filter that matches on title and the most recent user prompt, and the chat view lazy-loads earlier messages as you scroll up — making long sessions easier to browse. → [kimi web](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-web) #### Cap AgentSwarm ramp-up concurrency [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#cap-agentswarm-ramp-up-concurrency) A new `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` environment variable limits how many sub-agents AgentSwarm runs at once during its initial ramp-up, making large swarms less likely to hit provider rate limits. → [Runtime switches](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html#runtime-switches) Also in this release: the web app no longer loads only the 20 most recent sessions, and web settings now display the current version. Kimi Code CLI v0.17.0 June 17, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-17-0-june-17-2026) ----------------------------------------------------------------------------------------------------------- #### Kimi Code Web Mode [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-code-web-mode) A new web mode you can launch with `kimi web` or the in-CLI `/web`, continuing the current session in a browser chat interface. `kimi web` is an alias for `kimi server run --open` — it starts the local server in the background and opens the web UI automatically. → [kimi web](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-web) Also in this release: when an OAuth token refresh still fails after internal retries, the underlying connection error is shown instead of a misleading re-login prompt; and `kimi web` failing to start in the background is fixed (v0.17.1). Kimi Code CLI v0.16.0 June 16, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-16-0-june-16-2026) ----------------------------------------------------------------------------------------------------------- #### `kimi vis` session visualizer [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-vis-session-visualizer) A new built-in `kimi vis` command launches the session visualizer in your browser, pointed at your local sessions, so you can see a whole session unfold at a glance. It supports `--port`/`--host`, `--no-open`, and `kimi vis ` to deep-link straight to a specific session. → [kimi vis](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-vis) Also in this release: Anthropic-compatible providers no longer read ambient Anthropic shell credentials and custom headers, avoiding accidental credential leakage; and repeated compaction is fixed for cases where context stays over the blocking threshold. Kimi Code CLI v0.15.0 June 15, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-15-0-june-15-2026) ----------------------------------------------------------------------------------------------------------- #### All-sessions picker [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#all-sessions-picker) A new all-sessions picker view lets you browse sessions across every working directory, search them by name, page through the list, and copy a ready-to-run resume command for sessions started elsewhere. #### Reasoning follows your language [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#reasoning-follows-your-language) The same-language rule now extends to the model's reasoning, so its thinking follows the language you use while keeping code and technical terms in their original form. Also in this release: MCP now supports legacy SSE servers alongside stdio and streamable HTTP transports (→ [connection methods](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/mcp.html#connection-methods) ); and TUI components now wrap, compact, or truncate over-wide content to stay readable in narrow terminals. Model Release Kimi K2.7 Code June 12, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-k2-7-code-june-12-2026) ------------------------------------------------------------------------------------------------------------------------- **Kimi K2.7 Code**, our latest coding model, is now released and open-sourced — and available in Kimi For Coding. The new model takes effect only with Thinking On (thinking mode enabled). #### Improved coding & agent performance over K2.6 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#improved-coding-agent-performance-over-k2-6) +10.4% on Program-Bench, +11.4% on MCP Mark Verified, and +76.2% on SWE Marathon. #### Reasoning efficiency [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#reasoning-efficiency) Less overthinking, with 30% lower reasoning-token usage compared to K2.6. #### Long-horizon coding [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#long-horizon-coding) Improved instruction following and higher end-to-end coding task success rates. #### ⚡ Kimi K2.7 Code HighSpeed Edition (beta coming soon) [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#%E2%9A%A1-kimi-k2-7-code-highspeed-edition-beta-coming-soon) The same model at roughly 5-6× the output speed. Kimi Code CLI v0.14.0 June 10, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-14-0-june-10-2026) ----------------------------------------------------------------------------------------------------------- #### `Interrupt` hook event [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#interrupt-hook-event) When you interrupt a turn (for example by pressing Esc), hooks now receive a dedicated `Interrupt` event — it fires in place of `Stop`, so external tooling no longer mistakes an interrupted turn for one that is still running. Programmatic interruptions such as timeouts don't trigger it. → [Event reference](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/hooks.html#event-reference) #### Kimi Datasource adds legal data [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-datasource-adds-legal-data) The official data plugin is now at v3.2.0, adding Chinese laws, regulations, and judicial cases — coverage now spans five data domains: stock market, macroeconomics, corporate registry, academic literature, and legal. → [Plugin overview](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#kimi-datasource) Also in this release: images in tool outputs are no longer dropped when using OpenAI-compatible Chat Completions; since v0.13.1, running `/undo` without a count opens an interactive picker for choosing which prompts to roll back (→ [Session management](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#session-management) ). Kimi Code CLI v0.13.0 June 10, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-13-0-june-10-2026) ----------------------------------------------------------------------------------------------------------- #### Custom color themes [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#custom-color-themes) Beyond the built-in dark and light palettes, you can now define your own as a JSON file — override only the colors you care about, the rest fall back to a base palette, and the file name becomes the theme name. Or run `/custom-theme` and let Kimi pick colors with you and write the theme file into `~/.kimi-code/themes/`. → [Custom themes](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/themes.html) #### `/import-from-cc-codex` one-step import [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#import-from-cc-codex-one-step-import) Import selected instructions, Skills, and MCP settings from Claude Code and Codex — no need to reconfigure everything by hand when moving to Kimi Code. → [Built-in skill commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#built-in-skill-commands) Also in this release: the marketplace list now flags installed plugins that have updates available — select one and press `Enter` to upgrade (→ [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#installation-and-management) ); device login keeps the URL and code visible when the browser fails to open. Kimi Code CLI v0.12.0 June 9, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-12-0-june-9-2026) --------------------------------------------------------------------------------------------------------- #### `/swarm` multi-agent parallel tasks [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#swarm-multi-agent-parallel-tasks) Use `/swarm ` to start swarm mode — multiple agents work on the same objective in parallel, with live progress display and rate-limit-aware automatic retries. Swarm mode exits automatically when the task completes. → [Slash commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#modes-run-control) #### Proxy support [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#proxy-support) The standard `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, and `NO_PROXY` environment variables are now fully honored, including SOCKS proxies (`socks5://`, `socks4://`, and similar schemes). Loopback addresses always bypass the proxy, so local MCP servers on localhost continue to work after setting one. → [Environment variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html) #### Goals, background questions, and Sub-Skill discovery are now stable [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#goals-background-questions-and-sub-skill-discovery-are-now-stable) These three features no longer require experimental opt-ins and are available by default. Micro compaction is also enabled by default — it trims older oversized tool results to reduce context overhead. To opt out, set `experimental.micro_compaction = false` in `config.toml`. (Removed in v0.22.1.) Also in this release: Homebrew installations are detected and updated with `brew upgrade kimi-code`; Skills and global agent instructions load from `KIMI_CODE_HOME` when set; long shell commands in approval prompts now wrap to show the full command; multiple goal mode and ACP routing fixes. Kimi Code CLI v0.11.0 June 5, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-11-0-june-5-2026) --------------------------------------------------------------------------------------------------------- #### Built-in Skills as direct slash commands [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#built-in-skills-as-direct-slash-commands) Built-in Skills (such as `update-config`) now appear directly in the slash command panel — no `skill:` prefix needed. Type `/` and they show up immediately, grouped ahead of external Skills. → [Slash commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#skill-dynamic-commands) #### Sub-Skill discovery (experimental) [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#sub-skill-discovery-experimental) A new experimental Sub-Skill system ships built-in `sub-skill.review` (audit existing Skills) and `sub-skill.consolidate` (merge Skills into hierarchical groups). Enable with `KIMI_CODE_EXPERIMENTAL_SUB_SKILL=1`. → [Agent Skills](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/skills.html) Also in this release: YOLO mode now asks for confirmation before starting a goal and suggests switching to Auto for unattended work; sub-agents show resume instructions on timeout; multiple goal queue bug fixes. Kimi Code CLI v0.10.0 June 4, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-10-0-june-4-2026) --------------------------------------------------------------------------------------------------------- #### Goal queue [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#goal-queue) Use `/goal next ` to line up upcoming tasks — when the current goal completes, Kimi picks up the next one automatically, no waiting, no manual trigger. Open `/goal next manage` to reorder the queue interactively. → [Using Goals](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#goal-mode) #### Experimental features panel (`/experiments`) [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#experimental-features-panel-experiments) Type `/experiments` in the TUI to open a visual toggle panel — flip a switch, confirm, and Kimi writes the change to `config.toml` and reloads the session. No manual config editing needed. #### New built-in `update-config` Skill [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#new-built-in-update-config-skill) You can now ask Kimi to edit its own configuration files directly. This release also includes: `/reload` to hot-reload the session after config changes (→ [Slash commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#account-configuration) ); `kimi doctor` to validate config file syntax (→ [kimi doctor](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-doctor) ); Windows now fails early when Git Bash is missing. Kimi Code CLI v0.9.0 June 3, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-9-0-june-3-2026) ------------------------------------------------------------------------------------------------------- #### `kimi acp` subcommand [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-acp-subcommand) Connect the CLI to your IDE via the ACP (Agent Client Protocol) — Zed, JetBrains AI Chat, and other editors can directly drive Kimi's sessions and tool calls without switching to a browser or terminal. → [Use in IDEs](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/ides.html) #### `/btw` side-channel conversation [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#btw-side-channel-conversation) Open a side conversation without interrupting the current main turn — ask a quick question or add context without affecting the Agent's main task. Entering `/btw` with no content opens the panel and waits for your input. → [Slash Commands](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#information-status) Also: fixed `Ctrl-G` external editor invocation on Windows; unified TUI dialog and selector interaction. Kimi Code CLI v0.8.0 June 2, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-8-0-june-2-2026) ------------------------------------------------------------------------------------------------------- #### Autonomous Goal mode (experimental) [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#autonomous-goal-mode-experimental) Start with `/goal ` and Kimi will work toward that goal across multiple turns until it's done or hits a decision point that needs you. → [Autonomous goal](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/slash-commands.html#autonomous-goal) #### Background structured questions [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#background-structured-questions) When the Agent needs a decision from you, it parks that question in the background and keeps working on other steps — no more blocking on a single small choice. → [AskUserQuestion](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/tools.html#collaboration-tools) #### `kimi provider` subcommand [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-provider-subcommand) Add or remove providers directly from the terminal without entering the TUI — useful for scripts and CI. → [kimi provider](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-provider) Also: **background auto-update** is now on by default (disable in `tui.toml`); **context compaction** ([`/compact`](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/sessions.html#context-compression) ) now attaches the to-do list to the summary so the Agent doesn't forget where it left off. Kimi Code CLI v0.7.0 June 2, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-7-0-june-2-2026) ------------------------------------------------------------------------------------------------------- #### `/provider` interactive provider manager [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#provider-interactive-provider-manager) Type `/provider` in the TUI to open a visual interface for viewing, adding, and removing providers — no more manually editing config files to switch models. → [Platforms & Models](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html#provider-%E2%80%94-interactive-provider-management) #### `KIMI_MODEL_ADAPTIVE_THINKING` environment variable [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-model-adaptive-thinking-environment-variable) When connecting to a custom endpoint, force-specify whether adaptive thinking is enabled instead of relying on model-name inference. → [Model fields](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#models) Also: scheduled task trigger times now display in **local timezone**. Kimi Code CLI v0.6.0 May 29, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-6-0-may-29-2026) ------------------------------------------------------------------------------------------------------- #### `KIMI_MODEL_*` environment variable channel [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#kimi-model-environment-variable-channel) Set a few environment variables to temporarily switch models without touching config files — changes expire on restart, ideal for testing or CI. → [Define a model via environment variables](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html#define-a-model-from-environment-variables-kimi-model) #### Install plugins directly from a GitHub URL [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#install-plugins-directly-from-a-github-url) Paste a repo link to install community plugins, with support for pinning specific versions. The plugin manager labels each install with a trust level. → [Installation & Management](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#installation-and-management) #### Removed default step limit [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#removed-default-step-limit) The per-turn 1000-step cap is gone — long tasks no longer get force-interrupted. → [loop\_control](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#loop-control) Kimi Code CLI v0.5.0 May 28, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-5-0-may-28-2026) ------------------------------------------------------------------------------------------------------- #### Scheduled tasks [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#scheduled-tasks) Set timed schedules or one-off reminders in natural language — Kimi executes automatically at the right time without you having to watch. → [Scheduled Tasks](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/tools.html#scheduled-tasks) #### `/auto` permission mode [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#auto-permission-mode) A more restrained automation mode than `/yolo` — tool approvals are handled automatically, but the Agent won't ask you questions. Good for unattended runs where you don't want to fully open the gates. → [Interaction & Input](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#the-three-permission-modes) Kimi Code CLI v0.4.0 May 27, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-4-0-may-27-2026) ------------------------------------------------------------------------------------------------------- #### Plugin system launched [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#plugin-system-launched) Install plugin packages that bundle Skills and MCP servers. The official marketplace is live, with Kimi Datasource as the first published plugin. → [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html) #### Session export [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#session-export-1) Export conversation history as a Markdown file, or package it as a ZIP to submit feedback. → [Sessions & Context](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/sessions.html#exporting-a-session) #### Permission system redesign [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#permission-system-redesign) Read-only operations outside the working directory no longer trigger approval prompts — fewer unnecessary interruptions. → [Permission config](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#permission) Kimi Code CLI v0.2.0 – v0.3.0 May 26, 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-2-0-%E2%80%93-v0-3-0-may-26-2026) --------------------------------------------------------------------------------------------------------------------------------- #### OpenAI-compatible reasoning models work out of the box [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#openai-compatible-reasoning-models-work-out-of-the-box) DeepSeek, Qwen, One API, and other models with thinking tokens need no extra configuration. → [openai provider](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html#openai) #### `/logout` with provider selection [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#logout-with-provider-selection) A provider picker now appears on logout to avoid accidentally logging out of the wrong provider. #### `/connect` command [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#connect-command) Search a public directory of providers and configure one in a single step — no need to write config files by hand. (Superseded by `/provider` in v0.7.0.) Kimi Code CLI v0.1.0 May 2026 [​](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html#v0-1-0-may-2026) ------------------------------------------------------------------------------------------------ **Kimi Code CLI — initial release.** The entire codebase has been rewritten from Python / uv to TypeScript / Node.js. This isn't an incremental update — it's a new foundation, with a redesigned architecture, installation flow, and configuration format. Key differences from the legacy kimi-cli: | | Legacy kimi-cli | Kimi Code CLI | | --- | --- | --- | | Runtime | Python + uv | Node.js (no Python dependency) | | Install | `uv tool install` | One-line `curl` script or `npm install -g` | | Config file | `~/.kimi/config.toml` | `~/.kimi-code/config.toml` (incompatible format) | | Terminal UI | Basic text output | Full TUI (chat view + status bar + approval panel) | | Startup speed | Slower (Python cold start) | Faster (Node.js native binary) | | Multi-provider | Limited | Built-in Anthropic / OpenAI / Gemini / Vertex, and more | | Sub-agents | Not supported | Built-in coder / explore / plan sub-agents | | Plugin system | Not supported | Supported (since v0.4.0) | | Scheduled tasks | Not supported | Supported (since v0.5.0) | Existing kimi-cli data (config, sessions, MCP declarations) can be migrated in one step with `kimi migrate`. → [Version Upgrade](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/migration.html) --- # Error Reference | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#VPContent) On this page Error Reference [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#error-reference) ====================================================================================================== This document covers **server-side errors** and **tool call errors** you may encounter when calling the Kimi Code API, including authentication, rate limiting, request format, and internal server issues. If you are experiencing client-side problems (such as CLI installation failures, IDE connection issues, MCP configuration errors, etc.), please refer to the [FAQ](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#) . Find the relevant entry in the table below based on the error message shown in your terminal or client, and follow the guidance provided. Note If you are using a third-party client such as OpenCode or Claude Code, the client may transform or re-wrap error codes, so the code you see may differ from what is documented here. In that case, **focus on the text content of the error message** and match keywords in the quick lookup table below. Quick Lookup [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#quick-lookup) ------------------------------------------------------------------------------------------------ Errors fall into two groups: **model call errors** occur while the model is generating a response (authentication, rate limiting, request format, etc.), while **tool call errors** occur while the AI is executing a tool call (such as reading a web page or processing an image). Match keywords in the corresponding table below based on where the error originates. ### Model calls [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#model-calls) | Error keyword | HTTP status | Jump to | | --- | --- | --- | | `The API Key appears to be invalid or may have expired` | 401 | [Authentication Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-api-key) | | `Invalid Authentication` | 401 | [Authentication Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-authentication) | | `Your current subscription does not have access to k3` | 401 | [Permission Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#no-k3-access) | | `Your current plan supports only kimi-k3 up to 256K context` | 401 | [Permission Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#no-1m-access) | | `Your current subscription does not have access to kimi-for-coding-highspeed` | 401 | [Permission Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#highspeed-model-access-denied) | | `Your model id does not exist, recognized as other:` | 401 | [Permission Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#model-id-does-not-exist) | | `unable to verify your membership benefits` | 402 | [Membership Benefit Unavailable](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#unable-to-verify-membership) | | `You've reached your 5-hour usage limit` | 403 | [Quota & Account Limits](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#_5-hour-rolling-quota-reached) | | `You've reached your weekly (7-day) usage limit` | 403 | [Quota & Account Limits](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#weekly-7-day-quota-exhausted) | | `You've reached your monthly usage limit for this billing cycle` | 403 | [Quota & Account Limits](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#monthly-kimi-quota-exhausted) | | `You've reached your concurrent request limit` | 403 | [Quota & Account Limits](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#concurrent-request-limit) | | `We're receiving too many requests` | 429 | [Rate Limits & Overload](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#too-many-concurrent-requests) | | `The engine is currently overloaded` | 429 | [Rate Limits & Overload](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#inference-engine-overloaded) | | `total message size N exceeds limit 2097152` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#message-body-exceeds-context-limit) | | `Your request exceeded model token limit: 262144` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#token-limit-exceeded) | | `thinking is enabled but reasoning_content is missing` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#missing-reasoning-content-field) | | `unsupported image url` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#unsupported-image-url) | | `function name ... is duplicated` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#duplicate-tool-name) | | `The request was rejected because it was considered high risk` | 400 | [Request Format Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#content-safety-rejection) | | `Not found the model kimi-for-coding or Permission denied` | 404 | [Resource Not Found](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#model-not-found) | | `method not found` | 404 | [Resource Not Found](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#endpoint-not-found) | | `bot_id ... value does not match id_kinds` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-bot-id-format) | | `failed to connect to ... database=membership_` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#database-connection-failed) | | `FATAL: terminating connection due to administrator command` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#database-connection-failed) | | `failed to evaluate rate limit script` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#internal-connection-error) | | `i/o timeout` / `conn closed` / `bad connection` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#internal-connection-error) | | `503 Service Unavailable` / `504 Gateway Timeout` / `502 Bad Gateway` | 500 | [Internal Server Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#downstream-service-unavailable) | ### Tool calls [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#tool-calls) | Error keyword | HTTP status | Jump to | | --- | --- | --- | | `context canceled` | 499 | [Tool Call Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#request-canceled) | | `url2text` / `spider checkUrl failed` / `invalid html` | 500 | [Tool Call Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#web-page-read-failed) | | `image_url:moderation request error` | 500 | [Tool Call Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#image-moderation-failed) | | `We consider the current URL poses a security risk` | 403 | [Tool Call Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#url-security-risk-blocked) | | `invalid_url: The provided URL is invalid` | 400 | [Tool Call Errors](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-url-format) | Authentication Errors [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#authentication-errors) ------------------------------------------------------------------------------------------------------------------ **HTTP 401** The request did not carry valid credentials, or the credentials have expired. The server validates identity before processing any request — 401 means this step failed. **Do not retry**; fix the credentials and resend the request. ### Invalid API Key [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-api-key) error, status code: 401, message: The API Key appears to be invalid or may have expired. Please verify your credentials and try again. The API Key is incorrect, or the key has been revoked or expired in the console. **How to fix:** * **Typo in key**: Check for extra spaces or missing characters * **Key revoked or expired**: Go to [Console](https://www.kimi.com/code/console?from=kfc_overview_topbar) › API Keys and verify the key's status * **Environment variable override**: Check whether a `KIMI_API_KEY` or `OPENAI_API_KEY` environment variable is overriding your config file — run `echo $KIMI_API_KEY` to check ### Invalid Authentication [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-authentication) error, status code: 401, message: Invalid Authentication The request did not carry valid credentials, or uses an unsupported authentication format. **How to fix:** The most common cause is accidentally using an API key or Base URL from the Kimi Open Platform. Kimi Code and the [Kimi Open Platform](https://platform.kimi.com/) are two separate systems — keys and Base URLs are not interchangeable: * Kimi Code: get your key from the [Console](https://www.kimi.com/code/console?from=kfc_overview_topbar) , Base URL is `https://api.kimi.ai/coding/v1` (OpenAI protocol) or `https://api.kimi.ai/coding/` (Anthropic protocol) * Open Platform: get your key from [platform.kimi.com](https://platform.kimi.com/) , Base URL is `https://api.moonshot.ai/v1` Membership Benefit Unavailable [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#membership-benefit-unavailable) ------------------------------------------------------------------------------------------------------------------------------------ **HTTP 402** The server cannot verify the subscription status of the current account. This is usually a temporary issue. ### Unable to Verify Membership [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#unable-to-verify-membership) error, status code: 402, message: We're unable to verify your membership benefits at this time. Please ensure your membership is active. **How to fix:** * Confirm your Kimi Code subscription is still active * Wait a moment and retry * Check your subscription status in the [Console](https://www.kimi.com/code/console?from=kfc_overview_topbar) * If the issue persists, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to consult our support team Permission Errors [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#permission-errors) ---------------------------------------------------------------------------------------------------------- **HTTP 401** The request is correctly formatted and identity is verified, but the current account's subscription tier does not include the requested capability (such as K3, 1M context, or the HighSpeed model). **Retrying is pointless** — upgrade your plan or adjust the request. For quota and concurrency issues, see [Quota & Account Limits](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#quota-account-limits) and [Rate Limits & Overload](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#rate-limits-overload) . ### No K3 Access [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#no-k3-access) error, status code: 401, message: Your current subscription does not have access to k3. Upgrade to higher-tier Kimi Code plans. Upgrade: Upgrade: https://www.kimi.com/code?from=server_highspeed_error#pricing Your current subscription does not include access to `k3`. Calling K3 requires a Moderato / Plus plan or above. **How to fix:** * [Upgrade](https://www.kimi.com/code/#pricing) to a Moderato / Plus plan or above to call `k3` * If you prefer not to upgrade, keep using the standard model `kimi-for-coding` ### No 1M Access [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#no-1m-access) error, status code: 401, message: Your current plan supports only k3 up to 256K context. 1M context is available on higher-tier Kimi Code plans. Upgrade: https://www.kimi.com/code?from=server_k3_error#pricing Your current plan only supports up to 256K context when calling `k3`. To use up to 1M context, upgrade to an Allegretto / Pro plan or above. When calling `k3-256k` directly with context over 256K, the server returns `k3-256k supports only 256K context.` — compact the context or switch to `k3`. **How to fix:** * [Upgrade](https://www.kimi.com/code/#pricing) to an Allegretto / Pro plan or above to use `k3` with up to 1M context * If you prefer not to upgrade, keep using `k3` with 256K context, or switch to the standard model `kimi-for-coding` ### Model ID Does Not Exist [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#model-id-does-not-exist) error, status code: 401, message: Your model id does not exist, recognized as other:. Please set model id as ``. The model ID used in the request is not recognized by the model side. A common cause is using a format that's only valid in a specific scenario in an entry that doesn't support it. For example, the `k3[1m]` form (with surrounding quotes) is only needed in Claude Code environment-variable configurations to explicitly request a 1M context window. In API requests or other third-party tools' Model ID fields, use `k3` directly. **How to fix:** * Check the actual model id shown after `recognized as other:` in the error message and make sure it has no typos or extra symbols * If configuring Claude Code environment variables, make sure you followed the example in [Using in More Third-Party Tools](https://www.kimi.com/code/docs/third-party-tools/claude-code.html) , including the surrounding quotes * For API requests or other third-party tools, change the Model ID to the standard form (e.g. `k3`, `kimi-for-coding`, `kimi-for-coding-highspeed`) instead of the Claude Code env-only `k3[1m]` form ### HighSpeed Model Access Denied [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#highspeed-model-access-denied) error, status code: 401, message: Your current subscription does not have access to kimi-for-coding-highspeed. Upgrade to higher-tier Kimi Code plans. Upgrade: Upgrade: https://www.kimi.com/code?from=server_highspeed_error#pricing Your current subscription does not include access to the high-speed model `kimi-for-coding-highspeed`. It is the same model as the standard `kimi-for-coding`, but with roughly 5–6x faster output, and requires an Allegretto / Pro plan or above. **How to fix:** * [Upgrade](https://www.kimi.com/membership/pricing?from=server_highspeed_error) to an Allegretto / Pro plan or above to unlock the high-speed model * If you prefer not to upgrade, keep using the standard model `kimi-for-coding` — identical capabilities, just slower output Quota & Account Limits [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#quota-account-limits) ------------------------------------------------------------------------------------------------------------------ **HTTP 403** Account-side limits have been reached, in two kinds: quota errors are account usage issues — **retrying is pointless**; wait for the window to reset, purchase extra usage, or upgrade your plan. The concurrent request limit is triggered by risk-control policy, is unrelated to your remaining quota, and follows the appeal process. ### 5-Hour Rolling Quota Reached [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#_5-hour-rolling-quota-reached) error, status code: 403, message: You've reached your 5-hour usage limit. Your quota will reset when the current 5-hour window ends. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota The call volume within the current 5-hour rolling window has reached its limit. **How to fix:** * Wait for the current 5-hour window to end and the quota to reset; check the reset time in the [Console](https://www.kimi.com/code/console?from=kfc_overview_topbar) * Go to the [Subscription page](https://www.kimi.com/membership/subscription?tab=quota) to purchase extra usage or upgrade your plan for a higher limit ### Weekly (7-Day) Quota Exhausted [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#weekly-7-day-quota-exhausted) error, status code: 403, message: You've reached your weekly (7-day) usage limit. Your quota will reset when the current 7-day window ends. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota Kimi Code subscription quota refreshes every 7 days, and the quota in the current 7-day window has been fully used. This error only applies to existing members on legacy plans (Andante / Moderato / Allegretto / Allegro); new members (Go / Plus / Pro / Max / Ultra) are not subject to the weekly quota limit and never trigger this error. **How to fix:** * Wait for the current 7-day window to end and the quota to refresh; view usage details in the [Console](https://www.kimi.com/code/console?from=kfc_overview_topbar) * Go to the [Subscription page](https://www.kimi.com/membership/subscription?tab=quota) to purchase extra usage or upgrade your plan for a higher quota ### Monthly Kimi Quota Exhausted [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#monthly-kimi-quota-exhausted) error, status code: 403, message: You've reached your monthly usage limit for this billing cycle. Your quota will be refreshed in the next cycle. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota Your Kimi [monthly quota](https://www.kimi.com/membership/subscription) has been fully consumed. All Kimi membership benefits — including PPT, Agent Cluster, Kimi Code, etc. — share the same monthly quota. Once the total quota is exhausted, further requests cannot be made even if Kimi Code still has remaining quota. You must wait for the quota to automatically reset next month or upgrade your plan. See [Kimi Membership Credits](https://www.kimi.com/membership-credits) for details. When the quota is exhausted, your account enters a frozen state, as shown below: ![Monthly quota exhausted — frozen state](https://www.kimi.com/code/docs/%E6%9C%88%E9%A2%9D%E5%BA%A6%E5%86%BB%E7%BB%93%E8%8B%B1%E6%96%87%E7%89%88.png) **How to fix:** * Wait for automatic reset at the start of the next billing cycle * Go to the [Subscription page](https://www.kimi.com/membership/subscription?tab=quota) to purchase extra usage or upgrade your plan for a higher monthly quota ### Concurrent Request Limit [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#concurrent-request-limit) error, status code: 403, message: You've reached your concurrent request limit. Please wait for your ongoing requests to finish and try again. The number of in-flight requests on the account has reached its limit. This limit is triggered by risk-control policy. **How to fix:** * Read the [Kimi Code Community Guidelines](https://www.kimi.com/code/docs/en/kimi-code/community-guidelines.html) to understand the violation and what is covered * To appeal, email [support@moonshot.ai](mailto:support@moonshot.ai) and include your account ID, the time the limit was triggered, a description of your use case, and relevant screenshots Rate Limits & Overload [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#rate-limits-overload) ------------------------------------------------------------------------------------------------------------------ **HTTP 429** Transient limits — **a short wait and retry recovers them**: too many concurrent requests means the account sent too many requests in a short period; inference engine overload is a server capacity issue, not related to your personal quota or account status. ### Too Many Concurrent Requests [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#too-many-concurrent-requests) error, status code: 429, message: We're receiving too many requests at the moment. Please wait a moment and try again. Too many requests were sent in a short period, exceeding the account limit. **How to fix:** * Wait a moment and retry; avoid sending requests rapidly in succession ### Inference Engine Overloaded [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#inference-engine-overloaded) error, status code: 429, message: The engine is currently overloaded, please try again later The server's current request volume exceeds inference capacity. **Not related to your personal quota or account status.** This may occur during peak hours (14:00–17:00 on weekdays). Kimi Code will address this promptly — you can also avoid peak hours. **How to fix:** * Wait a moment and retry Request Format Errors [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#request-format-errors) ------------------------------------------------------------------------------------------------------------------ **HTTP 400** The request content itself has a problem; the server rejects it during parsing or validation. **Fix the request content — no need to wait or contact support.** ### Message Body Exceeds Context Limit [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#message-body-exceeds-context-limit) error, status code: 400, message: total message size 5943865 exceeds limit 2097152 The total size of all messages (including conversation history, system prompt, and tool results) exceeds the 2 MB context limit. This is the most frequently occurring 400 error. **How to fix:** * Trim conversation history by removing unnecessary earlier turns * Process long content in segments to keep each request within size limits ### Token Limit Exceeded [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#token-limit-exceeded) error, status code: 400, message: Invalid request: Your request exceeded model token limit: 262144 (requested: 558009) The number of tokens in the request exceeds the model's single-request limit (262,144 tokens). **How to fix:** * Shorten the prompt or truncate conversation history * Process long content across multiple requests ### Missing Reasoning Content Field [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#missing-reasoning-content-field) error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 2 Extended thinking (thinking mode) is enabled, but the `reasoning_content` field is missing from the tool call message. This is a Kimi Code-specific field required when thinking mode is active. **How to fix:** * Add the `reasoning_content` field to the assistant message in tool calls * See the [Providers and models](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html) for the field specification ### Unsupported Image URL [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#unsupported-image-url) error, status code: 400, message: Invalid request: unsupported image url: C:\Users\pc\...\screenshot.jpg The image URL format is not supported: local file paths, non-standard base64 prefixes, or unsupported external domains. **How to fix:** * Local paths must be uploaded to a publicly accessible URL * Base64 images must use the standard format: `data:image/jpeg;base64,...` ### Duplicate Tool Name [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#duplicate-tool-name) error, status code: 400, message: function name unnamed_function is duplicated The `tools` array contains duplicate tool definitions with the same name. **How to fix:** * Ensure every tool's `name` field is unique ### Content Safety Rejection [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#content-safety-rejection) error, status code: 400, message: The request was rejected because it was considered high risk The request content triggered content safety detection and was rejected by the server. **How to fix:** * Review your prompt for sensitive content and retry after modification * If you believe this is a false positive, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to contact our support team with the content that triggered the error Resource Not Found [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#resource-not-found) ------------------------------------------------------------------------------------------------------------ **HTTP 404** The requested resource does not exist, or the current account does not have access. Verify the model name and endpoint path. ### Model Not Found [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#model-not-found) error, status code: 404, message: Not found the model kimi-for-coding or Permission denied **How to fix:** * Confirm the model name is spelled correctly (`kimi-for-coding`) * Confirm the account has [Kimi Code](https://kimi.com/code) access enabled ### Endpoint Not Found [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#endpoint-not-found) method not found **How to fix:** * Verify the request URL is correct. Kimi Code Base URL is `https://api.kimi.ai/coding/v1` (OpenAI protocol) or `https://api.kimi.ai/coding/` (Anthropic protocol) Internal Server Errors [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#internal-server-errors) -------------------------------------------------------------------------------------------------------------------- **HTTP 500** An unexpected error occurred on the server — **not caused by request content or account status**. In most cases, waiting a moment and retrying will resolve it. If the issue persists, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to contact our support team. ### Invalid bot\_id Format [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-bot-id-format) invalid_argument: field kimi.billing.v1.ClawExtension.bot_id: value "KIMI_CLAW_ID" (id_kind=uuid_v4): value does not match id_kinds: [uuid_v4] invalid_argument: field kimi.billing.v1.ClawExtension.bot_id: value "openclaw-local" (id_kind=uuid_v4): value does not match id_kinds: [uuid_v4] The `bot_id` is not a valid UUID v4. This field is automatically attached by client software when sending requests — it is normally managed by the client, not set manually by users. **How to fix:** * Update to the latest version of your client and retry * If the issue persists after updating, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to contact our support team with the full error message ### Database Connection Failed [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#database-connection-failed) internal: failed to connect to `user=kimi_chat_prod_rw database=membership_009`: ...: connection reset by peer internal: FATAL: terminating connection due to administrator command (SQLSTATE 57P03) The server could not connect to the membership verification database, or the database is under maintenance. This is an infrastructure-level failure. **How to fix:** * Wait 1–2 minutes and retry ### Internal Connection Error [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#internal-connection-error) internal: conn closed internal: driver: bad connection internal: read tcp ...: i/o timeout internal: unexpected EOF internal: failed to evaluate rate limit script: read tcp ...: i/o timeout Internal network connection anomaly on the server side, covering connection resets, I/O timeouts, Redis rate-limit script timeouts, and similar low-level errors. Usually a transient fault. **How to fix:** * Wait a moment and retry (start with 1 second, up to 3 retries) ### Downstream Service Unavailable [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#downstream-service-unavailable) unavailable: 503 Service Unavailable unavailable: 504 Gateway Timeout unavailable: 502 Bad Gateway The server received a 5xx response while calling a downstream model or infrastructure component. **How to fix:** * Wait a moment and retry ### Account Status Abnormal [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#account-status-abnormal) unauthenticated: not_found: 未找到该账号,请确认是否注册 unauthenticated: failed_precondition: 因违反用户协议,该账号已被禁用。 unauthenticated: failed_precondition: 因违反用户协议,该账号已被暂时禁用。 unauthenticated: failed_precondition: 因违反用户协议,该账号已被禁言。 When the server queried the account, it found the account does not exist or is in an abnormal state. **How to fix:** * Account not found: confirm the account you are using has completed registration * Account disabled/muted: email [support@moonshot.ai](mailto:support@moonshot.ai) to learn the reason and how to appeal Tool Call Errors [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#tool-call-errors) -------------------------------------------------------------------------------------------------------- The following errors occur during AI tool call execution (such as reading web pages or processing images). **They do not affect the conversation itself** — only the specific operation that failed. If you see authentication or rate-limiting errors (e.g. 401, 429) in this context, refer to the corresponding sections above. ### Request Canceled [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#request-canceled) **HTTP 499** error sending 'CallDataSourceTool' request: Post "http://...": context canceled canceled: context canceled The client disconnected before receiving a result — typically caused by the user manually stopping the operation, a network interruption, or a client-side timeout. Not a server error. **How to fix:** * If manually stopped, no action needed * If this happens frequently without being triggered manually, check whether your client's timeout setting is too short ### Web Page Read Failed [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#web-page-read-failed) **HTTP 500** url2text:v2:fresh-request timeout url-to-text request failed: 30001 invalid html url-to-text request failed: 30041 check url failed, client error (4xx) url-to-text request failed: 30043 check url failed, server error (5xx) url-to-text request failed: 403 verify page url-to-text request failed: 500 url is in blacklist spider checkUrl failed: Post "...": context deadline exceeded The AI failed to read the web page content. Common causes: target page response timeout, abnormal page structure, login required, URL on blocklist, or the target server itself returned an error. **How to fix:** * Timeout or server error: retry later * Login-required pages (verify page): cannot be read via tool call — manually copy the content and paste it to the AI instead * Blocklisted URL: the address is blocked by the system and cannot be accessed ### Image Moderation Failed [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#image-moderation-failed) **HTTP 500** image_url:moderation request error: 非法输入 image_url:Post "https://api.msh.team/v1/moderations": context deadline exceeded While the AI was processing an image, the image content moderation service returned an error or timed out. **How to fix:** * `非法输入` (illegal input): the image content triggered content moderation — ensure the image complies with usage policies * Timeout: retry later, or check your network connection ### URL Security Risk Blocked [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#url-security-risk-blocked) **HTTP 403** (security_risk) We consider the current URL poses a security risk and are unable to provide fetch service at this time. The URL passed in the tool call was flagged as a security risk, and the server refused to fetch it. **How to fix:** * Internal network addresses (e.g. `192.168.x.x`, `10.x.x.x`) and known high-risk domains will be blocked * Pages that require login cannot be fetched via tool calls ### Invalid URL Format [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#invalid-url-format) **HTTP 400** (invalid_url) The provided URL is invalid: parse "https://the repo for the contents of the path": invalid character " " in host name (invalid_url) The provided URL is invalid: missing scheme The model passed a natural-language description or a malformed string as a URL to the tool — typically a descriptive phrase treated as an address, or a missing protocol prefix. **How to fix:** * Ensure the value passed is a real, accessible URL — not a text description of one * The protocol prefix (`http://` or `https://`) is required and cannot be omitted Errors Not Covered Here [​](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#errors-not-covered-here) ---------------------------------------------------------------------------------------------------------------------- If none of the entries above match the error you encountered, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to contact our support team, and include the full error message, Request ID, and the time of the request. --- # Changelog | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#VPContent) On this page Changelog [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#changelog) ============================================================================================ This page documents the changes in each Kimi Code Desktop release. 1.0.3 (2026-09-23) [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#_1-0-3-2026-09-23) ------------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#features) * Click a local HTML file in the conversation to open it as a real page in the built-in browser. * Downloads in the browser's download history can be paused, resumed, canceled, and retried, with speed and time left shown. * Valid leading slash commands are highlighted in the Composer, with argument hints shown before you type arguments. * Right-click a file name in the conversation to copy its path or reveal it in the folder. * New settings toggle for automatic session title generation; turn it off to stop AI naming for new sessions. * Free-plan accounts are prompted to upgrade when sending with subscription models. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#polish) * Markdown tables in the conversation now have a rounded frame and expand to the full width. * Cron jobs show readable names, schedules, and details in the conversation. * Address bar suggestions are highlighted, deduplicated, and distinguished by type. * The expanded tool panel shows the full Bash command. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#bug-fixes) * Fix a vulnerability that let malicious web pages run arbitrary commands through the local embedded server. * Fix long conversations freezing on open, stuttering while streaming, and excessive memory use on mobile. * Fix the confirmation dialog spinning forever after deleting a session. * Fix the subagent model showing as unconfigured in settings and not taking effect when saved. * Fix a series of display issues with Swarm cards and member statuses. * Fix forked sessions having their titles overwritten by automatic regeneration. * Fix the terminal opening the search panel on Cmd+K and Ctrl+C not copying the selection. * Fix the sidebar fighting the work panel when both are open. * Fix side chat not showing a failure card on failed requests and side chat entries staying enabled on the empty new-session screen. * Fix task notification cards losing stream order inside the turn fold. * Fix unstable pinned screenshot dragging on Windows. 1.0.2 (2026-09-19) [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#_1-0-2-2026-09-19) ------------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#features-1) * Built-in browser overhaul: the transcript shows the Agent's live browsing activity, grouped into activity summaries with sources listed; the page glows while the Agent controls a tab; the Agent proactively shows pages you ask to see. * New "Open in default browser" button in the address bar; download history shows live progress and file actions. * The Agent can search with your configured search engine. * Redesigned providers settings page. * Quit confirmation is now an in-app dialog. * Hover to reveal subagent names. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#polish-1) * Faster startup paint, lighter sidebar updates, and bounded session search. * The transcript no longer restyles when the composer wraps. * Screenshots are no longer re-decoded when exporting or copying. * The screenshot global hotkey is limited to stable builds. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#bug-fixes-1) * Fix page capture failing when the window is hidden or minimized. * Restore `` ctrl+` `` as the bottom terminal toggle and drop the new-terminal-tab shortcut. * Keep the current view after login instead of jumping to the most recent session. * Fix address bar suggestions not updating in place while typing. * Fix cmd-clicked and middle-clicked links not opening in a new tab. * Fix the Agent's browser URLs being cut to a single character. * Fix the download save dialog not appearing on the app window. * Fix sub-agent approval and question requests not being surfaced. * Fix session restore flicker; turn file cards are limited to the latest 3 turns. * Fix the transcript jumping while resizing the window or toggling dock panels. * Windows: detect editors installed in custom directories, and preserve fullscreen window chrome and media controls. 1.0.1 (2026-09-17) [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#_1-0-1-2026-09-17) ------------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#features-2) * New "Open file" button in the changes diff detail view. * Hovering a link in the transcript shows the full URL with open actions. * Browser tool calls are visualized in the transcript. * Image preview supports gallery navigation and a right-click menu. * The confirm dialog for removing a workspace now spells out what removal does. * Screenshot output actions are reordered to close, pin, save, copy. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#polish-2) * Unify the styles of the providers, plugins, shortcuts, and browser tabs in settings. * Improve interface clarity on low-DPI displays. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#bug-fixes-2) * Failed-turn cards now show the full provider error. * Edit and View menu role labels are localized. * Multiple built-in browser fixes: Agent clipboard and undo keys not working on macOS, pages going blank when a non-http link is blocked, and element refs and wait polling failing intermittently. * Fix toasts being hidden behind modal dialogs. * Fix the app root scrolling when the right panel opens. * Fix tool call rendering and chat interactions in side chat. 1.0.0 (2026-09-17) [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#_1-0-0-2026-09-17) ------------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/changelog.html#features-3) * Kimi Code Desktop is officially available: it carries the Agent core of Kimi Code CLI into a graphical interface, where you open a project, talk to the Agent, and ship changes in one window. Available for macOS (Apple Silicon / Intel) and Windows. * Every step stays visible: tool calls, thinking, and the files changed in each turn are all presented in the interface; sensitive operations raise approval prompts, and three permission modes (Always Ask / Ask When Needed / Never Ask) keep you in control. * A complete workflow from conversation to delivery: goal mode keeps long-running objectives moving and can be paused, resumed, or cancelled; plan mode proposes an approach before touching files, and the plan can be reviewed and refined; long tasks can move to the background, where you can check progress at any time. * Built-in browser and visual annotation: the browser lives in the right panel, with tabs that stay with the session and page context shared with the Agent; screenshot annotation, text selection comments, `@` file mentions, and element picking on web pages tell the Agent exactly what to change. * Sign in to use official Kimi models out of the box, or connect third-party model providers; sessions, projects, and background tasks are managed in one place, with plugins to extend capabilities. --- # Contact and Feedback | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#VPContent) On this page Contact and Feedback [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#contact-and-feedback) ===================================================================================================================== Hit a problem, have a feature request, or want to reach the team directly? See whether you can resolve it yourself first, and if you still need help, contact us through any of the channels below. Before you file [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#before-you-file) ----------------------------------------------------------------------------------------------------------- The [FAQ](https://www.kimi.com/code/docs/en/kimi-code/faq.html) covers common questions and the [Error Reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html) explains common server-side errors — worth checking before you reach out. A few quick self-checks often resolve things on the spot: * Is the CLI up to date? (run `kimi --version`, and update if needed) * Can you reach Kimi's service? A corporate network or proxy may block `api.kimi.ai` * Are you signed in, and is your API Key valid? * Are the current working directory and file permissions OK? Feedback channels [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#feedback-channels) --------------------------------------------------------------------------------------------------------------- Still stuck, or want to share a feature request or feedback? Pick whichever channel below fits. ### Online support [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#online-support) Go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to reach our support team. Product usage, bugs, quota, and refund questions are all handled here — please describe the problem, the steps you took, and any relevant logs. ### Report from the CLI (recommended) [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#report-from-the-cli-recommended) Run `/feedback` in the Kimi Code CLI interactive UI, then choose what to upload alongside your report: * **No attachment** — text feedback only * **Logs only** — wire events and diagnostic logs from this session; **pick at least this** so we have something to triage * **Logs + codebase** — also includes your codebase for deeper diagnosis; sensitive files (`.env`, config files, secret keys) are automatically excluded, and attachments are used only for diagnosis and never shared After submitting, the CLI shows a `Session` and a `Feedback ID`. Email [code@moonshot.ai](mailto:code@moonshot.ai) with both to follow up. ### GitHub Issues [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#github-issues) Search existing issues or open a new one in the Kimi Code CLI repository: * [https://github.com/MoonshotAI/kimi-code/issues](https://github.com/MoonshotAI/kimi-code/issues) ### Email [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#email) Email [code@moonshot.ai](mailto:code@moonshot.ai) . To help us triage quickly, please include: * A description of the problem * Steps to reproduce * Environment info (run `kimi --version`) * Relevant error logs — run `/export-debug-zip` in the CLI (or `kimi export` from the shell) to produce a debug ZIP that already bundles the diagnostic logs, and attach it. ### Join the Discord community [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#join-the-discord-community) Join our [Discord community](https://discord.gg/rGSAZtWSZg) to chat with the team and other users. Account appeals [​](https://www.kimi.com/code/docs/en/kimi-code/contact-and-feedback.html#account-appeals) ----------------------------------------------------------------------------------------------------------- If your account was mistakenly suspended or you need to report abuse, email [support@moonshot.ai](mailto:support@moonshot.ai) with your account ID, the time it occurred, and a brief description of the situation. --- # Using the Desktop App | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#VPContent) On this page Using the Desktop App [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#using-the-desktop-app) ======================================================================================================================== The desktop app covers the full conversation-to-delivery flow in one window: describe the task, track execution, review and verify the result, and manage your projects. This page introduces these capabilities by function; the shortest path from installation to your first task is in [Quick Start](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html) . From project to result [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#from-project-to-result) -------------------------------------------------------------------------------------------------------------------------- A complete task usually follows this flow: 1. Add a local workspace. 2. Create or resume a session. 3. Describe the task in the Composer and use `@` to reference relevant files or directories. 4. Choose a normal task, Plan, Goal, or Swarm based on the task. 5. Handle approvals and questions from the Agent. 6. Review changes, file previews, and Git status. 7. Run verification commands in the terminal. 8. Continue, revert, or finish based on the result. For your first session, start with a read-only task to confirm that Desktop is using the right workspace before asking the Agent to change files. Choose a task mode [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#choose-a-task-mode) ------------------------------------------------------------------------------------------------------------------ Different tasks call for different ways of working. The **+** button in the lower-left corner of the Composer provides several task modes: * **Normal task**: Use for well-scoped changes that are easy to verify. * **Plan**: Use when the impact is uncertain and you want to confirm the approach first. The Agent analyzes the task and proposes a plan before changing files. See [Plan mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#plan-mode) . * **Goal**: Use for a longer objective that needs multiple turns and checks. The goal appears above the Composer and can be paused, resumed, or cancelled. See [Goal mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#goal-mode) . * **Swarm**: Use for investigation or modification work that can be split into independent subtasks. Progress appears in the Tasks or Subagent area. See [Agents and Sub-Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html) . Provide useful context [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#provide-useful-context) -------------------------------------------------------------------------------------------------------------------------- The more specific the context, the less the Agent drifts from the goal. State the goal first, then add context: * Use `@` to reference relevant files or directories. * Type `/` to invoke built-in commands or saved extension commands; valid commands are highlighted. * Paste or drag files, images, videos, and other attachments. * Capture part of the screen with `Shift + Command + S` (macOS) or `Shift + Ctrl + S` (Windows), and add a comment to provide page state, design references, or error information. * Select text in messages, file previews, diffs, or the terminal and choose **Comment** or **Add to conversation** to quote it into the current task. * Provide error logs, reproduction steps, expected behavior, and verification commands. * Clearly state directories, files, or behavior that must not be changed. Steer while it runs [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#steer-while-it-runs) -------------------------------------------------------------------------------------------------------------------- While a task is running, the Agent's tool calls and thinking appear in the conversation and can be checked at any time. You can send follow-up input to adjust the direction, such as narrowing the scope, adding constraints, asking for an explanation, stopping the current action, or reverting changes with `/undo`. For questions not directly related to the current task, use Side chat to discuss them without leaving the main session. Review changes [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#review-changes) ---------------------------------------------------------------------------------------------------------- After a change, confirm which files were modified and what each change looks like. * **Changes**: The Changes tab in the right panel lists every change by file. Inspect an individual file or the changes from a single turn. The Changes tab is a singleton, so the new-tab menu hides it when one is already open. * **Git status**: The top of the Changes panel shows the current branch, ahead/behind status, and the number of changed files, and can also show pull request status. * **File Preview**: Preview Markdown, JSON, HTML, PDF, CSV, images, and code or text files, with actions to copy, download, reveal in the system, and open in an external app. Markdown files with frontmatter show a metadata card. File paths mentioned in the conversation can also be clicked open directly, and right-clicking a file name copies its path or reveals it in the folder. ![Inspect the diff of a single file in the right Changes panel](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/ui-04.jpg) The Changes tab in the right panel shows the exact diff for each modified file. ![Git status area and the changed-file list](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/ui-05.jpg) The top of the Changes panel shows the current branch and the number of changed files; each file in the list expands to show its diff. Verify in the terminal [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#verify-in-the-terminal) -------------------------------------------------------------------------------------------------------------------------- If the result needs verification, both terminal and web page options are available. The bottom terminal panel is the native desktop terminal. Open it from the terminal button in the upper-right corner of the session. It supports multiple tabs and runs commands with the current workspace as its `cwd`. Use it for the project's existing build, test, formatting, and other verification commands, or to inspect Git command output. ![Run verification commands in the bottom terminal panel](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/ui-07.jpg) The bottom terminal panel runs verification commands like builds and tests and shows their output. To verify web pages, open the built-in browser in the right panel: browser tabs stay with the session and share page context with the Agent, so you can check pages without switching to another window. Clicking a local HTML file in the conversation opens it as a real page in the built-in browser. You can also annotate elements or regions on the page—each annotation captures the element's details along with a screenshot and your comment, so the Agent knows exactly what to change. ![Annotate a page element in the built-in browser](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/ui-08.jpg) Annotating an element in the built-in browser: element details are captured automatically and can be inserted into the composer with a screenshot and comment. Manage background tasks [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#manage-background-tasks) ---------------------------------------------------------------------------------------------------------------------------- The desktop app can run background tasks while the main session continues. The work bar above the Composer shows running background work such as background Bash and background Agents, with status and counts. Expand it to see the task list (filter by recent, running, completed, or all), where you can: * Check the status, output, and runtime of background Bash and tool tasks. * See a background Agent's model, thinking effort, status, and result. * Open the details of a task or subagent — a background Agent opens a task tab in the right panel with its execution summary, thinking, and tool calls. * Stop a running task. Background tasks and background Agents are two kinds of work: the former shows command and tool execution, the latter shows a subagent's independent work. Manage projects and sessions [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#manage-projects-and-sessions) -------------------------------------------------------------------------------------------------------------------------------------- Desktop organizes sessions by workspace, and a workspace maps to a local project folder. Sessions in a workspace can be created, switched, renamed, archived, restored, deleted, forked, exported, pinned, and searched. Multiple sessions can stay open in parallel tabs, with batch management for cleanup, and global search finds sessions across workspaces. A title is generated after the first turn and can be regenerated from the session item, or automatic generation can be turned off in Settings. Forking keeps the current session while you try another direction; archiving, search, restore, and export help manage session history. Use external apps [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#use-external-apps) ---------------------------------------------------------------------------------------------------------------- File Preview is used to preview files and copy, download, reveal in the system, or open in an external app. The top menu opens the current project or file in an external app, including VS Code, Cursor, Zed, Xcode, the system terminal, or system file managers such as Finder or Explorer. It can also copy the current path. Extend with plugins [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#extend-with-plugins) -------------------------------------------------------------------------------------------------------------------- Plugins bring specific tools, workflows, or external services into the desktop app. In the Plugins area of Settings, you can browse the marketplace and install, enable, update, or remove plugins, or add custom plugin sources. The official extensions currently available include: * **Kimi Computer Use**: lets the Agent operate apps and interfaces on this Mac. * **Kimi Browser Extension**: lets the Agent drive your real browser with your existing sign-in state; if the browser extension is missing, the Plugins area provides the Chrome or Edge extension installer. * **Kimi Datasource**: gives the Agent data-query and datasource capabilities for tasks that need external data. For how plugins are added, the marketplace, and custom sources, see [Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html) . Adjust settings [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html#adjust-settings) ------------------------------------------------------------------------------------------------------------ The Settings panel includes General, Account, Agents & Sessions, Providers, Plugins, Shortcuts, About, Lab, and Archived Sessions. It is used to manage models, providers, message folding, account, permissions, shortcuts, agreement links, and experimental options. ![General page of the Settings panel](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/ui-06.jpg) The Settings sidebar lists General, Account, Providers, Plugins, and other areas; the right side shows the options for the selected area. Continue with [Quick Start](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html) for the shortest path through the first session. --- # Configuration | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#VPContent) On this page Configuration [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#configuration) =========================================================================================================== Configure in the "Kimi" section of VS Code settings (you can also open it via the action menu → **General Config**). ### Operation Approval [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#operation-approval) | Setting | Default | Description | | --- | --- | --- | | `kimi.yoloMode` | `false` | Automatically approve all tool calls. Suitable for scenarios where you trust the workflow and pursue efficiency | ### Files and Editor [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#files-and-editor) | Setting | Default | Description | | --- | --- | --- | | `kimi.autosave` | `true` | Automatically save files before Kimi reads or writes | | `kimi.editorContext` | `never` | Controls when to share the current editor's file and cursor position (`never` / `onConversationStart` / `onFileChange`) | ### Input and Shortcuts [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#input-and-shortcuts) | Setting | Default | Description | | --- | --- | --- | | `kimi.useCtrlEnterToSend` | `false` | Use Ctrl/Cmd+Enter to send messages | | `kimi.enableNewConversationShortcut` | `false` | Enable Cmd/Ctrl+N new conversation shortcut (enabling this will occupy the system's default "New File" shortcut) | ### Model and Reasoning [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#model-and-reasoning) | Setting | Default | Description | | --- | --- | --- | | `kimi.alwaysExpandThinking` | `false` | Expand thinking/reasoning process by default | ### Advanced [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/configuration.html#advanced) | Setting | Default | Description | | --- | --- | --- | | `kimi.executablePath` | `""` | Custom Kimi Code CLI path (empty value uses built-in) | | `kimi.environmentVariables` | `{}` | Environment variables passed to Kimi Code CLI | --- # Customization | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/customization.html#VPContent) On this page Customization [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/customization.html#customization) =========================================================================================================== MCP Servers [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/customization.html#mcp-servers) ------------------------------------------------------------------------------------------------------- MCP (Model Context Protocol) servers can extend Kimi with external tools and services. Manage them via the action menu (gear icon) → **MCP Servers**. ### Transport Types [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/customization.html#transport-types) Two transport types are supported: * **stdio**: Local command-line tools; requires specifying command, arguments, and environment variables * **http**: Remote service; requires specifying URL, with optional OAuth ### Recommended Servers [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/customization.html#recommended-servers) ![Kimi Code MCP Servers](https://www.kimi.com/code/docs/images/en/vscode/kimi-code-mcp.png) One-click installation of recommended servers is provided: | Server | Purpose | | --- | --- | | Playwright | Browser automation | | Context7 | Real-time documentation | | GitHub | API access | Some servers require OAuth authentication. Click the authorize button to open the flow, or reset credentials. You can test the connection before saving to verify server availability. --- # Core Operations | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#VPContent) On this page Core Operations [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#core-operations) ================================================================================================================= Opening the Panel [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#opening-the-panel) --------------------------------------------------------------------------------------------------------------------- ![Kimi Code Command Palette](https://www.kimi.com/code/docs/images/en/vscode/kimi-code-command-palette.png) Click the Kimi icon in the activity bar, or execute the "Kimi Code" command via the command palette. * * * Input and Control [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#input-and-control) ===================================================================================================================== File References [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#file-references) ----------------------------------------------------------------------------------------------------------------- Type `@` and then select a file or folder name. For example: `@src/handlers/` references a folder, `@app.ts` references a file, `@src/app.ts:10-20` references a specific line range. Press `Alt+K` to quickly insert the current file or selected code as a reference. Slash Commands [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#slash-commands) --------------------------------------------------------------------------------------------------------------- Type `/` to open the command menu. Use `/init` to scan the project and generate documentation, or `/compact` to compress overly long context. Input History [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#input-history) ------------------------------------------------------------------------------------------------------------- Press `↑` / `↓` in the input box to quickly browse recently sent message history, making it easy to repeat or modify questions. Media File Input [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#media-file-input) ------------------------------------------------------------------------------------------------------------------- Supports pasting, dragging and dropping, or selecting media files. Supported formats include: PNG, JPEG, GIF, WebP, HEIC and other image formats, as well as MP4, WebM, MOV and other video formats. * **Paste / Drag and drop**: Single image original size must not exceed 5MB; the system will automatically compress (HEIC to JPEG, oversize scaling, quality compression to approx. 2MB). * **File picker**: When selecting files via the "+" button in the input box or the `@` menu, images must not exceed 10MB, videos must not exceed 20MB. * **General limit**: Each message can attach at most 9 files, totaling no more than 80MB. When media files are attached, models that do not support multimodality will be automatically filtered out. Message Queue [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#message-queue) ------------------------------------------------------------------------------------------------------------- While Kimi is responding, you can continue typing and sending in the input box. These messages are not lost, but instead enter the **message queue**. The bottom toolbar displays the queue count; click to expand the queue panel: * View the list of pending messages * Edit or delete messages in the queue * Adjust message order * During Kimi's response process, click the ⚡ icon on a queue item to immediately insert that message as a **Steer**, guiding Kimi to adjust the current response direction Model Switching [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#model-switching) ----------------------------------------------------------------------------------------------------------------- Switch models via the dropdown menu in the input bar. **Using HighSpeed**: HighSpeed (`kimi-for-coding-highspeed`) delivers roughly 5–6× the output speed of Standard at about 3× the quota usage, and requires an [Allegretto / Pro or above](https://www.kimi.com/membership/pricing?from=kfc_membership_topbar&track_id=a7764d49-73ad-4d08-b2f3-a8d7433917f8) plan. If HighSpeed doesn't appear in the model dropdown yet, **restart VS Code or reinstall the extension**; then pick `kimi-for-coding-highspeed` from the dropdown to use it. Deep Thinking Mode [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#deep-thinking-mode) ----------------------------------------------------------------------------------------------------------------------- Some models support extended reasoning capabilities. Thinking mode toggle has two states: hidden when the model doesn't support thinking mode, or manually enable/disable by the user. > **Note**: **K2.8 Preview** supports adjustable thinking effort, with the same levels as K3; with Thinking mode off, requests are served by K2.8 Preview (no thinking). After enabling, thinking steps are collapsed by default in the response; you can expand to view the reasoning process. Enable `kimi.alwaysExpandThinking` in settings to expand thinking by default. * * * Working Modes [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#working-modes) ============================================================================================================= Operation Confirmation and Tool Execution [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#operation-confirmation-and-tool-execution) --------------------------------------------------------------------------------------------------------------------------------------------------------------------- When Kimi proposes running a tool or writing to a file, a confirmation dialog is displayed with three options: * **Yes**: Approve only the current operation * **Yes, for this session**: Approve similar operations within the current session until a new session is started * **No**: Reject the operation Enable `kimi.yoloMode` in settings to automatically approve all tool calls. Suitable for scenarios where you trust the workflow and pursue efficiency. ### Question Dialog [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#question-dialog) During execution, Kimi may ask you questions (for example, asking you to choose an implementation plan). At this point a Q&A card pops up at the bottom; you can directly click preset options, or select "Custom response..." to enter a custom reply. After answering, Kimi will continue execution. Plan Mode [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#plan-mode) ----------------------------------------------------------------------------------------------------- Click the 📋 icon to the left of the input box to enter plan mode. After enabling, Kimi will first output an expandable plan card before formal execution, listing the steps it intends to take. You can review the plan before letting it continue. * The plan mode button retains the previous setting for each new session. * If Kimi is already in a streaming response, exiting plan mode requires secondary confirmation to avoid interrupting the current task. File Change Tracking [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#file-change-tracking) --------------------------------------------------------------------------------------------------------------------------- After Kimi modifies files, all changes are tracked and displayed in the "File Changes" panel. You can view the list of modified files and their status (added, modified, or deleted), as well as line addition/deletion statistics. For each file, you can view changes in VS Code's native diff view, restore to the original state, or keep changes to clear the tracking record. Bulk operations are supported, allowing you to keep or undo all changes at once. The baseline state is captured at the first modification in the session; rollback will restore to this baseline version. * * * Context Management [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#context-management) ======================================================================================================================= Historical Sessions [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#historical-sessions) ------------------------------------------------------------------------------------------------------------------------- Click the history dropdown menu at the top of the panel to browse past sessions. Session data is stored locally and supports keyword search. You can delete old sessions or load a session to continue a previous conversation. The status bar displays context usage percentage and input/output token counts. When context usage is high, use the `/compact` command to compress. Working Directory Switching [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#working-directory-switching) ----------------------------------------------------------------------------------------------------------------------------------------- Click the gear icon (Action Menu) to the right of the input box → **Working Directory** to switch working directories among different subdirectories in the current Workspace. After switching, a new session is automatically started so that Kimi can work based on the new directory context. Supports directly selecting already-registered subdirectories, or browsing arbitrary subfolders via "Browse...". * * * Action Menu [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#action-menu) ========================================================================================================= Action Menu [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/core-operations.html#action-menu-1) ----------------------------------------------------------------------------------------------------------- The gear icon to the right of the input box is the action menu entry, containing the following functions: * **Working Directory**: Switch the current working directory (see "Working Directory Switching" above) * **MCP Servers**: Open the MCP server configuration panel * **General Config**: Open the Kimi configuration page in VS Code settings * **Show Logs**: Open the Kimi Code output log panel for troubleshooting * **Reset Kimi**: Reset the Kimi Webview, suitable for cases where the interface is frozen or unresponsive * **Sign out / Sign in**: Log out or log back in to your Kimi account Additionally, you can execute "Kimi Code: Run CLI" in the VS Code command palette to directly launch Kimi Code CLI in the integrated terminal. --- # Claude Code | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#VPContent) On this page Claude Code [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#claude-code) ================================================================================================== > [Claude Code](https://docs.anthropic.com/en/docs/claude-code) > is a programming agent product from Anthropic. Its interface, configuration options, and supported capabilities may change across versions. This guide describes a general integration approach: forwarding Claude Code model requests to the Kimi Code API through environment variables. Before You Start [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#before-you-start) ------------------------------------------------------------------------------------------------------------ * Make sure you have subscribed to [Kimi membership](https://www.kimi.com/membership/pricing?from=) and activated Kimi Code benefits. * Obtain an API Key: 1. Go to the [Kimi Code Console](https://www.kimi.com/code/console) ; 2. Click "Create API Key", enter a name and confirm; 3. Copy the generated key and keep it safe (the full key cannot be viewed again after closing the dialog). ![Kimi Code Console](https://www.kimi.com/code/docs/images/en/third-party-tools/claude-code/kimi-code-console.png) Configuration [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#configuration) ------------------------------------------------------------------------------------------------------ [Claude Code](https://docs.anthropic.com/en/docs/claude-code) is a command-line programming assistant launched by Anthropic. By configuring environment variables to connect it to Kimi's API endpoint, you can directly call Kimi Code's AI capabilities within Claude Code and enjoy the Kimi Code programming experience in a familiar terminal interface. ① **Install Claude Code** For installation instructions, please refer to the [Claude Code official documentation](https://docs.anthropic.com/en/docs/claude-code/getting-started) . │ ② **Run Script to Skip Login** After installation, do not start Claude directly. Execute the following script in the terminal first to skip Anthropic's default login flow and clean up historical configuration: sh node --eval " // enable third party model support and fast mode const claudeJsonFilePath = path.join(os.homedir(), '.claude.json'); if (fs.existsSync(claudeJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeJsonFilePath, 'utf-8')); fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ ...content, penguinModeOrgEnabled: true, hasCompletedOnboarding: true }, null, 2), 'utf-8'); } else { fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ penguinModeOrgEnabled: true, hasCompletedOnboarding: true }), 'utf-8'); } // delete old endpoint, credential and model id const claudeSettingsJsonFilePath = path.join(os.homedir(), '.claude', 'settings.json'); if (fs.existsSync(claudeSettingsJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeSettingsJsonFilePath, 'utf-8')); if (typeof content === 'object' && typeof content.env === 'object') { for (const element of [\ 'ANTHROPIC_BASE_URL',\ 'ANTHROPIC_API_KEY',\ 'ANTHROPIC_AUTH_TOKEN',\ 'ANTHROPIC_MODEL',\ 'ANTHROPIC_SMALL_FAST_MODEL',\ 'CLAUDE_CODE_SUBAGENT_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME',\ 'ENABLE_TOOL_SEARCH',\ 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',\ 'CLAUDE_CODE_EFFORT_LEVEL',\ ]) { delete content.env[element]; } fs.writeFileSync(claudeSettingsJsonFilePath, JSON.stringify(content, null, 2), 'utf-8'); } } " The settings.json cleanup part only removes endpoint, credential, and model-related entries under `env` (leftovers there **override** environment variables exported in the terminal) — other settings are untouched. Also check `~/.zshrc`, `~/.bashrc`, and other shell config files for leftover `ANTHROPIC_*` exports (Windows users should check user environment variables) and remove them as well. │ ③ **Configure API Access** Recommended model launch **K2.8 Preview** is now fully rolled out in Kimi Code — `kimi-for-coding` is upgraded in place with no configuration changes: performance close to K3, with `low` / `high` / `max` thinking effort levels and up to 1M context. See [What's New](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html) . First check your membership tier to confirm which models and context windows you can use (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans): | Plan | Available Models | Available Context Limit | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`: `262144`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576` | | Pro and above / Allegretto and above | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`: `1048576`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576`
`kimi-for-coding-highspeed`: `262144` | Two configuration methods are available — **pick one, do not mix them**: Method 1 writes to the settings.json config file and takes effect permanently regardless of how Claude Code is launched; Method 2 exports variables in the current terminal only, effective for that session. **Method 1: Write to settings.json (recommended, persistent)** The path of settings.json: macOS / LinuxWindows text ~/.claude/settings.json text C:\Users\\.claude\settings.json Write the following into the `env` field of that file (create the file if it does not exist): K3-256KK3 1M context json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.ai/coding/", "ANTHROPIC_API_KEY": "Your API Key", "ANTHROPIC_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3-256k", "CLAUDE_CODE_SUBAGENT_MODEL": "k3-256k", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "262144", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144" } } json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.ai/coding/", "ANTHROPIC_API_KEY": "Your API Key", "ANTHROPIC_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3[1m]", "CLAUDE_CODE_SUBAGENT_MODEL": "k3[1m]", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576" } } Restart Claude Code after saving for the changes to take effect. Plaintext key risk The API Key in `settings.json` is stored in plaintext — do not commit this file to a version-control repository or share it publicly with dotfiles. The file's `env` field **overrides** same-named variables exported in the terminal. **Method 2: Terminal environment variables (current session only)** **K3-256K configuration:** macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.ai/coding/ export ANTHROPIC_API_KEY=Your API Key export ANTHROPIC_MODEL="k3-256k" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.ai/coding/" $env:ANTHROPIC_API_KEY="Your API Key" $env:ANTHROPIC_MODEL="k3-256k" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="262144" claude **K3 1M context** configuration: The `k3[1m]` form is only needed for Claude Code env vars `k3[1m]` (with the surrounding quotes) explicitly tells Claude Code to use a 1M context window. In any other scenario — API requests, the Model ID field of other third-party tools — just use `k3`. macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.ai/coding/ export ANTHROPIC_API_KEY=Your API Key export ANTHROPIC_MODEL="k3[1m]" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.ai/coding/" $env:ANTHROPIC_API_KEY="Your API Key" $env:ANTHROPIC_MODEL="k3[1m]" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="1048576" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576" claude ### Configuration Reference [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#configuration-reference) Claude Code internally uses different model tiers for different scenarios (main conversation, background summarization, sub-agents, etc.). Configuring only some of these variables will silently break the corresponding scenarios: | Variable | Purpose | Impact if missing or misconfigured | | --- | --- | --- | | `ANTHROPIC_BASE_URL` | Routes model requests to the Kimi Code endpoint | Requests go to Anthropic's official endpoint and fail authentication | | `ANTHROPIC_API_KEY` | Authenticates with your Kimi Code API Key | Returns a 401 authentication error | | `ANTHROPIC_MODEL` | The model used for the main conversation | Falls back to Claude's default model name, which the Kimi Code endpoint does not recognize — model-not-found error | | `ANTHROPIC_DEFAULT_OPUS_MODEL` / `ANTHROPIC_DEFAULT_SONNET_MODEL` / `ANTHROPIC_DEFAULT_HAIKU_MODEL` / `ANTHROPIC_DEFAULT_FABLE_MODEL` | Model names Claude Code picks for each task tier | Tasks on those tiers (e.g., haiku-tier background title generation and summarization) fail | | `CLAUDE_CODE_SUBAGENT_MODEL` | The model used by sub-agents | Sub-agent tasks fail or degrade noticeably | | `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | Window size that triggers automatic context compaction | Must match the model's context: `1048576` for `k3[1m]`, `262144` for the others. Too small compacts too early and loses context; too large triggers context-overflow errors | | `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | Maximum context token budget | Same as above — must match the selected model's context window | | `CLAUDE_CODE_EFFORT_LEVEL` | Default thinking effort level; `high` is recommended for K3 | Lower values may reduce quality on complex tasks | When switching models, replace the value of every model variable in your configuration with the new model name. ### Switching thinking effort [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#switching-thinking-effort) After starting, type `/effort` in a session to switch thinking effort levels — no environment variable needed. Both K3 and K2.8 Preview support `low` / `high` / `max` with identical levels; the mapping from Claude Code levels to actual levels is: | Claude Code level | Actual level | | --- | --- | | `low` | `low` | | `medium` | `high` (recommended) | | `high` | `high` (recommended) | | `xhigh` | `max` | | `max` | `max` | | Not set (default) | `high` (K3) / `max` (K2.8 Preview) | Note With thinking disabled, requests to the K3 series and K2.8 Preview are served by K2.8 Preview (no thinking); the thinking shortcut is `Option+T` on macOS and `Alt+T` on Windows / Linux. > If prompted whether to use this API key, confirm to proceed. Afterwards, follow the prompts to select your trusted project folder to complete the authorization. > > ![Claude Code Authorize Project Access](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-trust-folder.jpg) │ ④ **Verify After Starting** After starting, enter `/status`. If the returned information shows Base URL as `https://api.kimi.ai/coding/`, the configuration is successful. Even if the model name still appears as a Claude model, the actual calls are still made to the Kimi Code API. ![Claude Code Status Check](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-status-check.png) │ Using the VS Code Extension [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#using-the-vs-code-extension) ---------------------------------------------------------------------------------------------------------------------------------- The extension ships with its own Claude Code binary and shares the config files under `~/.claude` with the CLI. Follow these steps: 1. Complete the API setup in [Configuration](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#configuration) above. 2. Open the extension and start a new session. When the login page appears, click **Run `claude` in terminal** at the bottom: ![Click Run claude in terminal on the login page](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-run-in-terminal.png) 3. In the terminal that opens, complete two confirmations: choose **Yes, I trust this folder** for the workspace, then **1\. Yes** to confirm your API key: ![Claude Code API key confirmation](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-api-key-confirm.jpg) 4. **Quit VS Code completely** (`Cmd+Q` on macOS) and reopen it — the extension is ready to use. Without this terminal confirmation, the extension lacks the API key confirmation record and the login page pops up repeatedly when you send a message. FAQ [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#faq) ---------------------------------------------------------------------------------- ### Changes to the configuration don't take effect [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#changes-to-the-configuration-don-t-take-effect) Check whether `~/.claude/settings.json` has leftover entries under `env` (they override terminal environment variables) — you can run the cleanup script from Step ②. Also note that variables exported in a terminal only apply to that session and must be set again after opening a new terminal; if you wrote to `settings.json`, make sure you restarted Claude Code after editing. ### 401 authentication error [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#_401-authentication-error) Check whether `ANTHROPIC_API_KEY` is a valid Kimi Code API Key — note that the full key is only shown once at creation time. ### Model not found [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#model-not-found) Check the spelling of each model variable (e.g. `k3-256k`, `k3[1m]`), and make sure there are no extra spaces or quotes. ### Background tasks or sub-agents fail [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#background-tasks-or-sub-agents-fail) Usually `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_DEFAULT_FABLE_MODEL`, or `CLAUDE_CODE_SUBAGENT_MODEL` is not configured — the corresponding scenario requested a model name the Kimi Code endpoint does not recognize. See the [Configuration Reference](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#configuration-reference) and fill in the missing entries. ### The VS Code extension keeps showing the login page [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#the-vs-code-extension-keeps-showing-the-login-page) The extension is missing the API key confirmation record. Click **Run `claude` in terminal** at the bottom of the login page, complete the trust-folder and API key confirmations in the terminal, then **quit VS Code completely** (`Cmd+Q` on macOS) and reopen. See [Using the VS Code Extension](https://www.kimi.com/code/docs/en/third-party-tools/claude-code.html#using-the-vs-code-extension) . --- # Changelog | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#VPContent) On this page Changelog [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#changelog) ======================================================================================== This page documents the changes in each Kimi Code CLI release. 2.1.0 (2026-09-23) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_2-1-0-2026-09-23) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features) * Add an experimental fullscreen mode toggle for the TUI. Enable it via the TUI mode setting in `/settings`, or set `tui_mode = "fullscreen"` in `~/.kimi-code/tui.toml`; it takes effect after restarting Kimi Code. * In fullscreen, click a folded block to open or close it. * Add a clickable "Jump to bottom" indicator to the fullscreen TUI. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish) * Reduce the CLI's startup time and memory usage. * Turn off filesystem watchers for config and workspace files by default. Set `[watch] enabled` to `true` or `KIMI_CODE_WATCH=1` to turn them back on. See [`watch`](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#watch) for details. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes) * Harden workspace security: block file tools from accessing files outside the working directory through symlinks, apply project-local configuration only after the workspace is trusted, block repository git configuration from executing commands during background git operations, and reject additional directories that resolve to the home directory or filesystem root. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 2.0.2 (2026-09-19) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_2-0-2-2026-09-19) --------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-1) * The agent no longer assumes the current working directory is the project root. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-1) * Fix compaction failing after switching to a model with a smaller context window. * Fix new messages occasionally landing at an old position in the conversation after resuming a session. * Fix a message sent while the agent was running sometimes appearing twice in the chat. * web: Improved interactions and fixed known bugs. 2.0.1 (2026-09-18) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_2-0-1-2026-09-18) --------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-2) * Remove the system-prompt rule that forbade all file access outside the working directory. * Providers can read their API key from a named environment variable via [`api_key_env`](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html) in `config.toml`. * Stop workspace file watchers from scanning an unbounded project root, and add `[watch] enabled` / `KIMI_CODE_WATCH` to disable watching entirely. See [`watch`](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#watch) for details. * Stop asking for approval of bash commands that cannot be statically analyzed in Ask When Needed permission mode. * Rename the `kimi install-app` subcommand to `kimi install-desktop`; the old name keeps working as a hidden alias. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-2) * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 2.0.0 (2026-09-17) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_2-0-0-2026-09-17) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-1) * Add the `/desktop` slash command (alias `/install-desktop`) and the `kimi install-app` subcommand. * Render mermaid code blocks as diagrams in the terminal; turn it off under `/settings` → Mermaid diagrams, or set `mermaid = "off"` in the `[markdown]` section of tui.toml. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-3) * The built-in browser plugin now appears as "Kimi Browser Extension" in the plugins panel, marketplace catalog, and docs, matching the product rename. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-3) * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.43.1 (2026-09-15) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-43-1-2026-09-15) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-2) * Add native clipboard support on Linux X11, so copying from the TUI no longer depends on the terminal's OSC 52 support. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-4) * Reduce event-loop stalls and GC churn in sessions with many concurrent subagents. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-4) * Fix pressing Ctrl+C while subagents are running exiting the whole CLI instead of just interrupting the subagents. * Fix progressively slower rendering on each round of large agent swarm runs. * Fix memory not being released when subagent scopes are disposed. * Fix tower mode mistaking newly spawned agents for previous sessions' roster entries. * Stop returning deleted sessions from global search before the search index catches up. * Fix link colors in wrapped markdown tables and `@` file-completion ordering. 0.43.0 (2026-09-14) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-43-0-2026-09-14) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-3) * web: AI session titles are now always on — a title is generated after the first turn and can be regenerated from the rename field, with no experimental flag required. * Delete sessions from the session picker: press Ctrl+X on a session, then y to confirm. * Add `-y, --yes` to `kimi upgrade` (alias `kimi update`) to skip the confirmation prompt and install the update directly. * Add the `loop_control.compaction_max_attempts` config option to set the maximum total attempts for a failing compaction request (default 5). See [`loop_control`](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html#loop-control) for details. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-5) * Skip the confirmation prompt for rm -rf commands that target only /tmp or /temp paths. * Allow steering messages to interrupt waits for background tasks. * Goal time budgets no longer count time spent with the session closed, and the 24-hour limit is removed. * Add the `KIMI_CODE_PERMISSION_MODE_REMINDER` environment variable: set it to `0` to stop injecting the auto permission-mode reminders into the model context. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-5) * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.42.0 (2026-09-09) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-42-0-2026-09-09) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-4) * Remote Control is now always on; the experimental `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL` flag has been removed. See [Remote Control](https://moonshotai.github.io/kimi-code/guides/remote-control.html) for details. * web: Support permanently deleting sessions from the session row context menu, with a confirmation prompt. * Add read-only tools to the `/btw` side agent. * web: Preview images and videos in a reorderable media rail in the composer, mention them in the text on demand, and keep the previews after queueing and sending. * Accept HEIC, HEIF, and BMP images in prompt attachments and `ReadMediaFile` when the model is served by Kimi. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-6) * Collapse finished tool calls in the transcript to a header plus one marked outcome row: short output is shown whole, hidden output is counted (`N more lines`, `+N more`) and revealed by `Ctrl-O`, which the footer advertises while it is available. * Upgrade the default thinking effort to the recommended level for eligible users. * The subagent model pool (`[secondary_model]`) is now always on; the experimental secondary-model flag and the `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` opt-out have been removed. * Add configurable character limits and resumable long-line file reads without repeated output truncation; see [`read`](https://moonshotai.github.io/kimi-code/configuration/config-files.html#read) for details. * The minidb session-index read model and global search worker are now always on; the experimental flags have been replaced by the `[database]` config section and the `KIMI_CODE_PERSISTENCE_MINIDB_READMODEL` / `KIMI_CODE_SEARCH_WORKER` env vars; see [`database`](https://moonshotai.github.io/kimi-code/configuration/config-files.html#database) for details. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-6) * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.41.0 (2026-09-04) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-41-0-2026-09-04) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-5) * web: Add tower multi-agent collaboration mode (experimental), enabled via the `/tower` command or the composer plus menu; `/tower` supports specifying a base branch (e.g. `/tower add-new-feature`). * web: Add selection annotation — select text in messages, file previews, the diff and per-turn changes panels, or the terminal to add a comment or quote it into the chat. * CLI: Add a session rating prompt that invites you to rate the session at appropriate times above the input box. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-7) * Auto permission mode no longer blocks dangerous commands and commands that cannot be statically analyzed. * Remind the model of its context budget before automatic compaction, and after compaction point it at the session's event log for exact details. * web: Rename the three permission modes to Always Ask / Ask When Needed / Never Ask and update their descriptions; switching to Ask When Needed or Never Ask permission mode now warns that files may be modified or deleted directly in that mode. * web: Esc no longer closes the right detail panel. * web: Restyle Bash commands in the right-side panel in terminal style. * Deliver background question answers to the agent directly instead of via a saved output file. * Subagent final messages under 200 characters are no longer bounced back for expansion. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-7) * Fix print mode (`kimi -p`) losing session records when the run exits on an error or a termination signal. * Fix print mode (`kimi -p`) ignoring the `KIMI_DISABLE_TELEMETRY` environment variable. * Tower mode (experimental): fix tower mode never starting when enabled through `[experimental] tower = true` in config.toml instead of the environment variable, and make `/tower` work in directories that are not git repositories; enablement errors now name the actual blocker. * Fix background questions being cancelled as soon as the agent finishes its turn. * Fix resuming a subagent by its agent id after the session is reopened in a new process; the resumed subagent follows the current permission mode and is matched by its own profile in permission rules. * web: Fix per-turn file change previews showing added/removed lines that never existed and inaccurate line counts when the same file is edited multiple times in one turn; change cards now show only exact line statistics. * web: Fix the default thinking effort in settings not being settable to the highest level (Max). * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.40.1 (2026-09-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-40-1-2026-09-02) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-8) * Fix the condition for showing the kimi-cli migration prompt. 0.40.0 (2026-09-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-40-0-2026-09-02) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-6) * web: Add a Plugins panel to Settings for browsing the plugin marketplace and installing, enabling, disabling, and removing plugins. * web: Support activating multiple skills from a single message. * Add the `kimi session list` command to list sessions from the command line. * Tower mode (experimental, `KIMI_CODE_EXPERIMENTAL_TOWER=1`): the agent no longer enters tower mode on its own — turn it on with `/tower on` or `/tower `. * The subagent model setting (`[secondary_model]`) graduates from experimental to stable. * Block dangerous shell commands such as shutdown, reboot, or rm -rf in Auto mode, and always ask before running them in Manual and YOLO modes; disable the guard with `[permission] dangerous_command_guard = false` or `KIMI_CODE_DANGEROUS_COMMAND_GUARD=false`. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-8) * Preserve comments, key order, and formatting in config.toml when configuration values are updated. * Remove the workspace restriction on the Bash tool's cwd parameter. * Default the workspace trust prompt selection to "Trust this folder" instead of "Don't trust". * The `kimi acp` subcommand no longer honors `KIMI_CODE_LEGACY_FLAG`; it always runs on the default agent engine. * web: Add a code wrap toggle to the diff panel and streamline its header. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-9) * Honor explicit `[experimental]` config entries over the `KIMI_CODE_EXPERIMENTAL_FLAG` master switch, so a flag set to `false` in config.toml stays off; per-feature `KIMI_CODE_EXPERIMENTAL_` variables still override both. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.39.1 (2026-08-28) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-39-1-2026-08-28) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-10) * web: Fix switching the permission mode in one session changing it for every session; the permission mode is now scoped per session. * web: Fix signed-in users without a usable model being wrongly asked to sign in (and getting stuck there on web); the send gate now offers picking or configuring a model instead. * web: Fix the first IME (or keyboard) character being silently swallowed after clicking the composer placeholder. * web: Fix attachments in a newly created session still showing as uploading after the upload has finished. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.39.0 (2026-08-27) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-39-0-2026-08-27) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-7) * Add Remote Control as an experimental feature for accessing a local web session remotely. Enable it with `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL=1`, then run `kimi rc`, `kimi web --remote-control`, or `/remote-control` to start it. * Add experimental tower mode for multi-agent orchestration; set `KIMI_CODE_EXPERIMENTAL_TOWER=1`, then run `/tower on` and `/tower ` to start. * Add an optional `fork` parameter to subagent and swarm tools that starts the subagent with a snapshot of the calling agent's conversation history; set `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK=1` or `subagent_fork = true` under `[experimental]` in config.toml to enable it. * web: Allow moving a running foreground Bash command or subagent to the background via the "Move to background" button on the running card. * web: Add a flat/by-workspace tab to the mobile session list. * Add the Tencent CloudBase plugin to the curated marketplace. * Add a dedicated `[swarm] timeout_ms` config option (or the `KIMI_CODE_SWARM_TIMEOUT_MS` env var) for AgentSwarm subagent timeouts, which no longer follow `[subagent] timeout_ms`. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-9) * web: Revamp the right sidebar as a multi-tab panel. * web: Improve composer interaction, including the presentation of file, folder, and media attachments. * web: Improve mobile UI styling. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-11) * Fix file tools and shell working directories failing to resolve Git Bash paths such as /c/Users or /tmp on Windows. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.38.0 (2026-08-20) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-38-0-2026-08-20) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-8) * Support two OAuth login methods — kimi.ai and kimi.com. * Add the WaitFor tool: the agent can now wait for a background task to finish within the current turn instead of ending the turn and being re-invoked. * Add 13 data sources to the official Kimi Datasource plugin — Chinese government data (NDA/NBS) and standards (GB/HB/DB/TT), eight international organization datasets (WHO, FAO, UNSD, ECB, Eurostat, UNICEF, OECD, FRED), Xinhua Finance, and Caixin. Update the plugin from the Official tab in /plugins. * web: Add a Pin action to the chat header more-menu. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-10) * Edit and Write now require reading an existing file before modifying it. * Collapse long `!` shell command output instead of flooding the transcript. Press ctrl+o to expand or collapse it together with tool output. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-12) * Fix config.toml entries being lost when the file had a syntax error or was edited outside the app. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.37.2 (2026-08-19) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-37-2-2026-08-19) ----------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-11) * web: Settings gains a Lab tab with a new multi-tab sidebar toggle; when enabled, the sidebar shows the Open / Done / Workspaces tabs. * Make several refinements and internal improvements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.37.1 (2026-08-18) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-37-1-2026-08-18) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-13) * Fix pasted images and videos failing to reach the model. 0.37.0 (2026-08-18) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-37-0-2026-08-18) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-9) * Activate multiple skills in a single prompt. Type `/` after whitespace to insert a skill token. * The Windows native (single-binary) CLI now supports automatic updates. * web: The sidebar gains Open / Done / Workspaces tabs, and sessions can be marked as done. * web: Add a session management page. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-12) * Queue slash skill commands entered while the agent is busy instead of rejecting them. * web: @-mentioned files, folders, and skills in chat messages now render as icon pills. * web: The browser tab title now shows the current workspace directory name. * web: The search dialog now finds workspaces too, and picking a workspace or session result expands the sidebar and scrolls the item into view. * web: Renamed the Subagent panel to "Background Agent". * Warn when a typed `/goal` objective exceeds the 4000-character limit, and keep the input if it is rejected. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-14) * Fix Gemini tool-calling sessions failing on follow-up requests. * web: Fix Ctrl+K in the composer opening session search on macOS — session search now only answers to Cmd+K. * web: Fix the Background Agent panel showing incorrect task counts and statuses. * web: Fix pasting a copied folder into the composer failing the upload with a connection error — folders are now skipped instead. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.36.1 (2026-08-14) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-36-1-2026-08-14) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-10) * web: Generate session titles with AI (experimental). Off by default — set `KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE=1` (or the master flag `KIMI_CODE_EXPERIMENTAL_FLAG=1`) to turn it on. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-13) * web: Polish the Plan, Goal, and Swarm toggles in the composer, which now live in the + menu next to the input box. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-15) * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.36.0 (2026-08-13) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-36-0-2026-08-13) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-11) * Upgrade the experimental subagent model setting to a model pool: the `[secondary_model]` section can now hold a set of candidate models with descriptions, and the main agent picks from them per spawn based on the task. Set `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` (or the master flag `KIMI_CODE_EXPERIMENTAL_FLAG=1`) before starting Kimi to enable it. Recommended setups: * Minimal: run `/secondary-model` in the TUI, or write a single `default_model` line in `config.toml`, to make every subagent run the same model by default; add `force = true` to pin that choice so the main agent cannot override it. * Declare a named pool with a one-line scenario description for each alias — the descriptions are what the main agent sees when choosing: toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" [secondary_model.models] "kimi-code/kimi-for-coding-highspeed" = "Fast and cheap — good for daily refactoring, code explanation, and small edits." "kimi-code/k3" = "Strong at complex reasoning and deep debugging — pick it for hard problems." See the [subagent model pool docs](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#subagent-model-pool) for details. * Add an experimental fullscreen TUI mode. Set the `KIMI_CODE_TUI_FULL_SCREEN=1` environment variable to enable it. * Support rendering LaTeX math formulas (`$…$` / `$$…$$`) in TUI messages as Unicode formulas. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-16) * Show project MCP launch targets in the workspace trust prompt, default to declining trust, and resolve `fd` and `stty` binaries to absolute paths so untrusted workspaces cannot plant bare-name executables before confirmation. * Fix sessions failing with a provider 400 error on every follow-up request after a turn is interrupted while the model is still thinking, on strict OpenAI-compatible providers (e.g. DeepSeek). * Fix Ctrl+C being ignored during automatic retries of failed API requests. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.35.0 (2026-08-12) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-35-0-2026-08-12) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-12) * Add the Modern Web Guidance plugin to the bundled plugin marketplace. Run `/plugins` and select Modern Web Guidance to install it. * Show the live work progress of background subagents in the `/tasks` panel. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-17) * Fix coder subagents spawning further subagents by default. * Fix the token counts reported after compaction reading far below the real context size; they now match the numbers shown while the session runs. * Fix two binary-planting risks on Windows. * Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. 0.34.0 (2026-08-06) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-34-0-2026-08-06) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-13) * web: Add a flat view to the sidebar session list. * The Kimi Computer Use plugin now supports Windows x64 — install it from `/plugins`. * Show a cache-expiry reminder when resuming or sending after a long idle. Set [`cache_expiry_hint`](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#tui-toml) to `false` to disable it. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-14) * web: Subagent tasks show their model and thinking level. * web: Show a failure card with one-click resume when a model request fails. * web: Show retry progress (attempt N of M) in the working status during automatic retries. * Show browser extension links and activation steps after installing Kimi WebBridge. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-18) * Fix UTF-16 LE/BE text files (with or without a BOM) failing to load. * web: Fix attachments being dropped when sent with a skill command. * web: Fix the model picker overflowing the screen when many models are available. * web: Fix a file path with spaces opening the Documents folder instead of the file on Windows. * web: Fix the thinking level resetting to the model default when a new session starts with a skill command. * web: Fix manually cancelled sessions showing an error marker in the sidebar; it now appears only when the last turn failed. * web: Fix IME composition while renaming a session — Enter and Esc no longer act mid-composition. * web: Fix dragging to select text while renaming moving the whole list item. * web: Fix the background-tasks and todos pills jumping to the top when the plan approval dialog expands. * web: Fix the chevron direction on the "show less" button of the changed-files summary card. * Fix `kimi -p` exiting before background tasks and subagents finish. * `/feedback` now works for signed-in users on any model; signed-out users see the sign-up page and GitHub Issues links. * Fix removing an MCP server breaking open sessions: its tools stay visible but calls fail with a removal notice. * Fix the last turn's outcome being lost across server restarts — failed turns now stay flagged in session lists and resumed sessions. * Fix resumed sessions showing background-task completion as raw protocol text instead of a status card. 0.33.0 (2026-08-05) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-33-0-2026-08-05) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-14) * Add Kimi Computer Use and Kimi WebBridge as built-in official marketplace entries in the v2 CLI. Installing from `/plugins` sets up the latest managed runtime and plugin together, reports incomplete manual steps, and supports retrying interrupted setup. * web: Add and manage custom providers in settings. * web: Pin sessions to the top of the sidebar. * web: Set an emoji for the session title. * web: Show the signed-in account and plan usage. * Add /bug as an alias for the /feedback slash command. Type /bug to submit feedback. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-15) * Ask whether to trust the current folder on startup. * `/fork` no longer switches to the forked session: the current session stays active and its background tasks keep running. Find the fork in `/sessions`. * web: Overhaul the UI/UX and fix known issues. * Start the interactive TUI without creating a session. * Rename the partner plugin marketplace tab to Curated and clarify that it contains third-party plugins from Kimi partners. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-19) * Fix all tool calls failing with spawn EBADF on macOS when a skill folder contains a very large file tree. * Fix MCP OAuth re-authorization always failing with "Invalid redirect URI"; the stale client registration is now dropped and re-created with the current callback URI. * Ensure the first request waits for MCP startup to finish while the interface still opens immediately. * MCP tool results now surface the spec-defined `structuredContent` field and `_meta` server metadata to the model instead of silently dropping them, so servers that return their machine-readable contract in these fields work the same as on other MCP hosts. * Fix built-in capability availability and installed status in `/plugins`, preserve legacy WebBridge skills as backups during updates, and prevent Computer Use updates from duplicating or disconnecting MCP servers. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors) * Run the CLI surfaces (interactive TUI, `kimi -p`, `kimi acp`, `kimi export`, `kimi provider`) on the agent-core-v2 engine by default. Set `KIMI_CODE_LEGACY_FLAG=1` to fall back to the legacy engine. 0.32.0 (2026-08-04) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-32-0-2026-08-04) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-15) * Add four hook events: `TurnStarted`, `UserPromptQueued`, `TaskStarted`, and `SessionHeartbeat`. Configure them under `[[hooks]]` in `config.toml` — see [Hooks](https://moonshotai.github.io/kimi-code/en/customization/hooks.html) for details. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-16) * Rename two `[loop_control]` keys: `max_retries_per_step` → `max_attempts_per_step` and `max_steps_per_run` → `max_steps_per_turn`; the old keys stop working with a rename warning at startup — see [loop\_control](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#loop-control) . * Add a `[token_counting]` config section: when a provider doesn't report token usage, switch the context-size display to local estimates — see [token\_counting](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#token-counting) . ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-20) * Fix answers to interactive question prompts being rejected when the model provider returns tool call IDs containing colons (some OpenAI-compatible gateways). * Fix automatic context compaction getting stuck retrying an oversized request until it fails. * Fall back to the built-in models.dev catalog snapshot when the public catalog is unreachable, so importing a known provider still works offline or in blocked networks. * Fix the context window limit showing as 0 when no model is configured; it now falls back to the default model. * web: Fix dark-mode monochrome controls and align the chat composer corner radius with the design system. * Fix the `/login` already-logged-in confirmation being hard to read; it now uses the success color. 0.31.1 (2026-07-31) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-31-1-2026-07-31) ----------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-17) * Reduce frequent full-screen redraws in the TUI. * Preserve the assistant's partial output when a turn is interrupted with Esc, and remind the model that the previous turn was deliberately interrupted. * web: Order permission modes from safest to most permissive across settings surfaces, and fix the swapped yolo/auto risk colors in the status panel and mobile settings. * web: Enable Monaco-based highlighting for code blocks, and fix line numbers overlapping or drifting out of alignment in fallback-rendered code blocks. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-21) * Fix sporadic "model is not configured" errors when starting kimi web, caused by the background provider-model refresh transiently clearing the model catalog while the first session was being created. * web: Fix new sessions showing the thinking level (e.g. Max) while the first message actually ran with thinking off. * web: Make the @ file mention work in a new-session draft, before the first prompt creates the session. * web: Fix chat code blocks rendering in the proportional UI font at the wrong size after the markdown renderer upgrade, and align the loading fallback with the highlighted block. 0.31.0 (2026-07-30) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-31-0-2026-07-30) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-16) * Support Markdown-defined custom agents on agent-core. * Add the /secondary\_model slash command to configure the secondary model used by subagents (experimental; enable it in /experiments first). * Plugins can contribute custom agents, discovered automatically and available for sub-agent delegation. * Plugins can contribute system prompt instructions through `systemPrompt` or `systemPromptPath` in `kimi.plugin.json`. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-22) * Remove the blocking `block`/`timeout` wait from the TaskOutput tool so checking a background task can no longer stall the conversation; it now always returns an immediate snapshot, and completion still arrives via automatic notification. * Fix sessions missing from the session picker when their cached metadata predates the archived flag. * Fix request headers not being passed correctly on some requests. 0.30.0 (2026-07-29) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-30-0-2026-07-29) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-17) * Add a customizable footer status line, configured via `[status_line]` in `tui.toml`. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-18) * Show a quota note after installing official plugins that bill against plan quota (such as Kimi Datasource). * Show a notice when an official plugin used in the session has an update available — run /plugins to update. * Remove the 50 MB size limit on file uploads to the built-in server. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-23) * Fail fast when account quota or balance is exhausted instead of silently retrying for ~3 minutes. * Stop the turn after repeated invalid tool calls instead of retrying indefinitely. * web: Fix garbled line numbers in code blocks. 0.29.2 (2026-07-27) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-29-2-2026-07-27) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-24) * Fix goal pursuit pausing when a goal turn hits the per-turn step limit (`loop_control.max_steps_per_turn`). * Fix messages sent during goal pursuit being rejected. * Fix /undo to restore conversation history, todo lists, plan mode, and task notifications consistently. * web: Fix copying selected chat text over plain HTTP overwriting the clipboard with an event placeholder. 0.29.1 (2026-07-24) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-29-1-2026-07-24) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-18) * Add global default MCP server timeouts in `config.toml` and env vars. * Add environment variables to configure the web search and web fetch services without OAuth login. * Add experimental secondary-model bindings for newly spawned subagents, including per-agent model preferences and subagent-only model overrides. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-25) * Fix loss of thinking content with OpenAI-compatible endpoints that return reasoning under a different field name (e.g. newer vLLM). 0.29.0 (2026-07-22) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-29-0-2026-07-22) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-19) * web: Support defining agents in Markdown files, declaring system prompt, name, description, and tool permissions. [Details](https://moonshotai.github.io/kimi-code/en/customization/agents.html#agent-file-format) * web: Permanently override the main agent's system prompt with SYSTEM.md. [Details](https://moonshotai.github.io/kimi-code/en/customization/agents.html#overriding-the-main-agent-s-system-prompt-with-system-md) * web: Globally enable or disable tools across all sessions via config.toml. [Details](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#tools) * Videos attached to a prompt now reach the model together with the prompt, with no extra tool round trip. * Support selecting a thinking effort level from ACP clients. * Add environment variable overrides for agent loop and background task limits. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-19) * Import many more providers from the models.dev catalog. * Improve TUI performance and resume speed for long-running sessions. * Reconnect a dropped MCP server connection automatically when one of its tools is called, and retry the call once. * Remove red coloring from syntax highlighting in code previews and markdown code blocks. * Add a reminder for third-party install sources to use the official installer in the update prompt. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-26) * Fix sessions getting stuck with a provider "message must not be empty" error after a content-filtered response. * Fix cancelled model requests being wrapped as retryable provider errors. * Fix thinking levels being offered for models that do not support them. * Fix config environment overrides being persisted into config.toml while the env var is set. * Send the session prompt cache key to OpenAI and OpenAI Responses providers. * Fix ReadMediaFile failing on videos when the provider has no file upload channel. * Fix goal mode continuation prompts leaking into the transcript when resuming a session. * web: Show transparent images over a checkerboard canvas. * Remove references to the non-existent `kimi resume` command from the scheduled-task tool descriptions. 0.28.1 (2026-07-20) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-28-1-2026-07-20) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-20) * Allow ACP sessions to start with configured non-OAuth model credentials instead of requiring terminal login. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-20) * Run web servers foreground-only end to end: the /web slash command now always starts a new server, and the `kimi web kill` / `kimi web ps` subcommands are removed — foreground servers stop with Ctrl+C. `kimi server kill` remains as a deprecated fallback that only stops servers started by a version before 0.28.0. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-27) * Fix running subagents not observing permission mode switches made after they started. 0.28.0 (2026-07-20) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-28-0-2026-07-20) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-21) * **Breaking:** * The `kimi server` command tree is deprecated; use `kimi web` instead. * `kimi web` now runs in the foreground of the current terminal and opens the browser; stop it with Ctrl+C. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-21) * Thinking effort persists only levels below the model's top tier (max). * web: Add a note in the model switcher that switching models or thinking effort invalidates the existing prompt cache. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-28) * Correct the YOLO and Auto permission mode descriptions: YOLO auto-approves tool actions but the agent may still ask questions, while Auto is fully autonomous and never asks. * Fix the web backend ignoring symbolic links when loading AGENTS.md files and reading files. 0.27.0 (2026-07-17) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-27-0-2026-07-17) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-22) * Add the /copy slash command to copy the last assistant message to the clipboard. * Using an API key for Kimi coding models now also fetches the latest model list automatically. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-22) * OAuth connection errors now include the underlying network cause (DNS, refused connection, TLS, or timeout) instead of a bare "fetch failed". ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-29) * Fix repeated request rejections after an interrupted model response. * Fix the built-in URL fetch tool's network safeguards: crafted domains and redirect chains can no longer reach loopback or internal network services. * web: Fix LaTeX formulas rendering as garbled overlapping text when the web UI is accessed over the network. * web: Fix queued messages silently re-sending previously uploaded files when a session is reopened. * web: Remember the thinking level per model, fixing an empty, unresponsive thinking picker when the model doesn't support the stored level. * web: Fix duplicate workspace groups on Windows when the same folder is opened with different path spellings; its sessions now list under one merged group. * Fix AGENTS.md files installed as symbolic links being ignored by the web backend. * Fix Esc and Ctrl+C cancelling compaction instead of closing an open /btw panel. * Fix whitespace-only thinking content rendering as a blank line in the transcript. * Fix `/export-debug-zip` and `kimi export` overwriting the previous ZIP on repeated runs for the same session; the default filename now includes a timestamp. 0.26.0 (2026-07-16) Say hi to the BIIIG DAY! [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-26-0-2026-07-16-say-hi-to-the-biiig-day) ------------------------------------------------------------------------------------------------------------------------------------------------------------ ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-23) * Expand the coder subagent tool set to include background tasks, todo lists, plan mode, skill invocation, and nested agents, mirroring the main agent's capabilities. * Warn in the `/model` and `/effort` pickers that switching invalidates the existing prompt cache, and hint to use `/new` to avoid extra token costs. * web: Refresh the model catalog for all providers when opening the model picker, so newly available models always show up. * Optimize the unit formatting of the context usage display. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-30) * Fix a resumed session being marked as just updated and jumping to the top of the session list without any new activity. * Fix the context size indicator under-reporting the model's actual context usage. * Fix Kimi-provider models routed through the Anthropic protocol incorrectly showing reasoning effort options. * Honor an explicit thinking "off" on OpenAI-compatible (chat completions) providers. * Report when users stop tasks and preserve other stop reasons in model context. * Fix a race where resuming a background subagent right after it was manually stopped could fail with an "already running" error. * Replay empty thinking content verbatim instead of substituting a placeholder space on Anthropic-compatible and Kimi preserved-thinking endpoints. * Keep legacy migrations idempotent across multiple Kimi homes and report damaged or unmapped sessions instead of silently skipping them. * web: Fix the sidebar resize handle being covered by the chat composer background. 0.25.0 (2026-07-16) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-25-0-2026-07-16) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-23) * web: Attach any file type in chat — files can be dropped anywhere in the window, and sent files, images, and videos show as chips in the message bubble. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-24) * web: Show full diagnostics for model request failures. * Apply official Anthropic effort profiles and a 128k output fallback for unknown models. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-31) * Fix the web server bearer-token check being bypassed by percent-encoded API paths, which allowed unauthenticated access to every API route. * Fix the session filesystem API following symlinks that point outside the workspace, which allowed accessing host files beyond the session directory. * web: Keep session activity indicators in sync with agent work and prevent duplicate streamed content after session activation races or LLM retries. * Fix custom-named models on Anthropic-compatible providers starting new sessions with thinking effort off and not showing the thinking control in ACP clients. * Honor adaptive\_thinking = false on Anthropic-compatible models by omitting the effort parameter from requests. * web: Fix the Content-Security-Policy on non-loopback server binds blocking the web UI's theme bootstrap script and bundled fonts. * Fix sessions failing to be created when the workspace directory is given through a symlink. * Fix the CLI exiting unexpectedly when reading an image from the clipboard fails; it now falls back to pasting text. * web: Fix completed background subagents losing their final output after a session reload. * web: Fix Enter not confirming modal confirmation dialogs in dev builds. * web: Fix a background subagent showing up as two identical rows in the agents dock panel during streaming. * Fix the diagnostic log missing the actual error when the CLI exits unexpectedly. 0.24.2 (2026-07-15) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-24-2-2026-07-15) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-24) * Add a builtin `/check-kimi-code-docs` skill that automatically answers Kimi Code product questions with official-docs sources. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-25) * Align `kimi -p` behavior across engines: `print_background_mode` and `print_max_turns` now apply, and `/goal` runs stay alive until the goal finishes. * `kimi -p` now stays alive by default while background tasks are pending, with no effective wait or turn limit, and feeds each completion back to the agent. Set `print_background_mode = "exit"` or `"drain"` to restore the old exit-after-one-turn behavior. * `kimi -p` background tasks and subagents no longer time out by default (interactive mode is unchanged); restore limits with `[background] bash_task_timeout_s` or `[subagent] timeout_ms`. * Subagent timeout now defaults to 2 hours everywhere; override with `[subagent] timeout_ms` or `KIMI_SUBAGENT_TIMEOUT_MS`. * The per-step LLM retry limit is raised from 3 to 10 attempts, so transient provider failures (429 / overload) are retried before a turn fails; tune with `loop_control.max_retries_per_step`. * Workspaces now stay in sync: new sessions register automatically, missing workspaces are restored at startup, and removed ones stay removed. * `kimi web` now logs failed requests and key operations so daemon issues are easier to diagnose. * web: AgentSwarm cards now stay expanded while subagents are still running. * web: Minimized plan review and question cards now use an upward chevron for expand. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-32) * web: Fix mobile layout on iOS, including the composer, safe areas, and toasts. * Fix new sessions not opening in older CLI versions. * Fix completion notifications firing early when a subagent finished while the main turn was still running. * Fix the web UI showing the wrong CLI version. * Fix Gemini tool call IDs colliding across turns and merging swarm runs into one card. * web: Show server error details when actions like stopping or archiving a session fail. * web: Fix long responses stalling after the tab was backgrounded. * web: Fix code block copy buttons over plain HTTP. * web: Keep loaded sessions visible when the session list fails to reload. * web: Restore the AgentSwarm member list after a page refresh. * web: Fix session titles not generating when the first message is a slash command. * web: Show each message's actual send time after reloading a session. * Fix several goal-mode issues around budgets and turn limits, pausing and resuming, crash recovery, final status messages, and invalid persisted goal records. * Fix replaced goals being able to affect the new goal's budget, and reject subagent goals consistently. * Correct the guidance shown when a goal cannot be paused or resumed. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-1) * Rename the dynamic tool loading capability from `select_tools` to `dynamically_loaded_tools`; behavior is unchanged. 0.24.1 (2026-07-14) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-24-1-2026-07-14) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-33) * Fix Kimi sessions getting stuck when preserved-thinking history contains an empty reasoning step. * Fix built-in tools being unavailable when the model provider becomes ready after the session starts. * Fix Thinking effort routing: non-Kimi providers now preserve configured values, while Kimi models validate runtime selections and fall back safely during model resolution. * web: Align thinking-level handling with the CLI: submit the selected level verbatim instead of silently downgrading it, fall back to the model's own default when nothing was chosen or the model switches, and persist explicit picks as the default for new sessions. * Preserve goal completion summaries and show untyped LLM errors without an internal error-code prefix in step interruption events. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-26) * web: Show just the level name (e.g. Max) in the model pill instead of "thinking: max". 0.24.0 (2026-07-14) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-24-0-2026-07-14) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-25) * web: Add session export: run `/export` or pick Export session from a session's more menu to download the session and troubleshooting logs as a ZIP (limited to 64 MiB). * Move foreground Bash commands that hit their timeout to the background instead of killing them, so long-running commands survive the timeout and report back on completion. Set `bash_auto_background_on_timeout = false` under `[background]` in config.toml to restore the kill-on-timeout behavior. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-27) * web: Refine goal mode controls with animated strip interactions, budget-aware progress, and design-system cancellation confirmation. * On session close, background tasks are now asked to stop and given a grace period before being force-stopped. * Rewrite repeated-tool-call reminders to redirect the agent toward a different action instead of prohibiting the call. * Optimize the TaskOutput tool prompts to discourage blocking waits on background tasks. * Send the kimi-code-cli User-Agent on provider registry (api.json) and model catalog fetches, so registries can identify the client version. * Log a warning when a skill fails to parse instead of silently dropping it, and fix skill scan results not being reported. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-34) * Prevent oversized image reads from poisoning sessions; sessions that already failed with request-too-large errors now recover automatically. * Fix session fork losing everything except the conversation log: forked sessions now carry over media attachments, plan files, background task output, and cron tasks, and a failed fork no longer leaves a broken copy behind. * web: Fix several session rendering glitches when reopening, reconnecting, or resyncing a session, including the context usage indicator dropping to 0, duplicate user message bubbles, and duplicated text in multi-step turns. * web: Fix uploaded images failing to display when connecting to the server over a non-localhost address. * web: Continue blocked goals after the user resumes them from the goal controls. * web: Fix the AgentSwarm member list disappearing after a page refresh while subagents are still running. * web: Fix the goal card disappearing after a page refresh while a session goal is active. * web: Fix the workspace picker menu sizing too narrowly for its content. * web: Recover transient subagent rate limits without surfacing them as session errors. * Fix Bash auto-detection on Windows failing when git comes from a native MSYS2 toolchain (ucrt64/clang64/clangarm64). * Fix OAuth login hanging after browser authorization when the provider configuration changes during sign-in. * Show the provider's actual rejection message instead of a misleading re-login prompt when an OAuth-managed model keeps returning 401 after a token refresh. * Fix providers without a configured `base_url` being rejected: anthropic/openai and other protocol providers now fall back to their official default endpoints again. * Fix MCP tools being unavailable on the first turn after session startup. * Fix pasted media and images being dropped from `/skill` and plugin command arguments, and when steering with `Ctrl-S`. * Fix empty reasoning blocks being dropped across providers, which broke multi-step tool calls. * In auto permission mode, plan exits are now marked as auto-approved instead of user-reviewed, so the agent no longer mistakes the approval for a user signal to start executing. * Fix background tasks being lost or wrongly marked as lost when resuming sessions. * Fix server shutdown sometimes leaving a stale instance file behind. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-2) * `kimi web` now runs on the reworked agent engine by default. 0.23.6 (2026-07-12) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-6-2026-07-12) ----------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-28) * web: Let wide Markdown tables grow beyond the reading column up to 1040px, scrolling horizontally inside the table when wider. * web: Keep the server access token for up to 7 days across tab close and browser restarts, instead of asking for it again with every new tab. * web: Add workspaces by typing an absolute path directly in the workspace picker's search box, with live validation and completion suggestions. * web: Auto-enable the default thinking effort when switching to a model that supports effort levels in the web UI. * Recognize the `support_efforts` and `default_effort` fields when importing a custom registry, so thinking effort levels are available for those models. * Update the WebBridge install page link opened from the `/plugins` panel. * Add a `subagent.timeout_ms` config option (or the `KIMI_SUBAGENT_TIMEOUT_MS` env var) to control how long a single subagent may run before timing out; the default is raised from 30 minutes to 2 hours. * Add a print-mode background policy: set `[background].print_background_mode = "steer"` to keep `kimi -p` alive across background-task completions, so the main agent can be steered into follow-up turns. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-35) * web: Fix sessions getting stuck in a sending state after a reconnect; turns that finish while the connection is down now stop the spinner and let the next message send normally. * web: Fix the first visit after starting or updating the web UI bouncing to the login page when the initial auth check fails; the connecting screen now stays up, shows the connection error, and retries. * Keep `kimi -p` runs alive after a turn ends while a goal is still active or a cron task is pending, so goal continuations and cron fires run their turns instead of being cut off when the main turn finishes. * Treat a dismissed question prompt as the user choosing not to answer, instead of implicitly selecting the recommended option. * web: Fix ReadMediaFile results rendering as plain tool cards instead of images after resuming or reloading a session. * web: Fix the chat view jumping downward while scrolling through conversation history. * web: Fix the model dropdown showing checkmarks on same-named models from other providers; the current model is now matched by its unique model id. * web: Fix sidebar lag with many sessions by removing repeated session list scans during rendering. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-3) * Rename the dynamic tool loading model capability from `select_tools` to `dynamically_loaded_tools`. 0.23.5 (2026-07-10) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-5-2026-07-10) ----------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-29) * Retry provider 429, overload, and other transient errors more reliably, honoring the server Retry-After delay, and surface retries in `-p --output-format stream-json`. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-36) * Stop unsupported image formats (AVIF, BMP, TIFF, ICO, …) from breaking sessions at every entry point — including remote image URLs and images mislabeled by a tool — and recover an already-stuck session by dropping the offending image and retrying, so one such image can no longer make every later request fail. * web: Fix the "Turn finished" desktop notification and completion sound firing twice per turn. * web: Hide the internal image-compression note so it no longer renders as user message text. 0.23.4 (2026-07-10) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-4-2026-07-10) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-26) * web: Add notifications when a tool needs approval, and improve notification reliability. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-30) * web: Polish the chat UI with Inter typography, localized labels, and tighter composer and menu styling. * web: Polish the session sidebar layout, colors, icons, and typography. * Display the Extra Usage (fuel pack) balance in the `/usage` and `/status` commands. * Add a Kimi WebBridge entry to the Official tab of the `/plugins` panel that opens the WebBridge install page in your browser. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-37) * Keep image-heavy sessions within provider request-size limits: oversized images (model-read and pasted, including WebP) are downscaled and compressed, HEIC/HEIF reads are refused with a platform-matched conversion command instead of poisoning the session, and an HTTP 413 request-too-large now recovers automatically — the request and `/compact` retry with older media replaced by text markers. The limits are configurable via `[image]` in `config.toml` (or `KIMI_IMAGE_*` env vars), and each core keeps its own settings so reloading one client's config no longer changes another client's compression. * Fix resuming sessions whose original working directory no longer exists. * Fix prompt-mode goals so they run until completion and report invalid goal commands before sending prompts. * web: Fix an occasional "another turn is active" error when sending the first message of a new conversation, and show a starting state while it is being sent. 0.23.3 (2026-07-08) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-3-2026-07-08) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-38) * Fix a misleading "OAuth login expired" message shown when a model is not available for the current account. 0.23.2 (2026-07-08) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-2-2026-07-08) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-27) * Add the Vercel plugin to the bundled plugin marketplace. Run `/plugins` and select Vercel Plugin to install it. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-39) * Fix `kimi -p` runs exiting with code 0 when a turn fails. * Prevent autonomous goals from being paused by model-reported status updates. * Count the turn that starts an autonomous goal toward its turn budget. * Raise the image downscale cap from 2000px to 3000px, and fix swapped width/height for EXIF-rotated (portrait) photos in compression captions and media read notes so region readback coordinates map correctly. * web: Fix the connection error toast lingering after the WebSocket reconnects when returning from the background. * Fix console windows flashing on Windows each time a hook runs. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-31) * web: Redesign the scheduled reminder UI. * web: Show session skills in the slash menu as `/skill:` so they are distinguishable from built-in commands; typing the bare skill name still works. * web: The composer model switcher switches the active session's model as before and additionally bumps the global default model, so new sessions inherit the choice. * web: Press Enter to confirm in archive and other confirmation dialogs. * Tighten goal-mode guidance for blocked and complete status updates. * Progressive tool disclosure (`select_tools`, experimental): compaction now discards the loaded tool schemas instead of re-injecting them, and the model re-selects the tools it still needs afterward. A from-memory call to a no-longer-loaded tool is rejected with guidance to select it first. No effect unless the `tool-select` experimental flag and a `select_tools`\-capable model are active. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-4) * web: Compile icons at build time so the bundled web UI only carries the icons it renders. 0.23.1 (2026-07-07) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-1-2026-07-07) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-40) * Fix `kimi -p` abandoning background subagents that start late or run long, so their results reach the main agent. * web: Recover chat streaming after a stale background-tab WebSocket instead of requiring a page refresh. * Fix some third-party models (e.g. Opus 4.8) falling back to the family default max output tokens; an unrecognized minor now reuses the nearest earlier known version's limit. * Honor explicit Anthropic `max_output_size` settings instead of clamping them to built-in ceilings. * Stop showing tool-produced `` metadata in tool outputs; failed tools now show their own error text. * Fix goal completion and blocked updates to produce one final user-facing outcome summary from the tool result. * Fix goal startup and queue handling so failed starts restore permission mode and queued goals wait behind new user messages. * Fix goal token budgets to count model completion tokens and stop without extra continuation steps when the budget is exhausted. * Fix goal tools being unavailable to the main agent, and return clear messages for invalid goal-control calls. * Respect the `--skills-dir` flag in interactive mode. * web: Fix several slash commands and skills not working on the new-session screen: `/goal ` and slash skill activations (for example `/pre-changelog`) silently did nothing, and `/btw []` opened an empty side chat. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-32) * Preserve prior turns' thinking by default on the Anthropic provider (Claude and Kimi's Anthropic-compatible mode), matching the Kimi default. Disable with `[thinking] keep = "off"` or `KIMI_MODEL_THINKING_KEEP=off`. * Clarify the permission mode descriptions shown by `/permission`, `/auto`, and `/yolo`, and reorder `/auto` and `/yolo` in the command list. * Show long-running goal wall-clock budget reminders in hours. * Tighten goal-mode guidance so agents continue reasonable work across turns instead of ending goals prematurely. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-5) * Record a per-request trace in the session wire log, so model requests can be reconstructed for debugging. 0.23.0 (2026-07-06) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-23-0-2026-07-06) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-28) * web: Add an Archived sessions page in Settings to browse and restore archived sessions. Open Settings → Archived to find it. * Add experimental on-demand tool loading (`select_tools`) under the `tool-select` flag: a supporting model loads MCP tools only when needed instead of sending all of them in every request, preserving the provider prompt cache. Off by default and only active on models that declare the `select_tools` capability. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-41) * Fix sessions that exist on disk but were missing from the session list or returned 404 on direct access, by rebuilding the session index at server startup. * Fix the Bash and Edit tool cards collapsing, jumping, or flickering in height when results stream in or finish with short output, and visually separate the Bash command from its output. * Fix the input box shifting upward after the slash command menu closes. * Fix the edit approval preview shown by Ctrl+E to include surrounding context lines, matching the summary panel. * Fix `@` file completion missing deeply nested files in large projects after adding extra workspace directories. * web: Fix several web layout and animation glitches: the collapsed sidebar now hides correctly, the chat history no longer replays its entrance animation when opening a session, and tool components no longer jump the conversation when expanded or collapsed. * web: Fix scheduled-reminder (cron) fires being hidden; they now show as notice cards in the chat. * web: Fix the end of a reply staying missing after reopening a session. * web: Fix queued media messages not loading back into the composer and keep attachments when undoing a message. * web: Keep the composer toolbar from clipping its controls on narrow windows and phones, with the context ring staying visible at every width. * web: Fix the font size setting so chat text, composer text, and sidebar text follow the selected size. * web: Fix an almost-invisible composer input caret and a washed-out strikethrough on completed todos. * web: Show the correct session search shortcut on Windows. * Fix tool calling with Google Gemini models, including Gemini 3 thinking-signature round-trips across turns. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-33) * web: Replace the swarm footer with a single inline tool card that shows live subagent progress and the aggregated result, and keep the swarm progress bar stable after refresh. * Show compaction summaries in the TUI after compaction. Press Ctrl+O to show or hide the summary. * web: Render AskUserQuestion answers as a readable option list with the chosen option(s) highlighted, instead of raw JSON. * web: Show available skills in the composer before a session is created. * web: Add an Archived sessions entry to the mobile settings sheet and clarify the archive confirmation to mention restoring from Settings. * web: Show the Kimi icon and clearer titles in desktop notifications. * web: Align the markdown diff code block with the design system: code text keeps the normal ink colour while the sign and a soft row background carry the change, matching the `~/diff` panel. * web: Prevent chat text from hyphenating at line breaks and render code without font ligatures. * web: Drop the stray left indent in the tool-call card body so expanded content aligns with the header. * Feed AskUserQuestion answers back to the model as question text and option labels instead of positional ids, so the model no longer has to map them back. Question texts must now be unique per call and option labels unique per question; existing clients keep answering with option ids, so no client change is required. * Keep prior reasoning across turns for Kimi models by default when Thinking is on. Set `[thinking] keep = "off"` to disable. 0.22.3 (2026-07-04) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-22-3-2026-07-04) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-42) * Wait for background subagents to finish and respond to their results before exiting in `kimi -p`, instead of ending the turn early. * web: Fix uploaded videos failing to play in the web chat. * Revert the recent TUI transcript rendering changes to the original upstream behavior and fix related rendering issues. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-34) * Add `--dangerous-bypass-auth` and `--keep-alive` flags to `kimi server run`, so the server can run without a token on trusted networks and stay alive past the idle timeout. * web: Add click-to-enlarge for images uploaded in the web chat. Click an image in a message to open it. 0.22.2 (2026-07-03) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-22-2-2026-07-03) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-43) * Fix sessions silently dropping later user messages after a turn was interrupted between a tool call and its result. * Fix requests being rejected by strict providers when the model emits duplicate tool call ids. * Fix `kimi upgrade` failing on Windows with a spawn error when installing the new version. * Fix duplicated transcript content appearing in scrollback during streaming. * Fix compressed-image prompts leaking an internal `` compression note into the visible message and the session title. * Keep automatic background updates from flashing a console window on Windows. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-35) * Have context-compaction notes capture a forward plan for the remaining work — upcoming steps, settled decisions, and foreseeable obstacles — instead of only the immediate next step, so the agent continues more coherently after auto-compaction. * Enrich PATH from the user's login shell at startup, so shell commands find user-installed tools (e.g. Homebrew's `gh`) even when kimi-code was launched without the full profile PATH. * Promote the language-matching rule to a dedicated section in the system prompt, so replies and reasoning consistently follow the user's language through long English tool output, while repository artifacts keep project conventions. * Add a TUI preference to keep rapid multi-line pastes from submitting line by line when bracketed paste is unavailable. Set `disable_paste_burst = true` in `tui.toml` to turn it off. * Keep subagent cards at a stable height and show a live status spinner with a compact two-row activity window. * In `kimi -p` runs, wait for background subagents to finish before exiting when `background.keep_alive_on_exit` is enabled. Set `keep_alive_on_exit = true` to let concurrent background subagents complete. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-6) * Record model response ids in session wire logs to make individual model requests easier to trace. 0.22.1 (2026-07-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-22-1-2026-07-02) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-44) * Fix TUI rendering bugs that caused the screen to go blank and the input box to disappear. * Fix the TUI crashing when the terminal is resized to a very narrow width while the input contains CJK or emoji text. * Fix the web UI becoming sluggish after opening many sessions. * Clear the screen fully when starting a new session via /new, /clear, or a session switch. * Fix web tooltips that could get stuck on screen when their trigger element is removed while open. * Fix the sidebar session row shifting its title and status badges when hovered. * Fix the session search dialog showing a horizontal scrollbar for long session titles or snippets. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-36) * Improve compaction handoff summaries for more reliable resumed sessions. They now keep the latest intent, key tool results, decisions, open questions, and context to re-check. * Save shell commands to input history and recall them in bash mode. Press Up on an empty `!` prompt to browse previous shell commands. * When large images are compressed, tell the model the original and delivered image details. Keep the original image available, and support cropped or full-resolution reads for fine details. * Refresh the web UI icon set and unify the message copy and undo button hover states and tooltips. * Let the web sidebar collapse an expanded workspace session list back to its first page. * Trim redundant and incorrect tooltips in the web UI. * Show an up arrow on the web composer send button. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-7) * Remove the experimental micro compaction feature and its toggle from the experiments panel. * Remove duplicate newline-shortcut handling from the prompt editor. 0.22.0 (2026-07-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-22-0-2026-07-02) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-29) * Automatically compress oversized images before they reach the model, downsampling and re-encoding them to cut vision-token cost and avoid provider image-size errors. * Add model alias overrides, letting you set model metadata under `[models."".overrides]` to override provider catalog refresh results. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-45) * Fix plan, swarm, and goal modes being shared across sessions in the web UI; each session now keeps its own toggles. * Fix the transcript jumping to the top when scrolling up through history during streaming output. * Release pasted images and streaming timers once they are no longer shown, so memory stops growing in long sessions. * Fix the terminal being left in raw mode with a hidden cursor and disabled flow control after a crash or abrupt exit. * Fix an active workspace showing only its five most recent sessions on load, so it now keeps loading older sessions from the last 12 hours. * Fix the Thinking-by-default setting not taking effect, so new sessions correctly start with thinking enabled. * Fix spurious errors from the web question, approval, and task actions when the action was already complete, and add loading feedback so each click is acknowledged immediately. * Show draft pull requests with a distinct draft status instead of displaying them as open. * Hide the conversation outline when there is not enough room to expand its labels, so it no longer clips against the window edge. * Hide the unsupported Off option in the /model thinking switcher for always-on models that already expose multiple effort levels. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-37) * Refresh the web UI with a new design system, including updated colors, typography, spacing, light and dark palettes, restyled tooltips, and subtle enter/exit and expand/collapse animations. * Group consecutive tool calls into a collapsible stack with per-tool renderers, including diff line-count chips for edits and inline previews for image, video, and audio results. * Improve session search with a Cmd/Ctrl+K palette that filters by title, workspace, and last prompt with highlighted matches. Press Cmd+K or Ctrl+K to open it. * Show queued prompts inline below the running turn in the web chat, and split Stop into its own button so Send no longer interrupts. * Show the conversation outline as one entry per user query that expands into a labeled list on hover. * Replace the Explore and Native theme options with a single chat layout and a Blue or Black accent-color setting. * Add workspace sorting by manual order or last-edited time, plus collapse-all and expand-all controls, to the sidebar. * Show time, duration, connection, and stack details in web error and warning toasts. * Use one consistent modal dialog for confirmations in the web UI (archive session, delete workspace, delete provider, undo message, and mode toggles). * Reduce the default TUI transcript window to keep long sessions responsive. * Reduce the web composer's default height for a more compact empty state, and fix ArrowUp recalling the previous message while editing a multi-line draft; ArrowUp now recalls only from the very start of the text and is disabled in the expanded editor. * Remove the fade-out animation when undoing a message in the web chat. 0.21.1 (2026-07-01) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-21-1-2026-07-01) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-46) * Keep the waiting spinner visible while encrypted reasoning streams, fixing a blank spinner-less gap before the first response text appears. 0.21.0 (2026-07-01) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-21-0-2026-07-01) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-30) * Plugins can now provide slash commands via a `commands` field in their manifest, registered as `:` and invoked with `$ARGUMENTS` expansion. * Add Mermaid diagram rendering to the web chat. Fenced `mermaid` blocks in assistant responses now render as diagrams. KaTeX math and Mermaid diagram parsing also run in Web Workers to keep the UI responsive during live streaming. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-47) * Stop a malformed message history from permanently bricking a session on strict providers (Anthropic). The request is repaired before sending — orphaned tool calls are closed and empty/whitespace-only text blocks dropped — and if the provider still rejects its structure, it is resent once with a wire-compliant rebuild. * Force-exit headless runs (`kimi -p`) so a stray ref'd handle left over from the run can't keep a completed run alive until an external timeout, and bound prompt cleanup so a wedged shutdown step can't hang shutdown. * Fix @ file mentions not opening when typed inside a slash command argument. * Fix adding a workspace by path in the web UI failing silently when the daemon rejects the path; it now shows an error instead of a broken workspace. * Fix duplicate workspaces showing in the web sidebar when the same folder is registered more than once. * Fix the web workspace rename not persisting after a page refresh. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-38) * Add a double-Esc shortcut to open the undo selector. Press Esc twice while idle to undo. * Show file path completions when typing `/` in shell mode (`!`). * Always show the usage-data opt-out toggle in the web settings with a clearer label and description. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-8) * Rework conversation compaction: * Keep only recent user prompts plus a single user-role summary; drop assistant and tool messages. * Repair tool\_use/tool\_result adjacency before sending, fixing a strict-provider HTTP 400 when a tool call and its result became non-adjacent. * Merge consecutive user turns for strict providers (Gemini/Vertex), fixing an HTTP 400 ("roles must alternate") after compaction or when a turn is steered in right after a tool result. * Micro-compaction now defaults off. * Refactor the thinking effort system * Add a server-side key-value store API for persisting web UI preferences to the user's data directory. 0.20.3 (2026-06-30) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-20-3-2026-06-30) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-48) * Fix provider error messages rendering as blank lines in the TUI when the server returns an HTML error page. * Fix the web composer being hidden behind the mobile Safari toolbar and the page auto-zooming when the composer is focused. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-39) * Refresh provider model lists automatically in the background instead of only at startup, so newly available models appear without restarting. * Glob now uses ripgrep, so it respects .gitignore by default, supports brace patterns, returns only files, and keeps partial results with a warning when some directories are unreadable. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-9) * Align malformed tool call argument handling with schema validation fallback. 0.20.2 (2026-06-29) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-20-2-2026-06-29) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-31) * Support the Anthropic-compatible protocol for Kimi Code, including video input. * Add a completion sound and question notifications to the web UI, with separate Settings toggles for completion notifications, question notifications, and sound. Question notifications default off so question text only reaches your desktop after you opt in. * Add `KIMI_CODE_CUSTOM_HEADERS` for custom outbound LLM request headers, and send the `User-Agent` header to non-Kimi providers. Set `KIMI_CODE_CUSTOM_HEADERS` to newline-separated `Name: Value` lines. * Add an optional `exclude_empty` parameter to the session list API to omit sessions that have no messages. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-49) * Recover from provider 413 context overflows by compacting before retrying. * Cap compaction output at 128k tokens by default to avoid provider `max_tokens` errors. * Fix compaction ignoring the configured max output size. * Fix unnecessary full-screen redraws when typing in the input box or toggling the slash panel. * Keep unsent composer attachments scoped to their session in the web UI, so switching sessions no longer leaks them into another session's next message. * Fix the web composer occasionally keeping typed text after sending the first message of a new session. * Fix debug timing output lingering after undoing a turn. * Fix working tips getting squeezed against the agent swarm progress bar. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-40) * Rework the web ask-user-question card into a step-by-step wizard so multi-question navigation and the final Submit action are easier to see. * In the bundled web UI, a new session is now created only when the first message is sent, so `+ New` without a workspace opens the composer instead of making an empty session. * Restore each session's scroll position when switching back to it in the web UI. * Keep the open side panel when switching between sessions in the web UI. * Scope the web composer's up/down input history to the current session instead of sharing it across all sessions. * In the bundled web UI, `/new` and `/clear` are now aliases that open the session onboarding composer and focus the input. iOS auto-zoom is prevented by keeping text inputs at 16px instead of disabling viewport scaling. * Hide unused "New Session" entries from the web session list by default. * Remove the `/sessions` slash command from the web UI; the sidebar already covers session browsing. * Show the first five sessions per workspace in the web sidebar instead of ten. * Replace the web composer attach button's plus icon with an image icon. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-10) * Route Kimi Code models on the Anthropic-compatible protocol through the beta Messages API. * Upgrade web markdown renderer dependencies (katex, markstream-vue, shiki) for bug fixes and performance improvements. * Add provider type and protocol attributes to turn and API error telemetry. 0.20.1 (2026-06-26) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-20-1-2026-06-26) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-32) * Plugins now support declaring lifecycle hooks in `kimi.plugin.json` to run scripts at specific stages. See [Hooks in Plugins](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/plugins.html#hooks-in-plugins) . * `/feedback` now supports attaching diagnostic logs and codebase context. * Add the `kimi update` command, equivalent to `kimi upgrade`, for upgrading to the latest version. * `kimi web` adds the `--allowed-host ` option to add a specified Host to the DNS-rebinding allowlist; 403 errors now explain how to allow it via `--allowed-host` or `KIMI_CODE_ALLOWED_HOSTS`, e.g. `kimi web --allowed-host example.com`. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-50) * Fix kimi server failing to start on Windows after the first run. * Fix the Web UI opened by the `/web` command not signing in automatically; the terminal now prints the access token. * Cap chat-completions providers' `max_tokens` to the remaining context window, avoiding context overflow and invalid parameter errors. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-41) * Optimize the default system prompt and built-in tool descriptions to stop the agent from blocking background tasks, unify tool guidance across profiles, and surface previously missing tool-result details (fetched-page mode, Grep match totals). * Cache rendered message lines to keep the terminal responsive in long conversations. * Retain only recent turns in the transcript and collapse older steps within each turn to keep long sessions responsive. * Make the web chat input grow with its content and add an expandable editor for longer messages. * Show the done / in progress / pending breakdown of hidden todos in the collapsed todo panel. 0.20.0 (2026-06-26) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-20-0-2026-06-26) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-33) * Add shell mode to the TUI. Type `!` in the input box to enable it. For long-running commands, press Ctrl+B to move them to the background. For example, you can run `!gh auth login` to sign in to the GitHub CLI without opening a new terminal. * Add a `--host` CLI option so `kimi web --host` can expose the server to the internet, with hardened token authentication, rate limiting, and other security measures. * Render LaTeX display math (`$$…$$`) in the web UI. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-51) * Fix a startup crash on Linux caused by an unhandled native clipboard error. * Fix `kimi web` and `/web` failing to start the background server daemon on Windows with `spawn EFTYPE` when the CLI is installed via npm/pnpm or run from source. The official single-binary install script was not affected. * Fix the terminal window repeatedly losing focus on Linux Wayland, which broke IME input. * Stop auto-dismissing questions in the web UI after 60 seconds so they wait for the user's answer. * Fix explore subagents silently losing git context when git commands time out or the directory is not a repository. * Fix Ctrl-C during compaction so it clears a pending editor draft first instead of cancelling immediately. * Fix MCP server working directories when sessions are hosted by the web server. * Fix duplicate session snapshot reloads in the bundled web UI during resync. * Fix truncated skill descriptions missing an ellipsis in the model's skill listing. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-42) * Redesign `/plugins` as a single tabbed panel: **Installed** (manage installed plugins — toggle, remove, MCP, details, reload), **Official** (Kimi-maintained marketplace plugins), **Third-party** (marketplace plugins from other publishers), and **Custom** (install straight from a GitHub URL, zip URL, or local path). Use `Tab` / `Shift-Tab` to switch tabs. * Show a line-by-line diff when the agent edits or writes a file in the web chat. * Show the plan body and approach choices in the plan review card when exiting plan mode in the web UI. * Show the full accumulated progress of a subagent in its detail panel, with concise tool-call summaries instead of raw JSON. * `/reload` now refreshes the assistant's view of plugin skills, so plugin changes take effect in the current session instead of requiring a new one. * Replace silent AGENTS.md truncation with a visible warning in the TUI status bar and web UI. * Add a confirmation prompt before installing third-party plugins. * Show update badges on the `/plugins` Installed tab, where Enter now installs the available update and I opens plugin details. * Add a copy button to user messages in the web chat. * Preserve full tool output logs when previews are truncated and link background task completion notifications to saved output. * Sync session title changes across all connected clients in server mode. * Add Ctrl+U and Ctrl+D as page up and page down shortcuts in the task output viewer. * Add a hint to the per-turn step limit error pointing users to the `loop_control.max_steps_per_turn` config option. * Reduce streaming redraw cost for long assistant messages with code blocks. * Page the web session list per workspace so the first screen no longer fetches every session up front. * Keep the web session sidebar from re-rendering on every streaming token to improve rendering performance. * Create missing parent directories automatically when writing a file. * Improve the image paste hint. 0.19.2 (2026-06-24) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-19-2-2026-06-24) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-34) * Keep drag-and-drop workspace reordering in the web sidebar, with sort order persisted locally; sessions now also float to the top of their group as soon as a new message arrives. * Add an Alt+S shortcut in the model picker to switch the model for the current session only, without saving it as the default. * Add a Ctrl+T shortcut to expand and collapse a truncated todo list. * Add `-c` as a shorthand for `--continue`. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-52) * Fix yolo mode in the web app auto-approving plan reviews and sensitive file access. * Fix resume not realigning a tool call that was interrupted mid-history. * Fix the composer's ↑/↓ input-history recall doing nothing right after the first message of a new session. * Fix stale rows occasionally leaving duplicate input boxes after tall content shrinks. * Fix inline images being rendered as broken escape sequences in the transcript. * Fix code blocks nested inside list items rendering blank in the web chat after a turn finishes generating. * Fix the Tab key unexpectedly opening the file completion list. * Fix clipboard copy actions in the web UI when served over plain HTTP. * Fix the web question prompt missing the free-text Other option. * Fix web chat stop actions so stale prompt ids fall back to cancelling the active session. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-43) * Read large text files in bounded memory and read tail lines without scanning whole files. * Show the command in running Bash tool cards and allow expanding it with Ctrl+O before the result arrives. * Allow the web sidebar and detail panel to be resized up to the available viewport width, keeping their resize handles reachable on narrow windows. * Show subcommand suggestions after Tab-completing a slash command name. * Show a transient footer hint when an image is detected in the clipboard, displaying the platform-appropriate paste shortcut. * Persist the collapsed state of workspace groups in the web sidebar across page reloads. * Add a development-mode indicator to the web sidebar for local development. * Optimize the loading tips display. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-11) * Reorganize the web app's components into area subdirectories (chat/settings/dialogs/mobile) and refresh the component path comments. * Extract several composer pieces into reusable composables. * Extract pure turn-rendering helpers out of the chat pane into their own module. * Extract the beta conversation outline (table of contents) into its own component. * Extract the workspace group rendering out of the sidebar into its own component. 0.19.1 (2026-06-23) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-19-1-2026-06-23) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-53) * Fix ACP editors such as Zed failing to start a new thread. * Fix the web sidebar's unread dots getting out of sync across browser tabs. * Clear all per-session state when a session is archived or removed, so archived sessions no longer leave orphaned data behind. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-12) * Consolidate web client localStorage access and split the root state store and app shell into focused composables. 0.19.0 (2026-06-22) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-19-0-2026-06-22) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-35) * Added the ability to add extra workspace directories: * Use the `/add-dir ` command to add extra working directories to the current session, or remember them for the project. * Use `kimi --add-dir ` to add them on startup. * Project-level local config is now managed in `.kimi-code/local.toml`; we recommend adding it to your `.gitignore`. * Allow long-running foreground commands and subagents to be moved into background tasks with `Ctrl+B`, and inspect them via the `/tasks` panel. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-54) * Surface provider safety-policy blocks instead of silently treating them as completed turns, and prevent the context token count from dropping to zero after a filtered response. * Fix provider requests failing when restored conversation history contains empty text content blocks. * Detect the real image format from file contents when reading media, so a mismatched filename extension no longer produces a data URL the model API rejects. * Fix commands flashing an empty console window on Windows. * Stop showing unread dots on cancelled or failed sessions in the web sidebar. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-44) * Speed up session snapshot loading with a direct disk reader and a request timeout safeguard, keeping the previous path as a legacy fallback. * Show longer branch names in the web chat header and expose the full name on hover. * Keep the web page title fixed instead of changing with the session or workspace name. * Polish file mention UX. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-13) * Unify image format detection when sniffing fails. * Consolidate web client localStorage access and decouple appearance/notification state into dedicated modules. 0.18.0 (2026-06-18) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-18-0-2026-06-18) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-36) * Add session filtering to the web sidebar, filtering by title and the last user prompt. * Add scroll-up lazy loading for older messages in the web chat session view. * Add an environment variable to cap AgentSwarm concurrency during the initial ramp, so large swarms do not trip provider rate limits as easily. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-55) * Fix the web app only loading the 20 most recent sessions. * Fix web slash skill selection sending immediately and allow slash search to match skill names by substring. * Fix the highlighted web slash command not staying visible while navigating a long slash menu. * Fix incorrect display after archiving the last session. * Fix the web login slash command description to match the browser authorization flow. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-45) * Redesign the web OAuth login dialog so the order of steps is unambiguous. * Show the current version in web settings. * Allow long web slash command names and descriptions to wrap without overflowing the slash menu. * Add `/reload` suggestion in plugin-change hints. 0.17.1 (2026-06-17) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-17-1-2026-06-17) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-56) * Fix the `kimi web` command failing to start in the background. * Stop the background local server from locking the directory it was started in. * Prevent the web login dialog from closing when clicking the backdrop. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-46) * Group the default model dropdown in web settings by provider. 0.17.0 (2026-06-17) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-17-0-2026-06-17) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-37) * Add Kimi Code Web mode, which you can start with `kimi web` or `/web` in the CLI, and continue sessions in a browser chat interface. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-57) * Show the underlying connection error when OAuth token refresh fails after internal retries, instead of prompting for login. Token refresh failures are no longer re-retried at the agent loop level. * Restore the turn counter from persisted loop events on resume so post-resume turns no longer reuse turn ids that already appear in history. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-47) * Skip debug TPS when the output stream is too short to measure reliably. 0.16.0 (2026-06-16) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-16-0-2026-06-16) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-38) * Add a built-in `kimi vis` command that launches the session visualizer in your browser, pointed at your local sessions. Supports `--port`/`--host`, `--no-open`, and `kimi vis ` deep-links. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-58) * Stop Anthropic-compatible providers from reading ambient Anthropic shell credentials and custom headers. * Fix repeated compaction handling when context remains over the blocking threshold. * Prevent session shutdown from resuming the agent when stopping background tasks. * Project session replay ranges over rendered replay records instead of raw persisted records. * Close wrapped output streams when buffered readers are destroyed. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-48) * Reduce the maximum height of the `/btw` side panel from half to one-third of the terminal. * Polish queue pane styling. * Add configurable banner display frequencies with local display state. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-14) * Remove redundant LLM request logging context plumbing. 0.15.0 (2026-06-15) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-15-0-2026-06-15) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-39) * Add an all-sessions picker view with name search, paginated browsing, and clipboard-ready resume commands for sessions in other working directories. * Add support for legacy SSE MCP servers alongside stdio and streamable HTTP transports. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-59) * Recover resumed sessions when an interrupted tool call result was not recorded. * Stop writing resume version markers into persisted agent metadata. * Do not carry obsolete legacy loop, background, plan, yolo, or unknown experimental flags into migrated config files. * Repair mismatched JSON Schema types emitted by Xcode 26.5 MCP server for Moonshot compatibility. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-49) * Keep TUI components within narrow terminal widths by wrapping, compacting, or truncating lines that could exceed the render width. * Prompt the CLI to show one brief same-language status sentence before non-trivial tool calls. * Extend the same-language rule to the model's reasoning, so thinking follows the user's language while keeping code and technical terms in their original form. * Read media files using header-detected types before falling back to media extensions. * Prioritize clearing draft editor text before Ctrl-C cancels an active stream. * Collapse hidden directories in the workspace prompt and explain how to inspect them. * Include the skill's directory on the loaded-skill context block so the agent can locate a skill's bundled resources (scripts, templates) after it is invoked. * Show the all-sessions toggle hint when the current working directory has no sessions. * Clarify that compaction summaries must be emitted in the final answer. * Clarify AGENTS.md prompt guidance and mark truncated instruction files. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-15) * Resolve model capabilities through a static lookup instead of instantiating a temporary provider. * Decouple agent skill access from session-specific registry implementations. * Optimize the npm packaging system. 0.14.3 (2026-06-14) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-14-3-2026-06-14) ----------------------------------------------------------------------------------------------------------- ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-50) * Refresh provider model metadata before opening the model picker. 0.14.2 (2026-06-12) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-14-2-2026-06-12) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-60) * Fix endless desktop notifications in iTerm2 by only sending terminal progress sequences to terminals that support them. * Show completed and cancelled compaction records correctly when resuming a session. * Drop invalid config.toml sections with a warning instead of failing to start. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-51) * Stream foreground Bash stdout and stderr while commands are still running. * Allow `--auto`, `--yolo`, and `--plan` to be combined with `--session` or `--continue` by applying the requested mode to the resumed session. * Qualify sub-skill names with their parent prefix and expose sub-skills as dotted slash commands in the TUI. * Sync custom registry provider additions, removals, and rotated registry keys during startup refresh. 0.14.1 (2026-06-12) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-14-1-2026-06-12) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-61) * Cancel active turns during session shutdown so foreground shell commands do not outlive prompt-mode exits. * Stop background tasks by default when sessions close. * Prevent overlapping interactive agent requests from using the wrong active agent. * Fix premature stream close errors when shell processes time out or are killed. * Degrade unsupported audio/video to placeholder text and reattach tool result media instead of silently dropping them. * Send OpenAI Responses system prompts as request instructions. * Propagate configured execution environment overrides across spawned processes. * Fix ACP file reads and edits for Windows workspaces opened through IDE clients. * Require AgentSwarm tool calls to run alone in a model response. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-52) * Add runtime support for dynamic MCP server updates, reference skills, replay timestamps, and Node file uploads. * Add a YOLO choice when starting swarm tasks from Manual mode. * Polish builtin skills. * Find slash commands by their aliases in autocomplete — typing `/clear` now suggests `new (clear)`. * Wrap long command and skill descriptions in the autocomplete menu onto a second line instead of cutting them off. * Display a tips banner below the welcome panel on startup. 0.14.0 (2026-06-10) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-14-0-2026-06-10) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-40) * Add an `Interrupt` hook event that fires when the user interrupts a turn (e.g. pressing Esc), letting hooks observe the turn stopping instead of getting stuck on a working state. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-62) * Preserve image outputs from tools when using OpenAI-compatible chat completions. 0.13.1 (2026-06-10) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-13-1-2026-06-10) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-63) * Prevent forking sessions during active turns and consolidate wire protocol definitions into a shared internal package. * Fix Kimi Datasource to use the matching OAuth credentials and service endpoint for the active Kimi Code environment. * Fix goal marker text overflowing terminal width. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-53) * Add Claude Fable 5 support to the Anthropic provider. * Add an interactive undo selector and clearer undo-limit messages. * YOLO mode no longer asks before writing or editing files outside the working directory. * Clarify active skill prompts so loaded skills are no longer represented as system reminders. * Tighten file tool guidance to route incremental edits through Edit. 0.13.0 (2026-06-10) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-13-0-2026-06-10) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-41) * Add custom color themes. Define your own palette as a JSON file in `~/.kimi-code/themes/`, or generate one with the built-in `/custom-theme` skill command. * Add `/import-from-cc-codex` to import selected Claude Code and Codex instructions, Skills, and MCP settings. * Show available plugin updates in the marketplace. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-64) * Fix Windows builds and development launches that could fail when package binaries resolve to command shims. * Fix device login to keep the URL and code visible when the browser cannot be opened. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-54) * Clarify grouped subagent progress with active status breakdowns and elapsed time. * Truncate queued message display to a single line with ellipsis when it exceeds terminal width. 0.12.1 (2026-06-09) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-12-1-2026-06-09) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-65) * Allow obsolete experimental config entries to remain without blocking startup. * Pass through xhigh reasoning effort for OpenAI-compatible chat completions requests. 0.12.0 (2026-06-09) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-12-0-2026-06-09) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-42) * Add the `/swarm` command for running agent swarms with live progress and rate-limit-aware retries. * Make goals, background questions, and sub-skill discovery available without experimental opt-ins. * Honor the standard `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` / `NO_PROXY` environment variables, including SOCKS proxies, for all outbound traffic. * Support Homebrew installations. * Enable micro compaction by default. Disable via `/experiments`. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-66) * Fix ACP slash skill routing, bootstrap context reads, file and permission edge cases, subagent event handling, and stale-file edit messaging. * Fix goal resume behavior by restoring goal state from agent records. * Fix thinking text and tool output display for subagents. * Fix session workdir mismatch on Windows caused by inconsistent path separators. * Fix the `/mcp` status panel border being broken by multi-line MCP server errors, which are now folded onto a single row. * Detect Git Bash installed through Scoop and other Git shims on Windows. * Show the underlying error when migration fails. * Allow the startup session picker to exit with repeated Ctrl-C or Ctrl-D. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-55) * Remove the per-turn auto-compaction limit so long conversations can keep compacting instead of failing early. * Improve goal mode outcome handling with follow-up messages, safer error pauses, and clearer TUI transcript display. * Show full plan cards directly and remove the Plan card keyboard shortcut. * Wrap long single-line shell commands in approval prompts so the full command remains visible. * Rework file reference completion in the TUI. * Load Kimi-specific user Skills and global agent instructions from `KIMI_CODE_HOME` when it is set. 0.11.0 (2026-06-05) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-11-0-2026-06-05) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-43) * Add experimental sub-skill discovery gated by the `KIMI_CODE_EXPERIMENTAL_SUB_SKILL` environment variable. Ships the `sub-skill` builtin bundle (`sub-skill.review`, `sub-skill.consolidate`) for inventorying and consolidating skills into hierarchical groups. * Add the following environment variables: * `KIMI_MODEL_TEMPERATURE`, `KIMI_MODEL_TOP_P` — sampling parameters applied globally to any `kimi` provider (not tied to `KIMI_MODEL_NAME`). * `KIMI_MODEL_THINKING_KEEP` — Moonshot preserved-thinking passthrough (`thinking.keep`), injected only while Thinking is on. * `KIMI_CODE_NO_AUTO_UPDATE` (legacy alias `KIMI_CLI_NO_AUTO_UPDATE`) — fully disables the update preflight (no check, background install, or prompt). * Show built-in skills as direct slash commands and group them ahead of external skill commands. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-67) * Fix slash command autocomplete so goal text can be submitted when the cursor is before existing text. * Fix queued goals so failed promotion attempts do not lose or duplicate queued work. * Fix upcoming-goal queue handling while editing or pasting queued goals. * Ask before starting goals in YOLO mode so users can switch to Auto for unattended work. * Show concise provider filtering errors when responses are blocked before visible output. * Show "unknown command" instead of "too many arguments" when an invalid subcommand is entered. * Clamp OpenAI Chat Completions `xhigh` and `max` thinking effort to `high` unless the model supports `xhigh` on `v1/chat/completions`. * Preserve thinking effort when compacting long conversations. * Refresh provider model metadata when capabilities change without model ID changes. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-56) * Show the upcoming-goal confirmation with the same accent treatment as goal lifecycle messages. * Start upcoming goals immediately when there is no active goal to wait for. Support multiline edits when managing upcoming goals. * Use a fixed 30-minute timeout for subagents and show concise resume instructions when they time out. * Highlight goal queue subcommands while typing slash commands. 0.10.1 (2026-06-05) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-10-1-2026-06-05) ----------------------------------------------------------------------------------------------------------- ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-68) * Fix a crash when starting a goal in the TUI. 0.10.0 (2026-06-04) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-10-0-2026-06-04) ----------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-44) * Users now can prepare several goals for the agent to work on sequentially. The agent will pick up the next goal from the queue once the current goal is completed. Use `/goal next ` to queue a goal and `/goal next manage` to review and change the queue interactively. * Add the built-in `update-config` skill — you can now have Kimi edit its own config files. * Add persistent experimental feature toggles and a TUI panel that applies confirmed changes by reloading the current session. * Add `/reload` to reload the current session and apply updated config files, plus `/reload-tui` to reload only TUI preferences. * Add a doctor command for validating Kimi Code configuration files. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-69) * Normalize malformed Responses stream rate limit errors as provider rate limit failures. * Keep managed OAuth credentials scoped to their configured authentication and API endpoints. * Stop carrying active and queued goals into forked sessions. * Fail early when Git Bash is missing on Windows before starting CLI sessions. * Refresh the update target before showing foreground update prompts so the displayed version matches the install. * Point session error diagnostics to the `/export-debug-zip` command. * Set terminal tab titles without renaming the running process. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-57) * Start automatic background updates as soon as startup's fresh update check finds a newer version. * Set the CLI process title to kimi-code during startup. * Lowercase the stale file content message in edit tool errors. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-16) * Ensure Nix-packaged CLI builds can find ripgrep and fd. ### Other [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#other) * Document the Git Bash prerequisite for Windows installs. 0.9.0 (2026-06-03) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-9-0-2026-06-03) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-45) * Add the `kimi acp` subcommand: kimi-code now speaks [Agent Client Protocol 0.23](https://agentclientprotocol.com/) over stdio so IDEs (Zed, JetBrains AI Chat, custom clients) can drive sessions directly — coverage matrix, Zed configuration and breaking pre-release notes are in [kimi acp Subcommand Page](https://moonshotai.github.io/kimi-code/en/reference/kimi-acp.html) . * Add `/btw` for side-channel conversations without steering the active main turn, and allow `/btw` to open the side-channel panel before entering a question. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-70) * Fix external editor (Ctrl+G) on Windows by removing `/bin/sh` dependency and using platform-aware shell quoting for temp file paths. * Use the OpenAI completion token field required by newer Chat Completions models. * Use configured model output limits for completion token caps. * Fix goal budget tool schemas for OpenAI-compatible providers. * Resume saved subagents lazily when they are accessed. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-58) * Unify the interaction and visuals across TUI dialogs and selectors. * Log enabled experimental flags at startup. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-17) * Allow SDK runtime creation to use a separate RPC client while preserving local CLI startup. 0.8.0 (2026-06-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-8-0-2026-06-02) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-46) * Add experimental goal mode for longer tasks that need more than one turn. Turn it on with `KIMI_CODE_EXPERIMENTAL_GOAL_COMMAND=1` before you start Kimi. Use `/goal ` in the TUI when you want Kimi to keep working on one task across turns. For example: text /goal Fix the failing checkout test Kimi shows the goal in the TUI and keeps progress visible while it works. Use `/goal status`, `/goal pause`, `/goal resume`, `/goal cancel`, and `/goal replace ` to manage the goal. This feature is still experimental. Try it and tell us what would make it more useful. * Add `kimi provider` CLI subcommand with `add`, `remove`, `list`, and `catalog list` / `catalog add` actions, so providers from a custom registry (api.json) or the public models.dev catalog can be imported and managed without launching the TUI. * Add background structured questions so agents can continue while waiting for user answers. * Add background automatic upgrades, which can be disabled in tui.toml. * Add `/undo` slash command to withdraw the last prompt from conversation history, and keep replay records in sync when a prompt is undone. * Add a `kimi upgrade` command for manually checking and upgrade Kimi Code CLI. * Add approval lifecycle hook events for observing pending and completed permission prompts. * Allow subagents to use custom tools registered on their parent agent. * Allow glob searches to target explicit absolute paths outside the workspace. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-71) * Fix cross-provider replay failures from incompatible tool call IDs and unsigned Claude thinking history. * Fix custom registry provider handling during re-import. Prevent loss of multi-provider entries and remove stale providers along with their model aliases and default model references. * Fix tool output preview rendering: trim trailing empty lines, append ellipsis to multi-line Bash command headers, and truncate long single-line output by visual wrapped lines instead of raw newline count. * Fix slash-activated skills not being recognized by the model due to missing system reminder wrapper. * Fix a crash in the `/sessions` picker on very narrow terminals by clamping every rendered line to the terminal width. * Normalize glob patterns before brace expansion to prevent incorrect path matching. * Prevent modified keyboard release sequences from appearing after exiting the CLI. * Fix Git Bash path detection on Windows by also searching `usr\bin\bash.exe` locations, which is where bash lives in many Git for Windows installations where `bin\bash.exe` does not exist. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-59) * Show MCP server summary in the welcome panel and add configuration hints in the /mcp command output. * Point users to `/provider` instead of the removed `/connect` command in the welcome screen and the no-models-configured hint. * Append the current todo list as markdown to compaction summaries before writing them to history. * Show the full model name in the footer status bar instead of truncating the provider prefix. * Remind the model to refresh TodoList during long-running tasks and strengthen TodoList progress-tracking guidance. * Replace chalk named color with theme-aware hex in session-directory warning. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-18) * Consolidate background task management under the agent background runtime. 0.7.0 (2026-06-02) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-7-0-2026-06-02) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-47) * Add `/provider` command for managing AI providers, support custom registry imports, and introduce a tabbed model selector. It replaces the deprecated `/connect` command — use `/provider` instead. * Render scheduled reminders distinctly in the TUI, expose cron fired events to SDK clients, and report cron fire times with local timezone offsets. * Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named compatible endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-72) * Report truncated compaction summaries clearly and apply valid completion token budgets across supported providers. * Fix glob pattern backslash escaping and include match count in truncation messages. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-60) * Clarify Kimi Platform API key login labels and prompt details. * Polish a small TUI visual interaction. 0.6.0 (2026-05-29) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-6-0-2026-05-29) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-48) * Add a `KIMI_MODEL_*` environment-variable channel that lets you run Kimi Code against a specific model (provider type, base URL, API key, context size, capabilities, and thinking settings) without editing `config.toml`. * Install plugins directly from GitHub repository URLs, and surface each install's origin and trust level (kimi-official, curated, third-party) in the plugin manager. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-73) * Show the real terminal status of background agents in the transcript so lost, failed, and killed ones no longer appear as completed, and include the resume agent id and recovery instructions in the failure notification so the model can resume reliably. * Recover from provider model token limit errors during long conversations. * Automatically retry when a model response stream is dropped mid-flight (a `terminated` error) instead of failing the turn. * Handle context overflow errors consistently across provider responses. * Back off failed compaction retries by a fixed slice of the model context window. * Fix the native self-updater reporting a successful update when the install command actually failed. * Project persisted hook and blocked prompt messages into model context. * Keep blocked prompt hook conversations available to subsequent model turns. * Fix footer leaking onto the terminal when resuming a non-existent session. * Fix automatic ripgrep installation when temporary files are on another filesystem. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-61) * Remove the default per-turn step limit of 1000. Users can still set `max_steps_per_turn` in config to enforce a custom limit. * Support querying sessions by sessionId or workDir in listSessions, and show a helpful cd command when resuming a session from a different working directory. * Expand the footer's rotating tips to surface more commands and shortcuts, featuring newer and important ones more prominently. * Improve the usage information display in the TUI. * Restrict plugin trust badges to Kimi-hosted plugin CDN URL patterns. * Clarify subagent and background task stop messages as user-initiated. * Align the datasource plugin with the generic two-tool workflow. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-19) * Introduce `ModelProvider` interface and `SingleModelProvider` to decouple `Agent` from `ProviderManager`. * Split `RuntimeConfig` into `Kaos` and `ToolServices` and update all references accordingly. * Slim the LLM diagnostic logs with fewer, more compact fields. * Relocate shared tool service typing to the tool support layer. 0.5.0 (2026-05-28) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-5-0-2026-05-28) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-49) * Add scheduled tasks: You can now ask the agent to remind you at a specific time, run a task on a recurring cron schedule (for example, check a deploy every 5 minutes or run a daily report every weekday at 9am), or come back on its own in a few minutes to continue what it was doing. Schedules use the standard 5-field cron syntax. * Add `/auto` slash command and `--auto` CLI flag for auto permission mode. * Show file content and diff in Write and Edit approval prompts, and open them in a dedicated full-screen viewer on ctrl+e instead of expanding inline. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-74) * Fix compaction to handle edge cases where no messages are compactable and improve retry logic. * Fix official datasource tools to preserve complete responses and write returned result files. * Fix migration mapping the legacy `default_yolo` key to the dead `yolo` field instead of `default_permission_mode`. ### Polish [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#polish-62) * Add a clickable changelog link to the update prompt. * Show the full Bash command when expanding a Bash tool card with `ctrl+o`. The header still truncates long commands at 60 chars, but the expanded view now reveals the complete multi-line command above the output. * Shorten the session title written to the terminal window/tab from 80 to 32 characters so long first messages and pasted content no longer stretch the tab bar past readable width. * Cap the inline todo panel at five rows and show a `+N more` indicator so long task lists no longer fill the screen. * Clarify plugin manager keyboard shortcuts and show plugin state changes inline. * Report discovered plugin skills in plugin manager summaries. * Offload large base64 media payloads from `wire.jsonl` into external blob files to reduce wire size and memory pressure during session replay. Includes an in-memory read-through cache on `BlobStore` so repeated rehydration avoids redundant disk reads. * Wrap long question, body, and option text in the AskUserQuestion dialog instead of truncating with an ellipsis. The question prompt, body description, option label, option description, and submit-tab review entries now flow onto multiple lines with a hanging indent. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-20) * Refactor TUI code structure. 0.4.0 (2026-05-27) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-4-0-2026-05-27) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-50) * Add user-global plugin installation, interactive plugin management, plugin-provided skills, and plugin-owned MCP servers. * Expand folded paste markers on second paste. * Rework tool permissions: reads outside cwd no longer prompt, session approvals match the exact call, and path-based rules are case-insensitive. * Add `/export-debug-zip` slash command to export the current session as a debug ZIP archive directly from the TUI. * Add `/export-md` slash command to export the current session as a Markdown file. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-75) * Prevent the TUI from crashing when pull request lookup fails during startup. * Fix thinking spinner leaking past turn end when an empty thinking delta creates an orphaned thinking component. * Show the original session resume command after forking a session. * Restrict plugin zip installs to manifests at the archive root or a single wrapper directory. * Route session-tagged log entries exclusively to the session sink instead of duplicating them to the global sink. Consistently omit stable main-agent context keys from all session log lines that carry `agentId=main`. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-21) * Refactor TUI resume replay logic. * Use one retry classification for transient LLM failures across regular turns and compaction. ### Other [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#other-1) * Enhance `kimi export` to include more diagnostic information in the manifest. 0.3.0 (2026-05-26) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-3-0-2026-05-26) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-51) * `/logout` now opens a picker so you can choose which provider to log out of, instead of always logging out the one tied to the current model. The current provider is highlighted by default, so pressing Enter matches the previous behavior. The command is also available as `/disconnect`. * The `openai` provider now works out of the box for OpenAI-compatible reasoner models: it auto-detects thinking fields in responses (`reasoning_content` / `reasoning_details` / `reasoning`) and auto-injects `reasoning_effort` when history contains prior thinking. DeepSeek, Qwen, One API and other gateway-fronted services no longer need a hand-set `reasoning_key`, which remains available as an explicit override for non-standard gateways. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-76) * Prevent running the `/model` and `/sessions` slash commands while streaming or compacting context. * Preserve catalog-declared interleaved reasoning fields for OpenAI-compatible models configured through `/connect`. * Fix API key input dialog showing a masked dot in empty state. * Fix user skills in `~/.agents/` not being loaded. * Restore real-time token display for running subagents in the TUI. * Hide the todo panel on resume when all todos are already completed. * Always emit a paired tool result when a tool returns a malformed or missing result, preventing the next request from failing with a missing tool\_call\_id error. * Fix Plan mode session resets so new sessions no longer fail after plan review rejection and continue receiving events after setup errors. * Exit promptly when the controlling terminal goes away. The TUI now handles `SIGHUP` / `SIGTERM` and stdout/stderr `EIO` / `EPIPE` / `ENOTCONN` errors, preventing leftover `kimi` processes that pin a CPU core after the parent shell or multiplexer dies unexpectedly. * Avoid overly small local completion caps that can truncate reasoning before summaries are produced. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-22) * Make `AgentRecords` hold the `Agent` instance directly and inline the restore dispatch logic. ### Other [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#other-2) * Improve the Write tool UX. 0.2.0 (2026-05-26) [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#_0-2-0-2026-05-26) --------------------------------------------------------------------------------------------------------- ### Features [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#features-52) * Add a `/connect` command that configures a provider and model from a model catalog. * The `/connect` provider and model pickers now support type-to-search filtering, and long lists are paginated. The `/model` picker is also paginated when many models are configured. * Add `Ctrl-J` as an additional shortcut for inserting new lines in the TUI prompt. * Add wire record migration handling during session replay. * Migrate user skills from `~/.kimi/skills/` to `~/.kimi-code/skills/` during the first-launch migration; existing target skills are kept. * Emit session resume hint as a structured meta message in stream-json output format. ### Bug Fixes [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#bug-fixes-77) * Report the macOS product version in OAuth device information instead of the Darwin kernel version. * Correct the `X-Msh-Platform` header value to `kimi_code_cli`. * Clarify the prompt-mode error when no model is configured by pointing users to the login flow. * Hide the empty current session from the sessions picker while keeping other empty sessions visible. * Stop mentioning OAuth credentials in the migration UI — they are never migrated, so the previous "needs /login" notice misread as a failure. OAuth-only installs no longer trigger the migration screen. * Surface API-provided error messages during feedback, usage, login, and model setup failures. * Persist model selections from the terminal UI to the default configuration, and honor the configured default thinking state for new sessions. * Retry compaction responses that do not contain a summary before updating conversation history. * Avoid CPU spikes from large streamed tool arguments and coalesce high-frequency streaming UI updates. * Resume sessions with a newer wire protocol version instead of failing. A warning is now shown in the TUI and records are replayed without migration. * Warn tmux users when extended key settings may prevent modified Enter shortcuts from working. * Let Kimi requests use the remaining context window for completion tokens by default while keeping explicit environment limits as hard caps. ### Refactors [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#refactors-23) * Flatten tool call data by inlining tool names and arguments at the top level, and limit legacy record migration so it only rewrites matching tool call payloads. * Move wire metadata handling into the record layer and keep persistence backends limited to storage operations. ### Other [​](https://www.kimi.com/code/docs/en/kimi-code-cli/changelog.html#other-3) * When no models are configured, `/model` and the welcome panel now point users to `/login` (for Kimi) and `/connect` (for other providers). --- # Using Kimi in OpenCode | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#VPContent) On this page Using Kimi in OpenCode [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#using-kimi-in-opencode) ===================================================================================================================== [OpenCode](https://opencode.ai/) is a terminal-based coding agent. This guide shows how to forward OpenCode model requests to Kimi For Coding via built-in authentication, with K3 or K2.8 Preview providing the model inference. Install OpenCode [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#install-opencode) --------------------------------------------------------------------------------------------------------- The easiest way to install OpenCode is through the installation script: bash curl -fsSL https://opencode.ai/install | bash Or install via npm: bash npm install -g opencode-ai Configure API key [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#configure-api-key) ----------------------------------------------------------------------------------------------------------- Run `opencode auth login` and select **Kimi For Coding** from the provider list: bash $ opencode auth login ┌ Add credentials │ ◆ Select provider │ ● Kimi For Coding │ ... └ Enter your Kimi For Coding API Key: bash $ opencode auth login ┌ Add credentials │ ◇ Select provider │ Kimi For Coding │ ◇ Enter your API key │ _ └ > API Keys can be created and managed in the [Kimi Code Console](https://www.kimi.com/code/console) > (up to 5 keys; each key is shown only once at creation). Launch and use [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#launch-and-use) ----------------------------------------------------------------------------------------------------- After configuring, start OpenCode: bash $ opencode Type `/models` in a session: bash /models Pick a model under the **Kimi For Coding** list. Recommended model launch **K2.8 Preview** is now fully rolled out in Kimi Code — `kimi-for-coding` is upgraded in place with no configuration changes: performance close to K3, with `low` / `high` / `max` thinking effort levels and up to 1M context. See [What's New](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html) . Before you start, check your membership tier and what it entitles you to (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans) — calling models or context windows beyond your plan will fail with an error: | Tier | Available models | Context window | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | K2.8 Preview | `1048576` | | Plus / Moderato | K3
K3-256K
K2.8 Preview | K3: `262144`
K3-256K: `262144`
K2.8 Preview: `1048576` | | Pro and above / Allegretto and above | K3
K3-256K
K2.8 Preview
K2.7 Code HighSpeed | K3: `1048576`
K3-256K: `262144`
K2.8 Preview: `1048576`
K2.7 Code HighSpeed: `262144` | With K3 or K2.8 Preview selected, type `/variants` to switch the thinking effort: bash /variants Thinking effort mapping OpenCode offers the variants `Default` / `low` / `high` / `max`, mapped to K3's actual effort levels as follows (full mapping table in [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html#switch-model) ): | OpenCode variant | K3 actual effort | | --- | --- | | `Default` | `high` (K3) / `max` (K2.8 Preview) | | `low` | `low` | | `high` | `high` (recommended) | | `max` | `max` | Both K3 and K2.8 Preview support `low` / `high` / `max`; K2.7 Code HighSpeed does not require this setting. See [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) for model capabilities and setup details. Next steps [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode.html#next-steps) --------------------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) — Compare the models and see the full effort mapping table * [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) — Confirm which models are available for your plan --- # Quick Start | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#VPContent) On this page Quick Start [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#quick-start) ========================================================================================================= Kimi Code for VS Code is an extension integrated into Visual Studio Code. After installation, you can ask questions directly within the editor, review code diffs, and quickly commit changes. The extension can read the content of files you reference and display modification suggestions through a visual interface, executing them after your confirmation. The entire workflow is under your control while significantly improving development efficiency. ![Kimi Code VS Code](https://www.kimi.com/code/docs/images/en/vscode/kimi-code-showcase.jpeg) This extension provides a native chat panel in VS Code, supporting referencing files or folders via the `@` symbol, executing project scans and context management via `/` commands, diff views showing file changes with rollback support, and integrating MCP servers to call external tools. The chat panel can be placed in the activity bar, sidebar, or as a standalone tab. Before Installation [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#before-installation) ------------------------------------------------------------------------------------------------------------------------- You need a Kimi account subscription or a Kimi API key. Installation [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#installation) ----------------------------------------------------------------------------------------------------------- Install via [VS Code Marketplace](vscode:extension/moonshot-ai.kimi-code) . If the extension doesn't appear after installation, please restart VS Code or execute "Developer: Reload Window" in the command palette (Mac: Cmd+Shift+P, Windows/Linux: Ctrl+Shift+P). Authentication [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#authentication) --------------------------------------------------------------------------------------------------------------- Kimi Code supports two authentication modes: **Kimi Account Mode**: Click the login button, and the browser will open the authorization page. After completing the authorization flow, return to VS Code. **API Key Mode**: If you have already configured an API key, you can click to skip login. The extension will run in this mode. ![Kimi Code Gear Icon](https://www.kimi.com/code/docs/images/en/vscode/kimi-code-gear-icon.png) You can switch authentication modes at any time via the gear icon. After logging out, you will return to the login screen. Typical Workflows [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#typical-workflows) --------------------------------------------------------------------------------------------------------------------- **Code Reading**: Type `@` to select a file or folder, request an explanation of the code flow, and continue asking follow-up questions. **Refactoring**: Reference target code such as `@src/feature/`, request a refactoring plan, review the diff and selectively approve, using rollback when necessary. **Debugging**: Paste error messages or stack traces, reference related files, request diagnosis and fixes, then approve the proposed changes. **Project Overview**: Reference a folder such as `@src/services/`, request a module map or architecture summary, and continue asking about dependencies or weak points. Commands and Shortcuts [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#commands-and-shortcuts) ------------------------------------------------------------------------------------------------------------------------------- | Shortcut | Function | | --- | --- | | `Ctrl+Shift+K` / `Cmd+Shift+K` | Focus Kimi input box | | `Alt+K` | Insert current file reference | | `Ctrl+N` / `Cmd+N` | New conversation (requires `kimi.enableNewConversationShortcut` to be enabled; enabling this will occupy the system's default "New File" shortcut) | | `↑` / `↓` | Browse input history in the input box | Type "Kimi Code" in the command palette to access more commands: open in new tab, open in sidebar, new conversation, etc. Next Steps [​](https://www.kimi.com/code/docs/en/kimi-code-for-vscode/getting-started.html#next-steps) ------------------------------------------------------------------------------------------------------- * [Core Operations](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html) – Learn chat panel usage, context management, and diff review * [Customization](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html) – Explore Skills, Hooks, and MCP extensions * [Configuration](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html) – Customize authentication, models, and behavior settings --- # Claude Code | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#VPContent) On this page Claude Code [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#claude-code) ============================================================================================= > [Claude Code](https://docs.anthropic.com/en/docs/claude-code) > is a programming agent product from Anthropic. Its interface, configuration options, and supported capabilities may change across versions. This guide describes a general integration approach: forwarding Claude Code model requests to the Kimi Code API through environment variables. Before You Start [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#before-you-start) ------------------------------------------------------------------------------------------------------- * Make sure you have subscribed to [Kimi membership](https://www.kimi.com/membership/pricing?from=) and activated Kimi Code benefits. * Obtain an API Key: 1. Go to the [Kimi Code Console](https://www.kimi.com/code/console) ; 2. Click "Create API Key", enter a name and confirm; 3. Copy the generated key and keep it safe (the full key cannot be viewed again after closing the dialog). ![Kimi Code Console](https://www.kimi.com/code/docs/images/en/third-party-tools/claude-code/kimi-code-console.png) Configuration [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#configuration) ------------------------------------------------------------------------------------------------- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) is a command-line programming assistant launched by Anthropic. By configuring environment variables to connect it to Kimi's API endpoint, you can directly call Kimi Code's AI capabilities within Claude Code and enjoy the Kimi Code programming experience in a familiar terminal interface. ① **Install Claude Code** For installation instructions, please refer to the [Claude Code official documentation](https://docs.anthropic.com/en/docs/claude-code/getting-started) . │ ② **Run Script to Skip Login** After installation, do not start Claude directly. Execute the following script in the terminal first to skip Anthropic's default login flow and clean up historical configuration: sh node --eval " // enable third party model support and fast mode const claudeJsonFilePath = path.join(os.homedir(), '.claude.json'); if (fs.existsSync(claudeJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeJsonFilePath, 'utf-8')); fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ ...content, penguinModeOrgEnabled: true, hasCompletedOnboarding: true }, null, 2), 'utf-8'); } else { fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ penguinModeOrgEnabled: true, hasCompletedOnboarding: true }), 'utf-8'); } // delete old endpoint, credential and model id const claudeSettingsJsonFilePath = path.join(os.homedir(), '.claude', 'settings.json'); if (fs.existsSync(claudeSettingsJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeSettingsJsonFilePath, 'utf-8')); if (typeof content === 'object' && typeof content.env === 'object') { for (const element of [\ 'ANTHROPIC_BASE_URL',\ 'ANTHROPIC_API_KEY',\ 'ANTHROPIC_AUTH_TOKEN',\ 'ANTHROPIC_MODEL',\ 'ANTHROPIC_SMALL_FAST_MODEL',\ 'CLAUDE_CODE_SUBAGENT_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME',\ 'ENABLE_TOOL_SEARCH',\ 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',\ 'CLAUDE_CODE_EFFORT_LEVEL',\ ]) { delete content.env[element]; } fs.writeFileSync(claudeSettingsJsonFilePath, JSON.stringify(content, null, 2), 'utf-8'); } } " The settings.json cleanup part only removes endpoint, credential, and model-related entries under `env` (leftovers there **override** environment variables exported in the terminal) — other settings are untouched. Also check `~/.zshrc`, `~/.bashrc`, and other shell config files for leftover `ANTHROPIC_*` exports (Windows users should check user environment variables) and remove them as well. │ ③ **Configure API Access** Recommended model launch **K2.8 Preview** is now fully rolled out in Kimi Code — `kimi-for-coding` is upgraded in place with no configuration changes: performance close to K3, with `low` / `high` / `max` thinking effort levels and up to 1M context. See [What's New](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html) . First check your membership tier to confirm which models and context windows you can use (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans): | Plan | Available Models | Available Context Limit | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`: `262144`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576` | | Pro and above / Allegretto and above | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`: `1048576`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576`
`kimi-for-coding-highspeed`: `262144` | Two configuration methods are available — **pick one, do not mix them**: Method 1 writes to the settings.json config file and takes effect permanently regardless of how Claude Code is launched; Method 2 exports variables in the current terminal only, effective for that session. **Method 1: Write to settings.json (recommended, persistent)** The path of settings.json: macOS / LinuxWindows text ~/.claude/settings.json text C:\Users\\.claude\settings.json Write the following into the `env` field of that file (create the file if it does not exist): K3-256KK3 1M context json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.ai/coding/", "ANTHROPIC_API_KEY": "Your API Key", "ANTHROPIC_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3-256k", "CLAUDE_CODE_SUBAGENT_MODEL": "k3-256k", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "262144", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144" } } json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.ai/coding/", "ANTHROPIC_API_KEY": "Your API Key", "ANTHROPIC_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3[1m]", "CLAUDE_CODE_SUBAGENT_MODEL": "k3[1m]", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576" } } Restart Claude Code after saving for the changes to take effect. Plaintext key risk The API Key in `settings.json` is stored in plaintext — do not commit this file to a version-control repository or share it publicly with dotfiles. The file's `env` field **overrides** same-named variables exported in the terminal. **Method 2: Terminal environment variables (current session only)** **K3-256K configuration:** macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.ai/coding/ export ANTHROPIC_API_KEY=Your API Key export ANTHROPIC_MODEL="k3-256k" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.ai/coding/" $env:ANTHROPIC_API_KEY="Your API Key" $env:ANTHROPIC_MODEL="k3-256k" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="262144" claude **K3 1M context** configuration: The `k3[1m]` form is only needed for Claude Code env vars `k3[1m]` (with the surrounding quotes) explicitly tells Claude Code to use a 1M context window. In any other scenario — API requests, the Model ID field of other third-party tools — just use `k3`. macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.ai/coding/ export ANTHROPIC_API_KEY=Your API Key export ANTHROPIC_MODEL="k3[1m]" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.ai/coding/" $env:ANTHROPIC_API_KEY="Your API Key" $env:ANTHROPIC_MODEL="k3[1m]" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="1048576" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576" claude ### Configuration Reference [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#configuration-reference) Claude Code internally uses different model tiers for different scenarios (main conversation, background summarization, sub-agents, etc.). Configuring only some of these variables will silently break the corresponding scenarios: | Variable | Purpose | Impact if missing or misconfigured | | --- | --- | --- | | `ANTHROPIC_BASE_URL` | Routes model requests to the Kimi Code endpoint | Requests go to Anthropic's official endpoint and fail authentication | | `ANTHROPIC_API_KEY` | Authenticates with your Kimi Code API Key | Returns a 401 authentication error | | `ANTHROPIC_MODEL` | The model used for the main conversation | Falls back to Claude's default model name, which the Kimi Code endpoint does not recognize — model-not-found error | | `ANTHROPIC_DEFAULT_OPUS_MODEL` / `ANTHROPIC_DEFAULT_SONNET_MODEL` / `ANTHROPIC_DEFAULT_HAIKU_MODEL` / `ANTHROPIC_DEFAULT_FABLE_MODEL` | Model names Claude Code picks for each task tier | Tasks on those tiers (e.g., haiku-tier background title generation and summarization) fail | | `CLAUDE_CODE_SUBAGENT_MODEL` | The model used by sub-agents | Sub-agent tasks fail or degrade noticeably | | `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | Window size that triggers automatic context compaction | Must match the model's context: `1048576` for `k3[1m]`, `262144` for the others. Too small compacts too early and loses context; too large triggers context-overflow errors | | `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | Maximum context token budget | Same as above — must match the selected model's context window | | `CLAUDE_CODE_EFFORT_LEVEL` | Default thinking effort level; `high` is recommended for K3 | Lower values may reduce quality on complex tasks | When switching models, replace the value of every model variable in your configuration with the new model name. ### Switching thinking effort [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#switching-thinking-effort) After starting, type `/effort` in a session to switch thinking effort levels — no environment variable needed. Both K3 and K2.8 Preview support `low` / `high` / `max` with identical levels; the mapping from Claude Code levels to actual levels is: | Claude Code level | Actual level | | --- | --- | | `low` | `low` | | `medium` | `high` (recommended) | | `high` | `high` (recommended) | | `xhigh` | `max` | | `max` | `max` | | Not set (default) | `high` (K3) / `max` (K2.8 Preview) | Note With thinking disabled, requests to the K3 series and K2.8 Preview are served by K2.8 Preview (no thinking); the thinking shortcut is `Option+T` on macOS and `Alt+T` on Windows / Linux. > If prompted whether to use this API key, confirm to proceed. Afterwards, follow the prompts to select your trusted project folder to complete the authorization. > > ![Claude Code Authorize Project Access](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-trust-folder.jpg) │ ④ **Verify After Starting** After starting, enter `/status`. If the returned information shows Base URL as `https://api.kimi.ai/coding/`, the configuration is successful. Even if the model name still appears as a Claude model, the actual calls are still made to the Kimi Code API. ![Claude Code Status Check](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-status-check.png) │ Using the VS Code Extension [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#using-the-vs-code-extension) ----------------------------------------------------------------------------------------------------------------------------- The extension ships with its own Claude Code binary and shares the config files under `~/.claude` with the CLI. Follow these steps: 1. Complete the API setup in [Configuration](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#configuration) above. 2. Open the extension and start a new session. When the login page appears, click **Run `claude` in terminal** at the bottom: ![Click Run claude in terminal on the login page](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-run-in-terminal.png) 3. In the terminal that opens, complete two confirmations: choose **Yes, I trust this folder** for the workspace, then **1\. Yes** to confirm your API key: ![Claude Code API key confirmation](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-api-key-confirm.jpg) 4. **Quit VS Code completely** (`Cmd+Q` on macOS) and reopen it — the extension is ready to use. Without this terminal confirmation, the extension lacks the API key confirmation record and the login page pops up repeatedly when you send a message. FAQ [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#faq) ----------------------------------------------------------------------------- ### Changes to the configuration don't take effect [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#changes-to-the-configuration-don-t-take-effect) Check whether `~/.claude/settings.json` has leftover entries under `env` (they override terminal environment variables) — you can run the cleanup script from Step ②. Also note that variables exported in a terminal only apply to that session and must be set again after opening a new terminal; if you wrote to `settings.json`, make sure you restarted Claude Code after editing. ### 401 authentication error [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#_401-authentication-error) Check whether `ANTHROPIC_API_KEY` is a valid Kimi Code API Key — note that the full key is only shown once at creation time. ### Model not found [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#model-not-found) Check the spelling of each model variable (e.g. `k3-256k`, `k3[1m]`), and make sure there are no extra spaces or quotes. ### Background tasks or sub-agents fail [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#background-tasks-or-sub-agents-fail) Usually `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_DEFAULT_FABLE_MODEL`, or `CLAUDE_CODE_SUBAGENT_MODEL` is not configured — the corresponding scenario requested a model name the Kimi Code endpoint does not recognize. See the [Configuration Reference](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#configuration-reference) and fill in the missing entries. ### The VS Code extension keeps showing the login page [​](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#the-vs-code-extension-keeps-showing-the-login-page) The extension is missing the API key confirmation record. Click **Run `claude` in terminal** at the bottom of the login page, complete the trust-folder and API key confirmations in the terminal, then **quit VS Code completely** (`Cmd+Q` on macOS) and reopen. See [Using the VS Code Extension](https://www.kimi.com/code/docs/en/third-party-tools/claude-code#using-the-vs-code-extension) . --- # 在 IDE 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#VPContent) On this page 在 IDE 中使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%9C%A8-ide-%E4%B8%AD%E4%BD%BF%E7%94%A8) ======================================================================================================================= Kimi Code CLI 支持通过 [Agent Client Protocol (ACP)](https://agentclientprotocol.com/) 集成到 IDE 中,让你在编辑器内直接使用 AI 辅助编程。 前置准备 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%89%8D%E7%BD%AE%E5%87%86%E5%A4%87) ------------------------------------------------------------------------------------------------------------- 在配置 IDE 之前,请确保已安装 Kimi Code CLI 并完成登录配置。 ACP server 以子命令 `kimi acp` 暴露,IDE 通过子进程方式启动它,并在标准输入/输出上跑 JSON-RPC。每次 IDE 创建会话时,CLI 会复用它的鉴权状态——不需要重复登录。 路径提示 macOS 下从 IDE GUI 启动的子进程通常**不会**继承终端 shell 的 `PATH`,所以如果 `kimi` 不在 `/usr/local/bin` 这类系统目录里,IDE 配置中要使用绝对路径。终端里运行 `which kimi` 可以查到当前生效的路径。 在 Zed 中使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%9C%A8-zed-%E4%B8%AD%E4%BD%BF%E7%94%A8) ----------------------------------------------------------------------------------------------------------------------- [Zed](https://zed.dev/) 是一个原生支持 ACP 的现代编辑器。 在 Zed 的配置文件 `~/.config/zed/settings.json` 中添加: json { "agent_servers": { "Kimi Code CLI": { "type": "custom", "command": "kimi", "args": ["acp"], "env": {} } } } 配置说明: * `type`:固定值 `"custom"` * `command`:Kimi Code CLI 的可执行路径。如果 `kimi` 不在 PATH 中,请使用完整路径(例如 `/Users/you/.local/bin/kimi`)。 * `args`:启动参数。`acp` 子命令切换到 ACP 模式。 * `env`:附加环境变量,通常留空即可。Zed 会自动注入一份默认环境。 保存配置后,在 Zed 的 Agent 面板里新建一次对话,就会以你刚才配置的 `Kimi Code CLI` 启动一个 ACP 子进程。Zed 在 `agent_servers` 这层声明的 MCP 服务也会通过 ACP 协议转发到 kimi 这一侧。 在 JetBrains IDE 中使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%9C%A8-jetbrains-ide-%E4%B8%AD%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------------------------------------- JetBrains 系列 IDE(IntelliJ IDEA、PyCharm、WebStorm 等)通过 AI 聊天插件支持 ACP。 如果没有 JetBrains AI 订阅,可以在注册表中启用 `llm.enable.mock.response`,便于在仅使用 ACP 的场景里访问 AI 聊天面板。连按两次 Shift 搜索 "Registry / 注册表" 即可打开。 在 AI 聊天面板的菜单中点击 "Configure ACP agents",添加以下配置: json { "agent_servers": { "Kimi Code CLI": { "command": "~/.local/bin/kimi", "args": ["acp"], "env": {} } } } JetBrains 这一侧对 `command` 字段处理较严格——务必填写**绝对路径**,可以在终端执行 `which kimi` 拿到。保存后,AI 聊天的 Agent 选择器里就会出现 `Kimi Code CLI`。 在 Paseo 中使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%9C%A8-paseo-%E4%B8%AD%E4%BD%BF%E7%94%A8) --------------------------------------------------------------------------------------------------------------------------- [Paseo](https://paseo.sh/) 是一个自托管的编排器,能在桌面、网页和手机上统一启动并接管各类 agent 的 CLI。它和 IDE 一样,通过 ACP 接入 Kimi Code CLI。 在 Paseo 内置的 ACP provider 目录里选择 **Kimi Code CLI**,或在 `~/.paseo/config.json` 里添加一个自定义 provider: json { "agents": { "providers": { "kimi": { "extends": "acp", "label": "Kimi Code CLI", "command": ["kimi", "acp"] } } } } Paseo 的通用 ACP 适配层不会帮你走登录流程,所以请先完成终端登录(见[前置准备](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E5%89%8D%E7%BD%AE%E5%87%86%E5%A4%87) )——否则创建会话会以 `Authentication required` 失败。 故障排查 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E6%95%85%E9%9A%9C%E6%8E%92%E6%9F%A5) ------------------------------------------------------------------------------------------------------------- * **会话立刻被中断 / IDE 提示 "agent exited"**:通常是 `command` 路径不对或 kimi 没登录。先在终端跑一次 `kimi acp` 验证:如果阻塞等待标准输入则说明 CLI 本身没问题,问题在 IDE 配置;如果立刻报错则按报错提示处理(多数是没 `/login`)。 * **IDE 显示 "auth required"**:表示 CLI 没有可用的鉴权令牌。退出 IDE,在终端执行 `kimi` 完成登录后再启动 IDE 即可。 * **MCP 工具看不到**:参考 [`kimi acp`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html) 中的能力表确认 IDE 配的 MCP 传输类型是否被支持。当前 Kimi Code CLI 的 ACP server 支持 `http`、`stdio` 与 `sse` 三种传输方式;`acp` 传输的 MCP server 会被静默丢弃并在日志中给出 warn。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) --------------------------------------------------------------------------------------------------- * [kimi acp 参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html) — ACP 能力矩阵和方法覆盖详情 * [kimi 命令参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html) — 完整子命令列表 --- # Using Kimi in OpenCode | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/opencode#VPContent) On this page Using Kimi in OpenCode [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode#using-kimi-in-opencode) ================================================================================================================ [OpenCode](https://opencode.ai/) is a terminal-based coding agent. This guide shows how to forward OpenCode model requests to Kimi For Coding via built-in authentication, with K3 or K2.8 Preview providing the model inference. Install OpenCode [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode#install-opencode) ---------------------------------------------------------------------------------------------------- The easiest way to install OpenCode is through the installation script: bash curl -fsSL https://opencode.ai/install | bash Or install via npm: bash npm install -g opencode-ai Configure API key [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode#configure-api-key) ------------------------------------------------------------------------------------------------------ Run `opencode auth login` and select **Kimi For Coding** from the provider list: bash $ opencode auth login ┌ Add credentials │ ◆ Select provider │ ● Kimi For Coding │ ... └ Enter your Kimi For Coding API Key: bash $ opencode auth login ┌ Add credentials │ ◇ Select provider │ Kimi For Coding │ ◇ Enter your API key │ _ └ > API Keys can be created and managed in the [Kimi Code Console](https://www.kimi.com/code/console) > (up to 5 keys; each key is shown only once at creation). Launch and use [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode#launch-and-use) ------------------------------------------------------------------------------------------------ After configuring, start OpenCode: bash $ opencode Type `/models` in a session: bash /models Pick a model under the **Kimi For Coding** list. Recommended model launch **K2.8 Preview** is now fully rolled out in Kimi Code — `kimi-for-coding` is upgraded in place with no configuration changes: performance close to K3, with `low` / `high` / `max` thinking effort levels and up to 1M context. See [What's New](https://www.kimi.com/code/docs/en/kimi-code/whats-new.html) . Before you start, check your membership tier and what it entitles you to (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans) — calling models or context windows beyond your plan will fail with an error: | Tier | Available models | Context window | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | K2.8 Preview | `1048576` | | Plus / Moderato | K3
K3-256K
K2.8 Preview | K3: `262144`
K3-256K: `262144`
K2.8 Preview: `1048576` | | Pro and above / Allegretto and above | K3
K3-256K
K2.8 Preview
K2.7 Code HighSpeed | K3: `1048576`
K3-256K: `262144`
K2.8 Preview: `1048576`
K2.7 Code HighSpeed: `262144` | With K3 or K2.8 Preview selected, type `/variants` to switch the thinking effort: bash /variants Thinking effort mapping OpenCode offers the variants `Default` / `low` / `high` / `max`, mapped to K3's actual effort levels as follows (full mapping table in [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html#switch-model) ): | OpenCode variant | K3 actual effort | | --- | --- | | `Default` | `high` (K3) / `max` (K2.8 Preview) | | `low` | `low` | | `high` | `high` (recommended) | | `max` | `max` | Both K3 and K2.8 Preview support `low` / `high` / `max`; K2.7 Code HighSpeed does not require this setting. See [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) for model capabilities and setup details. Next steps [​](https://www.kimi.com/code/docs/en/third-party-tools/opencode#next-steps) ---------------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) — Compare the models and see the full effort mapping table * [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) — Confirm which models are available for your plan --- # Using Kimi in Codex | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/codex#VPContent) On this page Using Kimi in Codex [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#using-kimi-in-codex) ======================================================================================================= [Codex](https://openai.com/codex/) is OpenAI's coding agent. The Kimi Code server natively supports the OpenAI Responses API (streaming and non-streaming, reasoning, and function calling all work), so Codex CLI and the Codex desktop app can connect directly with a custom model provider — no local routing or protocol-translation tool is needed. This guide covers the configuration. > The OpenAI Responses API supports text and image input, but not video input. To analyze video, extract key frames with ffmpeg first. Membership [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#membership) ------------------------------------------------------------------------------------- Before configuring, check your membership tier (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans) and pick a model from the table below: | Tier | Available models | Context window | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`: `262144`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576` | | Pro and above / Allegretto and above | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`: `1048576`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576`
`kimi-for-coding-highspeed`: `262144` | Prerequisites [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#prerequisites) ------------------------------------------------------------------------------------------- 1. Create and save an API Key in the [Kimi Code Console](https://www.kimi.com/code/console) . 2. Install Codex CLI: bash npm install -g @openai/codex Step 1: Create the model catalog models.json [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#step-1-create-the-model-catalog-models-json) -------------------------------------------------------------------------------------------------------------------------------------------------------- Create `models.json` in the Codex config directory: macOS / LinuxWindows text ~/.codex/models.json text C:\Users\\.codex\models.json Write the following content (K3 series models shown as an example): json { "models": [\ {\ "slug": "k3",\ "display_name": "K3",\ "description": "K3, 1M context",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 0,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 1048576,\ "max_context_window": 1048576,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ },\ {\ "slug": "k3-256k",\ "display_name": "K3 256K",\ "description": "K3 256K context",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 1,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 262144,\ "max_context_window": 262144,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ }\ ] } Step 2: Write config.toml [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#step-2-write-config-toml) ------------------------------------------------------------------------------------------------------------------ Path of the Codex CLI config file: macOS / LinuxWindows text ~/.codex/config.toml text C:\Users\\.codex\config.toml Write the following content (create the file if it does not exist): toml model = "k3-256k" model_provider = "kimi" web_search = "live" model_catalog_json = "~/.codex/models.json" [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.ai/coding/v1" env_key = "KIMI_API_KEY" wire_api = "responses" [desktop] enabled-reasoning-efforts = ["low", "high", "max"] Field reference: | Field | Description | | --- | --- | | `model` | Default model. `k3-256k` is recommended (more quota-friendly); use `k3` when you need the 1M context window | | `model_provider` | Default provider, matching the `[model_providers.kimi]` table below | | `web_search` | Web search switch. The Kimi Code endpoint supports web search; set to `"live"` to enable real-time search | | `model_catalog_json` | Path of the model catalog created in the previous step, declaring each model's context window and image input support | | `base_url` | Kimi Code API address — China `https://api.kimi.com/coding/v1`, Overseas `https://api.kimi.ai/coding/v1` | | `env_key` | The **name** of the environment variable holding the API Key (`KIMI_API_KEY` here — the Key itself goes elsewhere). Codex reads the secret from this variable at startup; you set its value in the next step | | `wire_api` | Wire protocol, must be `"responses"` to use the Responses API | | `enabled-reasoning-efforts` | Reasoning levels shown in the desktop model picker; desktop only — the CLI does not need this | Step 3: Set the API Key [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#step-3-set-the-api-key) -------------------------------------------------------------------------------------------------------------- The recommended approach is an environment variable (the `env_key` above): the config file contains no plaintext secret, so it can be shared and backed up safely. This is also the officially recommended approach by Codex. Pick the command for your operating system: macOSLinuxWindows sh echo 'export KIMI_API_KEY="sk-kimi-your-key"' >> ~/.zshrc source ~/.zshrc sh echo 'export KIMI_API_KEY="sk-kimi-your-key"' >> ~/.bashrc source ~/.bashrc powershell setx KIMI_API_KEY "sk-kimi-your-key" One more step is required for the Codex desktop app: apps launched from the Dock or Finder do not inherit environment variables from your terminal, so the Key must be injected into the current user session. Run in a terminal: sh launchctl setenv KIMI_API_KEY "sk-kimi-your-key" After running it, **fully quit** the desktop app (Cmd+Q) and reopen it for the change to take effect. Note: the variable does not survive a reboot — run the command again after restarting. Windows does not need this step: `setx` writes a system environment variable, and restarting the app is enough. ### Alternative: write the Key into the config (experimental\_bearer\_token) [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#alternative-write-the-key-into-the-config-experimental-bearer-token) If environment variables do not take effect (for example, GUI apps cannot read them, or CI environments make injection inconvenient), use `experimental_bearer_token` to write the Key directly into the provider config, replacing `env_key`: toml [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.ai/coding/v1" wire_api = "responses" experimental_bearer_token = "sk-kimi-your-key" Plaintext secret risk With this approach the Key is stored in **plaintext** in the config file. Do not commit the file to a version-control repository or share it publicly in dotfiles — weigh the trade-off yourself. Do not configure `env_key` and `experimental_bearer_token` at the same time. Step 4: Launch and verify [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#step-4-launch-and-verify) ------------------------------------------------------------------------------------------------------------------ Open a new terminal, switch to the project directory, and start Codex: bash cd /path/to/your/project codex Send a `hello` message in the session — a normal reply means the configuration works. Signs of a successful setup: * The startup banner shows `model: k3-256k` (or your chosen model) and `provider: kimi`; * The `Model metadata not found` warning no longer appears (models.json is in effect). Using the Codex desktop app [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#using-the-codex-desktop-app) ----------------------------------------------------------------------------------------------------------------------- The desktop app reads the same `~/.codex/models.json` and `~/.codex/config.toml` as the CLI. Follow the CLI configuration above through Step 3, then: 1. **(macOS only) Inject the environment variable**: GUI apps cannot read variables set in your terminal, so run the following command first to inject `KIMI_API_KEY` into the user session. On Windows, `setx` writes a system environment variable, so this step is not needed. sh launchctl setenv KIMI_API_KEY "sk-kimi-your-key" 2. **Restart the desktop app**: fully quit (Cmd+Q on macOS) and reopen it for the new configuration to load. 3. **Pick a model and start chatting**: select a Kimi model from the model picker in a new thread. TIP The desktop app automatically appends managed blocks (plugins, MCP servers, etc.) to `config.toml`. This is expected — your manually added Kimi Code configuration is preserved intact, and these auto-generated blocks should not be deleted. Switching reasoning effort [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#switching-reasoning-effort) --------------------------------------------------------------------------------------------------------------------- K3 supports three effort levels: `low` / `high` / `max`. In a Codex CLI session, type `/model` to re-select the current model, then choose a level from the **Select Reasoning Level** menu. After switching, start a new session to avoid extra cost from stale context caches. FAQ [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#faq) ----------------------------------------------------------------------- ### Error: Missing environment variable: KIMI\_API\_KEY [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#error-missing-environment-variable-kimi-api-key) The current process cannot read the environment variable. Make sure it is written to the correct shell config file and open a new terminal; on macOS for the desktop app, use the `launchctl` method from Step 3. If it still fails, switch to `experimental_bearer_token`. ### codex exec cannot run tool commands [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#codex-exec-cannot-run-tool-commands) In environments with a restricted user namespace (for example, bwrap reporting ENOSPC), Codex's default sandbox does not work. Add `--sandbox danger-full-access` to run tool commands: `codex exec --sandbox danger-full-access "your task"`. Note that this disables sandbox isolation — commands run directly in your real environment, so only use it with tasks from trusted sources. Next steps [​](https://www.kimi.com/code/docs/en/third-party-tools/codex#next-steps) ------------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/kimi-code/models.html) — compare model capabilities and see the full effort mapping table * [Membership](https://www.kimi.com/code/docs/kimi-code/membership.html) — check model availability and tier requirements --- # Using Kimi in Codex | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#VPContent) Return to top Using Kimi in Codex [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#using-kimi-in-codex) ============================================================================================================ [Codex](https://openai.com/codex/) is OpenAI's coding agent. The Kimi Code server natively supports the OpenAI Responses API (streaming and non-streaming, reasoning, and function calling all work), so Codex CLI and the Codex desktop app can connect directly with a custom model provider — no local routing or protocol-translation tool is needed. This guide covers the configuration. > The OpenAI Responses API supports text and image input, but not video input. To analyze video, extract key frames with ffmpeg first. Membership [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#membership) ------------------------------------------------------------------------------------------ Before configuring, check your membership tier (see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) for a comparison of the legacy and new plans) and pick a model from the table below: | Tier | Available models | Context window | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`: `262144`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576` | | Pro and above / Allegretto and above | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`: `1048576`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576`
`kimi-for-coding-highspeed`: `262144` | Prerequisites [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#prerequisites) ------------------------------------------------------------------------------------------------ 1. Create and save an API Key in the [Kimi Code Console](https://www.kimi.com/code/console) . 2. Install Codex CLI: bash npm install -g @openai/codex Step 1: Create the model catalog models.json [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#step-1-create-the-model-catalog-models-json) ------------------------------------------------------------------------------------------------------------------------------------------------------------- Create `models.json` in the Codex config directory: macOS / LinuxWindows text ~/.codex/models.json text C:\Users\\.codex\models.json Write the following content (K3 series models shown as an example): json { "models": [\ {\ "slug": "k3",\ "display_name": "K3",\ "description": "K3, 1M context",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 0,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 1048576,\ "max_context_window": 1048576,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ },\ {\ "slug": "k3-256k",\ "display_name": "K3 256K",\ "description": "K3 256K context",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 1,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 262144,\ "max_context_window": 262144,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ }\ ] } Step 2: Write config.toml [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#step-2-write-config-toml) ----------------------------------------------------------------------------------------------------------------------- Path of the Codex CLI config file: macOS / LinuxWindows text ~/.codex/config.toml text C:\Users\\.codex\config.toml Write the following content (create the file if it does not exist): toml model = "k3-256k" model_provider = "kimi" web_search = "live" model_catalog_json = "~/.codex/models.json" [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.ai/coding/v1" env_key = "KIMI_API_KEY" wire_api = "responses" [desktop] enabled-reasoning-efforts = ["low", "high", "max"] Field reference: | Field | Description | | --- | --- | | `model` | Default model. `k3-256k` is recommended (more quota-friendly); use `k3` when you need the 1M context window | | `model_provider` | Default provider, matching the `[model_providers.kimi]` table below | | `web_search` | Web search switch. The Kimi Code endpoint supports web search; set to `"live"` to enable real-time search | | `model_catalog_json` | Path of the model catalog created in the previous step, declaring each model's context window and image input support | | `base_url` | Kimi Code API address — China `https://api.kimi.com/coding/v1`, Overseas `https://api.kimi.ai/coding/v1` | | `env_key` | The **name** of the environment variable holding the API Key (`KIMI_API_KEY` here — the Key itself goes elsewhere). Codex reads the secret from this variable at startup; you set its value in the next step | | `wire_api` | Wire protocol, must be `"responses"` to use the Responses API | | `enabled-reasoning-efforts` | Reasoning levels shown in the desktop model picker; desktop only — the CLI does not need this | Step 3: Set the API Key [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#step-3-set-the-api-key) ------------------------------------------------------------------------------------------------------------------- The recommended approach is an environment variable (the `env_key` above): the config file contains no plaintext secret, so it can be shared and backed up safely. This is also the officially recommended approach by Codex. Pick the command for your operating system: macOSLinuxWindows sh echo 'export KIMI_API_KEY="sk-kimi-your-key"' >> ~/.zshrc source ~/.zshrc sh echo 'export KIMI_API_KEY="sk-kimi-your-key"' >> ~/.bashrc source ~/.bashrc powershell setx KIMI_API_KEY "sk-kimi-your-key" One more step is required for the Codex desktop app: apps launched from the Dock or Finder do not inherit environment variables from your terminal, so the Key must be injected into the current user session. Run in a terminal: sh launchctl setenv KIMI_API_KEY "sk-kimi-your-key" After running it, **fully quit** the desktop app (Cmd+Q) and reopen it for the change to take effect. Note: the variable does not survive a reboot — run the command again after restarting. Windows does not need this step: `setx` writes a system environment variable, and restarting the app is enough. ### Alternative: write the Key into the config (experimental\_bearer\_token) [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#alternative-write-the-key-into-the-config-experimental-bearer-token) If environment variables do not take effect (for example, GUI apps cannot read them, or CI environments make injection inconvenient), use `experimental_bearer_token` to write the Key directly into the provider config, replacing `env_key`: toml [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.ai/coding/v1" wire_api = "responses" experimental_bearer_token = "sk-kimi-your-key" Plaintext secret risk With this approach the Key is stored in **plaintext** in the config file. Do not commit the file to a version-control repository or share it publicly in dotfiles — weigh the trade-off yourself. Do not configure `env_key` and `experimental_bearer_token` at the same time. Step 4: Launch and verify [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#step-4-launch-and-verify) ----------------------------------------------------------------------------------------------------------------------- Open a new terminal, switch to the project directory, and start Codex: bash cd /path/to/your/project codex Send a `hello` message in the session — a normal reply means the configuration works. Signs of a successful setup: * The startup banner shows `model: k3-256k` (or your chosen model) and `provider: kimi`; * The `Model metadata not found` warning no longer appears (models.json is in effect). Using the Codex desktop app [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#using-the-codex-desktop-app) ---------------------------------------------------------------------------------------------------------------------------- The desktop app reads the same `~/.codex/models.json` and `~/.codex/config.toml` as the CLI. Follow the CLI configuration above through Step 3, then: 1. **(macOS only) Inject the environment variable**: GUI apps cannot read variables set in your terminal, so run the following command first to inject `KIMI_API_KEY` into the user session. On Windows, `setx` writes a system environment variable, so this step is not needed. sh launchctl setenv KIMI_API_KEY "sk-kimi-your-key" 2. **Restart the desktop app**: fully quit (Cmd+Q on macOS) and reopen it for the new configuration to load. 3. **Pick a model and start chatting**: select a Kimi model from the model picker in a new thread. TIP The desktop app automatically appends managed blocks (plugins, MCP servers, etc.) to `config.toml`. This is expected — your manually added Kimi Code configuration is preserved intact, and these auto-generated blocks should not be deleted. Switching reasoning effort [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#switching-reasoning-effort) -------------------------------------------------------------------------------------------------------------------------- K3 supports three effort levels: `low` / `high` / `max`. In a Codex CLI session, type `/model` to re-select the current model, then choose a level from the **Select Reasoning Level** menu. After switching, start a new session to avoid extra cost from stale context caches. FAQ [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#faq) ---------------------------------------------------------------------------- ### Error: Missing environment variable: KIMI\_API\_KEY [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#error-missing-environment-variable-kimi-api-key) The current process cannot read the environment variable. Make sure it is written to the correct shell config file and open a new terminal; on macOS for the desktop app, use the `launchctl` method from Step 3. If it still fails, switch to `experimental_bearer_token`. ### codex exec cannot run tool commands [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#codex-exec-cannot-run-tool-commands) In environments with a restricted user namespace (for example, bwrap reporting ENOSPC), Codex's default sandbox does not work. Add `--sandbox danger-full-access` to run tool commands: `codex exec --sandbox danger-full-access "your task"`. Note that this disables sandbox isolation — commands run directly in your real environment, so only use it with tasks from trusted sources. Next steps [​](https://www.kimi.com/code/docs/en/third-party-tools/codex.html#next-steps) ------------------------------------------------------------------------------------------ * [Model configuration](https://www.kimi.com/code/docs/kimi-code/models.html) — compare model capabilities and see the full effort mapping table * [Membership](https://www.kimi.com/code/docs/kimi-code/membership.html) — check model availability and tier requirements --- # Using Kimi in Hermes Agent | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#VPContent) Return to top Using Kimi in Hermes Agent [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#using-kimi-in-hermes-agent) =========================================================================================================================== [Hermes Agent](https://github.com/NousResearch/hermes-agent) is Nous Research's open-source self-improving AI agent with a built-in learning loop, accessible from the terminal, Telegram, Discord, and more. This guide shows how to connect it to the Kimi Code membership (Coding Plan), with K3 or K2.8 Preview providing the model inference. Prerequisites [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#prerequisites) ------------------------------------------------------------------------------------------------- Complete these preparations before you start. Follow the linked official guides for installation and account setup; they are not repeated here. [Install Hermes AgentInstall or update Hermes Agent with the official installation docs.](https://hermes-agent.nousresearch.com/docs/getting-started/installation) [Create an API keyCreate and safely store a membership API key in the Kimi Code Console.](https://www.kimi.com/code/console) [Check your membership tierSee the available models and quota rules for your tier on the Membership Benefits page.](https://www.kimi.com/code/docs/en/kimi-code/membership) Step 1: Select Kimi Coding Plan and a model [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-1-select-kimi-coding-plan-and-a-model) ------------------------------------------------------------------------------------------------------------------------------------------------------------ Run the model configuration wizard: sh hermes model Select **Kimi / Moonshot** in the top-level menu. ![Select Kimi / Moonshot in the top-level menu](https://www.kimi.com/code/docs/images/en/third-party-tools/hermes/provider-menu.png) Select **Kimi / Kimi Coding Plan** in the submenu, then paste your membership API key into the masked input. Hermes detects the `sk-kimi-` prefix and automatically uses the Kimi Code endpoint (`https://api.kimi.ai/coding`) — no manual Base URL configuration needed. ![Select Kimi / Kimi Coding Plan in the submenu](https://www.kimi.com/code/docs/images/en/third-party-tools/hermes/provider-region.png) When picking the default model, the wizard lists the models available to your key: ![The wizard lists the models available to your key](https://www.kimi.com/code/docs/images/en/third-party-tools/hermes/model-list.png) Check your membership tier first, then pick a model from the table below — see [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html#plan-comparison) : | Membership tier | Available models | Context window | | --- | --- | --- | | Go (new plans) | No coding quota | — | | Andante (legacy plans) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`: `262144`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576` | | Pro and above / Allegretto and above | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`: `1048576`
`k3-256k`: `262144`
`kimi-for-coding`: `1048576`
`kimi-for-coding-highspeed`: `262144` | Using models or context windows beyond your tier's allowance will trigger an error. Note that `k3-256k` is not in the wizard's list — to use it, choose **Enter custom model name** and type `k3-256k` without any prefix. Also, `kimi-k3` in the wizard list and `k3` in the config file are the same model — `kimi-` is only a display prefix in the wizard. When typing a model name manually or editing the config file, always use the ID without the prefix (`k3`, `k3-256k`). ![Choose Enter custom model name to type a model name manually](https://www.kimi.com/code/docs/images/en/third-party-tools/hermes/custom-model.png) New model recommendation `k3-256k` is newly released: identical quality within a 256K context, while `k3` (1M) costs about twice as much. It suits everyday Q&A, code completion, regular feature development, and single-file or few-file edits, and does not support video input. When switching from `k3` (1M) to `k3-256k`, compact the context first. Step 2: Write the complete K3 configuration [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-2-write-the-complete-k3-configuration) ------------------------------------------------------------------------------------------------------------------------------------------------------------ Run: sh hermes config edit > `hermes config edit` simply opens `~/.hermes/config.yaml` in the default terminal editor. If you are not comfortable with nano/vim, you can open the same file in any editor you like, such as VS Code — the result is identical. With the file open, merge the complete configuration below into it: the `model` and `agent` sections already exist — only change the fields shown (you can replace the whole `model` section outright); the `custom_providers` and `auxiliary` sections usually do not exist — paste them at the end of the file. Keep any other existing custom providers. yaml custom_providers: - name: kimi-coding-plan base_url: https://api.kimi.ai/coding/v1 key_env: KIMI_API_KEY api_mode: chat_completions model: k3-256k extra_body: reasoning_effort: high models: k3-256k: context_length: 262144 supports_vision: true model: provider: custom:kimi-coding-plan default: k3-256k context_length: 262144 supports_vision: true agent: reasoning_effort: high auxiliary: vision: provider: main model: k3-256k extra_body: reasoning_effort: high Save and exit when done (nano: `Ctrl+O` then Enter to save, `Ctrl+X` to exit; vim: `:wq`; VS Code: just save the file). What the key fields in the block do: * `reasoning_effort`: reasoning effort, explicitly set to `high` here. Accepts `low` / `high` / `max`, default `high` — see the effort mapping table in [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) * `context_length` and `supports_vision`: enable the 256K context window and native image understanding; the `auxiliary` section routes image analysis through the same main provider * `key_env`: the referenced `KIMI_API_KEY` is the membership key you pasted in Step 1 — no extra setup needed * `base_url`: only goes up to `/coding/v1`; Hermes appends `/chat/completions` automatically, so do not put the full request endpoint in Note To use the 1M-context `k3` (available on Allegretto / Pro or above), replace every `k3-256k` in the configuration above with `k3` and change both `context_length` values to `1048576`. On Moderato / Plus, `k3` is also capped at 256K, so no change is needed. Step 3: Enable video analysis (optional) [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-3-enable-video-analysis-optional) ---------------------------------------------------------------------------------------------------------------------------------------------------- Hermes Agent ships an official video analysis tool — enable it once: sh hermes tools enable video Once enabled, Hermes can call the official `video_analyze` tool. For local videos, the tool reads the full file, encodes it as `data:video/...;base64,...`, and sends it to the model as a `video_url` content block — it does not extract frames locally with FFmpeg first. Then, in a chat, provide the absolute video path and explicitly ask it to call `video_analyze` — no `/video` command needed: text Call video_analyze on /absolute/path/to/demo.mp4, summarize the video, and list three details that can be confirmed from the visuals. Common formats including MP4, WebM, MOV, AVI, MKV, and MPEG are supported, with an approximately 50 MB Base64-encoded payload limit — a hard-coded cap of the Hermes client video tool, not a Kimi API limit. Trim or compress larger videos first. You can also provide a directly accessible HTTP/HTTPS video URL. > Video analysis depends on the model's multimodal capability, and `k3-256k` does not support video input. If you configured `k3-256k` in Step 2, switch the default model to `k3` before analyzing videos. Step 4: Use images (optional) [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-4-use-images-optional) ------------------------------------------------------------------------------------------------------------------------------ Reference a local image by its absolute path in a chat: text /image /absolute/path/to/example.png You can also copy an image to the clipboard, type `/paste`, and then ask your question. The image is sent as native vision content to the model configured in Step 2. Step 5: Launch and verify [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-5-launch-and-verify) ------------------------------------------------------------------------------------------------------------------------ Start a new session so the provider and model settings take effect: sh hermes After startup, confirm the status bar shows the expected model and context window (e.g. `k3-256k` with `256K`), then send a simple request to verify connectivity. ![The status bar after startup shows the model and context window](https://www.kimi.com/code/docs/images/en/third-party-tools/hermes/chat.png) Troubleshooting [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#troubleshooting) ----------------------------------------------------------------------------------------------------- ### `k3-256k` is missing from the model list [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#k3-256k-is-missing-from-the-model-list) `k3-256k` is not in the wizard's default model list. Run `hermes model` again, select **Kimi / Moonshot > Kimi / Kimi Coding Plan**, then choose **Enter custom model name** and type `k3-256k` manually. ### 401 error or key rejected [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#_401-error-or-key-rejected) Confirm you are using an `sk-kimi-` membership key created in the [Kimi Code Console](https://www.kimi.com/code/console) , and that your membership tier supports the selected model (see the tier table in [Step 1](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#step-1-select-kimi-coding-plan-and-a-model) ). If the error persists, regenerate a key and run `hermes model` again. ### 403 error [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#_403-error) You've hit a quota or rate limit. Note the rolling 5-hour rate window; for existing members on legacy plans, the subscription quota also refreshes every 7 days (new members are not subject to the weekly limit) — both recover automatically when their windows reset. You can check your quota usage in the [Kimi Code Console](https://www.kimi.com/code/console) . For the exact error messages and how to handle them, see the [error reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html#quota-account-limits) . ### The video tool is not called [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#the-video-tool-is-not-called) Confirm you ran `hermes tools enable video`, explicitly asked for `video_analyze` in your prompt, and used an absolute local path. The encoded payload must stay below approximately 50 MB. Next steps [​](https://www.kimi.com/code/docs/en/third-party-tools/hermes.html#next-steps) ------------------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) — model capability comparison and the full effort mapping table * [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) — available models, quota refresh rules, and tier requirements --- # 开始使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#VPContent) On this page 开始使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8) ======================================================================================================================== Kimi Code CLI 是什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#kimi-code-cli-%E6%98%AF%E4%BB%80%E4%B9%88) ------------------------------------------------------------------------------------------------------------------------------------------ Kimi Code CLI 是一个运行在终端中的 AI Agent,帮助你完成软件开发任务和日常的终端操作——阅读和修改代码、执行 Shell 命令、搜索文件、抓取网页,并在执行过程中根据反馈自主规划和调整下一步行动。 它适用于以下场景: * **编写和修改代码**:实现新功能、修复 bug、完成重构 * **理解项目**:探索陌生的代码库,解答架构和实现层面的问题 * **自动化任务**:批量处理文件、运行构建与测试、串联多个脚本 整套 CLI 以 TypeScript 编写,通过 npm 分发,运行在 Node.js 之上。 安装 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E5%AE%89%E8%A3%85) ---------------------------------------------------------------------------------------------------- 提供两种安装方式:官方安装脚本(推荐,无需预装 Node.js)和 npm 全局安装。 安装之前 Kimi Code CLI 为全交互式 TUI 应用,推荐在支持真彩色与连字的现代终端中运行以获得最佳体验,例如 [Kitty](https://sw.kovidgoyal.net/kitty/) 或 [Ghostty](https://ghostty.org/) 。 ### 脚本安装(推荐) [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E8%84%9A%E6%9C%AC%E5%AE%89%E8%A3%85-%E6%8E%A8%E8%8D%90) macOS / LinuxWindows (PowerShell) sh curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash powershell irm https://code.kimi.com/kimi-code/install.ps1 | iex > Windows 用户首次启动前还需要安装 [Git for Windows](https://gitforwindows.org/) > ,Kimi Code CLI 会使用其中的 Git Bash 作为 Shell 环境。如果 Git Bash 安装在非标准路径,请把 `KIMI_SHELL_PATH` 设为 `bash.exe` 的绝对路径。 脚本会自动下载最新版本、校验 checksum,并把 `kimi` 可执行文件放到你的 `PATH` 中。 ### npm 安装 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#npm-%E5%AE%89%E8%A3%85) 需要 Node.js 22.19.0 或更高版本: sh node --version npmpnpm sh npm install -g @moonshot-ai/kimi-code sh pnpm add -g @moonshot-ai/kimi-code 第一次启动 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E7%AC%AC%E4%B8%80%E6%AC%A1%E5%90%AF%E5%8A%A8) ---------------------------------------------------------------------------------------------------------------------------------- 进入项目目录后直接运行 `kimi` 启动交互界面: sh cd your-project kimi 只想执行一条指令而不进入交互界面时,使用 `-p`: sh kimi -p "帮我看一下这个项目的目录结构" 继续上一次会话加 `-c`: sh kimi -c 首次启动时需要配置 API 来源。在交互界面中输入 `/login` 进入登录流程: /login `/login` 会弹出平台选择器,支持两种方式: * **Kimi Code(OAuth)** — 验证码流程,在任意设备打开链接、登录并输入验证码即可授权 * **Kimi Platform API 密钥** — 输入来自 `platform.kimi.com` 或 `platform.kimi.ai` 的 API 密钥 需要退出登录时,输入 `/logout` 清除当前凭证。 使用其他 AI 供应商 如果你想接入 Anthropic、OpenAI、Google 等其他供应商,需要直接编辑 `~/.kimi-code/config.toml` 配置 API 密钥,详见[平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 。配置项完整说明见[配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) 、[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 和[配置覆盖](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html) 。 第一个对话 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AF%B9%E8%AF%9D) ---------------------------------------------------------------------------------------------------------------------------------- 登录完成后,用自然语言描述任务即可。先让它熟悉当前项目: 帮我看一下这个项目的目录结构,简单介绍一下每个目录是做什么的 Kimi Code CLI 会自动调用文件读取、搜索等工具浏览相关内容后给出回答。只读操作默认自动执行无需确认;对于会修改文件或执行 Shell 命令的操作,默认会在执行前征求确认。 也可以直接描述更具体的任务: 在 src/utils 里新增一个函数,用来把任意字符串转成 kebab-case,并补一个单元测试 Kimi Code CLI 会规划步骤、修改代码、运行测试,并在每一步告诉你它做了什么。 不知道能做什么?输入 `/help` 随时在输入框输入 `/help`,可以打开内置的命令和快捷键面板,按 `↑`/`↓` 翻看,`Esc` 关闭。退出时输入 `/exit`,或按 `Ctrl-C` 两次,或在输入框为空时按 `Ctrl-D`。 常用命令与快捷键速查 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E4%B8%8E%E5%BF%AB%E6%8D%B7%E9%94%AE%E9%80%9F%E6%9F%A5) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 第一次使用时,记住下面这些就够了: **会话相关命令** | 命令 | 说明 | | --- | --- | | `/new` | 开启新会话,清空当前上下文 | | `/sessions` | 浏览历史会话,选择恢复 | | `/model` | 切换当前使用的模型 | | `/compact` | 手动压缩上下文,释放 token | | `/fork` | 派生当前会话为保留完整历史的独立副本(仍停留在当前会话) | **最常用快捷键** | 快捷键 | 说明 | | --- | --- | | `Esc` | 中断流式输出 / 关闭弹窗 | | `Ctrl-C` | 中断输出;空闲时连按两次退出 | | `Shift-Tab` | 切换 Plan 模式 | | `Ctrl-S` | 输出中途插入消息,无需等待结束 | | `Ctrl-O` | 折叠 / 展开工具输出和压缩摘要 | 想看完整列表,输入 `/help` 或访问[斜杠命令参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 和[键盘快捷键](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html) 。 数据存放在哪里 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E6%95%B0%E6%8D%AE%E5%AD%98%E6%94%BE%E5%9C%A8%E5%93%AA%E9%87%8C) ------------------------------------------------------------------------------------------------------------------------------------------------------ Kimi Code CLI 的本地数据默认保存在 `~/.kimi-code/` 下,包含配置文件、会话记录、日志和更新缓存。如需迁移到别处,通过 `KIMI_CODE_HOME` 环境变量指定新路径。完整说明见[数据路径](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html) 和[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 。 升级与卸载 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E5%8D%87%E7%BA%A7%E4%B8%8E%E5%8D%B8%E8%BD%BD) ---------------------------------------------------------------------------------------------------------------------------------- 安装完成后,验证可执行文件是否就绪: sh kimi --version **升级**:运行 `kimi upgrade`,CLI 会检查最新版本并展示更新选项。选择 `Install update now` 后根据当前安装来源执行升级;也可以直接用包管理器: sh npm install -g @moonshot-ai/kimi-code@latest **卸载**:脚本安装的用户删除 `kimi` 可执行文件即可;npm 安装的用户: sh npm uninstall -g @moonshot-ai/kimi-code 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------------- * [交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html) — 输入框操作、审批流程、Plan 模式和 "Ask When Needed" 模式详解 * [会话与上下文](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html) — 恢复会话、上下文压缩、导出会话 * [常见使用案例](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html) — 典型任务的 prompt 示例 --- # 快速开始 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#VPContent) On this page 快速开始 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) ======================================================================================================================== Kimi Code for VS Code 是集成于 Visual Studio Code 的扩展插件。安装后,您可在编辑器内直接发起提问、审查代码 diff 并快速提交变更。插件能够读取您引用的文件内容,并通过可视化界面展示修改建议,经您确认后执行。整个流程由您掌控,同时显著提升开发效率。 ![Kimi Code VS Code](https://www.kimi.com/code/docs/images/zh/vscode/kimi-code-showcase.jpeg) 本扩展在 VS Code 中提供了原生聊天面板,支持通过 `@` 符号引用文件或文件夹、`/` 命令执行项目扫描与上下文管理、diff 视图展示文件变更并支持回退操作,同时支持集成 MCP 服务器以调用外部工具。聊天面板可置于活动栏、侧边栏或独立标签页中。 安装之前 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E5%AE%89%E8%A3%85%E4%B9%8B%E5%89%8D) ------------------------------------------------------------------------------------------------------------------------ 需拥有 Kimi 账号订阅或 Kimi API 密钥。 安装方式 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F) ------------------------------------------------------------------------------------------------------------------------ 通过 [VS Code Marketplace](vscode:extension/moonshot-ai.kimi-code) 安装。 若安装后未显示扩展,请重启 VS Code 或在命令面板中执行 "Developer: Reload Window" (Mac: Cmd+Shift+P, Windows/Linux: Ctrl+Shift+P)。 身份认证 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E8%BA%AB%E4%BB%BD%E8%AE%A4%E8%AF%81) ------------------------------------------------------------------------------------------------------------------------ Kimi Code 支持两种认证模式: **Kimi 账号模式**:点击登录按钮,浏览器将打开授权页面,完成授权流程后返回 VS Code。 **API Key 模式**:若已配置 API Key,可点击跳过登录。插件将在此模式下运行。 ![Kimi Code Gear Icon](https://www.kimi.com/code/docs/images/zh/vscode/kimi-code-gear-icon.png) 您可随时通过齿轮图标切换认证模式。登出后将返回登录界面。 典型工作流 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E5%85%B8%E5%9E%8B%E5%B7%A5%E4%BD%9C%E6%B5%81) ---------------------------------------------------------------------------------------------------------------------------------- **代码解读**:输入 `@` 选择文件或文件夹,请求解释代码流程,可继续追问细节。 **重构**:引用目标代码如 `@src/feature/`,请求重构方案,审查 diff 并选择性批准,必要时使用回退。 **调试**:粘贴错误信息或堆栈跟踪,引用相关文件,请求诊断与修复,然后批准提议的变更。 **项目概览**:引用文件夹如 `@src/services/`,请求模块地图或架构摘要,可继续询问依赖关系或薄弱环节。 命令与快捷键 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E5%91%BD%E4%BB%A4%E4%B8%8E%E5%BF%AB%E6%8D%B7%E9%94%AE) -------------------------------------------------------------------------------------------------------------------------------------------- | 快捷键 | 功能 | | --- | --- | | `Ctrl+Shift+K` / `Cmd+Shift+K` | 聚焦 Kimi 输入框 | | `Alt+K` | 插入当前文件引用 | | `Ctrl+N` / `Cmd+N` | 新建对话(需启用 `kimi.enableNewConversationShortcut`,启用后将占用系统默认的"新建文件"快捷键) | | `↑` / `↓` | 在输入框中浏览输入历史 | 在命令面板中输入 "Kimi Code" 可访问更多命令:在新标签页打开、在侧边栏打开、新建对话等。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/getting-started.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------------- * [核心操作](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html) – 学习聊天面板用法、上下文管理与 diff 审查 * [定制化](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html) – 探索 Skills、Hooks 与 MCP 扩展能力 * [配置](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html) – 自定义认证、模型与行为设置 --- # 从 kimi-cli 迁移 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html#VPContent) Return to top 从 kimi-cli 迁移 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html#%E4%BB%8E-kimi-cli-%E8%BF%81%E7%A7%BB) ============================================================================================================================ INFO Kimi Code CLI 已完成重大版本升级,底层从 Python/uv 迁移至 Node.js,带来更简单的安装方式、更快的启动速度和全新的终端界面。旧版将逐渐停止维护,建议尽快升级至新版。 如果你正在从旧版迁移,按照以下步骤操作——一条命令就能把配置、MCP server 与会话历史一并迁移至新版。 新版优势 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html#%E6%96%B0%E7%89%88%E4%BC%98%E5%8A%BF) ------------------------------------------------------------------------------------------------------------------ * **不再依赖 Python / uv**:基于 Node.js 重写,无需配置 Python 环境,安装更简单 * **原生二进制,开箱即用**:启动更快,运行更轻量 * **终端界面全面重设计**:交互体验更流畅 * **数据可完整迁移**:配置、MCP、会话历史一键带走,无缝延续 如何迁移 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html#%E5%A6%82%E4%BD%95%E8%BF%81%E7%A7%BB) ------------------------------------------------------------------------------------------------------------------ 迁移有两种方式。 装好 kimi-code 之后**第一次运行 `kimi`** 时,它会自动检测 `~/.kimi/` 下是否存在 kimi-cli 的数据。一旦检测到,就会弹出迁移提示,你可以选择立即迁移、稍后再说,或不再提示。 你也可以**随时手动运行**: sh kimi migrate 你可以选择是否同时迁移聊天会话。如果暂时不需要历史记录,选 **Config only**;否则选 **Config + N sessions** 一并迁移。结束后会显示结果摘要。 迁移会发生什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html#%E8%BF%81%E7%A7%BB%E4%BC%9A%E5%8F%91%E7%94%9F%E4%BB%80%E4%B9%88) ------------------------------------------------------------------------------------------------------------------------------------------------ **会被迁移的内容**:配置(`config.toml`)、MCP 服务配置、输入历史,以及你选择迁移的聊天会话。 **不会被迁移的内容**:OAuth 登录凭证和 MCP 服务的授权都不会被复制,迁移后需要在 kimi-code 里重新执行 `/login` 和重新授权 MCP 服务。kimi-cli 的插件也不在迁移范围内。 提示 迁移**不会改动或删除** `~/.kimi/` 下的任何旧数据。kimi-cli 仍可照常使用,两者互不影响。迁移也可以重复运行,已经迁移过的会话不会被重复导入。 迁移完成后,从 kimi-cli 导入的会话会带上 `[imported]` 标记,方便你与新建的会话区分。 --- # 常见问题 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/faq.html#VPContent) Return to top 常见问题 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ================================================================================================= 安装与鉴权 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E9%89%B4%E6%9D%83) ----------------------------------------------------------------------------------------------------------- ### `/login` 时模型列表为空 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#login-%E6%97%B6%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8%E4%B8%BA%E7%A9%BA) 如果在运行 `/login` 命令时看到 "No models available for the selected platform" 错误,可能是以下原因: * **API 密钥无效或过期**:检查你输入的 API 密钥是否正确,以及是否仍有效。 * **网络连接问题**:确认能正常访问 API 服务地址(如 `api.kimi.com` 或 `api.moonshot.cn`)。 **注意区分平台** Kimi Code 会员权益与 [Kimi 开放平台](https://platform.kimi.com/) 有不同的 Base URL,配置时请注意 Base URL 与 API Key 的匹配是否正确。 | 平台 | Base URL | 计费方式 | Key 创建入口 | | --- | --- | --- | --- | | **Kimi Code** | Anthropic 兼容:国内 `https://api.kimi.com/coding/`
海外 `https://api.kimi.ai/coding/` | Kimi 会员订阅(含额度) | [Kimi Code 控制台](https://www.kimi.com/code/console) | | **Kimi 开放平台** | 国内 `https://api.moonshot.cn/v1`
海外 `https://api.moonshot.ai/v1` | 按量付费 | [Kimi 开放平台官网](https://platform.kimi.com/) | ### API 密钥无效 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#api-%E5%AF%86%E9%92%A5%E6%97%A0%E6%95%88) API 密钥无效可能的原因: * **密钥输入错误**:检查是否有多余的空格或遗漏的字符。 * **密钥已过期或被撤销**:在平台控制台确认密钥状态。 ### 会员过期或配额用尽 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E4%BC%9A%E5%91%98%E8%BF%87%E6%9C%9F%E6%88%96%E9%85%8D%E9%A2%9D%E7%94%A8%E5%B0%BD) 如果你使用 Kimi Code 平台,可以通过 `/usage` 命令查看当前的配额和会员状态。如果配额用尽或会员过期,需要在 [Kimi Code](https://kimi.com/code) 续费或升级。 订阅相关 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E8%AE%A2%E9%98%85%E7%9B%B8%E5%85%B3) ------------------------------------------------------------------------------------------------- ### 如何开发票或升级会员 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E5%A6%82%E4%BD%95%E5%BC%80%E5%8F%91%E7%A5%A8%E6%88%96%E5%8D%87%E7%BA%A7%E4%BC%9A%E5%91%98) 请前往 [Kimi 会员权益页面](https://www.kimi.com/membership/pricing?from=kfc_docs_faq#pricing-faq) ,根据页面指引完成开票申请或会员升级操作。 交互问题 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E4%BA%A4%E4%BA%92%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------- ### 粘贴图片失败 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E7%B2%98%E8%B4%B4%E5%9B%BE%E7%89%87%E5%A4%B1%E8%B4%A5) 使用 `Ctrl-V` 粘贴图片时,如果提示 "Current model does not support image input",说明当前模型不支持图片输入。 解决方法: * **切换到支持图片的模型**:使用支持 `image_in` 能力的模型。 * **检查剪贴板内容**:确保剪贴板中确实有图片数据,而非图片文件的路径。 更新与升级 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E6%9B%B4%E6%96%B0%E4%B8%8E%E5%8D%87%E7%BA%A7) ----------------------------------------------------------------------------------------------------------- ### macOS 首次运行缓慢 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#macos-%E9%A6%96%E6%AC%A1%E8%BF%90%E8%A1%8C%E7%BC%93%E6%85%A2) macOS 的 Gatekeeper 安全机制会在首次运行新程序时进行检查,导致启动变慢。解决方法: * **等待检查完成**:首次运行时耐心等待,后续启动会恢复正常。 * **添加到开发者工具**:在「系统设置 → 隐私与安全性 → 开发者工具」中添加你的终端应用。 ### 如何升级 Kimi Code CLI [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E5%A6%82%E4%BD%95%E5%8D%87%E7%BA%A7-kimi-code-cli) 在 CLI 内运行 `kimi upgrade`,会自动检查最新版本并引导升级。也可以直接用包管理器: sh npm install -g @moonshot-ai/kimi-code@latest VS Code 扩展常见问题 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E6%89%A9%E5%B1%95%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------------------------------------- 以下是 Kimi Code VS Code 扩展(VS Code Extension)的常见问题。 ### VS Code 提示未打开工作区 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E6%8F%90%E7%A4%BA%E6%9C%AA%E6%89%93%E5%BC%80%E5%B7%A5%E4%BD%9C%E5%8C%BA) 请在 VS Code 中打开文件夹,Kimi Code VS Code 扩展需要工作区才能正常工作。 ### VS Code 提示找不到 CLI [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E6%8F%90%E7%A4%BA%E6%89%BE%E4%B8%8D%E5%88%B0-cli) 请手动安装 Kimi Code CLI 并在 VS Code 设置中配置 `kimi.executablePath`,或确保内置 CLI 存在。 ### VS Code 登录失败 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E7%99%BB%E5%BD%95%E5%A4%B1%E8%B4%A5) 请尝试跳过登录使用 API 密钥模式,检查网络连接,或稍后通过 VS Code 扩展的操作菜单重试。 ### VS Code 发送消息无响应 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF%E6%97%A0%E5%93%8D%E5%BA%94) 请确认 Kimi Code CLI 可用、模型已配置且 VS Code 中已打开工作区文件夹。通过 "Kimi Code: Show Logs" 查看错误日志。 ### VS Code 连接超时 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E8%BF%9E%E6%8E%A5%E8%B6%85%E6%97%B6) 若 30 秒内无响应将超时。请检查网络后重试。 ### VS Code 发消息前报错 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#vs-code-%E5%8F%91%E6%B6%88%E6%81%AF%E5%89%8D%E6%8A%A5%E9%94%99) 某些错误会阻止在 VS Code 中发送消息,如 Kimi Code CLI 未找到、版本过低、未登录或会话忙碌。错误将以 toast 提示,您的输入将被保留以便重试。 反馈与联系 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E5%8F%8D%E9%A6%88%E4%B8%8E%E8%81%94%E7%B3%BB) ----------------------------------------------------------------------------------------------------------- ### 文档未能解决问题 [​](https://www.kimi.com/code/docs/kimi-code/faq.html#%E6%96%87%E6%A1%A3%E6%9C%AA%E8%83%BD%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98) 如果以上内容未能解决您的问题,欢迎前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,接入在线客服具体咨询。咨询时请描述您遇到的问题、操作步骤及相关日志信息,在线客服会尽快回复。 --- # Claude Code | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#VPContent) Return to top Claude Code [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#claude-code) =============================================================================================== > [Claude Code](https://docs.anthropic.com/en/docs/claude-code) > 是 Anthropic 提供的编程 Agent 产品,界面、配置项和支持能力可能随版本变化。本文说明一种通用接入方案:通过环境变量将 Claude Code 的模型请求转发到 Kimi Code API。 开始之前 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%BC%80%E5%A7%8B%E4%B9%8B%E5%89%8D) ----------------------------------------------------------------------------------------------------------------- * 确保你已经订阅 [Kimi 会员](https://www.kimi.com/membership/pricing?from=) 并开通 Kimi Code 权益。 * 获取 API Key: 1. 进入 [Kimi Code 控制台](https://www.kimi.com/code/console) ; 2. 点击「新建 API Key」,输入名称后确认; 3. 复制生成的 Key 并妥善保存(关闭弹窗后无法再次查看完整 Key)。 ![Kimi Code 控制台](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/kimi-code-console.png) 配置流程 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B) ----------------------------------------------------------------------------------------------------------------- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 是 Anthropic 推出的命令行编程助手。通过配置环境变量将其接入 Kimi 的 API 端点,你就能在 Claude Code 中直接调用 Kimi Code 的 AI 能力,在熟悉的终端交互里获得 Kimi Code 的编程体验。 ① **安装 Claude Code** 安装方式请参考 [Claude Code 官方文档](https://docs.anthropic.com/en/docs/claude-code/getting-started) 。 │ ② **执行脚本,跳过登录流程** 安装完成后,不要直接启动 Claude。先在终端执行以下脚本,跳过 Anthropic 默认的登录流程并清理历史配置: sh node --eval " // enable third party model support and fast mode const claudeJsonFilePath = path.join(os.homedir(), '.claude.json'); if (fs.existsSync(claudeJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeJsonFilePath, 'utf-8')); fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ ...content, penguinModeOrgEnabled: true, hasCompletedOnboarding: true }, null, 2), 'utf-8'); } else { fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ penguinModeOrgEnabled: true, hasCompletedOnboarding: true }), 'utf-8'); } // delete old endpoint, credential and model id const claudeSettingsJsonFilePath = path.join(os.homedir(), '.claude', 'settings.json'); if (fs.existsSync(claudeSettingsJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeSettingsJsonFilePath, 'utf-8')); if (typeof content === 'object' && typeof content.env === 'object') { for (const element of [\ 'ANTHROPIC_BASE_URL',\ 'ANTHROPIC_API_KEY',\ 'ANTHROPIC_AUTH_TOKEN',\ 'ANTHROPIC_MODEL',\ 'ANTHROPIC_SMALL_FAST_MODEL',\ 'CLAUDE_CODE_SUBAGENT_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME',\ 'ENABLE_TOOL_SEARCH',\ 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',\ 'CLAUDE_CODE_EFFORT_LEVEL',\ ]) { delete content.env[element]; } fs.writeFileSync(claudeSettingsJsonFilePath, JSON.stringify(content, null, 2), 'utf-8'); } } " 其中 settings.json 清理部分仅删除 `env` 中的端点、密钥与模型相关变量(这些残留会**覆盖**终端里 export 的同名环境变量),不影响其他配置。另外请检查 `~/.zshrc`、`~/.bashrc` 等 shell 配置文件中是否残留旧的 `ANTHROPIC_*` export(Windows 用户请检查用户环境变量),如有请一并删除。 │ ③ **配置 API 接入** 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 请先根据自己的会员档位确认可用的模型与上下文窗口(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ): | 会员档位 | 可配置模型 | 可用上下文上限 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3`
`k3-256k`
`kimi-for-coding` | `k3`:`262144`
`k3-256k`:`262144`
`kimi-for-coding`:`1048576` | | Pro 及以上 / Allegretto 及以上 | `k3`
`k3-256k`
`kimi-for-coding`
`kimi-for-coding-highspeed` | `k3`:`1048576`
`k3-256k`:`262144`
`kimi-for-coding`:`1048576`
`kimi-for-coding-highspeed`:`262144` | 提供两种配置方式,**任选其一,不要混用**:方式一写入 settings.json 配置文件,长期生效、任何方式启动都生效;方式二在当前终端临时 export,仅对当前会话有效。 **方式一:写入 settings.json(推荐,长期生效)** settings.json 的路径: macOS / LinuxWindows text ~/.claude/settings.json text C:\Users\<用户名>\.claude\settings.json 将以下配置写入该文件的 `env` 字段(文件不存在则新建): K3-256KK3 1M 上下文 json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", "ANTHROPIC_API_KEY": "你的API Key", "ANTHROPIC_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3-256k", "CLAUDE_CODE_SUBAGENT_MODEL": "k3-256k", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "262144", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144" } } json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", "ANTHROPIC_API_KEY": "你的API Key", "ANTHROPIC_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3[1m]", "CLAUDE_CODE_SUBAGENT_MODEL": "k3[1m]", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576" } } 保存后重启 Claude Code 生效。 明文密钥风险 `settings.json` 中的 API Key 以明文存储,请勿将该文件提交到版本仓库或随 dotfiles 公开分享;该文件的 `env` 会**覆盖**终端里 export 的同名变量。 **方式二:终端环境变量(仅当前会话)** **K3-256K 配置如下:** macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/ export ANTHROPIC_API_KEY=你的API Key export ANTHROPIC_MODEL="k3-256k" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.com/coding/" $env:ANTHROPIC_API_KEY="你的API Key" $env:ANTHROPIC_MODEL="k3-256k" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="262144" claude **K3 1M 上下文**配置如下: 注意 `k3[1m]` 写法仅在 Claude Code 环境变量场景需要 `k3[1m]`(以及外层的引号)用来明确告诉 Claude Code 把上下文窗口设为 1M;其它场景(例如 API 请求、其它第三方工具的 Model ID 字段)只需填 `k3` 即可。 macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/ export ANTHROPIC_API_KEY=你的API Key export ANTHROPIC_MODEL="k3[1m]" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.com/coding/" $env:ANTHROPIC_API_KEY="你的API Key" $env:ANTHROPIC_MODEL="k3[1m]" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="1048576" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576" claude ### 配置项说明 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E9%85%8D%E7%BD%AE%E9%A1%B9%E8%AF%B4%E6%98%8E) Claude Code 内部会按场景使用不同档位的模型(主对话、后台摘要、子 Agent 等),只配置部分变量会让对应场景静默失败: | 变量 | 作用 | 不配置或配置错误的影响 | | --- | --- | --- | | `ANTHROPIC_BASE_URL` | 将模型请求转发到 Kimi Code 端点 | 请求被发往 Anthropic 官方端点,鉴权失败 | | `ANTHROPIC_API_KEY` | 使用 Kimi Code API Key 鉴权 | 返回 401 鉴权错误 | | `ANTHROPIC_MODEL` | 主对话使用的模型 | 使用 Claude 默认模型名,Kimi Code 端点无法识别,报模型不存在错误 | | `ANTHROPIC_DEFAULT_OPUS_MODEL` / `ANTHROPIC_DEFAULT_SONNET_MODEL` / `ANTHROPIC_DEFAULT_HAIKU_MODEL` / `ANTHROPIC_DEFAULT_FABLE_MODEL` | Claude Code 按任务档位选择模型时使用的模型名 | 对应档位的任务(如 haiku 档的后台标题生成、摘要)请求失败 | | `CLAUDE_CODE_SUBAGENT_MODEL` | 子 Agent 使用的模型 | 子任务请求失败或效果明显变差 | | `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | 触发自动压缩上下文的窗口大小 | 需与模型上下文一致:`k3[1m]` 为 `1048576`,其余模型为 `262144`;设置过小会过早压缩丢失上下文,过大则报上下文超限错误 | | `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | 最大上下文 token 数 | 同上,需与所选模型的上下文窗口一致 | | `CLAUDE_CODE_EFFORT_LEVEL` | 默认思考档位,K3 推荐设为 `high` | 较低值可能在复杂任务上降低质量 | 切换模型时,请把配置中所有模型变量的值一并替换为新模型名。 ### 切换思考档位 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%88%87%E6%8D%A2%E6%80%9D%E8%80%83%E6%A1%A3%E4%BD%8D) 启动后在会话中输入 `/effort` 即可切换思考档位,无需配置环境变量。K3 与 K2.8 Preview 均支持 `low` / `high` / `max` 三档且档位一致,Claude Code 的档位与实际档位的映射关系如下: | Claude Code 档位 | 实际档位 | | --- | --- | | `low` | `low` | | `medium` | `high`(推荐) | | `high` | `high`(推荐) | | `xhigh` | `max` | | `max` | `max` | | 未设置(默认) | `high`(K3)/ `max`(K2.8 Preview) | 注意 关闭 thinking 后路由到 K2.8 Preview 无思考版:K3 系列与 K2.8 Preview 关闭 thinking 后,请求均由 K2.8 Preview(无思考)处理;thinking 快捷键 macOS 为 `Option+T`,Windows / Linux 为 `Alt+T`。 > 启动后若提示是否使用该 API key,确认使用即可。随后按照指引选择你信任的项目文件夹,完成授权即可。 > > ![Claude Code 授权访问项目文件](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-trust-folder.jpg) │ ④ **启动后验证** 启动后输入 `/status`,如果返回信息中显示 Base URL 为 `https://api.kimi.com/coding/`,则配置成功。此时即使模型名称仍显示为 Claude 模型,实际调用的仍是 Kimi Code 的 API。 ![Claude Code 状态检查](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-status-check.png) │ 在 VS Code 插件中使用 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%9C%A8-vs-code-%E6%8F%92%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------------------------------------------------- 插件自带 Claude Code 程序,与命令行共用 `~/.claude` 下的配置。按以下步骤接入: 1. 按方式一的「[配置流程](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B) 」完成 API 接入配置。 2. 打开插件新建会话,出现登录页面时点击底部的 **Run `claude` in terminal**: ![登录页面点击 Run claude in terminal](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-run-in-terminal.png) 3. 在弹出的终端中依次完成两个确认:信任目录选择 **Yes, I trust this folder**;API Key 确认选择 **1\. Yes**: ![Claude Code API key 确认提示](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-api-key-confirm.jpg) 4. **完全退出 VS Code** 后重新打开,即可在插件中直接对话。 如果不经过终端确认就使用插件,插件会缺少 API Key 的确认登记,发送消息时会反复弹出登录页面。 常见问题 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ----------------------------------------------------------------------------------------------------------------- ### 修改配置后不生效 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E4%BF%AE%E6%94%B9%E9%85%8D%E7%BD%AE%E5%90%8E%E4%B8%8D%E7%94%9F%E6%95%88) 检查 `~/.claude/settings.json` 的 `env` 中是否有残留旧配置(会覆盖终端环境变量),可执行第 ② 步中的清理脚本;另外终端中 export 的变量只对当前会话有效,重开终端后需要重新设置;如果写入了 `settings.json`,请确认修改后重启了 Claude Code。 ### 返回 401 鉴权错误 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E8%BF%94%E5%9B%9E-401-%E9%89%B4%E6%9D%83%E9%94%99%E8%AF%AF) 检查 `ANTHROPIC_API_KEY` 是否为有效的 Kimi Code API Key,注意 Key 只在创建时完整展示一次。 ### 提示模型不存在(model not found) [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E6%8F%90%E7%A4%BA%E6%A8%A1%E5%9E%8B%E4%B8%8D%E5%AD%98%E5%9C%A8-model-not-found) 检查各模型变量的值是否拼写正确(如 `k3-256k`、`k3[1m]`),注意不要携带多余空格或引号。 ### 后台任务或子 Agent 报错 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1%E6%88%96%E5%AD%90-agent-%E6%8A%A5%E9%94%99) 通常是 `ANTHROPIC_DEFAULT_HAIKU_MODEL`、`ANTHROPIC_DEFAULT_FABLE_MODEL` 或 `CLAUDE_CODE_SUBAGENT_MODEL` 未配置,对应场景请求了 Kimi Code 端点无法识别的模型名,请对照「配置项说明」补齐。 ### VS Code 插件一直弹出登录页面 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#vs-code-%E6%8F%92%E4%BB%B6%E4%B8%80%E7%9B%B4%E5%BC%B9%E5%87%BA%E7%99%BB%E5%BD%95%E9%A1%B5%E9%9D%A2) 插件缺少 API Key 的确认登记。详细操作见「[在 VS Code 插件中使用](https://www.kimi.com/code/docs/third-party-tools/claude-code.html#%E5%9C%A8-vs-code-%E6%8F%92%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8) 」。 --- # Quick Start | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#VPContent) On this page Quick Start [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#quick-start) ====================================================================================================== Kimi Code Desktop is the desktop client for Kimi Code. Open a local project, ask the Agent to read and modify code through conversation, and check the results with file previews, changes, and the built-in terminal. This page walks you through installation, model setup, your first workspace, and your first task. ![Kimi Code Desktop home](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/home.jpg) The Kimi Code Desktop home: type a message to start a conversation. Install and launch [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#install-and-launch) -------------------------------------------------------------------------------------------------------------------- [Kimi Code DesktopmacOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) [Kimi Code DesktopmacOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) [Kimi Code DesktopWindows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) On first launch, choose the interface language and theme. You can adjust them later in Settings. Sign in [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#sign-in) ---------------------------------------------------------------------------------------------- On first launch, follow the Kimi OAuth authorization flow, or skip it for now. When you need to sign in later, use the sign-in entry in the app to complete authorization. If authorization fails, retry as prompted. The sign-in site depends on your region: kimi.com for mainland China and kimi.ai for other regions. Once signed in, you can check your plan usage anytime in the account area of Settings. ![Kimi Code sign-in dialog](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/login.jpg) Sign in to Kimi Code: pick your account type, then complete OAuth authorization as prompted. Connect a model [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#connect-a-model) -------------------------------------------------------------------------------------------------------------- ### Use official Kimi models [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#use-official-kimi-models) Once signed in, the desktop app uses the official models available to your account. You can confirm the current model in the model selector inside the Composer, or view available models and model entitlements in the model area of Settings. Without a Kimi membership, the official models are not available directly, and model entitlements vary by plan. Find the membership entry in the account area to review and choose a plan. See [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) and [Model Configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) . ### Connect a third-party model provider [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#connect-a-third-party-model-provider) To use another model provider: 1. Open Settings and go to the model provider area. 2. Add a provider and enter its API key, base URL, and model information. 3. Save the configuration and return to the session. 4. Switch to the model near the Composer. 5. Send a read-only task to confirm that the model works. ![Manually add a model provider in Settings](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/qs-02.jpg) Manual setup asks for a name, API protocol, API key, base URL, and model information. For complete model and provider details, see [Model Configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) and [Providers and models](https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html) . Create a session and choose a workspace [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#create-a-session-and-choose-a-workspace) -------------------------------------------------------------------------------------------------------------------------------------------------------------- Desktop organizes sessions by workspace. After creating a session, choose the local project folder above the Composer: 1. Click **New session** on the left. 2. Click the folder name above the Composer to open the workspace picker. 3. Choose a recent project folder, or click **Choose folder…** to add another local folder. 4. Confirm that the target workspace appears above the Composer, then enter and send your task. The selected folder becomes a desktop workspace and is added to the recent folder list. When adding one, you can also expand **Enter an absolute path directly**; local absolute paths are resolved as provided. An empty session must have a workspace before you can send a message. Dropping a folder from Finder or File Explorer onto the sidebar can also add it as a workspace. The session appears in the session list for the selected workspace. You can switch between existing workspaces and sessions from the left sidebar. ![Open the workspace picker above the Composer after creating a session](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/qs-01.jpg) After creating a session, click the folder name above the Composer to choose a recent folder or add a new workspace. Start your first task [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#start-your-first-task) -------------------------------------------------------------------------------------------------------------------------- Enter a task in the Composer, or use `@` to reference files and directories. The **+** button in the lower-left corner of the Composer provides several task modes: * **Goal**: Set an objective for a longer task that needs multiple turns and checks. The goal appears above the Composer. See [Goal mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#goal-mode) . * **Plan**: Ask the Agent to analyze the task and propose a plan before changing files. See [Plan mode](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/interaction.html#plan-mode) . * **Swarm**: Split independent work across multiple subagents. Progress appears in the Tasks or Subagent area. See [Agents and Sub-Agents](https://www.kimi.com/code/docs/en/kimi-code-cli/customization/agents.html) . While the task is running, the Agent's tool calls, thinking, and the files changed in each turn are all presented in the interface and can be checked at any time. You can send follow-up input to adjust the direction, such as narrowing the scope, adding constraints, asking for an explanation, or stopping the current action. To pause or revert, interrupt the current turn or use `/undo` to revert the most recent change. Handle approvals [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#handle-approvals) ---------------------------------------------------------------------------------------------------------------- Desktop shows operations that need your decision in approval cards. A card can contain a command, file changes, or a plan. Review the exact scope before approving or rejecting it. When the Agent needs an answer, the question card can offer single-choice, multiple-choice, and **Other** input. There are three permission modes: * **Always Ask**: ask for approval for each operation that requires it. * **Ask When Needed**: ask only when approval is needed, reducing repeated confirmations while retaining control over key actions. * **Never Ask**: do not proactively show approval prompts; use this only when you understand the risks. For a first session or an unfamiliar project, **Always Ask** is a good starting point. You can change the mode after you understand the operation scope. Review changes and verify [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#review-changes-and-verify) ---------------------------------------------------------------------------------------------------------------------------------- After a change, open Changes on the right. Start with the file list, then inspect the specific file and the changes from an individual turn. When you need more context, use File Preview for Markdown, JSON, HTML, PDF, CSV, images, and code or text files. You can copy, download, reveal in the system, or open in an external app. File paths mentioned in the conversation can also be clicked open directly. When the task requires checks, open the bottom terminal panel from the terminal button in the upper-right corner of the session. Confirm the command, current workspace, and output. Continue only after the results look correct. If something is unexpected, explain it in the session or use `/undo` to revert the most recent change. For web projects, you can also open the built-in browser in the right panel. Browser tabs stay with the session and share page context with the Agent, so you can check page results without switching to another window. ![File diff in the Changes panel](https://www.kimi.com/code/docs/images/kimi-code-desktop/en/qs-04.jpg) The Changes panel on the right shows the exact diff for each file. Continue exploring [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#continue-exploring) -------------------------------------------------------------------------------------------------------------------- After your first task, you can continue with: * **Goal** for long-running objectives. * **Swarm** for independent investigation or modification work. * The top menu to open the project in an external editor, file manager, or system terminal. * Creating, archiving, restoring, forking, or exporting sessions. * Adjusting models, permissions, shortcuts, and plugins in Settings. Common commands [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#common-commands) -------------------------------------------------------------------------------------------------------------- The Composer accepts tasks directly and also supports built-in commands through `/`. Common commands include: | Command | Purpose | | --- | --- | | `/new` | Start a new session | | `/login` | Open the sign-in flow | | `/plan` | Enter plan mode | | `/goal` | Set an ongoing objective | | `/swarm` | Use multiple subagents for a task | | `/compact` | Compact the current context | | `/undo` | Revert the most recent change | | `/fork` | Fork the current session | | `/export` | Export the session | | `/status` | View the current session status | Desktop and the CLI [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#desktop-and-the-cli) ---------------------------------------------------------------------------------------------------------------------- Desktop carries the Agent core of Kimi Code CLI. The two can be installed on the same machine and share some local configuration, such as account, model, provider, and plugin-related settings. In the CLI, run the `/desktop` slash command or the [`kimi install-desktop`](https://www.kimi.com/code/docs/en/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) subcommand to open the Desktop page in your browser. Desktop focuses on projects, sessions, changes, and terminal verification in a graphical interface; the CLI is better suited to terminal-first and scripted workflows. Refer to each product's settings and configuration files for the exact shared scope. Next steps [​](https://www.kimi.com/code/docs/en/kimi-code-desktop/getting-started.html#next-steps) ---------------------------------------------------------------------------------------------------- * [Using the Desktop App](https://www.kimi.com/code/docs/en/kimi-code-desktop/using-desktop.html) : learn task modes, context, session management, terminal use, and settings. * [Kimi Code CLI Quick Start](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/getting-started.html) : learn terminal commands, sessions, and scripted workflows. * [Model Configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) : view available models and configuration options. * [Membership Benefits](https://www.kimi.com/code/docs/en/kimi-code/membership.html) : learn about account benefits, usage, and upgrades. --- # 远程控制 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#VPContent) Return to top 远程控制 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6) ======================================================================================================================= 在终端里使用 `kimi rc` 命令启动 Kimi Code CLI 并开启远程控制后,会自动生成一个可以远程控制本机的链接。你可以使用手机扫描二维码打开链接,或在其他设备上直接访问该链接。打开链接后,登录和本地 Kimi Code CLI 中相同的 Kimi 账号,就能远程查看任务进度、处理权限确认、继续对话,或新建会话。任务始终在本机执行,网页只是一个远程窗口。 开始使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8) ----------------------------------------------------------------------------------------------------------------------- ### 使用前准备 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E4%BD%BF%E7%94%A8%E5%89%8D%E5%87%86%E5%A4%87) 开启远程控制前,请确认本机满足以下条件: * **已安装 Kimi Code CLI**:安装见 [开始使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html) * **已登录 Kimi 账号且为付费会员**:远程控制需要会员权限,免费用户无法使用 * **本机保持唤醒并联网**:远程控制依赖本机与 Kimi 服务保持连接,关机、休眠或断网后远程会话不可用 ### 第一步:启动远程控制 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E7%AC%AC%E4%B8%80%E6%AD%A5-%E5%90%AF%E5%8A%A8%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6) 在本机用以下任一方式启动,效果相同:启动一个前台进程并打印远程访问信息。 * **`kimi rc`**(别名 `kimi remote`):直接启动远程控制 * **`kimi web --remote-control`**:与 `kimi rc` 等价,在启动本地网页界面的同时把它暴露到公网 * **`/remote-control`**(别名 `/rc`):已在 CLI 会话中时使用,把当前会话直接交给远程界面 启动成功后,终端会打印访问链接(形如 `https://code-rc.kimi.com/devices/<设备 ID>/`;`kimi login --region global` 后为 `https://code-rc.kimi.ai/devices/<设备 ID>/`)、二维码和本机设备名(主机名),同时默认浏览器会自动打开该链接(加 `--no-open` 可关闭)。二维码除了显示在终端里,还会保存为 PNG 文件(路径见启动信息),终端里无法正常显示二维码时,可以直接打开该文件。 ![kimi rc 启动后的终端输出:二维码与连接状态](https://www.kimi.com/code/docs/images/kimi-code-cli/kimi-rc-banner.jpg) 注意 远程控制链接是这台机器的远程控制入口,获得链接的人可能控制你的会话和文件,请勿分享给他人或发布到公开渠道。 两个使用限制: * 一台机器同时只能运行一个远程控制实例。重复启动会提示已有实例在运行,并给出在用的链接;停止旧实例的方法见 [如何关闭远程控制](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%A6%82%E4%BD%95%E5%85%B3%E9%97%AD%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6) * 远程控制不能与 `--dangerous-bypass-auth` 同时使用,也只绑定本机回环地址(不能用 `--host` 做局域网共享,远程访问统一走 Kimi 中转服务) ### 第二步:从其他设备连接 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E7%AC%AC%E4%BA%8C%E6%AD%A5-%E4%BB%8E%E5%85%B6%E4%BB%96%E8%AE%BE%E5%A4%87%E8%BF%9E%E6%8E%A5) 1. 在手机或另一台电脑的浏览器中打开启动信息里的访问链接,手机也可以直接扫终端里的二维码。 2. 使用与本机相同的 Kimi 账号登录。 3. 登录后在设备列表中选择这台机器(显示主机名),即可看到它的会话列表并开始操作。 远程控制通过浏览器访问。 设备数量限制 当前每个账号最多支持约 **3 台**设备。 ### 如何关闭远程控制 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%A6%82%E4%BD%95%E5%85%B3%E9%97%AD%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6) 远程控制是前台进程,停止方式取决于你能否找到启动它的终端: * **终端还在**:在该终端按 `Ctrl+C`(或直接关闭该终端窗口),设备会立即从远程列表中下线 * **找不到终端**:单实例锁文件 `~/.kimi-code/server/rc.json` 里记录着进程 pid 和在用的链接(重复启动时的报错也会打印这两个信息),执行 `kill ` 即可 * **进程已异常退出**(断电、崩溃等):残留的锁文件会在下次启动时自动清理,无需手动删除 想新开一个实例时,先把旧的按上面任一方式停掉再重新 `kimi rc` 即可。设备 ID 按本机数据目录生成,重开后设备和访问链接都不变。网页端设备管理与撤销的具体入口以最终发布版本为准。 远程会话中可以做什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%BF%9C%E7%A8%8B%E4%BC%9A%E8%AF%9D%E4%B8%AD%E5%8F%AF%E4%BB%A5%E5%81%9A%E4%BB%80%E4%B9%88) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 远程会话与本地会话能力基本一致,支持: * **发送新的任务**:直接向 AI 描述需求,任务在本机执行 * **查看当前进度**:实时展示执行步骤和正在使用的工具 * **继续对话**:在已有会话基础上追加指令 * **查看工具调用**:展开每次工具执行的输入与结果 * **处理权限确认**:文件修改、Shell 执行等确认请求,可直接在网页上批准或拒绝 * **中断或停止任务**:随时停止当前任务 * **查看子 Agent / workflow 状态**:任务派发的子 Agent 或 workflow,可在任务面板中查看进度 本地电脑上发生什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E6%9C%AC%E5%9C%B0%E7%94%B5%E8%84%91%E4%B8%8A%E5%8F%91%E7%94%9F%E4%BB%80%E4%B9%88) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 远程控制只是一个远程窗口,所有计算和文件操作仍在本机完成。边界如下: | 内容 | 是否在本地完成 | | --- | --- | | 读取项目文件 | 是 | | 修改项目文件 | 是 | | 执行 Shell 命令 | 是 | | 使用本地 MCP | 是 | | 手机或浏览器界面 | 否 | | 会话同步 | 通过 Kimi 服务完成 | 断线、休眠和恢复 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E6%96%AD%E7%BA%BF%E3%80%81%E4%BC%91%E7%9C%A0%E5%92%8C%E6%81%A2%E5%A4%8D) --------------------------------------------------------------------------------------------------------------------------------------------------------------- * **关闭浏览器**:任务在本机继续执行,不会中断。重新打开访问链接即可恢复会话视图 * **本机断网**:断网期间远程界面断开,无法操作。本机的远程控制进程和本地服务保持运行,但执行中的任务可能因模型请求发不出去而暂停或失败;网络恢复后本机会自动重连中转服务,刷新远程页面即可,无需重启 * **电脑休眠**:休眠后远程控制连接断开,任务可能暂停或失败。建议在系统设置中将电脑设为永不休眠,或在使用期间保持唤醒 * **本地进程退出**:按 `Ctrl+C` 或关闭终端后远程控制停止,设备从远程列表中下线。重新启动后可恢复 * **结束远程连接但保留本地任务**:直接关闭网页即可,本机任务不受影响 远程控制和 Kimi Code 网页版有什么区别? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6%E5%92%8C-kimi-code-%E7%BD%91%E9%A1%B5%E7%89%88%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [Kimi Code 网页版](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html) 是本机或局域网里的图形界面,远程控制把它延伸到了公网任意设备: | 对比项 | Kimi Code 网页版 | 远程控制 | | --- | --- | --- | | 访问范围 | 本机 `localhost`,或 `--host` 开启的局域网 | 公网任意设备(经 Kimi 中转) | | 启动方式 | 终端运行 `kimi web` | `kimi rc`、`kimi web --remote-control` 或 CLI 中 `/remote-control` | | 鉴权方式 | 本地 token | 登录同一个 Kimi 账号 | | 数据与执行位置 | 本机 | 本机(网页只是远程窗口) | | 典型场景 | 本机浏览器图形界面操作 | 手机、平板、另一台电脑远程跟进 | 网页界面的详细功能见 [在网页中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html) 。 安全与权限 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%AE%89%E5%85%A8%E4%B8%8E%E6%9D%83%E9%99%90) --------------------------------------------------------------------------------------------------------------------------------- ### 远程设备如何鉴权 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%BF%9C%E7%A8%8B%E8%AE%BE%E5%A4%87%E5%A6%82%E4%BD%95%E9%89%B4%E6%9D%83) 远程设备必须登录与本机相同的 Kimi 账号,才能查看和控制会话。不会向其他账号暴露你的设备,也不存在无需登录即可访问的公开链接。 ### 访问链接是否包含敏感信息 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%AE%BF%E9%97%AE%E9%93%BE%E6%8E%A5%E6%98%AF%E5%90%A6%E5%8C%85%E5%90%AB%E6%95%8F%E6%84%9F%E4%BF%A1%E6%81%AF) 访问链接本身不包含会话数据或本地 token,所有内容都需要登录后按账号权限展示。但它是这台机器的远程控制入口,启动信息中也会提示不要分享给他人。 常见问题 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ----------------------------------------------------------------------------------------------------------------------- ### 从微信里访问链接,无法打开怎么办? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E4%BB%8E%E5%BE%AE%E4%BF%A1%E9%87%8C%E8%AE%BF%E9%97%AE%E9%93%BE%E6%8E%A5-%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%E6%80%8E%E4%B9%88%E5%8A%9E) 微信内置浏览器会基于自身安全策略限制部分外部网页的应用内访问,远程控制的访问链接(`https://code-rc.kimi.com/…`)在微信中直接打开可能被拦截,出现"已停止访问该网页"等提示。 解决方式:点击页面右上角"…"菜单并选择"在浏览器中打开",或将链接复制到 Safari、Chrome 等系统浏览器中访问。使用微信"扫一扫"扫描启动二维码时同理,扫码后请选择在浏览器中打开,即可获得完整的会话功能。 ### 关闭浏览器后任务会停止吗? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%85%B3%E9%97%AD%E6%B5%8F%E8%A7%88%E5%99%A8%E5%90%8E%E4%BB%BB%E5%8A%A1%E4%BC%9A%E5%81%9C%E6%AD%A2%E5%90%97) 不会。浏览器只是窗口,任务在本机执行。关闭网页不影响本机继续运行,重新打开链接即可恢复视图。 ### 关闭本地终端后还能继续吗? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E5%85%B3%E9%97%AD%E6%9C%AC%E5%9C%B0%E7%BB%88%E7%AB%AF%E5%90%8E%E8%BF%98%E8%83%BD%E7%BB%A7%E7%BB%AD%E5%90%97) 不能。远程控制依赖本机的远程控制进程保持运行,进程退出后远程连接即断开。重新启动后可恢复。 ### 手机能直接访问本地文件吗? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E6%89%8B%E6%9C%BA%E8%83%BD%E7%9B%B4%E6%8E%A5%E8%AE%BF%E9%97%AE%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6%E5%90%97) 不能。手机端没有直接访问本机文件系统的通道:你在手机上看到的是会话界面里展示的内容(例如 AI 修改文件后的 diff 和文件卡片),但文件的读写和命令执行都发生在本机。手机无法脱离会话,直接浏览、打开或下载本机文件。 ### 远程连接失败如何排查? [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5%E5%A6%82%E4%BD%95%E6%8E%92%E6%9F%A5) 按以下顺序检查: 1. **唤醒状态**:确认本机处于唤醒状态,没有进入休眠 2. **网络连通性**:本机能否正常访问互联网 3. **进程状态**:本机的远程控制进程是否正在运行 4. **账号一致性**:网页端登录的 Kimi 账号与本机是否一致 5. **防火墙与代理**:公司网络或代理是否拦截了 `code-rc.kimi.com` 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------- * [在网页中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html) — 远程控制打开的就是网页界面,了解界面本身的功能与操作 --- # 平台与模型 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#VPContent) Return to top 平台与模型 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#%E5%B9%B3%E5%8F%B0%E4%B8%8E%E6%A8%A1%E5%9E%8B) =================================================================================================================================== Kimi Code CLI 支持同时接入多家模型供应商服务,模型在供应商之上声明自己的名称、上下文长度和能力。本页介绍如何在 `config.toml` 里配置各种供应商。 支持的供应商类型 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#%E6%94%AF%E6%8C%81%E7%9A%84%E4%BE%9B%E5%BA%94%E5%95%86%E7%B1%BB%E5%9E%8B) ----------------------------------------------------------------------------------------------------------------------------------------------------------------- `providers` 表里的 `type` 字段决定使用哪种协议实现: | 类型 | 协议 | 典型用途 | | --- | --- | --- | | [`kimi`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#kimi) | OpenAI 兼容 | Kimi Code 托管服务、Kimi Platform API 密钥 | | [`anthropic`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#anthropic) | Anthropic Messages | Claude 系列模型 | | [`openai`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#openai) | OpenAI Chat Completions | OpenAI 及兼容服务、DeepSeek、Qwen 等 | | [`openai_responses`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#openai-responses) | OpenAI Responses API | OpenAI 较新的 Responses 接口 | | [`google-genai`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#google-genai) | Google GenAI | Gemini API | | [`vertexai`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#vertexai) | Google GenAI on Vertex | Google Cloud Vertex AI | 所有供应商默认以流式方式与模型交互。thinking、视觉、工具调用等能力按模型名前缀自动匹配,通常不需要手动声明。 **凭证优先级**:`api_key` 或 `api_key_env`(互斥替代项,只能设置其中一个)> `[providers..env]` 子表键(两者都不存在时才读)> 全部缺失时启动报错。除显式声明的 `api_key_env` 外,CLI 不会从 shell 环境变量自动取凭证,详见[配置覆盖:供应商凭证](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) 。 `/provider` — 交互式供应商管理 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#provider-%E2%80%94-%E4%BA%A4%E4%BA%92%E5%BC%8F%E4%BE%9B%E5%BA%94%E5%95%86%E7%AE%A1%E7%90%86) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 不想手动编辑 TOML?在 TUI 里输入 `/provider` 打开**供应商管理器**,可以以交互方式添加或删除供应商。 ![/provider 供应商管理器](https://www.kimi.com/code/docs/images/kimi-code-cli/provider-manager.jpg) 管理器按来源把供应商显示为一行行条目。操作方式: * ↑/↓ 移动光标,←/→ 翻页 * `d` 键删除当前供应商(有 `[y/N]` 确认) * 在 `[ Add New Platform ]` 行按 Enter 添加新供应商 添加时有两条路径: * **Known third-party provider**:从 [models.dev](https://models.dev/) 拉取模型目录,选供应商 → 输入 API 密钥 → 选默认模型。目录未声明协议类型的供应商(如 xai、openrouter 这类厂商专用 SDK)会按 OpenAI 兼容协议导入并显示 "guessed" 提示;目录没有可用端点时会先弹出 base URL 输入框;Amazon Bedrock / Cohere 等专有协议和无法识别的显式协议会被拒绝导入。已下线(deprecated)和 alpha 状态的模型不会出现在导入列表中。如果公共目录不可达,CLI 会回退到内置目录快照,离线或网络受限环境下也能完成导入 * **Custom registry (api.json)**:粘贴自定义 registry 地址,私有 registry 再附上 Bearer token,CLI 自动创建 `providers` / `models` 条目。当 registry 条目声明了 `env` 字段(存放 API 密钥的环境变量名)时,CLI 会把它作为提示打印出来——想用就在 `config.toml` 里自己设置 `api_key_env`。绑定永远不会自动发生:registry 既决定变量名、又决定凭证发往的端点,不能由它来选择读取你的哪份密钥。对私有 registry,Bearer token 本身仍会存为 `source.apiKey`,供刷新时重新拉取。后续启动时,同一个 registry 地址下的供应商会一起刷新,因此上游新增、删除供应商以及模型元数据变化都会同步。 WARNING 通过 `/login` 登录的 Kimi Code OAuth 托管账号不会在 `/provider` 里显示,请用 `/login` 和 `/logout` 管理。 非交互环境下也可以用 shell 命令完成同样操作:[`kimi provider`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider) 。 `kimi` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#kimi) ------------------------------------------------------------------------------------------- 用于对接 Moonshot AI 的 OpenAI 兼容接口,包括 Kimi Code 托管服务和 Kimi Platform API 密钥。 * 默认 `base_url`:`https://api.moonshot.ai/v1` * 凭证键名:`KIMI_API_KEY`、`KIMI_BASE_URL` * 额外能力:支持视频上传 toml [providers.kimi] type = "kimi" base_url = "https://api.moonshot.ai/v1" api_key = "sk-xxxxx" > 使用 Kimi Code 托管服务时,`/login` 登录后会自动配置 `base_url` 和凭证,无需手动填写。 `anthropic` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#anthropic) ----------------------------------------------------------------------------------------------------- 用于对接 Claude API。标准 Claude 模型自动启用视觉、工具调用及 Thinking(如支持);自定义或未覆盖的模型需在 `[models.]` 里显式声明 `capabilities`。 * 默认 `base_url`:跟随 Anthropic SDK 默认值 * 凭证键名:`ANTHROPIC_API_KEY`、`ANTHROPIC_BASE_URL` * 默认 `max_tokens`:按模型自动推断。如需覆盖,在模型别名上设 `max_output_size` toml [providers.anthropic] type = "anthropic" api_key = "sk-ant-xxxxx" [models."claude-opus-4-7"] provider = "anthropic" model = "claude-opus-4-7" max_context_size = 200000 # max_output_size = 32000 # 可选,省略时使用模型推断的默认值 `openai` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#openai) ----------------------------------------------------------------------------------------------- 用于对接 OpenAI Chat Completions 协议,也可连接任何兼容该协议的第三方服务(覆盖 `base_url` 即可)。 第三方推理模型(DeepSeek、Qwen、One API 等)开箱即用:CLI 自动处理 `reasoning_content` 字段和 `reasoning_effort` 注入。如果你的网关用非标准字段名返回推理内容,在模型别名上设 `reasoning_key` 覆盖。 * 默认 `base_url`:`https://api.openai.com/v1` * 凭证键名:`OPENAI_API_KEY`、`OPENAI_BASE_URL` toml [providers.openai] type = "openai" base_url = "https://api.openai.com/v1" api_key = "sk-xxxxx" `openai_responses` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#openai-responses) ------------------------------------------------------------------------------------------------------------------- 对应 OpenAI 较新的 Responses API,始终以流式方式工作。配置方式与 `openai` 相同。 * 默认 `base_url`:`https://api.openai.com/v1` * 凭证键名:`OPENAI_API_KEY`、`OPENAI_BASE_URL` toml [providers.openai-responses] type = "openai_responses" base_url = "https://api.openai.com/v1" api_key = "sk-xxxxx" `google-genai` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#google-genai) ----------------------------------------------------------------------------------------------------------- 用于直连 Google Gemini API。thinking、视觉及多模态能力按模型名自动识别。 * 凭证键名:`GOOGLE_API_KEY` toml [providers.gemini] type = "google-genai" api_key = "xxxxx" 如需经由兼容 Gemini 协议的代理/网关访问,可设置 `base_url`(或 `GOOGLE_GEMINI_BASE_URL` 环境变量);不填时使用 SDK 默认地址 `https://generativelanguage.googleapis.com`。 > 只填**主机根地址**。Google GenAI SDK 会自行追加 API 版本与路径(如 `/v1beta/models/:generateContent`),所以结尾带 `/v1beta` 会导致路径重复成 `/v1beta/v1beta/…`。 toml [providers.gemini] type = "google-genai" api_key = "xxxxx" base_url = "https://your-gateway.example" `vertexai` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#vertexai) --------------------------------------------------------------------------------------------------- 与 `google-genai` 共用实现,`type = "vertexai"` 时切换到 Vertex AI 访问路径。 认证走 Google Cloud 标准 ADC 流程(`gcloud auth application-default login` 或 `GOOGLE_APPLICATION_CREDENTIALS` 服务账号 JSON),这部分与 Kimi Code 无关。**项目 ID 和区域必须写在 `[providers.vertexai.env]` 子表里**。直接在 shell 里 `export GOOGLE_CLOUD_PROJECT` 不会被 CLI 读取。 toml [providers.vertexai] type = "vertexai" [providers.vertexai.env] GOOGLE_CLOUD_PROJECT = "my-gcp-project" GOOGLE_CLOUD_LOCATION = "us-central1" sh gcloud auth application-default login # 一次性完成认证 kimi 如需让 Vertex 请求走自定义(如代理)端点,可设置 `base_url`(或 `GOOGLE_VERTEX_BASE_URL` 环境变量);不填时使用 SDK 默认的区域化 `*-aiplatform.googleapis.com` 地址。与 `google-genai` 一样,只填主机根地址。SDK 会自行追加 `/v1beta1/publishers/google/models/…`。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) --------------------------------------------------------------------------------------------------------------- * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) — `providers` 和 `models` 表的完整字段参考 * [配置覆盖](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html) — 供应商凭证的解析优先级规则 * [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) — 各供应商对应的凭证键名列表 --- # Membership Benefits | Kimi Code Docs [Skip to content](https://www.kimi.com/code/docs/en/kimi-code/membership#VPContent) Return to top Membership Benefits [​](https://www.kimi.com/code/docs/en/kimi-code/membership#membership-benefits) ==================================================================================================== 📢 New plans released The new Kimi membership plans are now available, with pricing unchanged — see the [Kimi Code plan page](https://www.kimi.ai/code/#pricing) for plan details and pricing. For new members, **the weekly quota limit is removed**, and only the rolling 5-hour rate window remains. The Go tier has no coding quota; Plus and above can use Kimi Code. Existing subscribers on legacy plans are not affected: the tier name, quota rules, and auto-renewal all remain as they are. See the [plan comparison](https://www.kimi.com/code/docs/en/kimi-code/membership#plan-comparison) below for the differences between the legacy and new plans. Overview [​](https://www.kimi.com/code/docs/en/kimi-code/membership#overview) ------------------------------------------------------------------------------ Kimi Code is the developer-focused AI coding service within [Kimi membership benefits](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) , provided together with a Kimi membership subscription and sharing the same quota. Requests from the CLI, VS Code, Desktop, and third-party tools all count toward that quota. See the [Kimi membership page](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) for tiers and pricing. Membership Tiers [​](https://www.kimi.com/code/docs/en/kimi-code/membership#plan-comparison) --------------------------------------------------------------------------------------------- Kimi membership tiers have been renamed, with pricing unchanged. Here is how the new plans compare with the legacy ones: | Item | Legacy plans | New plans | | --- | --- | --- | | Kimi Code availability | Andante and above | Plus and above | | 5-hour rate window | Yes | Yes | | Weekly rate window | Yes | No | | Monthly total quota | Yes | Yes | | K3 access | Moderato and above | Plus and above | | K3 1M context | Allegretto and above | Pro and above | | HighSpeed access | Allegretto and above | Pro and above | **FAQ** Can I keep using my legacy plan? Yes. Legacy plans purchased before the new plans launched remain usable. When the term ends, you can renew or upgrade to a new plan. Do I have to upgrade to a new plan? No — migration is optional. Your legacy plan keeps renewing as long as you stay subscribed; whether to upgrade depends on your needs. How do I upgrade my plan? On the [Kimi Code plan page](https://www.kimi.ai/code/#pricing) , pick the new plan you want and click "Subscribe" to complete payment. Your current plan's remaining days are prorated automatically, and the new plan takes effect immediately. Quota and Limits [​](https://www.kimi.com/code/docs/en/kimi-code/membership#quota-and-limits) ---------------------------------------------------------------------------------------------- Quota rules differ between new and existing members: * **New members**: the weekly quota limit is removed — quota no longer refreshes every 7 days. The **rolling 5-hour rate window** still applies: too many requests in a short time trigger rate limiting, which recovers automatically once the window rolls over. * **Existing members on legacy plans**: rules are unchanged — quota **refreshes automatically every 7 days** from your subscription date, unused quota does not roll over, and the same 5-hour rolling rate window applies. Both groups share the Kimi membership monthly total quota: if the monthly total is reached, Kimi Code quota is frozen until the monthly quota resets or you upgrade. Monthly usage can be viewed on the [Subscription](https://www.kimi.com/membership/subscription) page. All logged-in devices and API Keys share the same quota; devices inactive for over 30 days are automatically unbound and can be restored by running `/login` again. Log in to the [Kimi Code Console](https://www.kimi.com/code/console) at any time to check remaining quota and rate-limit status and to manage API Keys and devices. Extra Usage [​](https://www.kimi.com/code/docs/en/kimi-code/membership#extra-usage) ------------------------------------------------------------------------------------ When your subscription quota runs out, you can keep making requests using your Extra Usage balance without waiting for a refresh. Only subscribed members can enable it, and **Kimi on the web and Kimi Code share the same Extra Usage balance**. See the full terms in the [Extra Usage Agreement](https://www.kimi.com/user/agreement/extra-usage-rules-cn) . ![Extra Usage](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-en.jpeg) **Top-up entry points** * **From the main site**: go to the Kimi [Subscription page](https://www.kimi.com/membership/subscription?tab=quota) , scroll to the "Extra Usage" module at the bottom then choose an amount and complete payment. * **From the Kimi Code Console**: once your weekly quota (existing members on legacy plans) or 5-hour quota reaches over **80%** used, the progress card shows a **Buy Extra Usage** button that takes you to the subscription page to purchase. ![The Extra Usage entry in the Kimi Code Console](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-console-en.png) **Enabling and managing** Turn on the "Extra Usage" toggle, and when your subscription quota runs out, the system automatically deducts from your Extra Usage balance. Click **Settings** in the module to enable a **monthly spending cap** and set the maximum you can spend this month; the progress bar shows this month's Extra Usage consumption in real time. **Billing and rules** * **Billing**: charged by actual usage — the more content read and generated, and the more complex the task, the higher the cost; the balance is shown in RMB, with rates as displayed on the platform. Extra Usage pricing is close to the official API pricing of the [Kimi Open Platform](https://platform.kimi.com/) ; for heavy usage, upgrading your subscription is usually more cost-effective. * **Deduction priority**: time-limited quotas such as the subscription are deducted first; **Extra Usage is deducted last** as a fallback. Once enabled, even if your subscription quota is maxed out, Extra Usage is consumed seamlessly and tasks don't stop or error out. * **Spending cap**: enable a "monthly spending cap" in settings to limit how much Extra Usage can be spent this month; without it, there is no cap. * **Validity and stacking**: the balance does not expire and stacks across top-ups; it remains usable after the subscription lapses, but you can't top up during the lapse — re-subscribe first to top up again. * **Refunds**: generally non-refundable, non-transferable, and non-redeemable. > Billing example (from official examples, for a rough sense of scale; actual rates per the platform): a simple request (e.g. "recommend a rock song") costs about **¥0.03**; a complex multi-step task (e.g. "plan a week-long road trip from Chengdu to western Sichuan") costs about **¥1.6**. > Top-up limits: minimum ¥25 per top-up, up to 10 times and ¥3,000 per day, with a balance cap of ¥10,000. **Checking your usage** * **Kimi web / app**: Settings → Subscription & Invoices → [My Quota](https://www.kimi.com/membership/subscription?tab=quota) . * **Kimi Code Console**: **once Extra Usage is enabled**, log in to the [Console](https://www.kimi.com/code/console) to view your balance and usage. * **Kimi Code CLI**: type `/usage` on the command line to check directly. ![Checking Extra Usage with /usage in the CLI](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-cli.png) **FAQ** Do Kimi on the web and Kimi Code use the same Extra Usage wallet? Yes. The Extra Usage balance is shared between Kimi and Kimi Code — top up once and use it in both; the Extra Usage you top up under "My Quota" and the one in the Kimi Code Console are the same balance. Which is deducted first, Extra Usage or subscription quota? Time-limited quotas such as the subscription are deducted first; Extra Usage is only deducted as a fallback once all time-limited quotas are exhausted. When I hit the monthly / weekly (legacy plans) / hourly limit, or get rate-limited mid-session, can I keep going? Yes. Once Extra Usage is enabled you're not affected by subscription limits — whenever any quota is reached it seamlessly switches to the Extra Usage balance, so tasks don't stop or error out, and only Extra Usage is deducted without affecting your membership quota refresh. How is Extra Usage billed, and how does it compare with a same-priced subscription or Open Platform API? Billing depends on the request's input/output volume and cache hit rate; Extra Usage pricing is close to the [Kimi Open Platform](https://platform.kimi.com/) 's official API, and for heavy usage upgrading your subscription is usually more cost-effective. Can unused balance roll over to next month, and does it stack? Yes — it's credit-based, doesn't expire, and stacks; it stays usable after the subscription lapses, but you can't top up during the lapse and must re-subscribe to top up again. When the balance is nearly used up (e.g. a 25 RMB top-up), will the current request finish? It guarantees the "last model call" completes even if its billing exceeds the limit, but it doesn't guarantee the whole task will finish. Is Extra Usage available for Enterprise? Not yet supported. After I close my account, is the balance refunded? To request a refund, go to [Kimi.ai](https://www.kimi.com/) on the web, click your profile picture in the bottom-left corner, then select **Get Help** → **User Feedback** to reach our support team. Next steps [​](https://www.kimi.com/code/docs/en/kimi-code/membership#next-steps) ---------------------------------------------------------------------------------- * [Model configuration](https://www.kimi.com/code/docs/en/kimi-code/models.html) — models, context windows, and switching methods available for each tier * [Error reference](https://www.kimi.com/code/docs/en/kimi-code/error-reference.html) — how to handle errors such as quota exhaustion and insufficient permissions --- # 在网页中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#VPContent) Return to top 在网页中使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%9C%A8%E7%BD%91%E9%A1%B5%E4%B8%AD%E4%BD%BF%E7%94%A8) ================================================================================================================================ Kimi Code Web 是 Kimi Code CLI 内置的浏览器图形界面:在终端运行 `kimi web`,就能在浏览器里新建会话、对话、处理审批、查看文件改动——界面更易读,会话和数据仍全部保存在你的本机。 ![Kimi Code Web 界面](https://www.kimi.com/code/docs/images/kimi-code-cli/kimi-web-ui.jpg) 开始使用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------ 1 **安装并登录 Kimi Code CLI** `kimi web` 是 CLI 的内置命令,未安装 CLI 时不可用。安装与登录见 [开始使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html) 。 2 **在终端运行 `kimi web`** 如果你已经在 CLI 里,也可以输入 `/web`,把当前会话交接到浏览器。 3 **服务就绪后自动用默认浏览器打开 Web 界面** 启动横幅会打印访问地址,浏览器没有自动打开时,手动复制这行地址打开即可: text Local: http://127.0.0.1:58627/#token=... Token: ... Stop: Ctrl+C 注意 地址里的 `#token=` 是访问凭证,请勿外发,停止服务在终端按 `Ctrl+C`。 ### 启动选项 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%90%AF%E5%8A%A8%E9%80%89%E9%A1%B9) | 选项 | 说明 | | --- | --- | | `--port ` | 绑定端口;默认 `58627`,被占用时自动 +1 重试 | | `--host [host]` | 实现同一局域网下的手机、平板或其他电脑都能用 web 地址访问,也可指定 IP,如 `--host 192.168.1.10` | | `--no-open` | 就绪后不自动打开浏览器 | | `--log-level ` | 按所选级别开启服务日志;默认不输出 | ### 常用斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%B8%B8%E7%94%A8%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) | 斜杠命令 | 说明 | | --- | --- | | `/new` | 新开会话 | | `/goal` | 进入目标模式,跨轮次持续推进同一目标 | | `/compact` | 压缩当前会话上下文 | | `/tower` | Tower 多 Agent 协作(实验功能),`/tower ` 指定基准分支 | | `/export` | 导出会话内容与故障排查日志为 ZIP | | `/remote-control` | 开启远程控制,从远程访问本地 Web 会话 | 与 CLI 的关系 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E4%B8%8E-cli-%E7%9A%84%E5%85%B3%E7%B3%BB) ---------------------------------------------------------------------------------------------------------------------- Web 界面和 CLI 共享同一份登录态、配置(`config.toml`)和会话数据。 Web 支持的斜杠命令见上文 [常用斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%B8%B8%E7%94%A8%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) ,与 CLI 不完全一致;部分 CLI 指令在 Web 里有对应的图形入口(设置页、模型选择器、账户菜单、任务面板)。 两端能力对照如下: | 功能 | CLI | Web | 说明 | | --- | --- | --- | --- | | 流式对话 | ✓ | ✓ | Web 为富格式增量渲染(表格、代码高亮、diff、工具卡片) | | 会话管理 | ✓ | ✓ | Web 可把不常用的会话归档收起,在已归档页按时间排序、随时恢复;Open / Done / Workspaces 标签页为 Lab 实验特性,默认关闭,需在设置的 Lab 页开启 | | 审批处理 | ✓ | ✓ | Web 可在图形页面中点击处理,无需指令 | | 后台任务 | ✓ | ✓ | Web 为任务面板实时展示进度 | | 文件与改动 | ✓ | ✓ | Web 有改动文件摘要卡与逐文件 diff | | 设置 | ✓ | ✓ | Web 另有图形化设置页(供应商、账号与用量、Lab 实验特性) | | 全局搜索 | — | ✓ | Web 可实现跨会话、跨工作区搜索 | | 移动端适配 | — | ✓ | `--host` 开启局域网共享后,可实现在同一局域网下的手机浏览器中使用 | 安全注意 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%AE%89%E5%85%A8%E6%B3%A8%E6%84%8F) ------------------------------------------------------------------------------------------------------------ * **建议设置并列凭证**:绑定局域网地址后,额外设置 `KIMI_CODE_PASSWORD` 环境变量,服务端会对鉴权失败自动限流。 * **不要彻底关闭鉴权**:`--dangerous-bypass-auth` 会关闭所有鉴权,任何能访问该端口的人都能控制你的会话、文件系统和 shell。仅在可信网络或自有鉴权代理之后使用,详见 [kimi 命令参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) 。 常见问题 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------------ ### 端口被占用了怎么办 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E7%AB%AF%E5%8F%A3%E8%A2%AB%E5%8D%A0%E7%94%A8%E4%BA%86%E6%80%8E%E4%B9%88%E5%8A%9E) 不用处理。`kimi web` 会自动用下一个端口重试(58628、58629……),以启动横幅里实际打印的地址为准。 ### 浏览器打不开地址 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E6%B5%8F%E8%A7%88%E5%99%A8%E6%89%93%E4%B8%8D%E5%BC%80%E5%9C%B0%E5%9D%80) 先确认终端里的服务还在运行(它前台挂在这个终端上)。地址必须完整复制,包含 `#token=` 部分;只输 `http://127.0.0.1:58627` 会停在输入 token 的页面,手动粘贴横幅里的 `Token` 值也可以进入。 ### token 失效了怎么恢复 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#token-%E5%A4%B1%E6%95%88%E4%BA%86%E6%80%8E%E4%B9%88%E6%81%A2%E5%A4%8D) 运行 `kimi web rotate-token` 生成新 token,然后用启动横幅里的新地址重新打开。所有运行中的实例会自动换用新 token,无需重启。 ### 同一 WiFi 下其他设备访问不到 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%90%8C%E4%B8%80-wifi-%E4%B8%8B%E5%85%B6%E4%BB%96%E8%AE%BE%E5%A4%87%E8%AE%BF%E9%97%AE%E4%B8%8D%E5%88%B0) 确认启动时带了 `--host`(裸写即可),并用横幅中局域网地址(形如 `http://192.168.x.x:58627/#token=...`)访问。仍不通时检查电脑防火墙是否放行了该端口,以及两台设备是否真的在同一网段(访客 WiFi、VPN、4G/5G 热点切换都会造成隔离)。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------- * [服务 API](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html) — 面向脚本与第三方集成的 REST / WebSocket 接口(实验性) * [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) — `kimi web` 的全部命令行选项 * [远程控制](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html) — 从公网任意设备远程查看和接管本机会话 --- # 会话与上下文 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#VPContent) Return to top 会话与上下文 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E4%BC%9A%E8%AF%9D%E4%B8%8E%E4%B8%8A%E4%B8%8B%E6%96%87) ===================================================================================================================================== Kimi Code CLI 把每次对话持久化为一个「会话」,保留消息历史和元数据,可以随时关闭终端后再回来继续。本页介绍如何恢复会话、管理上下文,以及导出和派生会话。 会话存储 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E4%BC%9A%E8%AF%9D%E5%AD%98%E5%82%A8) ----------------------------------------------------------------------------------------------------------------- 所有会话保存在 `$KIMI_CODE_HOME/sessions/` 下(默认 `~/.kimi-code/sessions/`),按工作目录分组存放: text ~/.kimi-code/ ├── config.toml ├── session_index.jsonl └── sessions/ └── / └── / ├── state.json └── agents/ ├── main/ │ └── wire.jsonl └── / └── wire.jsonl * `state.json`:会话标题、创建时间等元数据。 * `agents/*/wire.jsonl`:Agent 事件流,用于会话恢复和回放;同时记录发给模型的请求轨迹(工具 schema、请求参数、MCP 工具清单),便于调试。 注意 `sessions/` 目录下的文件请勿手动编辑,否则可能导致会话无法正常恢复。 启动与恢复会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E5%90%AF%E5%8A%A8%E4%B8%8E%E6%81%A2%E5%A4%8D%E4%BC%9A%E8%AF%9D) ----------------------------------------------------------------------------------------------------------------------------------------------- 每次直接运行 `kimi` 都会创建新会话。以下方式可以恢复历史会话: **继续当前目录最近的会话:** sh kimi --continue **恢复指定会话(通过 ID):** sh kimi --session abc123 **交互式浏览历史会话并选择:** sh kimi --session 注意 `--continue` 与 `--session` 互斥。 在 TUI 中切换会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E5%9C%A8-tui-%E4%B8%AD%E5%88%87%E6%8D%A2%E4%BC%9A%E8%AF%9D) ----------------------------------------------------------------------------------------------------------------------------------------------- 不离开当前终端也可以管理会话,以下斜杠命令仅在 Agent 空闲时可用: * **`/new`**(别名 `/clear`):切换到新会话,丢弃当前上下文。 * **`/sessions`**(别名 `/resume`):浏览并恢复历史会话。 * **`/fork`**:派生当前会话(详见下文)。 * **`/title `**(别名 `/rename`):设置会话标题方便识别;不带参数时显示当前标题。 上下文压缩 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E4%B8%8A%E4%B8%8B%E6%96%87%E5%8E%8B%E7%BC%A9) --------------------------------------------------------------------------------------------------------------------------- 对话变长时,Kimi Code CLI 会在上下文接近窗口上限时自动压缩历史消息,释放 token 空间。也可以随时手动触发: /compact 压缩时可以附带指引,告诉模型优先保留哪些信息: /compact 保留与数据库迁移相关的讨论 派生会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E6%B4%BE%E7%94%9F%E4%BC%9A%E8%AF%9D) ----------------------------------------------------------------------------------------------------------------- 想在不破坏当前对话的前提下尝试新思路,使用 `/fork`: /fork fork 后你仍停留在原会话,对话不受影响、可以直接继续;派生出的副本与原会话彼此独立,可以随时通过 `/sessions` 切换过去。已保存的 `/goal` 不会复制到派生会话。如果你想在派生会话中进行自主 goal 工作,需要在那里开始一个新 goal。 fork 完成后,CLI 会打印一条可直接运行的 `kimi --resume` 命令(并自动复制到剪贴板),方便你在新终端进程中直接进入派生会话。 导出会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E5%AF%BC%E5%87%BA%E4%BC%9A%E8%AF%9D) ----------------------------------------------------------------------------------------------------------------- 用 `kimi export` 把会话打包为 ZIP,适合分享、归档或提交问题反馈: sh kimi export 不传 `sessionId` 时导出当前目录最近的会话(有交互式确认,加 `-y` 跳过)。用 `-o` 指定输出路径: sh kimi export -o ~/Desktop/my-session.zip 导出包含会话目录下的所有文件,包括诊断日志。全局诊断日志(`~/.kimi-code/logs/kimi-code.log`)默认也会打包;如不需要,加 `--no-include-global-log` 排除。 也可以在 TUI 内导出,无需离开交互界面: * **`/export-debug-zip`**:产生与 `kimi export` 相同的调试 ZIP。 * **`/export-md`**(别名 `/export`):导出为人类可读的 Markdown 对话记录,适合分享或存档。可选接收路径参数;不带参数时写入工作目录下的 `kimi-export--.md`。 在 web UI 中,`/export` 会把当前会话下载为诊断 ZIP。压缩包包含持久化的会话数据、诊断日志,以及记录浏览器关键事件且大小有上限、只含元数据的 `logs/kimi-web.jsonl`;提示词正文、WebSocket 内容和 console 参数不会写入这份浏览器日志。这里的 web 命令与上面的 TUI `/export` 别名行为不同。 提示 导出文件可能包含代码、命令输出和路径等敏感信息,分享前请先确认内容。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------- * [数据路径](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html) — 会话文件的完整目录结构说明 * [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html) — `--continue`、`--session`、`export` 等命令的完整参数参考 --- # 交互与输入 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#VPContent) Return to top 交互与输入 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%BA%A4%E4%BA%92%E4%B8%8E%E8%BE%93%E5%85%A5) ============================================================================================================================== Kimi Code CLI 以交互式 TUI 运行,核心由输入框、对话视图和状态栏三部分组成。本页介绍输入方式、媒体粘贴、审批流程和模式切换。 输入框基本操作 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E8%BE%93%E5%85%A5%E6%A1%86%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C) -------------------------------------------------------------------------------------------------------------------------------------------------- 输入框接受自由文本:`Enter` 发送,`Shift-Enter` 或 `Ctrl-J` 插入换行。输入框为空时按 `↑` / `↓` 浏览当前工作目录的历史输入,包括此前运行过的 Shell 命令。 **退出 CLI**:输入框为空时按 `Ctrl-D`,或空闲状态下连按 `Ctrl-C` 两次,或输入 `/exit`。流式输出期间按 `Ctrl-C` 或 `Esc` 是中断当前轮次,不会退出程序。 粘贴图片与视频 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%B2%98%E8%B4%B4%E5%9B%BE%E7%89%87%E4%B8%8E%E8%A7%86%E9%A2%91) -------------------------------------------------------------------------------------------------------------------------------------------------- Kimi Code CLI 支持在输入框中直接粘贴图片和视频,让 AI 结合视觉内容理解你的问题——截图报错、UI 设计图、架构图,直接粘贴进去就能讨论,无需上传或转存。 **视频输入是 Kimi Code 的特色能力**,支持直接粘贴视频片段让模型分析其中的内容、界面流程或代码演示。 操作方式: * **macOS / Linux**:`Ctrl-V` * **Windows**:`Alt-V` 粘贴后输入框显示占位符,可像普通文本一样编辑;提交时自动替换为实际内容。纯文本剪贴板会回退到普通粘贴。媒体功能是否可用取决于当前模型的多模态能力(`image_in` / `video_in`),登录 Kimi Code 账号后默认开启。 当会话中累积的媒体超过 20 MB 时,最早的图片和视频会自动从请求中省略,并显示一条警告。 斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) -------------------------------------------------------------------------------------------------------------------- 以 `/` 开头输入命令,补全菜单实时过滤,`Esc` 关闭;匹配不到时按普通消息发送。常用命令: | 命令 | 作用 | | --- | --- | | `/new` | 新建会话 | | `/sessions` | 浏览并恢复历史会话 | | `/compact` | 压缩当前会话的上下文 | | `/undo` | 撤销最近的提示词 | | `/model` | 切换当前会话使用的模型 | | `/plan` | 切换 Plan 模式(先出计划再动手) | | `/yolo` | 打开权限模式列表并预选 "Ask When Needed"(常规修改和命令自动完成) | | `/goal` | 开始或管理目标模式 | | `/help` | 查看全部命令 | 已激活的 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 也会注册为斜杠命令(如 `/skill:`)。全部命令说明见[斜杠命令参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 。 文件引用 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E6%96%87%E4%BB%B6%E5%BC%95%E7%94%A8) -------------------------------------------------------------------------------------------------------------------- 键入 `@` 触发文件路径补全,选中后插入相对路径,Agent 读取消息时直接加载该文件内容。 * **适用范围**:git 与非 git 目录都可用;隐藏路径也可补全,`.git` 除外 * **文件夹候选**:以 `/` 结尾,可继续补全其下路径 * **降级行为**:快速搜索辅助工具仍在下载时,先回退到基础文件系统扫描 > `@` 引用和斜杠命令是两套机制:`@` 给 Agent 提供文件上下文,`/` 调用内置功能或 Skill。 审批流程 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E5%AE%A1%E6%89%B9%E6%B5%81%E7%A8%8B) -------------------------------------------------------------------------------------------------------------------- Agent 调用会产生副作用的工具(修改文件、执行命令等)时,TUI 会弹出审批面板让你确认。 * **确认**:方向键选择后 `Enter`,或按 `1`/`2`/`3` 数字键直接选择 * **拒绝**:`Esc`、`Ctrl-C`、`Ctrl-D` * **会话内放行**:选「Approve for this session」,本次会话内同类调用不再询问 * **永久规则**:在[配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) 预置 allow / deny 规则 "Ask When Needed" 模式下的普通工具调用、Plan 模式下对计划文件的写入,不触发审批。 ### 三种权限模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) **"Always Ask"**(始终询问,原 Manual)是默认模式:只读操作自动放行,修改文件、执行命令等其余操作都会逐一向你确认,适合需要全程掌控每个改动的场景。 **"Ask When Needed"**(必要时询问,原 YOLO)用 `/yolo` 开启,自动批准普通工具调用,适合已知安全的批处理任务。敏感操作仍会询问——例如访问 `.env`、SSH 私钥等敏感文件、执行 `shutdown`、`rm -rf` 这类危险命令,或退出 Plan 模式——Agent 也仍可能向你提问。 **"Never Ask"**(完全自动,原 Auto)用 `/auto` 开启,是完全无人值守模式:所有工具审批自动处理,包括敏感文件和计划退出,且 Agent 不会向你提问,完全由它自己做决定。内置的危险命令拦截会在 "Always Ask" 和 "Ask When Needed" 模式下要求你确认 `shutdown`、`reboot`、`rm -rf` 这类命令;在 "Never Ask" 模式下这些命令直接执行,不再拦截。 模式切换 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2) -------------------------------------------------------------------------------------------------------------------- ### Plan 模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#plan-%E6%A8%A1%E5%BC%8F) Plan 模式下,Agent 先输出行动计划,等待你确认后才动手修改文件,适合复杂或高风险任务。 * 切换:`Shift-Tab` 或 `/plan` * 清除当前计划:`/plan clear`(仅空闲时) Agent 输出方案后会等待你审批——可批准执行、拒绝、或要求修改。退出 Plan 模式需要你确认,即使开启了 "Ask When Needed" 模式也不例外。"Never Ask" 模式例外:计划退出会自动批准,并在记录中标记为 "Auto-approved"。 ### Shell 模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#shell-%E6%A8%A1%E5%BC%8F) Shell 模式让你不离开对话就能运行终端命令,命令输出会写入对话上下文,AI 在后续轮次能够看到这些结果。 * 进入:在空输入框中键入 `!`,或粘贴以 `!` 开头的命令。 * 退出:在空输入框中按 `Backspace` 或 `Esc`;提交命令后也会自动回到普通模式。 * 后台运行:命令执行期间按 `Ctrl+B` 可将其转为后台任务。 * 召回历史命令:在 Shell 模式的空输入框中按 `↑` 浏览此前运行过的 Shell 命令,召回后仍处于 Shell 模式,可再次作为命令执行。 * 长输出:命令输出过长时,结束后的输出卡片会自动折叠,按 `Ctrl-O` 可与工具输出一起展开或折叠。 进入 Shell 模式后,输入框左侧会显示 `!` 提示符,边框变为紫色。例如,无需新开终端就能运行 `!gh auth login` 登录 GitHub CLI,登录后 Kimi 就可以直接使用 `gh`。 ### 目标模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) 目标(goal)让 Agent 在多个轮次中持续朝一个明确结果工作——普通提示词说「下一步做什么」,目标说的是「最终要达成什么状态」。适合终点清晰、结果可验证的任务,如修复一批失败的测试、追查并修复构建失败的根因。一次性修改或只需要一个答案的问题,用普通提示词更合适。 在 `/goal` 后写目标,写清完成条件和停止条件(目标最长 4000 个字符,超长会被拒绝,已输入的文本保留在输入框中): sh /goal 修复所有结算系统回退的漏洞,为每个修复补充测试,最后运行结算测试套件 避免 `/goal 找出代码库中的所有 bug` 这类宽泛写法——没有成功标准的目标,Agent 可能立刻进入「阻塞」状态,或工作得远超预期。明显无法完成的目标(如 `/goal 证明 1 + 1 = 3`)也会被直接标记为「阻塞」。 常用管理命令: | 命令 | 作用 | | --- | --- | | `/goal` 或 `/goal status` | 查看当前目标及进展 | | `/goal pause` / `/goal resume` | 暂停 / 继续目标 | | `/goal cancel` | 取消目标(需确认,取消后无法继续) | | `/goal replace ` | 用新目标替换当前目标 | | `/goal next ` | 追加后续目标,当前目标完成后自动开始 | 目标有三种停止方式:**完成**:达成后自动清除并总结;**暂停**:手动暂停、中断轮次或出错;**阻塞**:Agent 无法按当前表述继续,会简短说明原因。时间预算只在目标活跃且会话打开时计时,会话关闭或目标暂停期间不计时,重新打开会话后用 `/goal resume` 按剩余预算继续。 Web 界面中,对话下方的目标条可直接暂停、继续或取消目标;点击目标条可展开详情,配置了 token 预算时会显示预算进度。 用 `/goal next ` 可以在不打断当前目标的情况下安排后续工作:当前目标运行期间后续目标对 Agent 不可见,完成后自动开始第一个。`/goal next manage` 打开交互式管理器,可调整顺序、编辑或删除(方向键浏览,`Space` 选择,`E` 编辑,`D` 删除,`Esc` 取消)。当前目标被暂停、取消或阻塞时,后续目标不会自动开始。 > 提示:`manual` 权限模式下目标可能停下来等待工具审批;非交互模式只支持创建目标(`kimi -p "/goal ..."`),完成时退出码 `0`、阻塞时 `3`、暂停时 `6`。 流式输出期间 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E6%B5%81%E5%BC%8F%E8%BE%93%E5%87%BA%E6%9C%9F%E9%97%B4) ---------------------------------------------------------------------------------------------------------------------------------------- Agent 思考或调用工具时,输入框仍然可用,支持以下额外操作: * **`Ctrl-S`**:把输入框中的内容立即注入正在运行的轮次,无需等待结束 * **`Esc` / `Ctrl-C`**:中断当前轮次 * **`Ctrl-O`**:全局切换工具输出和压缩摘要的折叠状态 Agent 正通过 `WaitFor` 等待后台任务时,按 `Ctrl-S` 会提前结束本次等待。后台任务继续运行,已有工具结果保留;如果同批还有其他前台工具,Agent 会在它们返回后处理新消息。 外部编辑器 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E5%A4%96%E9%83%A8%E7%BC%96%E8%BE%91%E5%99%A8) ------------------------------------------------------------------------------------------------------------------------------ 按 `Ctrl-G` 把当前输入内容发给外部编辑器,保存后回填到输入框,不保存则保持原样。适合需要输入大段文本或带格式内容的场景。 编辑器优先级:`/editor` 配置 > `$VISUAL` 环境变量 > `$EDITOR` 环境变量。未配置时可先运行 `/editor` 选择默认编辑器。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------------------- * [键盘快捷键](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html) — 全部快捷键的完整速查表 * [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) — 所有内置命令的说明与别名 * [会话与上下文](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html) — 如何恢复会话、压缩上下文、导出对话 --- # 数据路径 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#VPContent) Return to top 数据路径 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E6%95%B0%E6%8D%AE%E8%B7%AF%E5%BE%84) ============================================================================================================================== Kimi Code CLI 把配置文件、会话历史、登录凭据、诊断日志等运行时数据集中存放在 `~/.kimi-code/` 下。本页帮你搞清楚每类数据在哪里、用来做什么,以及需要时怎么清理或搬迁。 数据根目录 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E6%95%B0%E6%8D%AE%E6%A0%B9%E7%9B%AE%E5%BD%95) ---------------------------------------------------------------------------------------------------------------------------------------- 默认数据根是 `~/.kimi-code/`,在不同平台的实际路径: * macOS:`/Users//.kimi-code` * Linux:`/home//.kimi-code` * Windows:`C:\Users\\.kimi-code` 如果你需要把数据目录挪到别处(比如用多个独立环境隔离不同项目的配置),设置 `KIMI_CODE_HOME` 即可: sh export KIMI_CODE_HOME="$HOME/.config/kimi-code" 设置后,配置、会话、日志、OAuth 凭据、Kimi 专属用户级 Skills、全局 `AGENTS.md` 等 **Kimi Code 数据**都会落到新路径下。`KIMI_CODE_HOME` 的完整说明见[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 。 提示 **通用 `.agents` 资源**仍放在真实 OS home 下,以便跨工具共享。例如,用户级通用 Skills 仍位于 `~/.agents/skills/`,而 Kimi 专属用户级 Skills 会随 `KIMI_CODE_HOME` 移动到 `$KIMI_CODE_HOME/skills/`。 目录结构 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84) ------------------------------------------------------------------------------------------------------------------------------ $KIMI_CODE_HOME (默认 ~/.kimi-code) ├── config.toml # 用户配置 ├── tui.toml # 终端界面偏好(含自动更新开关) ├── AGENTS.md # 全局 Kimi 专属 Agent 指令(可选) ├── mcp.json # 用户级 MCP server 声明(可选) ├── skills/ # Kimi 专属用户级 Skills(可选) ├── plugins/ │ ├── installed.json # 已安装 plugin 记录与启用状态 │ └── managed/ # zip/本地路径安装的 plugin 副本 ├── session_index.jsonl # 会话索引 ├── credentials/ # OAuth 凭据(目录 0700,文件 0600) │ ├── .json │ └── mcp/ │ └── -.json ├── sessions/ # 会话数据(详见下文) │ └── // ├── bin/ │ ├── rg # Grep 使用的托管 ripgrep 二进制(Windows 为 rg.exe) │ └── fd # 文件引用使用的托管 fd 二进制(Windows 为 fd.exe) ├── logs/ │ └── kimi-code.log # 全局诊断日志 ├── updates/ │ ├── latest.json │ ├── install.json │ ├── install.lock │ └── rollout.log └── user-history/ └── .jsonl 各类文件说明 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E5%90%84%E7%B1%BB%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E) -------------------------------------------------------------------------------------------------------------------------------------------------- 数据根下的顶层文件各有用途,大部分由 CLI 自动管理: * **`config.toml`**:主运行时配置,存放供应商、模型、循环控制等用户级设置。详见[配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) 。 * **`tui.toml`**:终端界面客户端偏好,包括自动更新开关 `[upgrade].auto_install`(默认开启)。可在 `/settings` 关闭,或手动设为 `auto_install = false`。 * **`AGENTS.md`**:全局 Kimi 专属 Agent 指令。该文件会随 `KIMI_CODE_HOME` 移动;跨工具通用指令仍可放在 `~/.agents/AGENTS.md`。 * **`mcp.json`**:用户级 MCP server 声明,启动时与项目内的 `.kimi-code/mcp.json` 合并加载。详见 [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) 。 * **`skills/`**:Kimi 专属用户级 Skills。该目录会随 `KIMI_CODE_HOME` 移动;跨工具通用 Skills 仍可放在 `~/.agents/skills/`。详见 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 。 * **`plugins/installed.json`**:记录已安装的 plugin、每个 plugin 的启用状态,以及通过 `/plugins` 或 `/plugins mcp disable|enable` 修改的 MCP server 能力状态。本地路径和 zip URL 安装的文件会复制到 `plugins/managed//`。详见 [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) 。 * **`credentials/`**:OAuth 凭据目录,权限 `0o700`(目录)/ `0o600`(文件),仅当前用户可读写。托管供应商凭据存为 `credentials/.json`,MCP server 凭据存在 `credentials/mcp/` 子目录下。凭据写入使用原子流程(tmp → fsync → rename)防止写损。 会话数据 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E4%BC%9A%E8%AF%9D%E6%95%B0%E6%8D%AE) ------------------------------------------------------------------------------------------------------------------------------ 每个会话的数据存在 `sessions///` 下,同时在顶层 `session_index.jsonl` 里维护一份索引(每行一条记录,含 `sessionId`、`sessionDir`、`workDir` 三个字段)。`workDirKey` 是从工作目录路径生成的桶名,格式为 `wd__`。 会话目录内部包含: * **`state.json`**:会话标题、`lastPrompt`、创建/更新时间、`forkedFrom` 等元数据。 * **`upcoming-goals.json`**:由 `/goal next ` 创建的 TUI 专属队列。它不属于 Agent 对话;只有当前目标完成并提升后续目标后,才会进入 Agent 对话。 * **`agents/main/wire.jsonl`**:main agent 的完整通信记录,用于会话恢复和回放。 * **`agents/main/plans/`**:Plan 模式下写入的计划文件,按计划 id 命名(`.md`)。 * **`agents/agent-0/` 等**:subagent 实例目录,各自含 `wire.jsonl`。 * **`logs/kimi-code.log`**:该会话的诊断日志,只有发生诊断事件时才存在。 * **`tasks/`**:后台任务持久化。`tasks/.json` 保存状态/pid/退出码,`tasks//output.log` 保存输出。 * **`cron/`**:定时任务持久化,用 `kimi --session` 恢复会话时重新加载到调度器。详见[定时任务](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1) 。 内置工具缓存 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E5%86%85%E7%BD%AE%E5%B7%A5%E5%85%B7%E7%BC%93%E5%AD%98) -------------------------------------------------------------------------------------------------------------------------------------------------- `Grep` 工具第一次需要 ripgrep 时,CLI 可自动下载 `rg` 并缓存到 `bin/rg`(Windows 为 `bin/rg.exe`)。终端界面的文件引用补全使用 `fd`;需要时 CLI 会在后台自动下载并缓存到 `bin/fd`(Windows 为 `bin/fd.exe`)。之后的运行会直接复用缓存的二进制。`rg` 优先使用系统 `PATH`,再使用缓存;`fd` 优先检查托管缓存,再回退到系统 `fd` / `fdfind`。删除 `bin/` 目录会在下次需要时触发重新下载。 日志与更新状态 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E6%97%A5%E5%BF%97%E4%B8%8E%E6%9B%B4%E6%96%B0%E7%8A%B6%E6%80%81) ------------------------------------------------------------------------------------------------------------------------------------------------------------ * **`logs/kimi-code.log`**(全局):记录启动、登录、导出等跨会话事件。 * **`/logs/kimi-code.log`**(会话级):记录单个会话内的诊断事件。 报 bug 时,优先用 `kimi export` 导出相关会话(详见 [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html) );会话日志默认包含在导出包里。不想分享全局日志时加 `--no-include-global-log`。 `updates/` 下的文件(`latest.json`、`install.json`、`install.lock`、`rollout.log`)由自动更新机制维护,通常无需手动编辑。`rollout.log` 记录每次更新检查命中的灰度分批情况,可用于排查设备何时能收到新版本。 输入历史 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E8%BE%93%E5%85%A5%E5%8E%86%E5%8F%B2) ------------------------------------------------------------------------------------------------------------------------------ 终端输入历史按工作目录分开保存,路径为 `user-history/.jsonl`。用于在终端界面里用方向键浏览历史提示词。 清理数据 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E6%B8%85%E7%90%86%E6%95%B0%E6%8D%AE) ------------------------------------------------------------------------------------------------------------------------------ 删除数据根目录(`~/.kimi-code/` 或 `KIMI_CODE_HOME` 指定路径)可清除所有运行时数据。只需清理部分内容时: | 需求 | 操作 | | --- | --- | | 重置配置 | 删除 `~/.kimi-code/config.toml` | | 重置终端界面偏好 | 删除 `~/.kimi-code/tui.toml` | | 清理所有会话 | 删除 `~/.kimi-code/sessions/` 和 `session_index.jsonl` | | 清理诊断日志 | 删除 `~/.kimi-code/logs/` | | 清理输入历史 | 删除 `~/.kimi-code/user-history/` | | 重置更新状态 | 删除 `~/.kimi-code/updates/latest.json` | | 强制重新下载托管 `rg` 和 `fd` | 删除 `~/.kimi-code/bin/` | | 清除供应商 OAuth 登录态 | 运行 `/logout`,或删除对应的 `credentials/.json` | | 清除 MCP server OAuth 登录态 | 删除 `credentials/mcp/`(`/logout` 不会清理 MCP 凭据) | | 移除用户级 MCP 声明 | 删除 `$KIMI_CODE_HOME/mcp.json`(默认为 `~/.kimi-code/mcp.json`) | | 清理全局 Kimi 专属 Agent 指令 | 删除 `$KIMI_CODE_HOME/AGENTS.md`(默认为 `~/.kimi-code/AGENTS.md`) | | 清理 plugin 安装记录 | 删除 `$KIMI_CODE_HOME/plugins/`(本地 plugin 源码不受影响) | | 清空 Kimi 专属用户级 Skills | 删除 `$KIMI_CODE_HOME/skills/`(默认为 `~/.kimi-code/skills/`) | 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------------------- * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) — `config.toml` 各字段的完整说明 * [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) — `KIMI_CODE_HOME` 等路径变量的详细用法 --- # 环境变量 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#VPContent) Return to top 环境变量 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F) ======================================================================================================================== Kimi Code CLI 通过环境变量控制少数运行时行为:迁移数据目录、关闭遥测、不改配置文件临时切换模型。 重要:API 密钥不在这里配置 `KIMI_API_KEY`、`ANTHROPIC_API_KEY`、`OPENAI_API_KEY` 等密钥变量**不会**从 shell 环境变量自动读取。在终端里 `export KIMI_API_KEY=xxx` 不会让任何供应商获得密钥。密钥必须写在 `config.toml` 的 `[providers.]` 段或 `[providers..env]` 子表里。 例外有两处:`KIMI_MODEL_*` 系列和供应商的 `api_key_env` 字段,这两个显式通道_确实_会从 shell 读取凭证。详见[用环境变量定义模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8Bkimi-model) 和[供应商凭证键](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81%E9%94%AE%E5%86%99%E5%9C%A8-configtoml-%E9%87%8C) 。 背景说明见[配置覆盖:供应商凭证](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) 。 核心路径 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E6%A0%B8%E5%BF%83%E8%B7%AF%E5%BE%84) ------------------------------------------------------------------------------------------------------------------------ ### `KIMI_CODE_HOME` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#kimi-code-home) 覆盖数据根目录,默认 `~/.kimi-code`。设置后,配置文件、会话、日志、OAuth 凭据等全部数据都落到新路径下: sh export KIMI_CODE_HOME="/path/to/custom/kimi-code" > 确保目录可写。多个 `kimi` 实例共用同一个 `KIMI_CODE_HOME` 会共享配置和凭证。 数据目录的完整结构见[数据路径](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html) 。 ### `KIMI_DISABLE_TELEMETRY` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#kimi-disable-telemetry) 设为 `1` 关闭匿名遥测上报(也接受 `true`/`yes`/`y`,不区分大小写): sh export KIMI_DISABLE_TELEMETRY=1 ### `KIMI_MODEL_*` 系列 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#kimi-model-%E7%B3%BB%E5%88%97) 不修改 `config.toml` 临时切换模型:设置 `KIMI_MODEL_NAME` 后,CLI 在内存里合成一个临时供应商,重启后失效。详见[用环境变量定义模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8Bkimi-model) 。 ### `KIMI_CODE_CUSTOM_HEADERS` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#kimi-code-custom-headers) 新增 新增于 0.20.2。 为所有出站的模型请求附加自定义 HTTP 请求头:LLM 聊天请求(所有供应商协议)和 `/models` 模型列表请求都会携带。适合网关按请求头路由的场景,例如指定集群: sh export KIMI_CODE_CUSTOM_HEADERS=$'X-Gateway-Cluster: my-cluster\nX-Custom-Tag: debug' 格式与 `ANTHROPIC_CUSTOM_HEADERS` 一致:由换行分隔的 `Name: Value` 行,键名和值两端的空白会被去除,不含冒号的行会被忽略。 > 优先级:Kimi 身份头(`User-Agent`、`X-Msh-*`)和 `config.toml` 里供应商的 `custom_headers`(见 [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#providers) > )会覆盖这里的同名条目。认证头的行为因协议而异:在 `kimi`、`openai`、`openai_responses` 协议上,`Authorization` 条目会替换生成的 bearer token;`/models` 列表请求始终使用自己的认证头。`authorization` 这类大小写变体不会被当作同名头。它会与真正的头合并,可能导致请求失败。不要用它设置认证等保留头。需要按供应商区分请求头时,请改用 `custom_headers`。 供应商凭证键(写在 config.toml 里) [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81%E9%94%AE-%E5%86%99%E5%9C%A8-config-toml-%E9%87%8C) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 下面这些键名不是直接从 shell 读取的。它们是写在 `config.toml` 的 `[providers..env]` 子表里、作为 `api_key` / `base_url` 备用来源的键名。CLI 只从配置文件读取,不从 `process.env` 读取。 上面的惯用键名是按供应商类型固定的。如果更希望把密钥放在 shell 环境里并使用自定义变量名,可以在供应商上设置 [`api_key_env`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#providers) :CLI 会在每次请求时从该变量读取密钥。 这样设计是为了让你保留熟悉的键名写法,同时把密钥放在配置文件里统一管理: toml [providers.kimi.env] KIMI_API_KEY = "sk-xxx" KIMI_BASE_URL = "https://api.moonshot.ai/v1" 各供应商对应的键名: | 键名 | 适用供应商 | 默认值 | | --- | --- | --- | | `KIMI_API_KEY` | Kimi / Moonshot | 无 | | `KIMI_BASE_URL` | Kimi / Moonshot | `https://api.moonshot.ai/v1` | | `ANTHROPIC_API_KEY` | Anthropic | 无 | | `ANTHROPIC_BASE_URL` | Anthropic | Anthropic SDK 默认值 | | `OPENAI_API_KEY` | OpenAI(`openai` 和 `openai_responses`) | 无 | | `OPENAI_BASE_URL` | OpenAI(`openai` 和 `openai_responses`) | `https://api.openai.com/v1` | | `GOOGLE_API_KEY` | Google GenAI、Vertex AI | 无 | | `VERTEXAI_API_KEY` | Vertex AI | 无 | | `GOOGLE_CLOUD_PROJECT` | Vertex AI | 无 | | `GOOGLE_CLOUD_LOCATION` | Vertex AI | 无 | WARNING `GOOGLE_APPLICATION_CREDENTIALS`(服务账号 JSON 路径)是唯一走系统环境变量的例外。它由 Google SDK 自身通过 ADC 流程读取,CLI 不参与。其他所有键名都必须写在 `[providers..env]` 子表里。 供应商类型与字段的完整说明见[平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 。 OAuth 与托管端点 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#oauth-%E4%B8%8E%E6%89%98%E7%AE%A1%E7%AB%AF%E7%82%B9) ---------------------------------------------------------------------------------------------------------------------------------------------- 这组变量用于将 OAuth 认证和托管服务端点指向自建或测试环境,日常使用不需要设置。 | 环境变量 | 用途 | 默认值 | | --- | --- | --- | | `KIMI_CODE_OAUTH_HOST` | OAuth 认证 host,优先级最高 | 未设时回退到 `KIMI_OAUTH_HOST` | | `KIMI_OAUTH_HOST` | OAuth 认证 host,作为上一个的 fallback | 未设时使用 `https://auth.kimi.com` | | `KIMI_CODE_BASE_URL` | OAuth 登录后的托管 API base URL | `https://api.kimi.com/coding/v1` | WARNING `KIMI_CODE_BASE_URL`(OAuth 托管服务,指向 `kimi.com`)和 `KIMI_BASE_URL`(API 密钥直连,指向 `moonshot.ai`)是两个不同的变量,请按场景区分。 用环境变量定义模型(`KIMI_MODEL_*`) [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8B-kimi-model) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 测试时想换个模型但不想动 `config.toml`?设置 `KIMI_MODEL_NAME` 后,CLI 会从 `KIMI_MODEL_*` 系列变量在内存里合成出一个临时供应商和模型别名,不写回配置文件。优先级高于 `config.toml` 的 `default_model`,但低于启动时 `-m ` 选项。 sh export KIMI_MODEL_NAME="kimi-for-coding" export KIMI_MODEL_API_KEY="YOUR_API_KEY" export KIMI_MODEL_BASE_URL="https://api.example.com/v1" export KIMI_MODEL_MAX_CONTEXT_SIZE="262144" export KIMI_MODEL_CAPABILITIES="image_in,thinking" kimi 完整变量列表: | 环境变量 | 必填 | 用途 | 默认值 | | --- | --- | --- | --- | | `KIMI_MODEL_NAME` | 是(同时是启用开关) | 发送给 API 的模型 ID | — | | `KIMI_MODEL_API_KEY` | 是 | API 密钥 | — | | `KIMI_MODEL_PROVIDER_TYPE` | 否 | 供应商类型:`kimi`、`anthropic`、`openai` | `kimi` | | `KIMI_MODEL_BASE_URL` | 否 | API 基础 URL | 各类型有各自默认值 | | `KIMI_MODEL_MAX_CONTEXT_SIZE` | 否 | 最大上下文长度(token 数) | `262144`(256K) | | `KIMI_MODEL_CAPABILITIES` | 否 | 逗号分隔的能力标签,与自动探测的能力取并集 | `image_in,thinking` | | `KIMI_MODEL_DISPLAY_NAME` | 否 | 在 `/model` 中显示的名称 | 回退到 `KIMI_MODEL_NAME` | | `KIMI_MODEL_MAX_OUTPUT_SIZE` | 否 | 单次输出上限(仅 `anthropic`);设置后会覆盖内置的 Claude 上限 | 模型默认值 | | `KIMI_MODEL_REASONING_KEY` | 否 | 推理字段名覆盖(仅 `openai`) | 自动探测 | | `KIMI_MODEL_THINKING_EFFORT` | 否 | Thinking 强度:`low`/`medium`/`high`/`xhigh`/`max` | — | | `KIMI_MODEL_ADAPTIVE_THINKING` | 否 | 强制开启或关闭 adaptive thinking(仅 `anthropic`) | 按模型名推断 | 设置了 `KIMI_MODEL_NAME` 但缺少必填变量时,启动会立即失败并给出明确提示。 运行时开关 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E8%BF%90%E8%A1%8C%E6%97%B6%E5%BC%80%E5%85%B3) ---------------------------------------------------------------------------------------------------------------------------------- 控制遥测、后台任务、plugin marketplace 等子系统行为的开关变量: | 环境变量 | 用途 | 合法值 | | --- | --- | --- | | `KIMI_DISABLE_TELEMETRY` | 关闭匿名遥测上报 | `1`、`true`、`yes`、`y`(不区分大小写) | | `KIMI_CODE_PASSWORD` | 为 `kimi web` 本地服务设置并列鉴权密码;绑到非本机地址时建议设置,见 [安全注意](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%AE%89%E5%85%A8%E6%B3%A8%E6%84%8F) | 任意非空字符串;未设置时仅 token 有效 | | `KIMI_CODE_BACKGROUND_KEEP_ALIVE_ON_EXIT` | 会话关闭时是否保留后台任务,优先级高于 `config.toml`。默认会在退出时停止后台任务 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_BACKGROUND_MAX_RUNNING_TASKS` | 同时运行的后台任务数上限,优先级高于 `config.toml` 的 `[background] max_running_tasks`;不设置表示无上限 | 正整数;非法值被忽略 | | `KIMI_CODE_BACKGROUND_BASH_TASK_TIMEOUT_S` | 后台 `Bash` 任务的默认超时(秒),也用于前台命令转入后台后的重新计时,优先级高于 `[task] bash_task_timeout_s`;`0` 表示无超时 | 非负整数;非法值被忽略 | | `KIMI_CODE_BACKGROUND_PRINT_BACKGROUND_MODE` | `kimi -p` 主轮次结束后仍有后台任务待处理时的行为,优先级高于 `[task] print_background_mode` | `exit`、`drain` 或 `steer`;非法值被忽略 | | `KIMI_CODE_BACKGROUND_PRINT_WAIT_CEILING_S` | print 模式 drain/steer 等待的时长上限(秒),优先级高于 `[task] print_wait_ceiling_s` | 正整数;非法值被忽略 | | `KIMI_CODE_BACKGROUND_PRINT_MAX_TURNS` | print 模式下由后台任务完成触发的新轮次上限,优先级高于 `[task] print_max_turns` | 正整数;非法值被忽略 | | `KIMI_IMAGE_MAX_EDGE_PX` | 图片压缩的最长边上限(像素),优先级高于 `config.toml` 的 `[image] max_edge_px`(默认 `2000`) | 正整数;非法值被忽略 | | `KIMI_IMAGE_READ_BYTE_BUDGET` | 模型自行读图的单图字节预算,优先级高于 `config.toml` 的 `[image] read_byte_budget`(默认 `262144`) | 正整数;非法值被忽略 | | `KIMI_CODE_PLUGIN_MARKETPLACE_URL` | 覆盖 `/plugins` 加载的 marketplace JSON;默认 `https://code.kimi.com/kimi-code/plugins/marketplace.json` | 也接受 `http://`、`file://` URL 和本地路径 | | `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` | 限制 AgentSwarm 初始提升并发阶段可同时运行的 subagent 数量;不设置表示不限制 | 正整数;非法值会立即失败 | | `KIMI_CODE_SUBAGENT_SCOPE_CACHE_SIZE` | 保留在内存中的已完成 subagent scope 数量,超出后最旧的会被驱逐,恢复时从持久化状态按需重建(默认 `32`;`0` 或负数 = 不驱逐) | 整数;非法值会立即失败 | | `KIMI_CODE_SUBAGENT_SCOPE_EVICT_TIMEOUT_MS` | 单个 subagent scope 驱逐允许的最长时间(毫秒),超时后驱逐队列跳过它继续后续驱逐(默认 `15000`) | 正整数;非法值会立即失败 | | `KIMI_SUBAGENT_TIMEOUT_MS` | 单个 `Agent` subagent 可运行的最长时间(毫秒),优先级高于 `config.toml` 的 `[subagent] timeout_ms` | 正整数;非法值回退到配置或默认值 | | `KIMI_CODE_SWARM_TIMEOUT_MS` | `AgentSwarm` subagent 可运行的最长时间(毫秒),优先级高于 `config.toml` 的 `[swarm] timeout_ms` | 正整数;非法值回退到配置或默认值 | | `KIMI_CODE_IDENTITY_NAME` | Agent 在系统提示词中的自称,优先级高于 `config.toml` 的 `[identity] name`,不写回配置文件 | 任意非空字符串;空值视为未设置 | | `KIMI_CODE_IDENTITY_SLUG` | 协议标识(`User-Agent` 产品名、MCP 客户端名),优先级高于 `[identity] slug`;未设置时由名称派生 | 任意非空字符串;会转小写并将连续非字母数字字符折叠为 `-` | | `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | 是否向模型提供介绍 Kimi Code 自身的内置 Skills,优先级高于 `config.toml` 的 `builtin_product_skills` | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_REPEAT_BREAKER` | 同一工具调用连续重复多次时,是否注入提醒并最终强制停止该轮。未设置时保持开启 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off`;其他值忽略 | | `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK` | 在 `Agent`/`AgentSwarm` 上启用实验性 `fork` 参数:以调用方对话历史快照而非空上下文启动 subagent | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_EXPERIMENTAL_TOOL_SELECT` | 启用实验性按需加载工具:标记 `deferred: true` 的 MCP server 工具不进入顶层工具列表,由模型经 `select_tools` 按需加载;还需模型声明 `dynamically_loaded_tools` 能力,详见 [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD%E5%B7%A5%E5%85%B7) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_WATCH` | 是否挂文件系统 watch 以热更新配置和工作区文件,优先级高于 `[watch] enabled`(默认 `false`) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_SEARCH_WORKER` | 在独立 worker 线程中运行全局搜索索引,优先级高于 `[database] search`(默认 `true`) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_PERSISTENCE_MINIDB_READMODEL` | 会话索引使用基于 minidb 的读模型,优先级高于 `[database] base`(默认 `true`) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_MCP_STARTUP_TIMEOUT_MS` | MCP server 全局默认连接超时(毫秒);优先级高于配置文件,低于 `mcp.json` 的 `startupTimeoutMs` | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_MCP_TOOL_TIMEOUT_MS` | MCP server 全局默认单次工具调用超时(毫秒);优先级高于配置文件,低于 `mcp.json` 的 `toolTimeoutMs` | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_LOOP_MAX_STEPS_PER_TURN` | Agent 单轮最大步数,优先级高于 `config.toml` 的 `[loop_control] max_steps_per_turn`;`0` 表示无上限 | 非负整数;非法值被忽略 | | `KIMI_LOOP_MAX_ATTEMPTS_PER_STEP` | 单步失败后的最大总尝试次数(含首次尝试),优先级高于 `config.toml` 的 `[loop_control] max_attempts_per_step` | 非负整数;非法值被忽略 | | `KIMI_CODE_INFINITE_RETRY` | 让所有失败的 LLM 请求无限重试而不是终止任务;指数退避(32 秒封顶)并尊重 `Retry-After`,等待期间中断仍生效 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_TOKEN_COUNTING_STRATEGY` | 对外上报的上下文 token 计数,优先级高于 `config.toml` 的 `[token_counting] strategy` | `measured+estimated`、`measured`、`estimated`(不区分大小写);非法值被忽略 | | `KIMI_WEB_SEARCH_BASE_URL` | 网页搜索(`WebSearch`)服务的 API URL,优先级高于配置文件;凭据与自定义 header 不发往该端点 | 非空字符串;空白值被忽略 | | `KIMI_WEB_SEARCH_API_KEY` | 网页搜索(`WebSearch`)服务的 API 密钥;设置后同时替换配置中的 API 密钥和 OAuth 凭据 | 非空字符串;空白值被忽略 | | `KIMI_WEB_FETCH_BASE_URL` | 网页抓取(`FetchURL`)服务的 API URL,优先级高于配置文件;未指定端点时已登录用户走 Kimi OAuth 托管抓取,再回退本地直连;凭据不发往该端点 | 非空字符串;空白值被忽略 | | `KIMI_WEB_FETCH_API_KEY` | 网页抓取(`FetchURL`)服务的 API 密钥;设置后同时替换配置中的 API 密钥和 OAuth 凭据 | 非空字符串;空白值被忽略 | | `KIMI_CODE_EXPERIMENTAL_FLAG` | 在当前进程启用所有已注册的实验功能 | `1`、`true`、`yes`、`on` | | `KIMI_SHELL_PATH` | Windows 上覆盖 Git Bash 路径(自动探测失败时使用) | 绝对路径 | | `KIMI_MODEL_MAX_COMPLETION_TOKENS` | 单步 LLM 请求的 `max_completion_tokens` 硬上限,仅对 `kimi` 供应商生效 | 正整数;`0` 或负数禁用 clamp | | `KIMI_MODEL_TEMPERATURE` | 每次请求的采样温度,仅对 `kimi` 供应商生效(全局生效,不依赖 `KIMI_MODEL_NAME`) | 数字,如 `0.3` | | `KIMI_MODEL_TOP_P` | 每次请求的核采样 `top_p`,仅对 `kimi` 供应商生效(全局生效) | 数字,如 `0.95` | | `KIMI_MODEL_THINKING_EFFORT` | 在线上强制使用指定的思考强度,绕过模型声明的 `support_efforts`;仅 `kimi` 供应商生效 | 思考强度值,如 `max` | | `KIMI_MODEL_THINKING_KEEP` | 保留思考透传;`kimi` 以 `thinking.keep` 发送,`anthropic` 以 `clear_thinking_20251015` 编辑发送;覆盖 `[thinking] keep` | API 接受的值,如 `all`;传入关值(`false`/`0`/`no`/`off`/`none`/`null`)可禁用 | | `KIMI_CODE_NO_AUTO_UPDATE` | 完全禁用更新预检:不检查、不后台安装、不提示。同时兼容旧名 `KIMI_CLI_NO_AUTO_UPDATE` | 真值:`1`/`true`/`yes`/`on` | | `KIMI_DISABLE_CRON` | 禁用定时任务工具(`CronCreate` 拒绝新计划,已有任务不触发) | `1` 表示禁用 | `KIMI_CODE_INFINITE_RETRY`、`KIMI_CODE_IDENTITY_*` 和 `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` 这几个变量由 `agent-core-v2` 引擎读取。 诊断日志 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E8%AF%8A%E6%96%AD%E6%97%A5%E5%BF%97) ------------------------------------------------------------------------------------------------------------------------ 这组变量控制日志级别和文件滚动,进程启动时读取一次: | 环境变量 | 用途 | 默认值 | | --- | --- | --- | | `KIMI_LOG_LEVEL` | 日志级别:`off`、`error`、`warn`、`info`、`debug` | `info` | | `KIMI_LOG_GLOBAL_MAX_BYTES` | 全局日志文件单个最大字节数 | `6291456`(6 MB) | | `KIMI_LOG_GLOBAL_FILES` | 全局日志文件保留份数 | `5` | | `KIMI_LOG_SESSION_MAX_BYTES` | 会话级日志文件单个最大字节数 | `5242880`(5 MB) | | `KIMI_LOG_SESSION_FILES` | 会话级日志文件保留份数 | `3` | 系统环境变量 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F) -------------------------------------------------------------------------------------------------------------------------------------------- CLI 还会读取一些标准系统变量来检测运行环境,不会修改它们: * `HOME`:解析默认数据路径 * `VISUAL`、`EDITOR`:外部编辑器命令(`VISUAL` 优先) * `PATH`:定位 `rg`、`fd`、`fdfind`、`git` 等依赖;在 Windows 上,Git Bash 探测会检查 `PATH` 中找到的每个 `git.exe`,包括 Scoop 等包管理器提供的 shim * `NO_COLOR`、`FORCE_COLOR`:控制颜色输出(遵循 [no-color.org](https://no-color.org/) 约定) * `CI`:非空且非 `"0"` 时关闭主题检测,回退深色主题 * `TERM_PROGRAM`、`TERM`、`TMUX`:检测终端特性和通知支持 * `DISPLAY`、`WAYLAND_DISPLAY`、`XDG_SESSION_TYPE`:检测 Linux 图形会话(用于剪贴板和图片功能) * `WSL_DISTRO_NAME`、`WSLENV`:检测 WSL,用于剪贴板 PowerShell 桥接 * `LOCALAPPDATA`:Windows 上探测 Git Bash 安装路径时作为 fallback 使用 HTTP 代理 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#http-%E4%BB%A3%E7%90%86) -------------------------------------------------------------------------------------------------------------- Kimi Code 会遵循标准代理环境变量,让所有出网流量(模型 API 调用、MCP 服务、网络工具、遥测、登录、更新检查)都走代理: * `HTTP_PROXY` / `http_proxy`:用于 `http://` 请求的代理 * `HTTPS_PROXY` / `https_proxy`:用于 `https://` 请求的代理 * `ALL_PROXY` / `all_proxy`:当对应 scheme 的变量未设置时使用的兜底代理 * `NO_PROXY` / `no_proxy`:以逗号分隔的、绕过代理的主机列表 ### 代理类型与优先级 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E4%BB%A3%E7%90%86%E7%B1%BB%E5%9E%8B%E4%B8%8E%E4%BC%98%E5%85%88%E7%BA%A7) 同时支持 HTTP(S) 代理和 SOCKS 代理。SOCKS 代理通过 scheme 识别:`socks5://`、`socks5h://`、`socks4://` 或 `socks://`(`socks5://` 的别名),通常设在 `ALL_PROXY`。对 HTTP/HTTPS 流量,HTTP(S) 代理优先于 `ALL_PROXY`。 ### 启用条件与回环地址 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E5%90%AF%E7%94%A8%E6%9D%A1%E4%BB%B6%E4%B8%8E%E5%9B%9E%E7%8E%AF%E5%9C%B0%E5%9D%80) 仅当设置了其中任一变量时才启用代理,否则直连。回环地址(`localhost`、`127.0.0.1`、`::1`)始终绕过代理,因此配置了代理后,本地服务(例如 localhost 上的 MCP 服务)仍能正常工作。你也可以把自己的内网主机加入 `NO_PROXY` 一并放行。 ### MCP 子进程 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#mcp-%E5%AD%90%E8%BF%9B%E7%A8%8B) 以 Node 子进程运行的 stdio MCP 服务,在其 Node 版本支持 `NODE_USE_ENV_PROXY` 时(Node ≥ 22.21 或 ≥ 24.5)会自动遵循 `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY`;SOCKS 代理仅作用于 Kimi Code 自身的流量。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------------- * [配置覆盖](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html) — 环境变量、CLI 选项、配置文件的优先级关系 * [数据路径](https://www.kimi.com/code/docs/kimi-code-cli/configuration/data-locations.html) — `KIMI_CODE_HOME` 影响的完整目录结构 * [平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) — 各供应商类型的完整接入示例 --- # Kimi Code 社区倡议 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#VPContent) Return to top Kimi Code 社区倡议 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#kimi-code-%E7%A4%BE%E5%8C%BA%E5%80%A1%E8%AE%AE) ====================================================================================================================================== Kimi Code 致力于为全球用户提供智能、高效的 AI 编程服务,用模型能力的持续跃迁、Agent产品力的极致打磨、Token Plan的范式革新,缩短人类想象到现实的路径,让通用agent普惠每个有想法的个体。为保证每位Kimi Code用户拥有更好的体验,我们提出以下倡议。 适用范围 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#%E9%80%82%E7%94%A8%E8%8C%83%E5%9B%B4) ------------------------------------------------------------------------------------------------------------------ Kimi Code 订阅仅限交互式使用,我们兼容主流编程工具与 Agent 框架(Kimi CLI、VS Code、Claude Code、OpenCode、OpenClaw 等),你可以在自己习惯的工具里自由调用 Kimi Code 的 AI 能力。如有企业级集成、商业化服务或其他开放平台相关需求,也可前往 [Kimi 开放平台](https://platform.moonshot.cn/) 了解更多合作方案。 ✧ 我们有必要提示的使用规范 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#%E2%9C%A7-%E6%88%91%E4%BB%AC%E6%9C%89%E5%BF%85%E8%A6%81%E6%8F%90%E7%A4%BA%E7%9A%84%E4%BD%BF%E7%94%A8%E8%A7%84%E8%8C%83) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 为了让每个人都能持续获得稳定的模型服务,有一些使用规范我们需要大家一起遵守。 #### 不以商业化为目的转售账号或 API 访问权限 账号是你和 Kimi Code 之间的连接,转让给他人使用也会让你自己的数据和使用记录处于风险中。 #### 不将 Kimi Code 的能力以任何形式二次分售 用 Kimi Code 来辅助自己的工作完全没问题,但把它包装成服务再卖给别人,绕过平台的定价和服务体系,对其他正常用户也不公平。 #### 不伪造或篡改客户端身份信息 客户端身份信息是平台识别请求来源、保障服务质量与安全的重要依据,伪造 User-Agent 或使用高风险的 Agent 不利于平台维护整体服务的稳定性。 #### 不进行非个人交互式使用 Kimi Code 订阅仅限个人交互式使用场景。通过脚本批量执行、数据标注等非交互式方式使用,超出了正常使用范畴。 如果出现了不符合上述规范的使用方式,我们会先评估情况,再根据情节进行**限制并发**等处理。你会收到 `You've reached your concurrent request limit` 报错,详情请见[错误参考文档](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B9%B6%E5%8F%91%E8%AF%B7%E6%B1%82%E9%99%90%E5%88%B6) 。相应地,若用户通过非官方渠道获取服务(如账号转售、第三方代购等),一经核实可能面临封号处理,且由此产生的损失需由用户**自行承担**。 处理有误? 若你被错误封禁,请通过支持邮箱联系我们 [support@moonshot.cn](mailto:support@moonshot.cn) 。为了更好地帮你解决问题,请务必提交账号 ID、封禁时间、使用场景说明及证明截图。 ♡ 我们欢迎的使用方式 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#%E2%99%A1-%E6%88%91%E4%BB%AC%E6%AC%A2%E8%BF%8E%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Kimi Code 欢迎每一位用代码改变世界的创造者——无论你是独立开发者、开源贡献者、还是正在把第一个想法变成产品的新手。我们更鼓励持续专注的使用方式,对于保持长会话、并充分复用历史内容的用户,平台会动态优化其额度使用效率,即在相同工作量下额度更加耐用。 加入社区 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#%E5%8A%A0%E5%85%A5%E7%A4%BE%E5%8C%BA) ------------------------------------------------------------------------------------------------------------------ 如果你想和更多志同道合的 Kimi Coder 交流技术心得,欢迎加入我们的飞书交流群,一起 Happy Coding! ![Kimi Code 用户群飞书二维码](https://www.kimi.com/code/docs/images/zh/kimi-code/contact-and-feedback/feishu-group.png) 常见问题 [​](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------------------ **Q1: 我是重度用户,每天高强度使用,会被误封吗?** 不会。风控识别会考虑多种特征,对于 IP 地址、对话状态等使用指标正常的重度用户通常不会触发处置。 **Q2:我用 VPN 或公司代理访问,会被误封吗?** 通过代理访问 Kimi(正向代理)没问题;把自己的账号给别人转发(反向代理),属于违规。 **Q3: 我同时在多个设备或工具上使用 Kimi Code,会被误封吗?** 不会。开发者在不同设备(如工作电脑、个人笔记本)或使用不同编程工具(Kimi CLI、VS Code、Claude Code)之间切换,属于完全正常的使用模式。只要不刻意篡改客户端身份信息就不会被误封。 --- # 错误参考(Error Reference) | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/error-reference.html#VPContent) Return to top 错误参考(Error Reference) [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%94%99%E8%AF%AF%E5%8F%82%E8%80%83-error-reference) ============================================================================================================================================== 本文档收录的是调用 Kimi Code API 时可能遇到的**服务端错误**和**工具调用错误**,包括权限、限流、请求格式、服务器内部等问题。如果你遇到的是客户端本身的问题(如 CLI 安装失败、IDE 连接异常、MCP 配置错误等),请参考 [常见问题 FAQ](https://www.kimi.com/code/docs/kimi-code/error-reference.html#) 。 根据终端或客户端显示的报错信息,在下表中找到对应条目,查看含义和处理方式。 提示 如果你使用的是 OpenCode、Claude Code 等第三方客户端,客户端自身可能对错误码进行了转换或重新包装,导致你看到的错误码与本文档不一致。这种情况下,请**以报错信息中的文字内容为主**,在下方快速查找表中匹配关键词,找到对应条目。 快速查找 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%BF%AB%E9%80%9F%E6%9F%A5%E6%89%BE) ------------------------------------------------------------------------------------------------------------- 报错分两类:**模型调用错误**发生在请求模型生成回复的过程中(认证、限流、请求格式等);**工具调用错误**发生在 AI 执行工具调用的过程中(如读取网页、处理图片)。按报错来源在下方对应表格中匹配关键词。 ### 模型调用 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%A8%A1%E5%9E%8B%E8%B0%83%E7%94%A8) | 看到的报错关键词 | HTTP 状态码 | 跳转章节 | | --- | --- | --- | | `The API Key appears to be invalid or may have expired` | 401 | [认证错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#api-key-%E6%97%A0%E6%95%88) | | `Invalid Authentication` | 401 | [认证错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#invalid-authentication) | | `Your current subscription does not have access to k3` | 401 | [权限错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%97%A0-k3-%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) | | `Your current plan supports only kimi-k3 up to 256K context` | 401 | [权限错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%97%A0-1m-%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) | | `Your current subscription does not have access to kimi-for-coding-highspeed` | 401 | [权限错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%AB%98%E9%80%9F%E7%89%88%E6%97%A0%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) | | `Your model id does not exist, recognized as other:` | 401 | [权限错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%A8%A1%E5%9E%8B-id-%E4%B8%8D%E5%AD%98%E5%9C%A8) | | `unable to verify your membership benefits` | 402 | [会员权益异常](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%BC%9A%E5%91%98%E6%9D%83%E7%9B%8A%E6%97%A0%E6%B3%95%E9%AA%8C%E8%AF%81) | | `You've reached your 5-hour usage limit` | 403 | [配额与账户限制](https://www.kimi.com/code/docs/kimi-code/error-reference.html#_5-%E5%B0%8F%E6%97%B6%E9%99%90%E9%A2%9D%E8%A7%A6%E9%A1%B6) | | `You've reached your weekly (7-day) usage limit` | 403 | [配额与账户限制](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%AF%8F%E5%91%A8-7-%E5%A4%A9%E9%A2%9D%E5%BA%A6%E8%80%97%E5%B0%BD) | | `You've reached your monthly usage limit for this billing cycle` | 403 | [配额与账户限制](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%BC%9A%E5%91%98%E6%9C%88%E5%BA%A6%E9%A2%9D%E5%BA%A6%E8%80%97%E5%B0%BD) | | `You've reached your concurrent request limit` | 403 | [配额与账户限制](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B9%B6%E5%8F%91%E8%AF%B7%E6%B1%82%E9%99%90%E5%88%B6) | | `We're receiving too many requests` | 429 | [限流与过载](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B9%B6%E5%8F%91%E8%AF%B7%E6%B1%82%E8%BF%87%E5%A4%9A) | | `The engine is currently overloaded` | 429 | [限流与过载](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%8E%A8%E7%90%86%E5%BC%95%E6%93%8E%E8%BF%87%E8%BD%BD) | | `total message size N exceeds limit 2097152` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%B6%88%E6%81%AF%E4%BD%93%E8%B6%85%E5%87%BA%E4%B8%8A%E4%B8%8B%E6%96%87%E9%99%90%E5%88%B6) | | `Your request exceeded model token limit: 262144` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#token-%E8%B6%85%E9%99%90) | | `thinking is enabled but reasoning_content is missing` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%80%9D%E7%BB%B4%E9%93%BE%E5%AD%97%E6%AE%B5%E7%BC%BA%E5%A4%B1) | | `unsupported image url` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%B8%8D%E6%94%AF%E6%8C%81%E7%9A%84%E5%9B%BE%E7%89%87-url) | | `function name ... is duplicated` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B7%A5%E5%85%B7%E5%90%8D%E9%87%8D%E5%A4%8D) | | `The request was rejected because it was considered high risk` | 400 | [请求格式错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%86%85%E5%AE%B9%E5%AE%89%E5%85%A8%E6%8B%A6%E6%88%AA) | | `Not found the model kimi-for-coding or Permission denied` | 404 | [资源未找到](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%A8%A1%E5%9E%8B%E6%9C%AA%E6%89%BE%E5%88%B0) | | `method not found` | 404 | [资源未找到](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%8E%A5%E5%8F%A3%E8%B7%AF%E5%BE%84%E4%B8%8D%E5%AD%98%E5%9C%A8) | | `bot_id ... value does not match id_kinds` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#bot-id-%E6%A0%BC%E5%BC%8F%E4%B8%8D%E5%90%88%E8%A7%84) | | `failed to connect to ... database=membership_` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5) | | `FATAL: terminating connection due to administrator command` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5) | | `failed to evaluate rate limit script` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%86%85%E9%83%A8%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8) | | `i/o timeout` / `conn closed` / `bad connection` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%86%85%E9%83%A8%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8) | | `503 Service Unavailable` / `504 Gateway Timeout` / `502 Bad Gateway` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%B8%8B%E6%B8%B8%E6%9C%8D%E5%8A%A1%E4%B8%8D%E5%8F%AF%E7%94%A8) | | `未找到该账号` / `该账号已被禁用` / `已被禁言` | 500 | [服务端内部错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%B4%A6%E5%8F%B7%E7%8A%B6%E6%80%81%E5%BC%82%E5%B8%B8) | ### 工具调用 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8) | 看到的报错关键词 | HTTP 状态码 | 跳转章节 | | --- | --- | --- | | `context canceled` | 499 | [工具调用错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%AF%B7%E6%B1%82%E8%A2%AB%E5%8F%96%E6%B6%88) | | `url2text` / `spider checkUrl failed` / `invalid html` | 500 | [工具调用错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E7%BD%91%E9%A1%B5%E8%AF%BB%E5%8F%96%E5%A4%B1%E8%B4%A5) | | `image_url:moderation request error` | 500 | [工具调用错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%9B%BE%E7%89%87%E5%AE%A1%E6%A0%B8%E5%A4%B1%E8%B4%A5) | | `We consider the current URL poses a security risk` | 403 | [工具调用错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#url-%E5%AE%89%E5%85%A8%E9%A3%8E%E9%99%A9%E6%8B%A6%E6%88%AA) | | `invalid_url: The provided URL is invalid` | 400 | [工具调用错误](https://www.kimi.com/code/docs/kimi-code/error-reference.html#url-%E6%A0%BC%E5%BC%8F%E6%97%A0%E6%95%88) | 认证错误 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%AE%A4%E8%AF%81%E9%94%99%E8%AF%AF) ------------------------------------------------------------------------------------------------------------- **HTTP 401** 请求未携带有效凭证,或凭证已失效。服务端在处理请求之前会先验证身份,401 表示这一步没有通过。**不需要重试**,修复凭证后重新发送请求。 ### API Key 无效 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#api-key-%E6%97%A0%E6%95%88) error, status code: 401, message: The API Key appears to be invalid or may have expired. Please verify your credentials and try again. API Key 填写有误,或该 Key 已在控制台被撤销/过期。 **处理方式:** * **密钥输入错误**:检查是否有多余的空格或遗漏的字符 * **密钥已过期或被撤销**:前往[控制台](https://www.kimi.com/code/console?from=kfc_overview_topbar) › API Keys 确认密钥状态 * **环境变量覆盖**:检查是否有 `KIMI_API_KEY` 或 `OPENAI_API_KEY` 环境变量覆盖了配置文件中的密钥,可运行 `echo $KIMI_API_KEY` 检查;如果发现环境变量中配置了旧 Key,请更新为正确的 Key,或删除错误的环境变量后重新启动服务 ### Invalid Authentication [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#invalid-authentication) error, status code: 401, message: Invalid Authentication 请求未携带有效凭证,或使用了不支持的认证格式。 **处理方式:** 最常见原因是误用了开放平台的 Key 或 URL。Kimi Code 和 [Kimi 开放平台](https://platform.kimi.com/) 是两套独立系统,Key 和 Base URL 均不通用: * Kimi Code:Key 从[控制台](https://www.kimi.com/code/console?from=kfc_overview_topbar) 获取,Base URL 为 `https://api.kimi.com/coding/v1`(OpenAI 协议)或 `https://api.kimi.com/coding/`(Anthropic 协议) * 开放平台:Key 从 [platform.kimi.com](https://platform.kimi.com/) 获取,Base URL 为 `https://api.moonshot.cn/v1` 会员权益异常 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%BC%9A%E5%91%98%E6%9D%83%E7%9B%8A%E5%BC%82%E5%B8%B8) --------------------------------------------------------------------------------------------------------------------------------- **HTTP 402** 服务端无法确认当前账号的订阅状态,通常为临时性问题。 ### 会员权益无法验证 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%BC%9A%E5%91%98%E6%9D%83%E7%9B%8A%E6%97%A0%E6%B3%95%E9%AA%8C%E8%AF%81) error, status code: 402, message: We're unable to verify your membership benefits at this time. Please ensure your membership is active. **处理方式:** * 确认 Kimi Code 订阅仍在有效期内 * 等待片刻后重试 * 前往[控制台](https://www.kimi.com/code/console?from=kfc_overview_topbar) 检查订阅状态 * 如持续出现,请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,接入在线客服具体咨询 权限错误 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%9D%83%E9%99%90%E9%94%99%E8%AF%AF) ------------------------------------------------------------------------------------------------------------- **HTTP 401** 请求本身格式正确,身份也已验证,但当前账号的订阅档位不包含该能力(如 K3、1M 上下文或高速版)。**重试无意义**,需要升级订阅或调整请求。配额与并发类问题请见[配额与账户限制](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%85%8D%E9%A2%9D%E4%B8%8E%E8%B4%A6%E6%88%B7%E9%99%90%E5%88%B6) 和[限流与过载](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%99%90%E6%B5%81%E4%B8%8E%E8%BF%87%E8%BD%BD) 。 ### 无 K3 访问权限 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%97%A0-k3-%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) error, status code: 401, message: Your current subscription does not have access to k3. Upgrade to higher-tier Kimi Code plans. Upgrade: Upgrade: https://www.kimi.com/code?from=server_highspeed_error#pricing 当前订阅未包含 `k3` 的访问权限。K3 需要 Moderato / Plus 及以上套餐才能调用。 **处理方式:** * [升级订阅](https://www.kimi.com/code/#pricing) 到 Moderato / Plus 及以上套餐即可调用 `k3` * 暂不升级时,可继续使用标准版 `kimi-for-coding` ### 无 1M 访问权限 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%97%A0-1m-%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) error, status code: 401, message: Your current plan supports only k3 up to 256K context. 1M context is available on higher-tier Kimi Code plans. Upgrade: https://www.kimi.com/code?from=server_k3_error#pricing 当前套餐调用 `k3` 时仅支持最高 256K 上下文;如需使用最高 1M 上下文,需升级至 Allegretto / Pro 及以上套餐。直接调用 `k3-256k` 时上下文超过 256K,会返回 `k3-256k supports only 256K context.`,压缩上下文或切换到 `k3` 即可。 **处理方式:** * [升级订阅](https://www.kimi.com/code/#pricing) 到 Allegretto / Pro 及以上套餐即可使用 `k3` 的最高 1M 上下文 * 暂不升级时,可继续使用 `k3` 的 256K 上下文,或切换到标准版 `kimi-for-coding` ### 模型 ID 不存在 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%A8%A1%E5%9E%8B-id-%E4%B8%8D%E5%AD%98%E5%9C%A8) error, status code: 401, message: Your model id does not exist, recognized as other:. Please set model id as ``. 请求中使用的模型 ID 不被模型侧识别。常见原因是把只在特定场景使用的写法填到了不支持该写法的入口。例如 `k3[1m]`(带外层引号)仅在 Claude Code 环境变量场景中用于显式声明 1M 上下文窗口;在 API 请求、其他第三方工具的 Model ID 字段等场景中,应直接使用 `k3`。 **处理方式:** * 检查报错中 `recognized as other:` 后面的实际 model id,确认没有拼写错误或多加符号 * 如果是 Claude Code 环境变量配置,确认已按 [在更多第三方工具中使用](https://www.kimi.com/code/docs/third-party-tools/claude-code.html) 的示例填写,包括外层引号 * 如果是 API 请求或其他第三方工具,将 Model ID 改为标准形式(如 `k3`、`kimi-for-coding`、`kimi-for-coding-highspeed`),避免使用仅适用于 Claude Code env 的 `k3[1m]` 写法 ### 高速版无访问权限 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%AB%98%E9%80%9F%E7%89%88%E6%97%A0%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90) error, status code: 401, message: Your current subscription does not have access to kimi-for-coding-highspeed. Upgrade to higher-tier Kimi Code plans. Upgrade: Upgrade: https://www.kimi.com/code?from=server_highspeed_error#pricing 当前账号的订阅未包含高速版模型 `kimi-for-coding-highspeed` 的访问权限。高速版与标准版 `kimi-for-coding` 是同一个模型,但输出速度约为标准版的 5–6 倍,需要 Allegretto / Pro 及以上套餐才能使用。 **处理方式:** * [升级订阅](https://www.kimi.com/membership/pricing?from=server_highspeed_error) 到 Allegretto / Pro 及以上套餐即可解锁高速版 * 暂不升级时,可继续使用标准版 `kimi-for-coding`,功能与高速版完全一致,仅输出速度较慢 配额与账户限制 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%85%8D%E9%A2%9D%E4%B8%8E%E8%B4%A6%E6%88%B7%E9%99%90%E5%88%B6) ------------------------------------------------------------------------------------------------------------------------------------------- **HTTP 403** 账户侧的额度或限制触顶,分两类:配额类错误属于账户使用量问题,**重试无意义**,需等待窗口重置、购买额外用量或升级套餐;并发请求限制由风控策略触发,与剩余额度无关,需按申诉流程处理。 ### 5 小时限额触顶 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#_5-%E5%B0%8F%E6%97%B6%E9%99%90%E9%A2%9D%E8%A7%A6%E9%A1%B6) error, status code: 403, message: You've reached your 5-hour usage limit. Your quota will reset when the current 5-hour window ends. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota 当前 5 小时滚动窗口内的调用量已达上限。 **处理方式:** * 等待当前 5 小时窗口结束、额度自动重置,可前往[控制台](https://www.kimi.com/code/console?from=kfc_overview_topbar) 查看重置时间 * 前往[订阅页](https://www.kimi.com/membership/subscription?tab=quota) 购买额外用量(加油包)或升级套餐,提升限额上限 ### 每周 7 天额度耗尽 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%AF%8F%E5%91%A8-7-%E5%A4%A9%E9%A2%9D%E5%BA%A6%E8%80%97%E5%B0%BD) error, status code: 403, message: You've reached your weekly (7-day) usage limit. Your quota will reset when the current 7-day window ends. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota Kimi Code 订阅额度每 7 天刷新一次,当前 7 天窗口内的额度已全部用完。此错误仅适用于老会员(Andante / Moderato / Allegretto / Allegro 套餐);新会员(Go / Plus / Pro / Max 套餐)已取消每周额度限制,不会触发此错误。 **处理方式:** * 等待当前 7 天窗口结束、额度自动刷新,可前往[控制台](https://www.kimi.com/code/console?from=kfc_overview_topbar) 查看额度使用情况 * 前往[订阅页](https://www.kimi.com/membership/subscription?tab=quota) 购买额外用量(加油包)或升级套餐,获取更高配额 ### 会员月度额度耗尽 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%BC%9A%E5%91%98%E6%9C%88%E5%BA%A6%E9%A2%9D%E5%BA%A6%E8%80%97%E5%B0%BD) error, status code: 403, message: You've reached your monthly usage limit for this billing cycle. Your quota will be refreshed in the next cycle. To continue now, purchase extra usage or upgrade your plan: https://www.kimi.com/membership/subscription?tab=quota 你的 Kimi [月度额度](https://www.kimi.com/membership/subscription) 已全部用完。 Kimi 的所有会员权益——包括 PPT、Agent 集群、Kimi Code 等共用同一套月度额度。一旦总额度耗尽,即使 Kimi Code 还有剩余额度,也无法继续发起请求,需等待下个月额度自动刷新或升级会员计划,详情见[Kimi 会员额度计费说明](https://www.kimi.com/membership-credits) 。额度耗尽后账户进入冻结状态,如下图所示: ![月度额度耗尽冻结状态](https://www.kimi.com/code/docs/%E6%9C%88%E9%99%90%E9%A2%9D.png) **处理方式:** * 等待下个计费周期自动重置 * 前往[订阅页](https://www.kimi.com/membership/subscription?tab=quota) 购买额外用量(加油包)或升级会员计划,获取更高的月度额度 ### 并发请求限制 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B9%B6%E5%8F%91%E8%AF%B7%E6%B1%82%E9%99%90%E5%88%B6) error, status code: 403, message: You've reached your concurrent request limit. Please wait for your ongoing requests to finish and try again. 账号同时进行中的请求数达到上限。该限制由风控策略触发。 **处理方式:** * 前往 [Kimi Code 社区倡议](https://www.kimi.com/code/docs/kimi-code/community-guidelines.html) 了解违规原因及判定范围 * 如需申诉,请发送邮件至 [support@moonshot.cn](mailto:support@moonshot.cn) ,并在邮件中附上:账号 ID、触发风控的时间、使用场景说明及相关截图 限流与过载 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%99%90%E6%B5%81%E4%B8%8E%E8%BF%87%E8%BD%BD) ----------------------------------------------------------------------------------------------------------------------- **HTTP 429** 瞬时性限制,**稍后重试即可恢复**:并发请求过多是短时间内请求量超出账户限制;推理引擎过载是服务端容量问题,与个人配额和账户状态无关。 ### 并发请求过多 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B9%B6%E5%8F%91%E8%AF%B7%E6%B1%82%E8%BF%87%E5%A4%9A) error, status code: 429, message: We're receiving too many requests at the moment. Please wait a moment and try again. 短时间内发出的请求太多,超出了账户限制。 **处理方式:** * 稍等片刻后重试,避免连续快速地重复发送请求 ### 推理引擎过载 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%8E%A8%E7%90%86%E5%BC%95%E6%93%8E%E8%BF%87%E8%BD%BD) error, status code: 429, message: The engine is currently overloaded, please try again later 服务端当前请求量超出推理容量,**与个人配额和账户状态无关**。 工作日高峰期(14:00-17:00)可能会触发,Kimi Code会及时处理,为你提供更丝滑的体验,也可避开高峰期请求 **处理方式:** * 稍等片刻后重试 请求格式错误 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%AF%B7%E6%B1%82%E6%A0%BC%E5%BC%8F%E9%94%99%E8%AF%AF) --------------------------------------------------------------------------------------------------------------------------------- **HTTP 400** 请求内容本身有问题,服务端在解析或校验阶段就拒绝了。**修改请求内容即可解决,无需等待或联系支持。** ### 消息体超出上下文限制 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%B6%88%E6%81%AF%E4%BD%93%E8%B6%85%E5%87%BA%E4%B8%8A%E4%B8%8B%E6%96%87%E9%99%90%E5%88%B6) error, status code: 400, message: total message size 5943865 exceeds limit 2097152 所有消息(含历史对话、系统提示、工具结果)加起来超过 2MB 上下文限制。这是出现频率最高的 400 错误。 **处理方式:** * 精简对话历史,删除不必要的早期轮次 * 分段处理长文本,控制单次请求体积 ### Token 超限 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#token-%E8%B6%85%E9%99%90) error, status code: 400, message: Invalid request: Your request exceeded model token limit: 262144 (requested: 558009) 请求的 token 数超过模型单次处理上限(262,144 tokens)。 **处理方式:** * 缩短 prompt 长度或截断历史对话 * 分多次请求处理长文本 ### 思维链字段缺失 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%80%9D%E7%BB%B4%E9%93%BE%E5%AD%97%E6%AE%B5%E7%BC%BA%E5%A4%B1) error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 2 启用了思维链(thinking)模式,但工具调用消息中缺少 `reasoning_content` 字段。这是 Kimi Code 特有字段,启用思维链时必须携带。 **处理方式:** * 在工具调用的 assistant 消息中补充 `reasoning_content` 字段 * 参考 [平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 查看思维链字段规范 ### 不支持的图片 URL [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%B8%8D%E6%94%AF%E6%8C%81%E7%9A%84%E5%9B%BE%E7%89%87-url) error, status code: 400, message: Invalid request: unsupported image url: C:\Users\pc\...\screenshot.jpg 传入的图片 URL 格式不支持:本地路径、非标准 base64 前缀,或不支持的外部域名。 **处理方式:** * 本地路径需上传至可公开访问的 URL * base64 图片需使用标准格式:`data:image/jpeg;base64,...` ### 工具名重复 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B7%A5%E5%85%B7%E5%90%8D%E9%87%8D%E5%A4%8D) error, status code: 400, message: function name unnamed_function is duplicated `tools` 数组中存在同名工具定义。 **处理方式:** * 确保每个工具的 `name` 字段唯一 ### 内容安全拦截 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%86%85%E5%AE%B9%E5%AE%89%E5%85%A8%E6%8B%A6%E6%88%AA) error, status code: 400, message: The request was rejected because it was considered high risk 请求内容触发了内容安全检测,服务端拒绝处理。 **处理方式:** * 检查 prompt 中是否包含敏感内容,修改后重试 * 如认为是误判,请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,联系在线客服,并附上触发报错的请求内容 资源未找到 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%B5%84%E6%BA%90%E6%9C%AA%E6%89%BE%E5%88%B0) ----------------------------------------------------------------------------------------------------------------------- **HTTP 404** 请求的资源不存在,或当前账号无权访问。检查模型名称和接口路径是否正确。 ### 模型未找到 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%A8%A1%E5%9E%8B%E6%9C%AA%E6%89%BE%E5%88%B0) error, status code: 404, message: Not found the model kimi-for-coding or Permission denied **处理方式:** * 确认模型名称拼写正确(`kimi-for-coding`);常见错误拼写:`Kimi For Coding`、`Kimi-for-Coding`、`kimi-for-code`、`kimi-code`、`K2.6` * 确认账号已开通 [Kimi Code](https://kimi.com/code) 访问权限 ### 接口路径不存在 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%8E%A5%E5%8F%A3%E8%B7%AF%E5%BE%84%E4%B8%8D%E5%AD%98%E5%9C%A8) method not found **处理方式:** * 检查请求 URL 是否正确,Kimi Code 的 Base URL 为 `https://api.kimi.com/coding/v1`(OpenAI 协议)或 `https://api.kimi.com/coding/`(Anthropic 协议) 服务端内部错误 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%86%85%E9%83%A8%E9%94%99%E8%AF%AF) ------------------------------------------------------------------------------------------------------------------------------------------- **HTTP 500** 服务端发生了意外错误,**不由请求内容或账户状态引起**。大多数情况下等待片刻后重试即可恢复,如持续出现,请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,联系在线客服进行反馈。 ### bot\_id 格式不合规 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#bot-id-%E6%A0%BC%E5%BC%8F%E4%B8%8D%E5%90%88%E8%A7%84) invalid_argument: field kimi.billing.v1.ClawExtension.bot_id: value "KIMI_CLAW_ID" (id_kind=uuid_v4): value does not match id_kinds: [uuid_v4] invalid_argument: field kimi.billing.v1.ClawExtension.bot_id: value "openclaw-local" (id_kind=uuid_v4): value does not match id_kinds: [uuid_v4] `bot_id` 不是合法的 UUID v4 格式。这是客户端软件在发请求时自动附上的字段,通常由客户端负责填写,用户无需手动设置。 **处理方式:** * 更新到最新版本的客户端后重试 * 如更新后仍出现,请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,联系在线客服并发送完整报错信息 ### 数据库连接失败 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5) internal: failed to connect to `user=kimi_chat_prod_rw database=membership_009`: ...: connection reset by peer internal: FATAL: terminating connection due to administrator command (SQLSTATE 57P03) 服务端无法连接会员资格校验数据库,或数据库正在维护重启。属于基础设施层故障。 **处理方式:** * 等待 1-2 分钟后重试 ### 内部连接异常 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%86%85%E9%83%A8%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8) internal: conn closed internal: driver: bad connection internal: read tcp ...: i/o timeout internal: unexpected EOF internal: failed to evaluate rate limit script: read tcp ...: i/o timeout 服务端内部网络连接异常,涵盖连接被重置、I/O 超时、Redis 限流脚本超时等多种底层错误,通常为瞬态故障。 **处理方式:** * 稍等片刻后重试(初始等待 1 秒,最多重试 3 次) ### 下游服务不可用 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E4%B8%8B%E6%B8%B8%E6%9C%8D%E5%8A%A1%E4%B8%8D%E5%8F%AF%E7%94%A8) unavailable: 503 Service Unavailable unavailable: 504 Gateway Timeout unavailable: 502 Bad Gateway 服务端调用下游模型或基础组件时收到 5xx 响应。 **处理方式:** * 等待片刻后重试 ### 账号状态异常 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%B4%A6%E5%8F%B7%E7%8A%B6%E6%80%81%E5%BC%82%E5%B8%B8) unauthenticated: not_found: 未找到该账号,请确认是否注册 unauthenticated: failed_precondition: 因违反用户协议,该账号已被禁用。 unauthenticated: failed_precondition: 因违反用户协议,该账号已被暂时禁用。 unauthenticated: failed_precondition: 因违反用户协议,该账号已被禁言。 服务端查询账号信息时发现账号不存在或处于异常状态。 **处理方式:** * 账号未注册:确认使用的账号已完成注册 * 账号被禁用/禁言:发送邮件至 [support@moonshot.cn](mailto:support@moonshot.cn) 了解原因和申诉方式 工具调用错误 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E9%94%99%E8%AF%AF) --------------------------------------------------------------------------------------------------------------------------------- 以下错误发生在 AI 执行工具调用过程中(如读取网页、处理图片),**不影响对话本身继续使用**,只是当前这一步操作没有成功。 如果看到的是认证或限流类错误(如 401、429),请参考前面的对应章节。 ### 请求被取消 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E8%AF%B7%E6%B1%82%E8%A2%AB%E5%8F%96%E6%B6%88) **HTTP 499** error sending 'CallDataSourceTool' request: Post "http://...": context canceled canceled: context canceled 客户端在收到结果之前主动中断了连接,通常是用户手动停止操作、网络中断或客户端超时触发。不是服务端错误。 **处理方式:** * 用户主动停止属正常行为,无需处理 * 频繁出现且非主动触发时,检查客户端超时配置是否过短 ### 网页读取失败 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E7%BD%91%E9%A1%B5%E8%AF%BB%E5%8F%96%E5%A4%B1%E8%B4%A5) **HTTP 500** url2text:v2:fresh-request timeout url-to-text request failed: 30001 invalid html url-to-text request failed: 30041 check url failed, client error (4xx) url-to-text request failed: 30043 check url failed, server error (5xx) url-to-text request failed: 403 verify page url-to-text request failed: 500 url is in blacklist spider checkUrl failed: Post "...": context deadline exceeded AI 尝试读取网页内容时失败。常见原因:目标页面响应超时、页面结构异常、需要登录验证、URL 在黑名单内,或目标服务器本身出错。 **处理方式:** * 超时或服务器错误:稍后重试 * 需要登录验证的页面(verify page):无法通过工具读取,改为手动复制内容后粘贴给 AI * 黑名单 URL:该地址被系统拦截,无法访问 ### 图片审核失败 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E5%9B%BE%E7%89%87%E5%AE%A1%E6%A0%B8%E5%A4%B1%E8%B4%A5) **HTTP 500** image_url:moderation request error: 非法输入 image_url:Post "https://api.msh.team/v1/moderations": context deadline exceeded AI 在处理图片时,图片内容审核服务返回错误或超时。 **处理方式:** * `非法输入`:图片内容触发了内容审核,请确认图片符合使用规范 * 超时:稍后重试,或检查网络连接是否正常 ### URL 安全风险拦截 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#url-%E5%AE%89%E5%85%A8%E9%A3%8E%E9%99%A9%E6%8B%A6%E6%88%AA) **HTTP 403** (security_risk) We consider the current URL poses a security risk and are unable to provide fetch service at this time. 工具调用中传入的 URL 被判定为安全风险,服务端拒绝抓取。 **处理方式:** * 内网地址(如 `192.168.x.x`、`10.x.x.x`)及已知风险域名会被拦截 * 需要登录才能访问的页面无法通过工具调用抓取 ### URL 格式无效 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#url-%E6%A0%BC%E5%BC%8F%E6%97%A0%E6%95%88) **HTTP 400** (invalid_url) The provided URL is invalid: parse "https://the repo for the contents of the path": invalid character " " in host name (invalid_url) The provided URL is invalid: missing scheme 模型将自然语言描述或格式有误的字符串作为 URL 传给工具,通常是描述性文字被当成地址传入,或缺少协议头。 **处理方式:** * 确认传入的是真实可访问的 URL,不是对 URL 的文字描述 * 协议头(`http://` 或 `https://`)不可省略 未覆盖的错误类型 [​](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E6%9C%AA%E8%A6%86%E7%9B%96%E7%9A%84%E9%94%99%E8%AF%AF%E7%B1%BB%E5%9E%8B) ----------------------------------------------------------------------------------------------------------------------------------------------------- 如以上条目未能覆盖你遇到的报错,请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,联系在线客服,并附上完整的错误消息、Request ID 和请求时间。 --- # 快速开始 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#VPContent) On this page 快速开始 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) ===================================================================================================================== Kimi Code 桌面端是 Kimi Code 的桌面客户端。你可以在图形界面中打开本地项目,通过对话让 Agent 阅读和修改代码,并使用改动、文件预览和终端检查结果。 本页介绍从安装、连接模型到完成第一个任务的最短路径。 ![Kimi Code 桌面端首页](https://www.kimi.com/code/docs/images/kimi-code-desktop/home.jpg) Kimi Code 桌面端首页:输入消息即可开始对话。 安装与启动 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E5%90%AF%E5%8A%A8) ------------------------------------------------------------------------------------------------------------------------------- [Kimi Code 桌面版macOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) [Kimi Code 桌面版macOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) [Kimi Code 桌面版Windows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) 首次启动时选择界面语言和主题,之后可以在设置中调整。 登录 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E7%99%BB%E5%BD%95) ------------------------------------------------------------------------------------------------- 首次启动时可以按页面提示完成 Kimi OAuth 授权,也可以先跳过。之后需要登录时,再从应用中的登录入口完成授权;授权失败时按页面提示重试。登录站点随所在区域而定:国内区域为 kimi.com,海外区域为 kimi.ai。登录后可在设置的账号区域随时查看套餐用量。 ![登录 Kimi Code 授权弹窗](https://www.kimi.com/code/docs/images/kimi-code-desktop/login.jpg) 登录 Kimi Code:选择账号类型后按提示完成 OAuth 授权。 连接模型 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E8%BF%9E%E6%8E%A5%E6%A8%A1%E5%9E%8B) --------------------------------------------------------------------------------------------------------------------- ### 使用 Kimi 官方模型 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E4%BD%BF%E7%94%A8-kimi-%E5%AE%98%E6%96%B9%E6%A8%A1%E5%9E%8B) 登录 Kimi 账号后,桌面端会使用账号可用的官方模型。你可以在输入框内的模型选择区域确认当前模型,也可以在设置中的模型模块查看可用模型和模型权限。 未订阅 Kimi 会员的用户系统无法直接读取并使用官方模型,不同会员可使用的模型权益也不同,可以从账号区域找到会员入口,查看并选择适合的会员方案。会员权益和模型权限说明见[会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) 和[模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) 。 ### 接入第三方模型供应商 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E6%8E%A5%E5%85%A5%E7%AC%AC%E4%B8%89%E6%96%B9%E6%A8%A1%E5%9E%8B%E4%BE%9B%E5%BA%94%E5%95%86) 如果你需要使用其他模型供应商: 1. 打开设置,进入模型供应商区域。 2. 选择添加供应商,填写 API Key、Base URL 和模型信息。 3. 保存后回到会话,在输入框附近切换到该模型。 4. 发送一个只读任务,确认模型可用。 ![在设置中手动添加模型供应商的表单](https://www.kimi.com/code/docs/images/kimi-code-desktop/qs-02.jpg) 手动添加供应商需要填写名称、API 协议、API Key、Base URL 和模型信息。 完整的模型和供应商说明见[模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) 和[平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 。 新建会话并选择工作区 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E6%96%B0%E5%BB%BA%E4%BC%9A%E8%AF%9D%E5%B9%B6%E9%80%89%E6%8B%A9%E5%B7%A5%E4%BD%9C%E5%8C%BA) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 桌面端会按工作区整理会话。新建会话后,可以在输入框上方选择要使用的本地项目文件夹: 1. 点击左侧的“新建会话”。 2. 点击输入框上方的文件夹名称,打开工作区选择器。 3. 从最近使用的文件夹中选择项目,或点击“选择文件夹…”添加新的本地文件夹。 4. 确认输入框上方显示了目标工作区后,再输入任务并发送消息。 新选择的文件夹会成为桌面端的工作区,并加入最近使用的文件夹列表。添加时若选择“直接输入绝对路径”,路径会以本地绝对路径解析;空会话必须先选择工作区才能发送。将 Finder 或文件资源管理器中的文件夹拖到侧边栏,也可以直接添加为工作区。 会话会出现在所选工作区的会话列表中。已有工作区和会话可以直接从左侧切换。 ![新建会话后,在输入框上方打开工作区选择器](https://www.kimi.com/code/docs/images/kimi-code-desktop/qs-01.jpg) 新建会话后,点击输入框上方的文件夹名称,从最近使用的文件夹中选择或添加新的工作区。 发起第一个任务 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%8F%91%E8%B5%B7%E7%AC%AC%E4%B8%80%E4%B8%AA%E4%BB%BB%E5%8A%A1) --------------------------------------------------------------------------------------------------------------------------------------------------- 在输入框中输入任务,也可以用 `@` 引用文件或目录。输入框左下角的 **+** 提供几种任务模式: * **目标**:设定一个持续推进的目标,适合需要多轮执行和检查的长任务;开启后,目标会显示在输入框上方。见[目标模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) 。 * **计划**:先让 Agent 分析并给出计划,确认后再修改文件。见 [Plan 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#plan-%E6%A8%A1%E5%BC%8F) 。 * **Swarm**:把可拆分的任务交给多个子代理并行处理,进度会显示在 Tasks 或 Subagent 区域。见 [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) 。 任务执行过程中,Agent 的工具调用、思考过程和每轮修改的文件都会呈现在界面中,可以随时查看。你可以继续输入补充要求来调整方向,例如缩小修改范围、补充约束、要求先解释原因、要求停止当前操作,或让 Agent 按新的要求继续。需要回退时,可以使用 `/undo` 回退最近的修改。 处理审批 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%A4%84%E7%90%86%E5%AE%A1%E6%89%B9) --------------------------------------------------------------------------------------------------------------------- 桌面端会把需要你决定的操作显示为审批卡片。卡片可能包含命令、文件修改或计划等内容;阅读具体范围后再选择批准或拒绝。智能体提出问题时,问题卡片可能提供单选、多选和「其他」输入。 权限模式有三种: * **始终询问**:仅自动读取,其余操作逐一向你确认。 * **必要时询问**:自动完成常规修改和命令;高危操作、提问和计划仍会问你。 * **完全自动**:完全不打断,所有操作和判断自动完成。 首次使用或处理不熟悉的项目时,建议先使用 **始终询问**,确认操作范围后再调整模式。 查看改动并验证 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E6%9F%A5%E7%9C%8B%E6%94%B9%E5%8A%A8%E5%B9%B6%E9%AA%8C%E8%AF%81) --------------------------------------------------------------------------------------------------------------------------------------------------- 修改完成后,在右侧查看改动,先检查文件列表,再按文件和单次修改查看具体变化。需要进一步确认时,可以在文件预览中检查 Markdown、JSON、HTML、PDF、CSV、图片以及代码或文本文件,并复制、下载、在系统中显示或在外部应用中打开。会话中提到的文件路径也可以直接点开预览。 如果任务需要运行检查,可通过会话右上角的终端按钮打开底部终端面板,确认命令、当前工作区和输出结果。验证无误后再继续下一步;如果结果不符合预期,可以回到会话中说明问题,或使用 `/undo` 回退最近的修改。 如果是网页类项目,还可以在右侧面板打开内置浏览器:标签页随会话常驻,页面信息与 Agent 共享,直接在应用内查看页面效果,无需切到其他窗口。 ![右侧改动面板中的文件差异](https://www.kimi.com/code/docs/images/kimi-code-desktop/qs-04.jpg) 右侧改动面板按文件显示每次修改的具体差异。 继续探索 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E7%BB%A7%E7%BB%AD%E6%8E%A2%E7%B4%A2) --------------------------------------------------------------------------------------------------------------------- 完成第一个任务后,可以继续: * 用**目标**推进长任务。 * 用 **Swarm** 处理可拆分的调查或修改。 * 通过顶部菜单在外部编辑器、文件管理器或系统终端中打开项目。 * 创建、归档、恢复、Fork 或导出会话。 * 在设置中调整模型、权限、快捷键和插件。 常用命令 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4) --------------------------------------------------------------------------------------------------------------------- 输入框可以直接输入任务,也支持通过 `/` 使用内置命令。常用命令: | 命令 | 作用 | | --- | --- | | `/new` | 新建会话 | | `/login` | 打开登录流程 | | `/plan` | 进入计划模式 | | `/goal` | 设定持续推进的目标 | | `/swarm` | 使用多个子代理处理任务 | | `/compact` | 压缩当前上下文 | | `/undo` | 回退最近的修改 | | `/fork` | Fork 当前会话 | | `/export` | 导出会话 | | `/status` | 查看当前会话状态 | 桌面端和命令行的关系 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E6%A1%8C%E9%9D%A2%E7%AB%AF%E5%92%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%9A%84%E5%85%B3%E7%B3%BB) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 桌面端延续 Kimi Code CLI 的 Agent 核心能力,两者可以安装在同一台机器上,并共享部分本地配置,如账号、模型、模型供应商和插件相关设置。在 CLI 中运行 `/desktop` 斜杠命令或 [`kimi install-desktop`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) 子命令,可以在浏览器中打开桌面端页面进行下载安装。 桌面端适合在图形界面中管理项目、会话、改动和终端验证;命令行更适合终端优先和脚本化的工作流。具体共享范围以各自的设置和配置文件为准。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ----------------------------------------------------------------------------------------------------------- * [使用桌面端](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html) :了解任务模式、上下文、会话管理、终端和设置。 * [Kimi Code CLI 快速开始](https://www.kimi.com/code/docs/kimi-code-cli/guides/getting-started.html) :了解终端中的命令、会话和脚本化流程。 * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) :查看可用模型和模型配置方式。 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) :了解账号权益、额度和升级方式。 --- # 变更记录 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#VPContent) Return to top 变更记录 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E5%8F%98%E6%9B%B4%E8%AE%B0%E5%BD%95) =============================================================================================================== 本页记录 Kimi Code Desktop 每个版本的变更内容。 1.0.3(2026-09-23) [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#_1-0-3-2026-09-23) --------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD) * 点击会话中的本地 HTML 文件,会在右侧内置浏览器中按真实网页打开,方便直接验证页面效果。 * 浏览器下载记录支持暂停、继续、取消和重试,并显示下载速度与剩余时间。 * 输入框中高亮有效的行首 `/` 命令,未输入参数时显示参数提示。 * 右键点击会话中的文件名,可以复制路径或在文件夹中显示。 * 设置中新增自动生成会话标题的开关,关闭后不再用 AI 命名新会话。 * 免费套餐账号使用订阅模型发送消息时,会提示升级套餐。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BC%98%E5%8C%96) * 会话中的 Markdown 表格改用圆角外框,加宽后可占满会话整宽。 * 定时任务在会话记录中显示易读的名称、周期和详情。 * 浏览器地址栏建议列表支持高亮、去重,并区分不同类型的建议。 * 展开的工具面板中显示完整的 Bash 命令。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BF%AE%E5%A4%8D) * 修复恶意网页可通过本地内嵌服务器执行任意命令的安全漏洞。 * 修复长对话打开卡死、流式输出掉帧和移动端内存占用过高的问题。 * 修复删除会话后确认弹窗一直转圈无法关闭的问题。 * 修复子代理模型设置在界面显示未配置、保存后不生效的问题。 * 修复 Swarm 工具卡片与成员状态显示的一系列问题。 * 修复 Fork 会话继续聊天后,标题被自动重新生成覆盖的问题。 * 修复内置终端 `Cmd+K` 误弹出搜索面板、`Ctrl+C` 在选中文字时无法复制的问题。 * 修复侧边栏与工作面板同时打开时互相遮挡争抢的问题。 * 修复侧边聊天在请求失败时不显示失败卡片、新建会话空页面仍可点击侧边聊天入口的问题。 * 修复任务通知卡片在回合折叠内顺序错乱的问题。 * 修复 Windows 上置顶截图拖拽不稳定的问题。 1.0.2(2026-09-19) [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#_1-0-2-2026-09-19) --------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-1) * 内置浏览器全面升级:会话记录中实时展示 Agent 的浏览活动,按活动分组汇总并列出信息来源;Agent 控制标签页时页面四周显示高亮描边;Agent 还会主动展示你要求查看的页面。 * 浏览器地址栏新增「在默认浏览器中打开」按钮;下载记录中显示实时下载进度与文件操作。 * Agent 可按照你配置的搜索引擎进行搜索。 * 重新设计供应商设置页。 * 退出确认改为应用内对话框。 * 鼠标悬停可查看 subagent 名称。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BC%98%E5%8C%96-1) * 启动渲染更快,侧边栏更新更轻量,会话搜索范围加上限。 * 输入框换行时不再重绘整个会话记录。 * 截图导出与复制不再重复解码。 * 截图全局快捷键仅限稳定版可用。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BF%AE%E5%A4%8D-1) * 修复窗口隐藏或最小化时页面截图失败的问题。 * 恢复 `` ctrl+` `` 为底部终端开关,移除新建终端标签的快捷键。 * 登录后保持当前视图,不再跳转到最近的会话。 * 修复地址栏输入时建议列表不即时更新的问题。 * 修复 cmd 点击和中键点击链接不在新标签页打开的问题。 * 修复 Agent 的浏览器 URL 被截断为单个字符的问题。 * 修复下载保存对话框未显示在应用窗口上的问题。 * 修复 sub-agent 的审批与提问请求不显示的问题。 * 修复会话恢复时的闪烁;回合文件卡片仅保留最近 3 轮。 * 修复调整窗口大小或切换面板时会话记录跳动的问题。 * Windows:支持检测安装在自定义目录的编辑器,保留全屏窗口边框与媒体控制。 1.0.1(2026-09-17) [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#_1-0-1-2026-09-17) --------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-2) * 改动详情的 diff 视图新增「打开文件」按钮。 * 会话记录中的链接悬停时显示完整 URL,并提供打开操作。 * 浏览器工具调用在会话记录中可视化展示。 * 图片预览支持图集导航与右键菜单。 * 移除工作区时,确认弹窗会说明移除后的影响。 * 截图输出操作顺序调整为关闭、置顶、保存、复制。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BC%98%E5%8C%96-2) * 统一设置页中供应商、插件、快捷键、浏览器标签页的样式。 * 提升低 DPI 显示器下的界面清晰度。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E4%BF%AE%E5%A4%8D-2) * 失败的回合卡片现在显示完整的供应商错误信息。 * 编辑与视图菜单标签随界面语言本地化。 * 修复内置浏览器的多项问题:macOS 下 Agent 剪贴板与撤销键失效、非 http 链接被拦截后页面空白、元素引用与等待轮询偶发失效。 * 修复 toast 提示被模态框遮挡的问题。 * 修复打开右侧面板时页面根节点跟随滚动的问题。 * 修复侧边聊天中工具调用的渲染与交互问题。 1.0.0(2026-09-17) [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#_1-0-0-2026-09-17) --------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-desktop/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-3) * Kimi Code 桌面客户端正式发布:延续 Kimi Code CLI 的 Agent 核心能力,在图形界面中打开项目、与 Agent 对话并交付改动。支持 macOS(Apple Silicon / Intel)和 Windows。 * 每一步都清晰可见:工具调用、思考过程和每轮修改的文件都在界面中呈现;敏感操作弹出审批提示,始终询问 / 必要时询问 / 完全自动三档权限模式由你掌控。 * 从对话到交付的完整工作流:目标模式持续推进长任务,可暂停、恢复或取消;计划模式先出方案再动手,计划可评审、可反馈;长任务可转入后台继续运行,随时查看进度。 * 内置浏览器与可视化标注:浏览器进驻右侧面板,标签页随会话常驻,页面信息与 Agent 共享;支持截图标注、划词评论、`@` 提及文件和网页元素点选,让 Agent 准确定位要修改的位置。 * 登录即可使用 Kimi 官方模型,也可接入第三方模型供应商;会话、项目与后台任务集中管理,并可通过插件扩展能力。 --- # 会员权益 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/membership.html#VPContent) Return to top 会员权益 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#%E4%BC%9A%E5%91%98%E6%9D%83%E7%9B%8A) ======================================================================================================== 📢 新套餐发布 Kimi 会员新套餐正式发布,定价不变。新套餐详情见 [Kimi Code 套餐购买页](https://www.kimi.com/code/#pricing) 。新会员**取消每周额度限制**,仅保留每 5 小时的滚动频率窗口;Go 档无 coding 额度,Plus 及以上档位可使用 Kimi Code。老套餐会员不受影响,档位名称、额度规则与自动续费均维持原样。新老套餐的规则差异见下方 [套餐档位](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) 对比。 概述 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#%E6%A6%82%E8%BF%B0) ------------------------------------------------------------------------------------ Kimi Code 是 [Kimi 会员权益](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) 中面向开发者的智能编程服务,随 Kimi 会员订阅一同提供,与 Kimi 会员共享同一套额度。CLI、VS Code、桌面端及第三方工具发起的请求,均计入该额度。 订阅档位与价格详见 [Kimi 会员权益页](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) 。 套餐档位 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ----------------------------------------------------------------------------------- Kimi 会员已启用新的档位名称,定价不变。新老套餐的规则对比如下: | 对比项 | 老套餐 | 新套餐 | | --- | --- | --- | | Kimi Code 使用门槛 | Andante 及以上 | Plus 及以上 | | 5 小时频率窗口 | 有 | 有 | | 周频率窗口 | 有 | 无 | | 月总额度 | 有 | 有 | | K3 调用门槛 | Moderato 及以上 | Plus 及以上 | | K3 1M 上下文门槛 | Allegretto 及以上 | Pro 及以上 | | 高速版门槛 | Allegretto 及以上 | Pro 及以上 | **常见问题** 老套餐还能继续使用吗? 可以。在新版套餐上线前购买的旧版套餐仍可继续使用,到期后可选择续订或升级到新版套餐。 我一定要升级新套餐吗? 不是强制迁移。老套餐可以继续维持订阅,是否升级取决于你的使用需求。 如何升级会员计划? 在 [Kimi Code 套餐购买页](https://www.kimi.com/code/#pricing) 选择想要升级的新套餐,点击「订阅」后按提示完成支付即可。升级时系统会根据当前套餐的剩余天数折算,新套餐权益立即生效。 额度与限制 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#%E9%A2%9D%E5%BA%A6%E4%B8%8E%E9%99%90%E5%88%B6) ------------------------------------------------------------------------------------------------------------------ 新会员与老会员的额度规则不同: * **新会员**:取消每周额度限制,不再每 7 天刷新;保留**每 5 小时的滚动频率窗口**——短时间请求过多会触发限流,等窗口滚动后自动恢复。 * **老会员**:规则不变,额度以订阅日为起点**每 7 天自动刷新**,未用完不累积;同样有每 5 小时的滚动频率窗口。 两类会员都与 Kimi 会员计划共享月总额度:如月总额度达到上限,Kimi Code 额度会冻结,需等待月额度重置或升级订阅。月额度消耗可在 [订阅](https://www.kimi.com/membership/subscription) 页查看。 所有登录设备和 API Key 共享同一套配额;超过 30 天未活跃的设备会自动解绑,重新 `/login` 即可恢复。登录 [Kimi Code 控制台](https://www.kimi.com/code/console) 可随时查看剩余额度与频限状态、管理 API Key 和登录设备。 加油包 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#extra-usage) ------------------------------------------------------------------------------ 订阅额度用尽后,可用加油包(Extra Usage)余额继续发起请求,不必等待刷新。仅订阅会员可开启,且**网页端 Kimi 与 Kimi Code 共享同一份加油包额度**。完整条款见 [加油包充值协议](https://www.kimi.com/user/agreement/extra-usage-rules-cn) 。 ![额度加油包](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-module.png) **充值入口** * **从主站充值**:进入 Kimi [订阅页面](https://www.kimi.com/membership/subscription?tab=quota) ,滚动至页面底部的「额度加油包」模块 → 选择充值金额 → 完成支付即可。 * **从 Kimi Code 控制台充值**:当你的**周额度(老会员)或 5 小时额度任意一项消耗超过 80%** 时,进度条卡片会出现【加油包购买】按钮,点击即可跳转到 Kimi 订阅页完成购买。 ![Kimi Code 控制台的额度加油包入口](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-console.png) **开启与管理** 打开「额度加油包」开关后,当订阅额度用尽时,系统会自动从加油包余额中扣减。点击模块的「设置」可开启**每月消费上限**、设定本月最多可花费的金额;进度条则实时显示本月加油包的消耗情况。 **计费与规则** * **计费**:按实际用量扣费——读取与生成的内容越多、任务越复杂,花费越高;余额以人民币显示,费率以平台展示为准。加油包价格近似于 [Kimi 开放平台](https://platform.kimi.com/) 的官方 API 价格;用量较大时,升级订阅通常更划算。 * **消耗优先级**:先扣订阅等限时额度,**加油包最后扣**,作为兜底补充。开启后即使订阅额度被打满,也能无缝消耗加油包余额,任务不中断、不报错。 * **限额控制**:可在设置中开启「每月消费上限」,为加油包设定本月最多可花费的金额;不开启则不限额。 * **有效期与叠加**:余额不过期、可叠加;订阅失效后余额仍可继续消费,但失效期间无法再充值,需重新开通订阅后才能充值。 * **退款**:一般不可退款、转让或兑现。 > 计费示例(引自官方示例,仅供感受量级,实际以平台为准):一次简单请求(如「推荐一首摇滚歌曲」)约 **0.03 元**;一次复杂的多步任务(如「规划一周成都到川西的自驾行程」)约 **1.6 元**。 > 充值限制:单次最低 25 RMB,每日最多 10 次、累计 3,000 RMB,余额上限 10,000 RMB。 **查询用量** * **Kimi 网页 / App**:设置 → 订阅和发票 → [我的额度](https://www.kimi.com/membership/subscription?tab=quota) 。 * **Kimi Code 控制台**:**开启加油包后**,登录 [控制台](https://www.kimi.com/code/console) 即可查看余额与用量。 * **Kimi Code CLI**:在命令行中输入 `/usage` 直接查询。 ![CLI 中 /usage 查看加油包(Extra Usage)用量](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-cli.png) **常见问题** 网页端 Kimi 和 Kimi Code 的加油包是同一个钱包吗? 是的。加油包额度在 Kimi 与 Kimi Code 之间共享——充值一次,两端通用;「我的额度」里充值的加油包与 Kimi Code 控制台的加油包也是同一个。 加油包和订阅额度谁先扣? 先扣订阅等限时额度,加油包在所有限时额度耗尽后才作为兜底扣除。 达到月 / 周(老会员)/ 小时额度上限,或会话中被限流时,还能继续吗? 能。开启加油包后不受订阅限额影响,任意额度触顶都会无缝切到加油包余额,任务不中断、不报错,且只扣加油包余额、不影响会员额度刷新。 加油包怎么计费?和同价位的订阅、开放平台 API 相比如何? 计费取决于请求的输入 / 输出量与 cache 命中率;加油包单价近似 [Kimi 开放平台](https://platform.kimi.com/) 的官方 API,用量较大时升级订阅通常更划算。 没用完的余额能留到下个月、能叠加吗? 能。余额制、不过期、可叠加;订阅失效后余额仍可消费,但失效期间无法充值,需重新开通订阅后再充。 余额快用尽时(如充了 25 元),会保证当前请求跑完吗? 会保证「最后一次模型调用」即使计费超限也完成,但不保证整个任务一定跑完。 加油包支持企业版吗? 暂不支持。 注销账户后余额会退回吗? 请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,接入在线客服申请退款。 下一步 [​](https://www.kimi.com/code/docs/kimi-code/membership.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 各档位可用的模型、上下文窗口与切换方式 * [错误参考](https://www.kimi.com/code/docs/kimi-code/error-reference.html) — 额度用尽、权限不足等报错的处理方式 --- # 最新动态 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/whats-new.html#VPContent) On this page 最新动态 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%9C%80%E6%96%B0%E5%8A%A8%E6%80%81) ======================================================================================================= 记录 Kimi Code 各产品的新功能与核心修复,重点介绍最值得关注的变化。 最新Kimi Code CLI v2.1.0 2026 年 9 月 23 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v2-1-0-2026-%E5%B9%B4-9-%E6%9C%88-23-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 全屏模式(实验性) [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%85%A8%E5%B1%8F%E6%A8%A1%E5%BC%8F-%E5%AE%9E%E9%AA%8C%E6%80%A7) 新增实验性全屏界面:transcript 独立滚动、支持鼠标选择,点击折叠块即可展开或收起,底部还有可点击的 "Jump to bottom" 指示器。在 `/settings` 的 TUI mode 中开启,或在 `~/.kimi-code/tui.toml` 中设置 `tui_mode = "fullscreen"`,重启 Kimi Code 后生效。→ [tui.toml](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tuitoml) #### 启动更快、占用更低 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%90%AF%E5%8A%A8%E6%9B%B4%E5%BF%AB%E3%80%81%E5%8D%A0%E7%94%A8%E6%9B%B4%E4%BD%8E) 缩短 CLI 启动时间并降低内存占用,大项目下的首屏等待明显变短。 #### 文件监听默认关闭 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%96%87%E4%BB%B6%E7%9B%91%E5%90%AC%E9%BB%98%E8%AE%A4%E5%85%B3%E9%97%AD) 对配置文件和工作区文件的监听默认不再开启;如需热更新 AGENTS.md、skills 或 MCP 配置,将 `[watch] enabled` 设为 `true` 或设置 `KIMI_CODE_WATCH=1`。→ [watch](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#watch) 此外:加强工作区安全限制——文件工具无法再通过符号链接访问工作目录外的文件,项目本地配置仅在工作区受信任后生效;新增 `auto_session_title` 配置,可关闭客户端自动生成会话标题。→ [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%A1%B6%E5%B1%82%E5%AD%97%E6%AE%B5) Kimi Code Desktop Kimi Code Desktop 正式发布 2026 年 9 月 17 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-code-desktop-%E6%AD%A3%E5%BC%8F%E5%8F%91%E5%B8%83-2026-%E5%B9%B4-9-%E6%9C%88-17-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Kimi Code 桌面客户端正式上线:延续 Kimi Code CLI 的 Agent 核心能力,在图形界面中打开项目、与 Agent 对话并交付改动。现已支持 macOS(Apple Silicon / Intel)和 Windows。→ [快速开始](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html) #### 每一步都清晰可见 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%AF%8F%E4%B8%80%E6%AD%A5%E9%83%BD%E6%B8%85%E6%99%B0%E5%8F%AF%E8%A7%81) 工具调用、思考过程和每轮修改的文件都在界面中呈现;敏感操作会弹出审批提示,始终询问 / 必要时询问 / 完全自动三档权限模式由你掌控。→ [处理审批](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html#%E5%A4%84%E7%90%86%E5%AE%A1%E6%89%B9) #### 从对话到交付的完整工作流 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BB%8E%E5%AF%B9%E8%AF%9D%E5%88%B0%E4%BA%A4%E4%BB%98%E7%9A%84%E5%AE%8C%E6%95%B4%E5%B7%A5%E4%BD%9C%E6%B5%81) 目标模式持续推进长任务,可暂停、恢复或取消;计划模式先出方案再动手,计划可评审、可反馈;长任务还可转入后台继续运行,随时查看进度。→ [选择任务模式](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E9%80%89%E6%8B%A9%E4%BB%BB%E5%8A%A1%E6%A8%A1%E5%BC%8F) #### 内置浏览器与可视化标注 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%86%85%E7%BD%AE%E6%B5%8F%E8%A7%88%E5%99%A8%E4%B8%8E%E5%8F%AF%E8%A7%86%E5%8C%96%E6%A0%87%E6%B3%A8) 浏览器进驻右侧面板,标签页随会话常驻,页面信息与 Agent 共享;截图标注、划词评论、`@` 提及文件、网页元素点选,让 Agent 准确定位要修改的位置。→ [验证修改](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E9%AA%8C%E8%AF%81%E4%BF%AE%E6%94%B9) 下载:[macOS · Apple Silicon](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-arm64.dmg) · [macOS · Intel](https://code.kimi.com/kimi-code/desktop/download/KimiCode-mac-x64.dmg) · [Windows](https://code.kimi.com/kimi-code/desktop/download/KimiCode-win-x64.exe) Kimi Code CLI v2.0.0 2026 年 9 月 17 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v2-0-0-2026-%E5%B9%B4-9-%E6%9C%88-17-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 新增 `/desktop` 命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%96%B0%E5%A2%9E-desktop-%E5%91%BD%E4%BB%A4) 新增 `/desktop` 斜杠命令(别名 `/install-desktop`)与 `kimi install-desktop` 子命令,在浏览器中打开桌面端页面,从终端直达桌面端下载安装。→ [`kimi install-desktop`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) #### Mermaid 图表在终端渲染 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#mermaid-%E5%9B%BE%E8%A1%A8%E5%9C%A8%E7%BB%88%E7%AB%AF%E6%B8%B2%E6%9F%93) Mermaid 代码块现在会直接渲染为图表;可在 `/settings` → Mermaid diagrams 中关闭,或在 tui.toml 的 `[markdown]` 配置段设置 `mermaid = "off"`。 此外:内置浏览器插件更名为 Kimi Browser Extension;会话中累积的媒体超过 20 MB 时,最早的图片和视频会自动从请求中省略并显示警告 → [粘贴图片与视频](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%B2%98%E8%B4%B4%E5%9B%BE%E7%89%87%E4%B8%8E%E8%A7%86%E9%A2%91) 。v2.0.1 起,供应商密钥可改用 `api_key_env` 从指定的环境变量读取,不再必须写进配置文件 → [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#providers) 。 Kimi Code CLI v0.43.0 2026 年 9 月 14 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-43-0-2026-%E5%B9%B4-9-%E6%9C%88-14-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Web 版会话 AI 标题默认开启 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E7%89%88%E4%BC%9A%E8%AF%9D-ai-%E6%A0%87%E9%A2%98%E9%BB%98%E8%AE%A4%E5%BC%80%E5%90%AF) 首轮对话后自动生成会话标题,在重命名输入框中还可以一键重新生成,不再需要你手动起名。 #### 会话选择器中可删除会话 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BC%9A%E8%AF%9D%E9%80%89%E6%8B%A9%E5%99%A8%E4%B8%AD%E5%8F%AF%E5%88%A0%E9%99%A4%E4%BC%9A%E8%AF%9D) 在会话选择器中选中目标会话按 `Ctrl-X`,再按 `y` 确认即可删除,清理历史会话更方便。 #### 目标模式时间预算更合理 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F%E6%97%B6%E9%97%B4%E9%A2%84%E7%AE%97%E6%9B%B4%E5%90%88%E7%90%86) 时间预算不再计入会话关闭期间的时间,并取消 24 小时上限,长期目标不再被离线时间白白消耗。→ [目标模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) 此外:`kimi upgrade`(别名 `kimi update`)新增 `-y, --yes` 选项,跳过确认直接安装更新;新增 `KIMI_CODE_PERMISSION_MODE_REMINDER` 环境变量,设为 `0` 可关闭自动权限模式提醒的注入。v0.43.1 修复了在 subagent 运行时按 `Ctrl-C` 会直接退出整个 CLI 的问题,现在只会中断正在运行的 subagent。 模型发布 K2.8 Preview 2026 年 9 月 11 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#k2-8-preview-2026-%E5%B9%B4-9-%E6%9C%88-11-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------------------- 🎉 **K2.8 Preview** 现已全量上线 Kimi Code!Model ID 不变,仍为 `kimi-for-coding`,客户端与第三方工具无需修改配置即可使用。→ [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) #### 综合性能接近 K3,思考效率更高 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%BB%BC%E5%90%88%E6%80%A7%E8%83%BD%E6%8E%A5%E8%BF%91-k3-%E6%80%9D%E8%80%83%E6%95%88%E7%8E%87%E6%9B%B4%E9%AB%98) 编码与智能体能力全面提升,思考(thinking)效率较 K2.7 Code 显著改善。 #### 支持 thinking effort 档位调节 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%94%AF%E6%8C%81-thinking-effort-%E6%A1%A3%E4%BD%8D%E8%B0%83%E8%8A%82) 与 K3 的思考等级一致,支持 `low` / `high` / `max` 三档(默认 `max`)。关闭 thinking 后,K3 系列与 K2.8 Preview 的请求均路由到 K2.8 Preview(无思考)。 #### 支持 1M 超长上下文 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%94%AF%E6%8C%81-1m-%E8%B6%85%E9%95%BF%E4%B8%8A%E4%B8%8B%E6%96%87) 全部会员档位均开放最高 1M 上下文窗口。 Kimi Code CLI v0.42.0 2026 年 9 月 9 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-42-0-2026-%E5%B9%B4-9-%E6%9C%88-9-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### Remote Control 转为正式功能 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#remote-control-%E8%BD%AC%E4%B8%BA%E6%AD%A3%E5%BC%8F%E5%8A%9F%E8%83%BD) 远程控制结束实验阶段正式开放,无需再设置实验开关,随时随地从手机或另一台电脑接管本地会话。→ [远程控制](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html) #### Web 版输入框媒体预览栏 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E7%89%88%E8%BE%93%E5%85%A5%E6%A1%86%E5%AA%92%E4%BD%93%E9%A2%84%E8%A7%88%E6%A0%8F) 附件以可排序的预览栏展示,可在文本中按需引用图片和视频,排队与发送后预览仍然保留;并新增支持 HEIC、HEIF 和 BMP 图片。→ [粘贴图片与视频](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%B2%98%E8%B4%B4%E5%9B%BE%E7%89%87%E4%B8%8E%E8%A7%86%E9%A2%91) #### 工具调用结果折叠为摘要 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%B7%A5%E5%85%B7%E8%B0%83%E7%94%A8%E7%BB%93%E6%9E%9C%E6%8A%98%E5%8F%A0%E4%B8%BA%E6%91%98%E8%A6%81) 已完成的工具调用折叠为标题加一行结果摘要,消息记录更清爽,按 `Ctrl-O` 可展开查看完整内容。→ [键盘快捷键](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E5%B7%A5%E5%85%B7%E8%BE%93%E5%87%BA) 此外:`/btw` 侧边聊天的 subagent 新增只读工具;子 Agent 模型池(`[secondary_model]`)始终开启,实验开关已移除。 Kimi Code CLI v0.41.0 2026 年 9 月 4 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-41-0-2026-%E5%B9%B4-9-%E6%9C%88-4-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### Web 版 Tower 多 Agent 协作 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E7%89%88-tower-%E5%A4%9A-agent-%E5%8D%8F%E4%BD%9C) Web 版新增 tower 多智能体协作模式(实验功能),可通过 `/tower` 命令或输入框加号菜单开启,`/tower ` 可指定基准分支。 #### Web 版划词标注 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E7%89%88%E5%88%92%E8%AF%8D%E6%A0%87%E6%B3%A8) 在消息、文件预览、diff 与每轮改动面板或终端中选中文字,即可添加评论或引用到对话。 #### 危险命令不再拦截 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%8D%B1%E9%99%A9%E5%91%BD%E4%BB%A4%E4%B8%8D%E5%86%8D%E6%8B%A6%E6%88%AA) 自动权限模式不再拦截危险命令和无法静态分析的命令。→ [三种权限模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) 此外:新增会话评分提示(可在配置中关闭);后台提问的回答直接送达 Agent,不再经输出文件中转。 Kimi Code CLI v0.40.0 2026 年 9 月 2 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-40-0-2026-%E5%B9%B4-9-%E6%9C%88-2-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 权限模式更名,新增危险命令护栏 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F%E6%9B%B4%E5%90%8D-%E6%96%B0%E5%A2%9E%E5%8D%B1%E9%99%A9%E5%91%BD%E4%BB%A4%E6%8A%A4%E6%A0%8F) 原 YOLO / Auto 模式更名为「必要时询问」(`/ask-when-needed`)和「完全自动」(`/never-ask`),Manual 即「始终询问」。同时新增内置危险命令护栏:`shutdown`、`reboot`、`rm -rf` 这类命令在完全自动模式下会被直接拒绝,其余模式执行前必须经你确认,可用 `[permission] dangerous_command_guard = false` 关闭。→ [交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) #### 子 Agent 模型池转为正式功能 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AD%90-agent-%E6%A8%A1%E5%9E%8B%E6%B1%A0%E8%BD%AC%E4%B8%BA%E6%AD%A3%E5%BC%8F%E5%8A%9F%E8%83%BD) `[secondary_model]` 子代理设置结束实验状态,在所有启动模式下默认启用,仍可通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=0` 或 `[experimental] secondary-model = false` 退出。→ [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#secondary-model) #### Web 设置新增插件面板 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E8%AE%BE%E7%BD%AE%E6%96%B0%E5%A2%9E%E6%8F%92%E4%BB%B6%E9%9D%A2%E6%9D%BF) Web 版设置新增「插件」面板,可直接浏览插件市场,并安装、启停、移除插件。→ [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) 此外:Tower 模式(实验性)不再由 Agent 自行进入,需用 `/tower on` 或 `/tower ` 显式开启;新增 `kimi session list` 命令,可在命令行直接列出会话。v0.40.1 修复了 kimi-cli 迁移完成或关闭后仍重复弹出迁移提示的问题。 Kimi Code CLI v0.39.0 2026 年 8 月 27 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-39-0-2026-%E5%B9%B4-8-%E6%9C%88-27-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 远程控制本地 Web 会话 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%BF%9C%E7%A8%8B%E6%8E%A7%E5%88%B6%E6%9C%AC%E5%9C%B0-web-%E4%BC%9A%E8%AF%9D) 开启 `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL=1` 后,运行 `kimi rc`、`kimi web --remote-control` 或 `/remote-control`,即可从远程访问本地 Web 会话。→ [远程控制](https://www.kimi.com/code/docs/kimi-code-cli/guides/remote-control.html) #### 实验性 Tower 多 Agent 编排 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AE%9E%E9%AA%8C%E6%80%A7-tower-%E5%A4%9A-agent-%E7%BC%96%E6%8E%92) 开启 `KIMI_CODE_EXPERIMENTAL_TOWER=1` 后,用 `/tower on` 和 `/tower ` 启动 Tower 模式,让多个 Agent 协同推进目标。 #### 子 Agent 继承当前对话历史 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AD%90-agent-%E7%BB%A7%E6%89%BF%E5%BD%93%E5%89%8D%E5%AF%B9%E8%AF%9D%E5%8E%86%E5%8F%B2) 开启 `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK=1`,或在 `[experimental]` 中设置 `subagent_fork = true`,即可让 subagent 和 swarm 工具通过 `fork` 参数继承调用方当前对话历史的快照。→ [Agent 与子 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) 此外:AgentSwarm 现在可通过 `[swarm] timeout_ms` 或 `KIMI_CODE_SWARM_TIMEOUT_MS` 单独设置超时;Windows 文件工具和 Shell 现在能正确解析 Git Bash 路径。v0.39.1 修复了 web 端权限模式跨会话串改、空输入框首个输入字符被吞、工作区较多时启动卡在 Connecting 等问题,OpenIn 菜单新增文件模式(复制绝对路径、选择编辑器打开)。 Kimi Code CLI v0.38.0 2026 年 8 月 20 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-38-0-2026-%E5%B9%B4-8-%E6%9C%88-20-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 新增 WaitFor 工具 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%96%B0%E5%A2%9E-waitfor-%E5%B7%A5%E5%85%B7) Agent 可以在当前轮次内等待后台任务完成,无需结束轮次后再被唤起——任务一结束就能接着处理结果。→ [后台任务](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1) #### Kimi Datasource 新增 13 个数据源 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-datasource-%E6%96%B0%E5%A2%9E-13-%E4%B8%AA%E6%95%B0%E6%8D%AE%E6%BA%90) 官方数据插件新增中国政府数据(NDA/NBS)与中国标准(GB/HB/DB/TT)、八个国际组织数据集(WHO、FAO、UNSD、ECB、Eurostat、UNICEF、OECD、FRED)、新华财经和财新,在 `/plugins` 的 Official 标签页更新插件即可使用。→ [Kimi Datasource](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-datasource) 此外:Edit 和 Write 现在要求先读取已存在的文件再进行修改;过长的 `!` Shell 命令输出会自动折叠,按 ctrl+o 可与工具输出一起展开。 Kimi Code CLI v0.37.0 2026 年 8 月 18 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-37-0-2026-%E5%B9%B4-8-%E6%9C%88-18-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 单条提示词激活多个 Skill [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%8D%95%E6%9D%A1%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%BF%80%E6%B4%BB%E5%A4%9A%E4%B8%AA-skill) 在输入框空白后输入 `/` 即可插入 skill 标记,一条提示词里可以同时激活多个 skill。Agent 忙碌时输入的 skill 斜杠命令也会排队执行,不再被直接拒绝。→ [调用 Skill](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E8%B0%83%E7%94%A8-skill) #### Web 会话管理升级 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86%E5%8D%87%E7%BA%A7) 侧边栏新增 Open / Done / Workspaces 标签页,会话可标记为 Done,并新增独立的会话管理页面;搜索对话框现在也能直接搜索工作区并滚动定位。→ [在网页中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html) #### Windows 原生 CLI 自动更新 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#windows-%E5%8E%9F%E7%94%9F-cli-%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0) Windows 单文件版 CLI 现在支持自动更新,无需手动下载替换。 此外:聊天消息中 @提及的文件、文件夹和 skill 渲染为图标胶囊,浏览器标签页标题显示当前工作区目录名;web 端 Subagent 面板更名为 Background Agent;0.37.1 修复了粘贴的图片和视频无法发送给模型的问题。 Kimi Code CLI v0.36.0 2026 年 8 月 13 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-36-0-2026-%E5%B9%B4-8-%E6%9C%88-13-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 子 Agent 模型池 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AD%90-agent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) 实验性的子 Agent 模型配置升级为模型池:在 `[secondary_model]` 中配置一组带描述的候选模型,主 Agent 每次派生子 Agent 时按任务从中挑选;也可以用 `/secondary-model` 或 `default_model` 固定默认模型。设置 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用。→ [subagent 模型池](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) #### 实验性全屏 TUI 模式 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AE%9E%E9%AA%8C%E6%80%A7%E5%85%A8%E5%B1%8F-tui-%E6%A8%A1%E5%BC%8F) 设置 `KIMI_CODE_TUI_FULL_SCREEN=1` 即可启用全屏 alternate-screen 界面:可滚动的 transcript 视口、鼠标选择文本、可点击链接、Ctrl-Shift-F 搜索。→ [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) #### LaTeX 公式渲染 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#latex-%E5%85%AC%E5%BC%8F%E6%B8%B2%E6%9F%93) TUI 现在会把消息中的 LaTeX 数学公式(`$…$` 与 `$$…$$`)渲染为 Unicode 公式。 此外:工作区信任提示现在展示项目 MCP 的启动目标并默认拒绝信任,未信任工作区也无法再植入同名 `fd`/`stty` 可执行文件;修复 API 请求失败自动重试期间按 Ctrl+C 无反应的问题。 Kimi Code CLI v0.35.0 2026 年 8 月 12 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-35-0-2026-%E5%B9%B4-8-%E6%9C%88-12-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 内置插件市场新增 Modern Web Guidance [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%86%85%E7%BD%AE%E6%8F%92%E4%BB%B6%E5%B8%82%E5%9C%BA%E6%96%B0%E5%A2%9E-modern-web-guidance) 运行 `/plugins` 选择 Modern Web Guidance 即可安装,获取现代 Web 开发指导。→ [插件](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) #### `/tasks` 面板实时展示后台子 Agent 进度 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#tasks-%E9%9D%A2%E6%9D%BF%E5%AE%9E%E6%97%B6%E5%B1%95%E7%A4%BA%E5%90%8E%E5%8F%B0%E5%AD%90-agent-%E8%BF%9B%E5%BA%A6) 后台子 Agent 的工作进展现在会实时显示在 `/tasks` 面板中,无需等待完成即可掌握进度。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 此外:修复压缩后 token 计数远低于实际上下文大小的问题,现在与会话运行期间显示的数字一致;修复 coder 子 Agent 默认继续派发子 Agent 的问题。 Kimi Code CLI v0.34.0 2026 年 8 月 6 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-34-0-2026-%E5%B9%B4-8-%E6%9C%88-6-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### Kimi Computer Use 支持 Windows [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-computer-use-%E6%94%AF%E6%8C%81-windows) Kimi Computer Use 新增 Windows x64 支持(Windows 10 1903+ / Windows 11),在 `/plugins` 的 Official 标签页回车即可安装。→ [Kimi Computer Use](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-computer-use) #### 缓存过期提醒 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%BC%93%E5%AD%98%E8%BF%87%E6%9C%9F%E6%8F%90%E9%86%92) 恢复长时间未活动的会话、或长时间空闲后发送消息时,会提醒上下文缓存可能已过期,可选择先压缩或新建会话;将 [`cache_expiry_hint`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tui-toml) 设为 `false` 可关闭。 #### `kimi web` 稳定性与体验增强 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-web-%E7%A8%B3%E5%AE%9A%E6%80%A7%E4%B8%8E%E4%BD%93%E9%AA%8C%E5%A2%9E%E5%BC%BA) 模型请求失败时会话内保留失败卡片,可一键恢复;侧边栏会话列表新增平铺视图;子 Agent 任务显示所用模型与思考等级;自动重试期间工作状态显示重试进度(第 N/M 次)。 此外:安装 Kimi WebBridge 后会显示浏览器扩展链接与激活步骤;支持读取 UTF-16 编码的文本文件;`/feedback` 对所有已登录用户开放;修复 `kimi -p` 未等待后台任务与子 Agent 完成就退出的问题;修复移除 MCP server 会破坏进行中会话的问题(其工具保留可见,调用返回移除提示)。 Kimi Code CLI v0.33.0 2026 年 8 月 5 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-33-0-2026-%E5%B9%B4-8-%E6%9C%88-5-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 官方内置插件:Kimi Computer Use 与 Kimi WebBridge [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AE%98%E6%96%B9%E5%86%85%E7%BD%AE%E6%8F%92%E4%BB%B6-kimi-computer-use-%E4%B8%8E-kimi-webbridge) `/plugins` 市场的 Official 标签页新增两个官方内置能力,回车即可一键部署托管运行时,安装中断后可重试,升级时自动备份旧版 WebBridge 技能。→ [安装与管理](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E7%AE%A1%E7%90%86) #### 默认启用 agent-core-v2 引擎 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%BB%98%E8%AE%A4%E5%90%AF%E7%94%A8-agent-core-v2-%E5%BC%95%E6%93%8E) 交互式 TUI、`kimi -p`、`kimi acp` 等 CLI 界面默认运行在 agent-core-v2 引擎上;如遇问题,设置 `KIMI_CODE_LEGACY_FLAG=1` 可回退旧引擎。→ [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) #### `kimi web` 界面增强 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-web-%E7%95%8C%E9%9D%A2%E5%A2%9E%E5%BC%BA) web 端支持在设置中添加和管理自定义供应商,侧边栏可将会话置顶,会话标题支持设置 emoji,并显示登录账号信息与套餐用量。 此外:新增 `/bug` 命令作为 `/feedback` 的别名;启动时询问是否信任当前文件夹;修复 MCP OAuth 重新授权总是因 `Invalid redirect URI` 失败的问题。 Kimi Code CLI v0.32.0 2026 年 8 月 4 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-32-0-2026-%E5%B9%B4-8-%E6%9C%88-4-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 四个新的 hook 事件 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%9B%9B%E4%B8%AA%E6%96%B0%E7%9A%84-hook-%E4%BA%8B%E4%BB%B6) 新增 `TurnStarted`、`UserPromptQueued`、`TaskStarted` 和 `SessionHeartbeat` 四个 hook 事件,在 `config.toml` 的 `[[hooks]]` 下配置,即可监听回合开始、用户输入排队、子任务启动与会话心跳。→ [事件一览](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E4%B8%80%E8%A7%88) #### `loop_control` 配置键改名 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#loop-control-%E9%85%8D%E7%BD%AE%E9%94%AE%E6%94%B9%E5%90%8D) `max_retries_per_step` 改为 `max_attempts_per_step`,`max_steps_per_run` 改为 `max_steps_per_turn`;旧键不再生效,启动时会有改名警告,请及时更新配置。→ [loop\_control](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#loop-control) #### 本地估算 token 用量 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%9C%AC%E5%9C%B0%E4%BC%B0%E7%AE%97-token-%E7%94%A8%E9%87%8F) 新增 `[token_counting]` 配置节:供应商不上报 token 用量时,可将上下文大小显示切换为本地估算。→ [token\_counting](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#token-counting) 此外:models.dev 目录不可达时回退到内置快照,离线或网络受限时也能导入已知第三方供应商;修复上下文自动压缩因请求过大反复重试直至失败的问题。 Kimi Code CLI v0.31.0 2026 年 7 月 30 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-31-0-2026-%E5%B9%B4-7-%E6%9C%88-30-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 插件可贡献自定义 Agent [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%8F%92%E4%BB%B6%E5%8F%AF%E8%B4%A1%E7%8C%AE%E8%87%AA%E5%AE%9A%E4%B9%89-agent) Plugin 现在可以携带自己的 Agent:在 manifest 的 `agents` 字段声明目录,或直接在插件根下放置 `agents/` 目录,其中的 Agent 文件会在插件启用期间被主 Agent 自动发现并用于子 Agent 委派。→ [插件 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6-agent) #### 插件可向系统提示词注入指令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%8F%92%E4%BB%B6%E5%8F%AF%E5%90%91%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%E6%8C%87%E4%BB%A4) `kimi.plugin.json` 新增 `systemPrompt` 与 `systemPromptPath` 字段,插件启用期间可向 Agent 的系统提示词提供指令,TUI、`kimi -p` 与 `kimi web` 均生效。→ [系统提示词指令](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%8C%87%E4%BB%A4) #### TUI 支持 Markdown 定义的自定义 Agent [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#tui-%E6%94%AF%E6%8C%81-markdown-%E5%AE%9A%E4%B9%89%E7%9A%84%E8%87%AA%E5%AE%9A%E4%B9%89-agent) 此前仅限 `kimi web` 的 Markdown Agent 文件,现在在 TUI 中同样可用:Frontmatter 声明名称、描述与工具权限,正文即系统提示词。→ [自定义 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) 此外:新增 `/secondary_model` 斜杠命令,可配置子 Agent 使用的辅助模型(实验性功能,需先在 `/experiments` 中开启);TaskOutput 工具改为始终非阻塞并立即返回快照,后台任务完成仍会通过自动通知送达。 Kimi Code CLI v0.30.0 2026 年 7 月 29 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-30-0-2026-%E5%B9%B4-7-%E6%9C%88-29-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 自定义底部状态栏 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%BA%95%E9%83%A8%E7%8A%B6%E6%80%81%E6%A0%8F) `tui.toml` 新增 `[status_line]` 配置:用 `items` 排列内置槽位(模式、目标、模型、任务、Git 等),或用 `command` 接入自定义状态栏命令,底部信息栏随心定制。→ [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tui-toml) #### 额度耗尽立即报错 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%A2%9D%E5%BA%A6%E8%80%97%E5%B0%BD%E7%AB%8B%E5%8D%B3%E6%8A%A5%E9%94%99) 账户额度或余额耗尽时,不再静默重试约 3 分钟,现在会立即报错,不再空等。 此外:安装计入套餐额度的官方插件(如 Kimi Datasource)后会显示额度说明,会话中使用的插件有可用更新时会提示运行 `/plugins` 升级;工具调用反复无效时不再无限重试,会终止当前回合。 Kimi Code CLI v0.29.1 2026 年 7 月 24 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-29-1-2026-%E5%B9%B4-7-%E6%9C%88-24-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 网页搜索与网页抓取无需 OAuth [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%BD%91%E9%A1%B5%E6%90%9C%E7%B4%A2%E4%B8%8E%E7%BD%91%E9%A1%B5%E6%8A%93%E5%8F%96%E6%97%A0%E9%9C%80-oauth) v0.29.1 新增 `KIMI_WEB_SEARCH_*` 与 `KIMI_WEB_FETCH_*` 环境变量,可直接配置网页搜索和网页抓取服务,无需 OAuth 登录。→ [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E8%BF%90%E8%A1%8C%E6%97%B6%E5%BC%80%E5%85%B3) #### 全局默认 MCP 服务器超时 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%85%A8%E5%B1%80%E9%BB%98%E8%AE%A4-mcp-%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%B6%85%E6%97%B6) `config.toml` 与环境变量现支持配置全局默认 MCP 服务器超时时间,无需逐个 server 设置。→ [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#mcp) 此外:新增实验性子 Agent 辅助模型绑定;修复部分 OpenAI 兼容端点因 reasoning 字段名不一致导致思考内容丢失的问题。 Kimi Code CLI v0.29.0 2026 年 7 月 22 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-29-0-2026-%E5%B9%B4-7-%E6%9C%88-22-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Web:Markdown 文件定义 Agent [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-markdown-%E6%96%87%E4%BB%B6%E5%AE%9A%E4%B9%89-agent) 现在可以用 Markdown 文件定义自己的 Agent:顶部 Frontmatter 声明名称、描述和工具权限,正文就是系统提示词。自定义 Agent 会被主 Agent 自动发现,与内置子 Agent 并列委派。→ [Agent 与子 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) #### Web:SYSTEM.md 永久覆盖主 Agent 系统提示词 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-system-md-%E6%B0%B8%E4%B9%85%E8%A6%86%E7%9B%96%E4%B8%BB-agent-%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) 把 `$KIMI_CODE_HOME/SYSTEM.md` 写成纯 Markdown 即可永久覆盖默认主 Agent 的系统提示词,无需每次启动都传 `--agent` 或 `--agent-file`;显式传入的 Agent 文件仍会优先。→ [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E7%94%A8-system-md-%E8%A6%86%E7%9B%96-main-agent-%E7%9A%84%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) #### 配置文件统一开关工具 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%BB%9F%E4%B8%80%E5%BC%80%E5%85%B3%E5%B7%A5%E5%85%B7) `config.toml` 新增 `[tools]` 配置,可在所有会话中统一启用或禁用指定工具,避免每次手动调整。→ [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tools) 此外:附加到提示词的视频现在会随提示词一起送达模型;ACP 客户端也支持选择思考强度;v0.29.1 新增网页搜索与网页抓取服务的环境变量配置(无需 OAuth 登录),并支持在 `config.toml` 中配置全局默认 MCP 服务器超时时间。 Kimi Code CLI v0.28.0 2026 年 7 月 20 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-28-0-2026-%E5%B9%B4-7-%E6%9C%88-20-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### `kimi web` 改为前台运行,`kimi server` 整体废弃 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-web-%E6%94%B9%E4%B8%BA%E5%89%8D%E5%8F%B0%E8%BF%90%E8%A1%8C-kimi-server-%E6%95%B4%E4%BD%93%E5%BA%9F%E5%BC%83) `kimi web` 现在在当前终端前台运行并自动打开浏览器,按 `Ctrl+C` 即可停止;旧的 `kimi server` 命令树已整体废弃,相关子命令均已移除,仅保留 `kimi server kill` 作为停止 0.28.0 之前后台服务的回退。→ [kimi web](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) #### 思考强度持久化更保守 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%80%9D%E8%80%83%E5%BC%BA%E5%BA%A6%E6%8C%81%E4%B9%85%E5%8C%96%E6%9B%B4%E4%BF%9D%E5%AE%88) 模型切换后,思考强度设置现在仅保留低于该模型最高档(`max`)的档位,避免因旧 `max` 值不被支持而出现空白或无响应的选择器。→ [模型配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 此外:Web 模型切换器现在会提示切换模型或思考强度将使已有提示词缓存失效;修正了 YOLO 与 Auto 权限模式的描述,明确 YOLO 自动批准工具但仍可能提问,而 Auto 完全自主、不会提问。 Kimi Code CLI v0.27.0 2026 年 7 月 17 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-27-0-2026-%E5%B9%B4-7-%E6%9C%88-17-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### `/copy` 复制上一条回复 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#copy-%E5%A4%8D%E5%88%B6%E4%B8%8A%E4%B8%80%E6%9D%A1%E5%9B%9E%E5%A4%8D) 新增 `/copy` 斜杠命令,一键把上一条 AI 回复复制到剪贴板,长答案不必再手动选中。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) #### API Key 用户自动拉取最新模型列表 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#api-key-%E7%94%A8%E6%88%B7%E8%87%AA%E5%8A%A8%E6%8B%89%E5%8F%96%E6%9C%80%E6%96%B0%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8) 使用 API key 调用 Kimi 编程模型时,Kimi Code 现在会自动拉取最新模型列表,新模型上线后无需手动改配置即可使用。→ [模型配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 此外:OAuth 连接失败时显示底层网络原因(DNS、连接被拒、TLS、超时),不再是笼统的 `fetch failed`;修复内置 URL 抓取工具的网络防护缺陷,恶意构造的域名与重定向链无法再访问回环地址或内网服务。 模型发布 Kimi K3 2026 年 7 月 16 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-k3-2026-%E5%B9%B4-7-%E6%9C%88-16-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- 我们迄今能力最强的模型 **Kimi K3** 正式发布并开源,现已接入 Kimi Code。 #### 模型规模与架构 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%A8%A1%E5%9E%8B%E8%A7%84%E6%A8%A1%E4%B8%8E%E6%9E%B6%E6%9E%84) 2.8 万亿参数,基于 KDA 混合线性注意力机制与 Attention Residuals 构建,是全球首个开源的 3 万亿级别模型。 #### 长上下文与多模态 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%95%BF%E4%B8%8A%E4%B8%8B%E6%96%87%E4%B8%8E%E5%A4%9A%E6%A8%A1%E6%80%81) 原生支持视觉理解,最高 100 万 token 上下文窗口,可处理大规模代码库与长程连贯推理。 #### 编程与 Agent 优势 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%BC%96%E7%A8%8B%E4%B8%8E-agent-%E4%BC%98%E5%8A%BF) 尤其擅长长程编程、游戏 / 3D 与知识类任务;在极少人工监督下即可持续完成长时间工程任务,在 Kernel 优化、GPU 编译器、芯片设计、科研编程等复杂场景中表现出色。 #### 对比表现 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AF%B9%E6%AF%94%E8%A1%A8%E7%8E%B0) 整体能力稳居第一梯队,已稳定超过 Opus 4.8、GPT 5.5 等主流模型;在 Kernel 优化等高难度编程任务中,表现接近当前最强闭源模型。 #### 会员权限 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BC%9A%E5%91%98%E6%9D%83%E9%99%90) Moderato 及以上会员可调用 Kimi K3,Allegretto 及以上会员可解锁 100 万上下文。K3 支持 `low` / `high` / `max` 三档思考强度,可按任务复杂度自由切换。→ [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) #### 使用建议 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BD%BF%E7%94%A8%E5%BB%BA%E8%AE%AE) 切换模型会使已建立的上下文缓存失效,刚切换时消耗会偏高;建议开启新会话再使用 Kimi K3,效果更好、消耗更少。 Kimi Code CLI v0.26.0 2026 年 7 月 16 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-26-0-2026-%E5%B9%B4-7-%E6%9C%88-16-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### coder 子 Agent 能力对齐主 Agent [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#coder-%E5%AD%90-agent-%E8%83%BD%E5%8A%9B%E5%AF%B9%E9%BD%90%E4%B8%BB-agent) coder 子 Agent 现在支持后台任务、待办列表、Plan 模式、Skill 调用与嵌套 Agent,可独立完成更复杂的编码工作流。→ [Agent 与子 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) #### `/model` 与 `/effort` 切换缓存提示 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#model-%E4%B8%8E-effort-%E5%88%87%E6%8D%A2%E7%BC%93%E5%AD%98%E6%8F%90%E7%A4%BA) 切换模型或思考程度时会提示已有提示词缓存失效,并建议通过 `/new` 新开会话避免额外 token 开销。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 此外:修复了上下文大小指示器低估模型实际上下文用量的问题;恢复的会话没有新活动时不再被错误标记为刚更新。 Kimi Code CLI v0.25.0 2026 年 7 月 16 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-25-0-2026-%E5%B9%B4-7-%E6%9C%88-16-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Web 聊天支持任意附件 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E8%81%8A%E5%A4%A9%E6%94%AF%E6%8C%81%E4%BB%BB%E6%84%8F%E9%99%84%E4%BB%B6) 内置 Web UI 的聊天现在支持附加任意类型文件:直接将文件拖放到窗口任意位置即可发送,文件、图片、视频都会以附件标签显示在消息气泡中。→ [在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) #### 对齐 Anthropic 官方 effort 配置 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AF%B9%E9%BD%90-anthropic-%E5%AE%98%E6%96%B9-effort-%E9%85%8D%E7%BD%AE) Anthropic 兼容供应商现在应用官方 effort 配置,未知模型回退到 128k 输出上限,自定义命名模型新会话的思考强度控制也更准确。→ [平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 此外:模型请求失败时会展示完整诊断信息;修复了 Web 服务器 bearer token 校验可被百分号编码路径绕过、以及会话文件系统 API 可跟随工作区外符号链接导致越权访问的两个安全问题。 Kimi Code CLI v0.24.2 2026 年 7 月 15 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-24-2-2026-%E5%B9%B4-7-%E6%9C%88-15-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 内置文档问答 Skill [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%86%85%E7%BD%AE%E6%96%87%E6%A1%A3%E9%97%AE%E7%AD%94-skill) 新增内置 `/check-kimi-code-docs`:直接依据官方文档回答 Kimi Code 的产品问题(CLI 用法、配置、会员、错误码),并在答案中附上来源链接,不确定的用法不必再离开终端翻文档。→ [内置 Skill 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E5%86%85%E7%BD%AE-skill-%E5%91%BD%E4%BB%A4) 此外:每步 LLM 调用的重试上限从 3 次提高到 10 次,供应商侧 429 / 过载等临时失败会在整轮失败前自动重试;print 模式(`kimi -p`)也不再跑完一轮就退出,只要还有未完成的后台任务就保持运行、把结果回馈给主 Agent 继续处理(`print_background_mode` 默认 `steer`,后台任务与子 Agent 默认不再超时)。 Kimi Code CLI v0.24.0 2026 年 7 月 14 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-24-0-2026-%E5%B9%B4-7-%E6%9C%88-14-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 会话导出 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BC%9A%E8%AF%9D%E5%AF%BC%E5%87%BA) Web 界面新增会话导出:运行 `/export` 或在会话的更多菜单中选择「导出会话」,即可将会话内容与故障排查日志打包为 ZIP 下载(上限 64 MiB),便于存档或反馈问题。→ [导出会话](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E5%AF%BC%E5%87%BA%E4%BC%9A%E8%AF%9D) #### 前台命令超时后转入后台 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%89%8D%E5%8F%B0%E5%91%BD%E4%BB%A4%E8%B6%85%E6%97%B6%E5%90%8E%E8%BD%AC%E5%85%A5%E5%90%8E%E5%8F%B0) 前台 `Bash` 命令触及超时后不再被直接终止,而是自动转入后台继续运行,完成时回报结果,长耗时命令不会再半途丢失。如需恢复超时即终止的行为,将 `[background]` 的 `bash_auto_background_on_timeout` 设为 `false`。→ [内置工具 · Shell](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#shell) 此外:会话 fork 现在完整保留媒体附件、plan 文件、后台任务输出与 cron 任务,fork 失败也不再留下残缺副本;`kimi web` 默认切换到重构后的 Agent 引擎。 Kimi Code 高速版 & 加油包上线 2026 年 7 月 9 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%AB%98%E9%80%9F%E7%89%88-%E5%8A%A0%E6%B2%B9%E5%8C%85%E4%B8%8A%E7%BA%BF-2026-%E5%B9%B4-7-%E6%9C%88-9-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #### ⚡ 高速版正式上线 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E2%9A%A1-%E9%AB%98%E9%80%9F%E7%89%88%E6%AD%A3%E5%BC%8F%E4%B8%8A%E7%BA%BF) Kimi Code 现提供**普通版**与**高速版**两档:同一模型、编码能力一致,高速版**输出速度约为普通版的 5–6 倍**。CLI 内输入 `/model` 一键切换,第三方工具将 model ID 配置为 `kimi-for-coding-highspeed` 即可。高速版需订阅 [Allegretto](https://www.kimi.com/membership/pricing?from=kfc_membership_topbar&track_id=a7764d49-73ad-4d08-b2f3-a8d7433917f8) 及以上档位会员。→ [如何切换模型](https://www.kimi.com/code/docs/kimi-code/models.html#switch-model) #### 加油包(Extra Usage)上线 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%8A%A0%E6%B2%B9%E5%8C%85-extra-usage-%E4%B8%8A%E7%BA%BF) 订阅额度用尽后,可用加油包余额继续发起请求,**无视会员的月 / 周 / 小时额度限制**——任意额度触顶时都能用,使用时只扣加油包余额,不影响会员额度刷新。仅订阅会员可开启,入口在 Kimi 主页 → 设置 → 会员计划 → 我的额度。→ [了解加油包](https://www.kimi.com/code/docs/kimi-code/membership.html#extra-usage) Kimi Code CLI v0.23.0 2026 年 7 月 6 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-23-0-2026-%E5%B9%B4-7-%E6%9C%88-6-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 已归档会话 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%B7%B2%E5%BD%92%E6%A1%A3%E4%BC%9A%E8%AF%9D) Web 界面新增「已归档会话」页面,可浏览并一键恢复已归档的会话,前往「设置 → 已归档」即可查看。 #### 思考内容跨轮次保留 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%80%9D%E8%80%83%E5%86%85%E5%AE%B9%E8%B7%A8%E8%BD%AE%E6%AC%A1%E4%BF%9D%E7%95%99) Kimi 模型开启 Thinking 时,现在默认在多轮之间保留推理内容,让模型延续此前的思路;如需关闭,可设置 `[thinking] keep = "off"`。→ [模型配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#thinking) #### 压缩摘要一键查看 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%8E%8B%E7%BC%A9%E6%91%98%E8%A6%81%E4%B8%80%E9%94%AE%E6%9F%A5%E7%9C%8B) 上下文压缩完成后,TUI 会显示本次压缩摘要;按 `Ctrl-O` 即可在压缩块中显示或隐藏摘要,与折叠工具输出共用同一快捷键。→ [交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E6%B5%81%E5%BC%8F%E8%BE%93%E5%87%BA%E6%9C%9F%E9%97%B4) 此外:新增实验性的按需工具加载(`select_tools`),开启 `tool-select` 标志后,支持的模型会按需加载 MCP 工具而非每次发送全部,以保留供应商的 prompt cache;并修复了会话已存在于磁盘却在列表中缺失、或直接访问返回 404 的问题,服务器现在会在启动时重建会话索引。 Kimi Code CLI v0.22.0 2026 年 7 月 2 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-22-0-2026-%E5%B9%B4-7-%E6%9C%88-2-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 自动压缩超大图片 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%87%AA%E5%8A%A8%E5%8E%8B%E7%BC%A9%E8%B6%85%E5%A4%A7%E5%9B%BE%E7%89%87) 上传的图片若超过模型限制,Kimi Code 会在送达模型前自动降采样并重新编码,降低视觉 token 成本,同时避免供应商因图片过大而报错。 #### 模型配置覆盖 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%A8%A1%E5%9E%8B%E9%85%8D%E7%BD%AE%E8%A6%86%E7%9B%96) 新增 `[models."".overrides]` 配置项,可覆盖供应商刷新后的模型元数据(如思考强度档位、默认 effort 等),让自定义模型配置在刷新后仍然生效。→ [模型配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E6%A8%A1%E5%9E%8B%E8%A6%86%E7%9B%96%E9%A1%B9) #### Web UI 全新设计系统 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-ui-%E5%85%A8%E6%96%B0%E8%AE%BE%E8%AE%A1%E7%B3%BB%E7%BB%9F) 内置 web 界面采用新的设计系统,包括更新的配色、字体排版、间距、明暗调色板,以及更细腻的进入/退出与展开/折叠动画,整体视觉和交互更统一。 此外:新增 Cmd/Ctrl+K 会话搜索面板,可按标题、工作区和最近提示词快速定位会话;连续工具调用现在会归组为可折叠堆栈,diff 行数与图片/视频/音频结果都能更紧凑地展示。 Kimi Code CLI v0.21.0 2026 年 7 月 1 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-21-0-2026-%E5%B9%B4-7-%E6%9C%88-1-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 插件可提供斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%8F%92%E4%BB%B6%E5%8F%AF%E6%8F%90%E4%BE%9B%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) 插件现可在 manifest 的 `commands` 字段中声明斜杠命令,注册为 `:` 形式,调用时展开 `$ARGUMENTS`,无需额外配置就能把常用工作流做成命令。→ [插件斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) #### Web 聊天支持 Mermaid 图表 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E8%81%8A%E5%A4%A9%E6%94%AF%E6%8C%81-mermaid-%E5%9B%BE%E8%A1%A8) 助手回复中的 `mermaid` 代码块会在内置 web UI 中渲染为图表;KaTeX 数学公式与 Mermaid 的解析改到 Web Worker 执行,流式输出时界面更跟手。 Kimi Code CLI v0.20.2 2026 年 6 月 29 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-20-2-2026-%E5%B9%B4-6-%E6%9C%88-29-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 视频输入与 Anthropic 兼容协议 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%A7%86%E9%A2%91%E8%BE%93%E5%85%A5%E4%B8%8E-anthropic-%E5%85%BC%E5%AE%B9%E5%8D%8F%E8%AE%AE) Kimi Code 现已支持 Anthropic 兼容协议;配合 `ReadMediaFile` 工具,可将视频作为多模态内容发送给具备视觉能力的模型,能力随模型的 `image_in` / `video_in` 而定。→ [内置工具](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E6%96%87%E4%BB%B6%E7%B1%BB) #### Web 完成提示音与通知 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E5%AE%8C%E6%88%90%E6%8F%90%E7%A4%BA%E9%9F%B3%E4%B8%8E%E9%80%9A%E7%9F%A5) 内置 web UI 新增完成提示音、完成通知与问题通知,并在设置中分别提供开关。问题通知默认关闭,仅在你主动开启后,才会把问题文本推送到桌面。 #### 自定义出站请求头 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%87%BA%E7%AB%99%E8%AF%B7%E6%B1%82%E5%A4%B4) 新增 `KIMI_CODE_CUSTOM_HEADERS` 环境变量,可为出站 LLM 请求自定义请求头(按行写 `Name: Value`),并会向非 Kimi 供应商发送 `User-Agent` 请求头。 此外:遇到供应商 413 上下文溢出时,现在会先压缩再重试以恢复,并默认将压缩输出限制在 128k token,避免触发供应商的 `max_tokens` 错误。 Kimi Code CLI v0.20.0 2026 年 6 月 26 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-20-0-2026-%E5%B9%B4-6-%E6%9C%88-26-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Shell 模式 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#shell-%E6%A8%A1%E5%BC%8F) 在输入框中键入 `!` 即可进入 Shell 模式,不离开对话就能运行终端命令,输出会写入上下文供后续轮次使用;对于长时间运行的命令,按 `Ctrl+B` 可将其移至后台。例如运行 `!gh auth login` 登录 GitHub CLI,无需新开终端。→ [Shell 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#shell-%E6%A8%A1%E5%BC%8F) #### 将 Web 服务暴露到互联网 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%B0%86-web-%E6%9C%8D%E5%8A%A1%E6%9A%B4%E9%9C%B2%E5%88%B0%E4%BA%92%E8%81%94%E7%BD%91) `kimi web` 新增 `--host` 选项,可将 web 服务器暴露到本机以外,并配套加固了 token 鉴权、限流等安全措施,便于在远程机器上访问会话界面。→ [kimi web](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) #### 全新的插件管理面板 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%85%A8%E6%96%B0%E7%9A%84%E6%8F%92%E4%BB%B6%E7%AE%A1%E7%90%86%E9%9D%A2%E6%9D%BF) `/plugins` 重新设计为单个标签页面板:**Installed** 管理已安装插件、**Official** 浏览 Kimi 官方 marketplace、**Third-party** 浏览第三方 marketplace、**Custom** 从 GitHub URL、zip 或本地路径安装,用 `Tab` / `Shift-Tab` 切换;安装第三方插件前会先弹出确认提示。→ [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E7%AE%A1%E7%90%86) 此外:修复了 Linux 上由原生剪贴板错误导致的启动崩溃;`/reload` 现在会刷新插件 Skill,使插件变更在当前会话即时生效,无需新开会话。 Kimi Code CLI v0.19.0 2026 年 6 月 22 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-19-0-2026-%E5%B9%B4-6-%E6%9C%88-22-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 额外工作区目录 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%A2%9D%E5%A4%96%E5%B7%A5%E4%BD%9C%E5%8C%BA%E7%9B%AE%E5%BD%95) 现在可以为会话添加工作目录之外的额外目录:用 `/add-dir ` 添加到当前会话,或在启动时用 `kimi --add-dir ` 添加。选择"记住此目录"时,路径会写入项目级的 `.kimi-code/local.toml`,在该项目的每个会话中自动生效。→ [项目级本地配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%A1%B9%E7%9B%AE%E7%BA%A7%E6%9C%AC%E5%9C%B0%E9%85%8D%E7%BD%AE) #### 后台任务 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1) 用 `Ctrl+B` 可将长时间运行的前台命令和子 Agent 转入后台,腾出会话继续操作,并通过 `/tasks` 面板查看它们的状态。→ [会话管理](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86) 此外:现在会显示供应商安全策略拦截,而非静默当作已完成轮次;并优化了文件提及体验。 Kimi Code CLI v0.18.0 2026 年 6 月 18 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-18-0-2026-%E5%B9%B4-6-%E6%9C%88-18-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Web 会话筛选与懒加载 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#web-%E4%BC%9A%E8%AF%9D%E7%AD%9B%E9%80%89%E4%B8%8E%E6%87%92%E5%8A%A0%E8%BD%BD) Web 侧边栏新增会话筛选,可按标题和最近一条用户提示词过滤;聊天视图在向上滚动时懒加载更早的消息,浏览长会话更顺畅。→ [kimi web](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) #### 限制 AgentSwarm 初始并发 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%99%90%E5%88%B6-agentswarm-%E5%88%9D%E5%A7%8B%E5%B9%B6%E5%8F%91) 新增 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 环境变量,可限制 AgentSwarm 在初始提速阶段同时运行的子 Agent 数量,让大型 swarm 更不容易触发供应商的速率限制。→ [运行时开关](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E8%BF%90%E8%A1%8C%E6%97%B6%E5%BC%80%E5%85%B3) 此外:修复了 web 应用此前只加载最近 20 个会话的问题;web 设置中现在会显示当前版本。 Kimi Code CLI v0.17.0 2026 年 6 月 17 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-17-0-2026-%E5%B9%B4-6-%E6%9C%88-17-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### Kimi Code Web 模式 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-code-web-%E6%A8%A1%E5%BC%8F) 新增 Web 模式,可通过 `kimi web` 或 CLI 内的 `/web` 启动,在浏览器的聊天界面中继续当前会话。`kimi web` 是 `kimi server run --open` 的别名——后台启动本地服务并自动打开 web UI。→ [kimi web](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) 此外:当 OAuth token 刷新在内部重试后仍失败时,显示底层连接错误而不是误提示重新登录;并修复了 `kimi web` 无法在后台启动的问题(v0.17.1)。 Kimi Code CLI v0.16.0 2026 年 6 月 16 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-16-0-2026-%E5%B9%B4-6-%E6%9C%88-16-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### `kimi vis` 会话可视化 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-vis-%E4%BC%9A%E8%AF%9D%E5%8F%AF%E8%A7%86%E5%8C%96) 新增内置的 `kimi vis` 命令,在浏览器中启动会话可视化工具并指向本地会话,直观查看一次会话的全过程。支持 `--port`/`--host`、`--no-open`,以及用 `kimi vis ` 直接深链到指定会话。→ [kimi vis](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-vis) 此外:阻止 Anthropic 兼容供应商读取环境中的 Anthropic shell 凭证和自定义 header,避免凭证意外泄漏;修复上下文仍超过阻塞阈值时的重复压缩问题。 Kimi Code CLI v0.15.0 2026 年 6 月 15 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-15-0-2026-%E5%B9%B4-6-%E6%9C%88-15-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 全会话选择器 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%85%A8%E4%BC%9A%E8%AF%9D%E9%80%89%E6%8B%A9%E5%99%A8) 新增跨工作目录的全会话选择器视图,支持按名称搜索、分页浏览,并能为其他工作目录中的会话一键生成可复制的恢复命令,找回历史会话更顺手。 #### 推理过程跟随用户语言 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%8E%A8%E7%90%86%E8%BF%87%E7%A8%8B%E8%B7%9F%E9%9A%8F%E7%94%A8%E6%88%B7%E8%AF%AD%E8%A8%80) 同语言规则现已扩展到模型的推理过程,思考内容会跟随你使用的语言,同时保留代码和技术术语的原始形式。 此外:MCP 新增对旧式 SSE server 的支持,与 stdio、streamable HTTP 传输并存(→ [接入方式](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E6%8E%A5%E5%85%A5%E6%96%B9%E5%BC%8F) );窄终端下 TUI 组件会自动换行、压缩或截断超宽内容,避免布局错乱。 模型发布 Kimi K2.7 Code 2026 年 6 月 12 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-k2-7-code-2026-%E5%B9%B4-6-%E6%9C%88-12-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------------------------- 我们最新的代码模型 **Kimi K2.7 Code** 正式发布并开源,现已在 Kimi For Coding 中上线,新模型仅在 Thinking On(开启思考模式)状态下生效。 #### 编码与智能体能力较 K2.6 全面提升 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%BC%96%E7%A0%81%E4%B8%8E%E6%99%BA%E8%83%BD%E4%BD%93%E8%83%BD%E5%8A%9B%E8%BE%83-k2-6-%E5%85%A8%E9%9D%A2%E6%8F%90%E5%8D%87) Program-Bench 提升 10.4%,MCP Mark Verified 提升 11.4%,SWE Marathon 提升 76.2%。 #### 推理效率 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%8E%A8%E7%90%86%E6%95%88%E7%8E%87) 改善过度思考问题,推理 token 用量较 K2.6 降低 30%。 #### 长程编码 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E9%95%BF%E7%A8%8B%E7%BC%96%E7%A0%81) 指令遵循能力提升,端到端编码任务成功率更高。 #### ⚡ Kimi K2.7 Code 高速版(即将开始内测) [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E2%9A%A1-kimi-k2-7-code-%E9%AB%98%E9%80%9F%E7%89%88-%E5%8D%B3%E5%B0%86%E5%BC%80%E5%A7%8B%E5%86%85%E6%B5%8B) 同一个模型,输出速度约为普通版的 5-6 倍。 Kimi Code CLI v0.14.0 2026 年 6 月 10 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-14-0-2026-%E5%B9%B4-6-%E6%9C%88-10-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### `Interrupt` hook 事件 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#interrupt-hook-%E4%BA%8B%E4%BB%B6) 用户中断当前轮次时(例如按下 Esc),hooks 现在能收到专门的 `Interrupt` 事件——此时 `Stop` 不再触发,由它替代,外部工具不会再误以为轮次仍在运行。超时等程序性中断不会触发该事件。→ [事件一览](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E4%B8%80%E8%A7%88) #### Kimi Datasource 新增法律法规数据 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-datasource-%E6%96%B0%E5%A2%9E%E6%B3%95%E5%BE%8B%E6%B3%95%E8%A7%84%E6%95%B0%E6%8D%AE) 官方数据插件升级到 v3.2.0,新增中国法律法规与司法案例查询,现已覆盖股票行情、宏观经济、企业工商、学术文献、法律法规五大数据源。→ [插件介绍](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-datasource) 此外:修复了 OpenAI 兼容 Chat Completions 下工具输出中的图像丢失问题;v0.13.1 起 `/undo` 不带参数会打开交互式选择器,按条挑选要撤销的提示词(→ [会话管理](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86) )。 Kimi Code CLI v0.13.0 2026 年 6 月 10 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-13-0-2026-%E5%B9%B4-6-%E6%9C%88-10-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------- #### 自定义颜色主题 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%9C%E8%89%B2%E4%B8%BB%E9%A2%98) 内置 dark / light 配色之外,现在可以用 JSON 文件定义自己的调色板——只写想改的颜色,其余沿用基准配色,文件名就是主题名。也可以直接运行 `/custom-theme` 让 Kimi 帮你选色、生成主题文件并写入 `~/.kimi-code/themes/`。→ [自定义主题](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html) #### `/import-from-cc-codex` 一键导入 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#import-from-cc-codex-%E4%B8%80%E9%94%AE%E5%AF%BC%E5%85%A5) 从 Claude Code 和 Codex 导入选定的指令、Skills 和 MCP 设置,迁移到 Kimi Code 不用逐项手动重配。→ [内置 Skill 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E5%86%85%E7%BD%AE-skill-%E5%91%BD%E4%BB%A4) 此外:marketplace 列表会标出已安装 plugin 的可用更新,选中按 `Enter` 即可升级(→ [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E7%AE%A1%E7%90%86) );设备登录在浏览器无法打开时保持 URL 和验证码可见。 Kimi Code CLI v0.12.0 2026 年 6 月 9 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-12-0-2026-%E5%B9%B4-6-%E6%9C%88-9-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### `/swarm` 多 Agent 并行任务 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#swarm-%E5%A4%9A-agent-%E5%B9%B6%E8%A1%8C%E4%BB%BB%E5%8A%A1) 用 `/swarm <任务>` 启动群组模式——多个 Agent 并行拆解同一目标,带实时进度展示和速率限制自动重试,任务完成后自动退出群组模式。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E6%A8%A1%E5%BC%8F%E4%B8%8E%E8%BF%90%E8%A1%8C%E6%8E%A7%E5%88%B6) #### 代理支持 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BB%A3%E7%90%86%E6%94%AF%E6%8C%81) 现在完整识别 `HTTP_PROXY`、`HTTPS_PROXY`、`ALL_PROXY`、`NO_PROXY` 标准环境变量,SOCKS 代理也可用(`socks5://`、`socks4://` 等 scheme)。本地回环地址始终直连,配置代理不会影响 localhost 上的 MCP 服务。→ [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) #### Goal / 后台问题 / Sub-Skill 正式发布 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#goal-%E5%90%8E%E5%8F%B0%E9%97%AE%E9%A2%98-sub-skill-%E6%AD%A3%E5%BC%8F%E5%8F%91%E5%B8%83) 这三项功能不再需要实验功能 flag,默认可用。微压缩(micro compaction)同步默认开启——自动清理较旧的大型工具结果,减少上下文占用;如需关闭,在 `config.toml` 中设置 `experimental.micro_compaction = false`。(该功能已于 v0.22.1 移除。) 此外:Homebrew 安装时自动用 `brew upgrade kimi-code` 更新;`KIMI_CODE_HOME` 设置后 Skills 和全局 Agent 指令从该目录加载;审批面板超长 shell 命令自动折行展示完整内容;多项 Goal 模式和 ACP 路由修复。 Kimi Code CLI v0.11.0 2026 年 6 月 5 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-11-0-2026-%E5%B9%B4-6-%E6%9C%88-5-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 内置 Skill 直接变为斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%86%85%E7%BD%AE-skill-%E7%9B%B4%E6%8E%A5%E5%8F%98%E4%B8%BA%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) 内置 Skill(如 `update-config`)现在直接出现在斜杠命令面板里,不再需要加 `skill:` 前缀——输入 `/` 即可看到,排在外部 Skill 前面。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#skill-%E5%8A%A8%E6%80%81%E5%91%BD%E4%BB%A4) #### Sub-Skill 发现机制(实验) [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#sub-skill-%E5%8F%91%E7%8E%B0%E6%9C%BA%E5%88%B6-%E5%AE%9E%E9%AA%8C) 新增实验性 Sub-Skill 系统,内置 `sub-skill.review`(审查现有 Skill)和 `sub-skill.consolidate`(将 Skill 整合为层级分组)。通过 `KIMI_CODE_EXPERIMENTAL_SUB_SKILL=1` 启用。→ [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 此外:YOLO 模式下启动 Goal 前会先确认并建议切换到 Auto 模式;子 Agent 超时后显示 resume 提示;Goal 队列修复多处 bug。 Kimi Code CLI v0.10.0 2026 年 6 月 4 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-10-0-2026-%E5%B9%B4-6-%E6%9C%88-4-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### Goal 队列 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#goal-%E9%98%9F%E5%88%97) 用 `/goal next <目标>` 提前排好后续任务,当前 Goal 完成后自动衔接,不用守着等、不用手动触发。`/goal next manage` 打开交互管理器,随时调整顺序。→ [使用目标模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) #### 实验功能面板(`/experiments`) [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AE%9E%E9%AA%8C%E5%8A%9F%E8%83%BD%E9%9D%A2%E6%9D%BF-experiments) TUI 内输入 `/experiments` 打开可视化开关面板,勾选后自动写入 `config.toml` 并重载会话,无需手改配置文件。 #### 新增内置 `update-config` Skill [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%96%B0%E5%A2%9E%E5%86%85%E7%BD%AE-update-config-skill) 现在可以让 Kimi 直接编辑它自己的配置文件了。 此外:`/reload` 修改配置后原地重载会话(→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E8%B4%A6%E5%8F%B7%E4%B8%8E%E9%85%8D%E7%BD%AE) );`kimi doctor` 一条命令校验配置文件格式(→ [kimi doctor](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-doctor) );Windows 缺少 Git Bash 时启动前提前报错。 Kimi Code CLI v0.9.0 2026 年 6 月 3 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-9-0-2026-%E5%B9%B4-6-%E6%9C%88-3-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------- #### `kimi acp` 子命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-acp-%E5%AD%90%E5%91%BD%E4%BB%A4) 通过 ACP(Agent Client Protocol)协议把 CLI 接入 IDE——Zed、JetBrains AI Chat 等编辑器可直接驱动 Kimi 的会话和工具调用,无需在浏览器或终端切换。→ [在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) #### `/btw` 旁路对话 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#btw-%E6%97%81%E8%B7%AF%E5%AF%B9%E8%AF%9D) 不打断当前主轮次的情况下开一个侧通道对话——临时提问、补充信息,Agent 的主任务不受影响。不带内容直接输入 `/btw` 会先打开面板等你输入。→ [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%BF%A1%E6%81%AF%E4%B8%8E%E7%8A%B6%E6%80%81) 此外:修复 Windows 上 `Ctrl-G` 外部编辑器调用;统一 TUI 对话框与选择器的交互体验。 Kimi Code CLI v0.8.0 2026 年 6 月 2 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-8-0-2026-%E5%B9%B4-6-%E6%9C%88-2-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------- #### 自主 Goal 模式(实验) [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E8%87%AA%E4%B8%BB-goal-%E6%A8%A1%E5%BC%8F-%E5%AE%9E%E9%AA%8C) 用 `/goal <目标>` 启动后,Kimi 会跨多个轮次持续推进同一个目标,直到完成或遇到需要你决策的阻塞。→ [自主 goal](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) #### 后台结构化提问 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%90%8E%E5%8F%B0%E7%BB%93%E6%9E%84%E5%8C%96%E6%8F%90%E9%97%AE) Agent 遇到需要你做选择的问题时,会挂到后台继续处理其他步骤,不再因为一个小问题卡住整个流程。→ [AskUserQuestion](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%8D%8F%E4%BD%9C%E7%B1%BB) #### `kimi provider` 子命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-provider-%E5%AD%90%E5%91%BD%E4%BB%A4) 在终端直接增删供应商,无需进入 TUI,适合脚本和 CI 场景。→ [kimi provider](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider) 此外:**后台自动更新**默认开启,可在 `tui.toml` 中关闭;**上下文压缩**([`/compact`](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E4%B8%8A%E4%B8%8B%E6%96%87%E5%8E%8B%E7%BC%A9) )时待办列表会附在摘要里,防止 Agent 忘记中断前的进度。 Kimi Code CLI v0.7.0 2026 年 6 月 2 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-7-0-2026-%E5%B9%B4-6-%E6%9C%88-2-%E6%97%A5) --------------------------------------------------------------------------------------------------------------------------------- #### `/provider` 交互式供应商管理器 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#provider-%E4%BA%A4%E4%BA%92%E5%BC%8F%E4%BE%9B%E5%BA%94%E5%95%86%E7%AE%A1%E7%90%86%E5%99%A8) TUI 内输入 `/provider` 打开可视化界面,查看、新增、删除供应商,切换模型不再需要手改配置文件。→ [平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#provider-%E2%80%94-%E4%BA%A4%E4%BA%92%E5%BC%8F%E4%BE%9B%E5%BA%94%E5%95%86%E7%AE%A1%E7%90%86) #### `KIMI_MODEL_ADAPTIVE_THINKING` 环境变量 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-model-adaptive-thinking-%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F) 接自定义端点时,可强制指定是否启用 adaptive thinking,不再依赖模型名自动推断。→ [模型字段](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 此外:定时任务触发时间改为按**本地时区**显示。 Kimi Code CLI v0.6.0 2026 年 5 月 29 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-6-0-2026-%E5%B9%B4-5-%E6%9C%88-29-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### `KIMI_MODEL_*` 环境变量通道 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#kimi-model-%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E9%80%9A%E9%81%93) 只需设置几个环境变量就能临时切换模型,完全不用改配置文件,重启后自动失效,适合测试或 CI 场景。→ [用环境变量定义模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8B-kimi-model) #### 从 GitHub URL 直接安装 Plugin [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BB%8E-github-url-%E7%9B%B4%E6%8E%A5%E5%AE%89%E8%A3%85-plugin) 粘贴仓库链接即可安装社区插件,支持锁定特定版本,Plugin 管理器会标注来源信任等级。→ [安装与管理](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E7%AE%A1%E7%90%86) #### 移除默认步数上限 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E7%A7%BB%E9%99%A4%E9%BB%98%E8%AE%A4%E6%AD%A5%E6%95%B0%E4%B8%8A%E9%99%90) 取消了每轮 1000 步的限制,长任务不再被强制中断。→ [loop\_control](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#loop-control) Kimi Code CLI v0.5.0 2026 年 5 月 28 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-5-0-2026-%E5%B9%B4-5-%E6%9C%88-28-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### 定时任务 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1) 用自然语言设定定时计划或一次性提醒,Kimi 到点自动执行,无需守着。→ [定时任务](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1) #### `/auto` 权限模式 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#auto-%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) 比 `/yolo` 更克制的自动化模式——工具审批自动处理,但 Agent 不会向你提问,适合无人值守但不想完全放开的场景。→ [交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) Kimi Code CLI v0.4.0 2026 年 5 月 27 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-4-0-2026-%E5%B9%B4-5-%E6%9C%88-27-%E6%97%A5) ----------------------------------------------------------------------------------------------------------------------------------- #### Plugin 系统上线 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#plugin-%E7%B3%BB%E7%BB%9F%E4%B8%8A%E7%BA%BF) 可安装携带 Skills 和 MCP server 的插件包,官方 marketplace 同步上线,Kimi Datasource 数据插件已上架。→ [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) #### 会话导出 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E4%BC%9A%E8%AF%9D%E5%AF%BC%E5%87%BA-1) 将对话记录导出为 Markdown 文件,或打包为 ZIP 提交反馈。→ [会话与上下文](https://www.kimi.com/code/docs/kimi-code-cli/guides/sessions.html#%E5%AF%BC%E5%87%BA%E4%BC%9A%E8%AF%9D) #### 权限系统重构 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#%E6%9D%83%E9%99%90%E7%B3%BB%E7%BB%9F%E9%87%8D%E6%9E%84) 工作目录外的只读操作不再触发审批,减少不必要的确认打断。→ [权限配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) Kimi Code CLI v0.2.0 – v0.3.0 2026 年 5 月 26 日 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-2-0-%E2%80%93-v0-3-0-2026-%E5%B9%B4-5-%E6%9C%88-26-%E6%97%A5) ------------------------------------------------------------------------------------------------------------------------------------------------------------- #### OpenAI 兼容推理模型开箱即用 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#openai-%E5%85%BC%E5%AE%B9%E6%8E%A8%E7%90%86%E6%A8%A1%E5%9E%8B%E5%BC%80%E7%AE%B1%E5%8D%B3%E7%94%A8) DeepSeek、Qwen、One API 等带 thinking 的模型无需额外配置即可使用。→ [openai 供应商](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#openai) #### `/logout` 支持选择供应商 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#logout-%E6%94%AF%E6%8C%81%E9%80%89%E6%8B%A9%E4%BE%9B%E5%BA%94%E5%95%86) 退出时弹出选择器,避免误退出其他供应商的登录态。 #### `/connect` 命令 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#connect-%E5%91%BD%E4%BB%A4) 从公共目录搜索供应商并一键配置,无需手写配置文件。(v0.7.0 起已升级为 `/provider`。) Kimi Code CLI v0.1.0 2026 年 5 月 [​](https://www.kimi.com/code/docs/kimi-code/whats-new.html#v0-1-0-2026-%E5%B9%B4-5-%E6%9C%88) ----------------------------------------------------------------------------------------------------------------- **Kimi Code CLI 新版首发**,底层从 Python / uv 完整重写为 TypeScript / Node.js。这不是一次渐进式更新,而是一个新起点——核心架构、安装方式、配置格式全面升级。 与旧版 kimi-cli 的主要区别: | 对比项 | 旧版 kimi-cli | 新版 Kimi Code CLI | | --- | --- | --- | | 运行时 | Python + uv | Node.js(无 Python 依赖) | | 安装 | `uv tool install` | 一行 `curl` 脚本或 `npm install -g` | | 配置文件 | `~/.kimi/config.toml` | `~/.kimi-code/config.toml`(格式不兼容) | | 终端界面 | 基础文本输出 | 全功能 TUI(对话视图 + 状态栏 + 审批面板) | | 启动速度 | 较慢(Python 冷启动) | 更快(Node.js 原生二进制) | | 多供应商支持 | 有限 | 内置 Anthropic / OpenAI / Gemini / Vertex 等 | | Agent 子任务 | 不支持 | 内置 coder / explore / plan 三种子 Agent | | Plugin 系统 | 不支持 | 支持(v0.4.0 起) | | 定时任务 | 不支持 | 支持(v0.5.0 起) | 已有 kimi-cli 数据(配置、会话、MCP 声明)可通过 `kimi migrate` 一键迁移。→ [版本升级](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html) --- # 使用桌面端 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#VPContent) Return to top 使用桌面端 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E4%BD%BF%E7%94%A8%E6%A1%8C%E9%9D%A2%E7%AB%AF) ============================================================================================================================= 桌面端在一个窗口中覆盖从对话到交付的完整流程:描述需求、跟踪执行、审查验证、管理项目。本页按功能类型介绍这些能力;从安装到第一个任务的最短路径见[快速开始](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html) 。 选择任务模式 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E9%80%89%E6%8B%A9%E4%BB%BB%E5%8A%A1%E6%A8%A1%E5%BC%8F) --------------------------------------------------------------------------------------------------------------------------------------- 不同任务适合不同的推进方式。开始任务前,可以根据任务类型,在输入框左下角 **+** 中选择合适的任务模式: * **普通任务**:适合边界清楚、容易验证的修改。 * **计划模式**:适合影响范围不确定、需要先确认方案的修改。Agent 会先分析并给出计划,确认后再执行。 * **目标模式**:适合需要多轮执行和检查的长任务。目标会显示在输入框上方,可持续暂停、恢复或取消。 * **Swarm 模式**:适合可以拆成多个独立子任务的调查或修改,进度会显示在 Tasks 或 Subagent 区域。 给 Agent 提供上下文 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E7%BB%99-agent-%E6%8F%90%E4%BE%9B%E4%B8%8A%E4%B8%8B%E6%96%87) ----------------------------------------------------------------------------------------------------------------------------------------------------- 上下文越具体,Agent 越不容易偏离目标。先描述目标,再按下表补充材料: | 入口 | 触发方式 | 作用 | | --- | --- | --- | | 添加附件 | 粘贴、拖拽或点击 **+** | 上传截图、文档、图片、视频或其他材料,作为当前任务的上下文 | | 插入 `@` 提及 | 输入 `@` | 引用工作区中的文件或文件夹,让 Agent 定位相关代码或资料 | | 插入 `/` 命令 | 输入 `/` | 调用内置命令或已保存的扩展命令,复用固定流程;有效的行首命令会高亮 | | 截屏 | macOS:`Shift + Command + S`
Windows:`Shift + Ctrl + S` | 点击 **+** 开启截屏功能,根据提示打开权限,框选屏幕区域并添加序号和评论,帮助 Agent 定位页面位置或错误信息 | | 评论并添加到对话 | 选中内容后选择“评论”或“添加到对话” | 把对话中的文字、代码或工具结果作为引用补充到当前任务,便于继续追问或调整方向 | 也可以直接提供错误日志、复现步骤、期望行为、验证命令,以及不希望修改的目录、文件或行为。 追问与调整方向 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E8%BF%BD%E9%97%AE%E4%B8%8E%E8%B0%83%E6%95%B4%E6%96%B9%E5%90%91) ------------------------------------------------------------------------------------------------------------------------------------------------- 任务执行过程中,Agent 的工具调用和思考过程会显示在会话中,可以随时查看。你可以继续输入补充要求来调整方向,例如缩小范围、补充约束、要求先解释原因、要求停止当前操作,或让 Agent 按新的要求继续。需要回退时,可以使用 `/undo` 回退最近的修改。 与当前任务不直接相关的疑问,可以在侧边聊天中讨论,无需离开主会话。 审查改动 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E5%AE%A1%E6%9F%A5%E6%94%B9%E5%8A%A8) ------------------------------------------------------------------------------------------------------------------- 任务产生修改后,需要先确认改了哪些文件、每处改成什么样。 * **改动**:右侧面板的改动标签页按文件列出所有变化,可检查单个文件或单次修改的差异;改动标签页是单例,已打开时新建菜单会隐藏该入口。 * **Git 状态**:改动面板顶部显示当前分支、领先 / 落后状态和文件变化数量,也可以查看拉取请求状态。 * **文件预览**:预览 Markdown、JSON、HTML、PDF、CSV、图片以及代码或文本文件,并支持复制、下载、在系统中显示和在外部应用中打开;带 frontmatter 的 Markdown 会显示元数据卡片。会话中提到的文件路径也可以直接点开预览,右键文件名可复制路径或在文件夹中显示。 ![右侧面板中查看单个文件的改动详情](https://www.kimi.com/code/docs/images/kimi-code-desktop/ui-04.jpg) 右侧面板的改动标签页可以按文件查看每次修改的具体差异。 ![Git 状态区域与改动文件列表](https://www.kimi.com/code/docs/images/kimi-code-desktop/ui-05.jpg) 改动面板顶部显示当前分支和文件变化数量,列表中的每个文件可以展开查看改动详情。 验证修改 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E9%AA%8C%E8%AF%81%E4%BF%AE%E6%94%B9) ------------------------------------------------------------------------------------------------------------------- 修改后的结果如需要运行检查确认,支持终端或网页形式。底部终端面板是桌面端原生终端,可通过会话右上角的终端按钮打开,也可以按 Ctrl + 反引号显示或隐藏。它支持多个 tab,并在当前工作区的 `cwd` 中运行命令,适合执行项目已有的构建、测试、格式检查和其他验证命令,也可以查看 Git 命令输出。 ![底部终端面板中运行验证命令](https://www.kimi.com/code/docs/images/kimi-code-desktop/ui-07.jpg) 底部终端面板可直接运行构建、测试等验证命令并查看输出。 需要验证网页效果时,可以在右侧面板打开内置浏览器:标签页随会话常驻,页面信息与 Agent 共享,启动本地服务后即可在应用内查看页面,无需切到其他窗口;点击会话中的本地 HTML 文件,也会在内置浏览器中按真实网页打开。还可以标注网页中的元素或区域,自动捕获元素信息并附上截图和评论,让 Agent 准确定位要修改的位置。 ![内置浏览器中标注网页元素](https://www.kimi.com/code/docs/images/kimi-code-desktop/ui-08.jpg) 内置浏览器中标注网页元素:自动捕获元素信息,可附截图和评论加入输入框。 管理后台任务 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E7%AE%A1%E7%90%86%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1) --------------------------------------------------------------------------------------------------------------------------------------- 桌面端支持在主会话继续时运行后台任务。输入框上方的工作条会显示后台 Bash、后台 Agent 等后台工作的运行状态和数量,点击可展开任务列表(可按最近、进行中、已完成、全部筛选),你可以在这里: * 查看后台 Bash 和工具任务的状态、输出和运行时长; * 查看后台 Agent 的模型、思考强度、状态和结果; * 打开具体任务或子代理的详情——后台 Agent 会在右侧打开任务详情标签页,展示执行摘要、思考过程和工具调用; * 停止运行中的任务。 后台任务和后台 Agent 是两类不同的工作:前者用于查看命令和工具执行,后者用于查看子代理的独立工作。 管理项目与会话 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E7%AE%A1%E7%90%86%E9%A1%B9%E7%9B%AE%E4%B8%8E%E4%BC%9A%E8%AF%9D) ------------------------------------------------------------------------------------------------------------------------------------------------- 桌面端按工作区整理会话,工作区对应一个本地项目文件夹。工作区内的会话支持新建、切换、重命名、归档、恢复、删除、Fork、导出、置顶和搜索。多个会话可以用标签页并行打开,并支持批量管理;全局搜索可跨工作区查找会话。首轮对话后会自动生成标题,也可以在会话项中重新生成,或在设置中关闭自动生成。 Fork 用于保留当前会话并尝试另一种方向;归档、搜索、恢复和导出用于管理历史会话。 使用外部应用 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E4%BD%BF%E7%94%A8%E5%A4%96%E9%83%A8%E5%BA%94%E7%94%A8) --------------------------------------------------------------------------------------------------------------------------------------- 文件预览用于查看文件并执行复制、下载、在系统中显示或在外部应用中打开。顶部菜单用于在外部应用中打开当前项目或文件,可以选择 VS Code、Cursor、Zed、Xcode、系统终端,以及 Finder 或 Explorer 等系统文件管理器,也可以复制当前路径。 使用插件扩展能力 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E4%BD%BF%E7%94%A8%E6%8F%92%E4%BB%B6%E6%89%A9%E5%B1%95%E8%83%BD%E5%8A%9B) ----------------------------------------------------------------------------------------------------------------------------------------------------------- 插件用于把特定工具、流程或外部服务接入桌面端。你可以在设置中的插件区域浏览插件市场,安装、启用、更新或移除插件,也可以添加自定义插件来源。 当前可用的官方扩展能力包括: * **Kimi Computer Use**:让 Agent 在 macOS 上操作本机应用和界面。 * **Kimi Browser Extension**:让 Agent 操作你的真实浏览器并复用已有登录状态;缺少浏览器扩展时,插件区域会提供 Chrome 或 Edge 扩展安装入口。 * **Kimi Datasource**:为 Agent 提供数据查询和数据源相关能力,适合需要查询外部数据或接入数据源的任务。 插件的添加方式、插件市场和自定义来源说明见[Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) 。 调整设置 [​](https://www.kimi.com/code/docs/kimi-code-desktop/using-desktop.html#%E8%B0%83%E6%95%B4%E8%AE%BE%E7%BD%AE) ------------------------------------------------------------------------------------------------------------------- 设置面板包含通用、账号、智能体与会话、模型供应商、插件、快捷键、关于、实验室和已归档会话等区域,用于管理模型、模型供应商、消息折叠、账号、权限、快捷键、协议入口和实验性选项。 ![设置面板的通用设置页](https://www.kimi.com/code/docs/images/kimi-code-desktop/ui-06.jpg) 设置面板左侧是通用、账户、供应商、插件等主要区域入口,右侧展示当前区域的配置项。 下一步可以从[快速开始](https://www.kimi.com/code/docs/kimi-code-desktop/getting-started.html) 回到最短操作路径。 --- # Model Context Protocol | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#VPContent) Return to top Model Context Protocol [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#model-context-protocol) ======================================================================================================================= [Model Context Protocol(MCP)](https://modelcontextprotocol.io/) 是一个开放协议,让模型可以安全地调用外部进程或服务暴露的工具:读取 GitHub issues、查询数据库、操作本地文件系统。Kimi Code CLI 作为 MCP client 接入这些外部工具,把它们与内置工具一起暴露给 Agent 使用,行为上没有差异。 MCP 工具结果可以包含文本(`content`)和结构化数据(`structuredContent`)。Kimi Code CLI 会将两者提供给 Agent,只有能够确认某个文本块已包含同一份完整 JSON 值时,才省略重复的结构化内容。文本摘要和媒体不会替代结构化记录。 Kimi Code CLI 会保留因格式或大小限制而无法直接交付的内嵌 MCP 附件。内嵌图片、音频和视频即使能够原样交付也会保存,因为后续供应商协议转换或历史精简可能省略它们。模型支持相应内容时,即使工作区文件系统不可用,也仍可读取会话附件。原件随会话保存在媒体存储中,不会被图片缓存淘汰。保存的原件(包括图片压缩前的原图)均提供绝对路径和稳定的 `kimi-file://` 引用。将引用作为 `path` 传给 `Read` 或 `ReadMediaFile`,即使工作区 runtime 无法访问会话存储,也能直接从当前会话存储读取字节。分页续读会保留该引用,包括 fork 后的会话。对于 `Read` 无法打开的二进制格式,错误信息会在可用时提供服务端本地路径;外部转换工具必须能够访问该文件系统。CSV、HTML、JSON 和普通 SVG 等文本附件使用可读取的扩展名。 附件路径和压缩说明共用工具输出预算。较长的清单会保存为文本文件,结果中保留简短指针,即使伴随的文本被截短,该指针仍然可见;Agent 可将清单的 `kimi-file://` 引用传给 `Read`,分页读取完整内容。取消工具调用会停止后续附件处理,并通知正在进行的写入操作。如果解码或保存失败,结果会明确说明原件未能保留,并保留其他可用输出。资源链接不会被自动下载。 接入方式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E6%8E%A5%E5%85%A5%E6%96%B9%E5%BC%8F) ------------------------------------------------------------------------------------------------------------------- Kimi Code CLI 支持三种 MCP server 接入方式: * **stdio**:CLI 以子进程方式启动本地 MCP server,通过标准输入输出通信。适合本地命令行工具。 * **HTTP**:CLI 连接一个已在运行的 HTTP 端点。适合远程服务或需要持久运行的进程。 * **SSE**:CLI 连接旧式 HTTP+SSE 端点。新 MCP server 优先使用 HTTP;只有服务仍仅暴露旧式 SSE 传输时,才设置 `transport: "sse"`。 配置 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E9%85%8D%E7%BD%AE) ----------------------------------------------------------------------------------------------- MCP server 配置写在 `mcp.json` 中,分两层: * **用户级**:`~/.kimi-code/mcp.json`(或 `$KIMI_CODE_HOME/mcp.json`),跨项目共享 * **项目级**:工作目录下的 `.kimi-code/mcp.json`,只对当前仓库生效 同名条目以项目级为准,覆盖用户级。 在 TUI 中运行 `/mcp-config` 可以交互式地新增、编辑或删除 server,无需手动编辑 JSON 文件。运行 `/mcp` 可查看当前所有 server 的连接状态。 从配置中删除某个 server 不会打断进行中的会话:该 server 在 `/mcp` 中仍显示为 `removed`,其工具在这些会话中保持可见,但调用会失败并返回移除提示;新会话则完全不会注册这些工具。反过来,编辑 `mcp.json` 或安装 plugin 新增的 server 也不会注册到已打开的会话,只会加入之后创建的会话。 当 Kimi Code 在不受信任的文件夹中发现项目级 MCP server 时,工作区信任提示会显示每个 server 的传输方式和启动目标。提示默认选中 `Trust this folder`;核对列出的命令与参数或远程 URL 后确认即可,选择 `Don't trust` 则该工作区的项目级 MCP server 不会启用。 `mcp.json` 的结构: json { "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"] }, "linear": { "url": "https://mcp.linear.app/mcp" }, "legacy-events": { "transport": "sse", "url": "https://mcp.example.com/sse" } } } 含 `command` 字段的条目为 stdio server;含 `url` 字段且未写 `transport` 的条目为 HTTP server。旧式 SSE server 需要显式把 `transport` 设为 `"sse"`。 可选字段: | 字段 | 类型 | 适用方式 | 说明 | | --- | --- | --- | --- | | `env` | `Record` | stdio | 注入子进程的环境变量 | | `cwd` | `string` | stdio | 子进程工作目录 | | `headers` | `Record` | HTTP、SSE | 附加到每次请求的静态请求头 | | `bearerTokenEnvVar` | `string` | HTTP、SSE | 存放 bearer token 的环境变量名 | | `enabled` | `boolean` | 全部 | 设为 `false` 可禁用该 server | | `deferred` | `boolean` | 全部 | 实验功能:设为 `true` 时该 server 的工具由模型按需加载,默认 `false`(始终直接暴露)。前提与行为见 [按需加载工具](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD%E5%B7%A5%E5%85%B7) | | `startupTimeoutMs` | `number` | 全部 | 连接超时,取值范围为 `1` 到 `2147483647` 毫秒,默认 `30000` | | `toolTimeoutMs` | `number` | 全部 | 单次工具调用超时,取值范围为 `1` 到 `2147483647` 毫秒 | | `enabledTools` | `string[]` | 全部 | 工具白名单 | | `disabledTools` | `string[]` | 全部 | 工具黑名单 | 连接超时和单次工具调用超时的默认值都不必逐个 server 设置:`config.toml` 的 `[mcp] startup_timeout_ms` / `[mcp] tool_timeout_ms` 或环境变量 `KIMI_MCP_STARTUP_TIMEOUT_MS` / `KIMI_MCP_TOOL_TIMEOUT_MS` 可以调整全局默认值,优先级为 server 字段 > 环境变量 > `config.toml` > 内置默认。详见 [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#mcp) 。 HTTP 与 SSE server 支持通过 `headers` 或 `bearerTokenEnvVar` 提供静态凭证。需要 OAuth 时,运行 `/mcp-config login ` 完成浏览器授权。 Plugins 也可以在 manifest 中声明 MCP servers。Plugin 声明的 servers 默认启用,可以在 `/plugins` 中禁用或重新启用:禁用或移除后,已打开会话中的工具调用会失败并返回移除提示;新增或启用 server 会立即连接到已打开的会话。详见 [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#plugin-%E4%B8%AD%E7%9A%84-mcp-servers) 。 注意 项目级 `.kimi-code/mcp.json` 中的 stdio 条目会在会话启动时执行本地命令,只在你信任的仓库里启用。 按需加载工具 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E6%8C%89%E9%9C%80%E5%8A%A0%E8%BD%BD%E5%B7%A5%E5%85%B7) --------------------------------------------------------------------------------------------------------------------------------------- 默认情况下,server 的所有工具都会直接进入模型的顶层工具列表;接入的 server 较多、或单个 server 暴露的工具较多时,这些工具定义会持续占用上下文。把 server 标记为 deferred 后,它的工具不再进入顶层工具列表:模型先看到一份可加载工具清单,需要时通过内置的 `select_tools` 工具加载完整定义,加载后同一轮即可调用。 按需加载是实验功能,同时满足两个前提才会生效: * 启用 `tool-select` 实验标志:设置环境变量 `KIMI_CODE_EXPERIMENTAL_TOOL_SELECT=1`,或在 `config.toml` 的 `[experimental]` 下写 `tool-select = true`;总开关 `KIMI_CODE_EXPERIMENTAL_FLAG=1` 会一并启用。 * 当前模型声明了 `dynamically_loaded_tools` 能力:官方模型自动声明;其他模型可在 `config.toml` 的 `capabilities` 中追加,见 [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 。 满足前提后,在 `mcp.json` 的 server 条目里设 `deferred: true`: json { "mcpServers": { "github": { "url": "https://mcp.example.com/mcp", "deferred": true } } } 未设置 `deferred` 的 server 不受影响,工具始终直接暴露;前提不满足时该字段被忽略,行为相同。需要 OAuth 授权的 server 在完成授权前暴露的认证工具也遵循这个字段。 工具命名与权限 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E5%B7%A5%E5%85%B7%E5%91%BD%E5%90%8D%E4%B8%8E%E6%9D%83%E9%99%90) ------------------------------------------------------------------------------------------------------------------------------------------------- MCP 工具按 `mcp____` 格式命名,例如 `mcp__github__create_issue`。权限规则中支持 `*` 和 `**` 通配,例如 `mcp__github__*` 命中该 server 下所有工具。MCP 工具参数不参与权限匹配。 未命中权限规则的调用会触发审批请求;在审批弹窗中选择“Approve for this session”后,本次会话内的后续同类调用自动放行。 也可以在 `config.toml` 的 `[[permission.rules]]` 中预置永久规则: toml [[permission.rules]] decision = "allow" pattern = "mcp__github__*" [[permission.rules]] decision = "deny" pattern = "mcp__filesystem__write_file" 权限规则的完整语法见 [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) 。 安全性 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E5%AE%89%E5%85%A8%E6%80%A7) --------------------------------------------------------------------------------------------------------- 接入外部 MCP server 时需注意: * 只接入可信来源的 server * 在审批请求中核查工具名与参数是否合理 * 对高风险工具(写文件、执行命令等)维持手动审批,避免用 `mcp__*` 通配放行全部工具 注意 在 [YOLO 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) 下,MCP 工具调用会被自动批准。仅在完全信任所接入的 MCP server 时使用此模式。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) --------------------------------------------------------------------------------------------------------- * [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) — 在 plugin manifest 中声明 MCP server,一键打包和分发 * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) — 权限规则的完整字段参考 --- # Agent Skills | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#VPContent) Return to top Agent Skills [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#agent-skills) ====================================================================================================== Agent Skills 是 Kimi Code CLI 扩展模型能力的轻量机制。一个 Skill 就是一份带 YAML frontmatter 的 Markdown 文档,描述某项专业知识或工作流程:项目的代码风格规范、PR review 流程、提交消息格式。 与每次把同样的指引粘到提示词里相比,Skill 把内容沉淀在文件里,可以跨项目和团队复用,既可以通过斜杠命令一键加载,也可以让模型在需要时自动调用。 创建 Skill [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E5%88%9B%E5%BB%BA-skill) -------------------------------------------------------------------------------------------------------------- Skill 文件需放在[已知的扫描目录](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#skill-%E5%AD%98%E6%94%BE%E4%BD%8D%E7%BD%AE) 中。支持两种文件结构: * **目录形式(推荐)**:在 Skills 目录下创建一个子目录,主文件命名为 `SKILL.md`,可在同目录下放置脚本、参考资料等辅助文件。 * **扁平形式**:不建子目录,把一个 `.md` 文件直接放在 Skills 目录下,适合不需要辅助文件的简单 Skill。 两种结构都会注册出 Skill,区别只在文件组织方式: text skills/ ├── review-pr/ # 目录形式 → Skill 名 review-pr │ ├── SKILL.md # 主文件 │ └── checklist.md # 辅助文件,正文用 ${KIMI_SKILL_DIR} 引用 └── commit.md # 扁平形式 → Skill 名 commit Skill 名的推导规则: * 目录形式取 frontmatter 的 `name` 字段(必填,见下文表格);惯例让子目录名与 `name` 保持一致——`review-pr/SKILL.md` 里写 `name: review-pr`,注册为 `review-pr`。 * 扁平形式的 `name` 可省略,省略时取文件名去掉 `.md` 扩展名:`commit.md` 注册为 `commit`。注意「去掉 `.md`」只发生在注册后的 Skill 名上——磁盘上的文件必须带 `.md` 扩展名才会被扫描到,不要真的创建一个没有扩展名的 `commit` 文件。 * 同一目录下 `/SKILL.md` 与 `.md` 同时存在时,以目录形式为准,扁平文件被忽略。 扁平形式还有两点限制: * 只有直接放在 Skills 目录顶层的 `.md` 文件会被识别;子目录里散放的 `.md`(`SKILL.md` 除外)不会被当作 Skill。 * 扁平 Skill 没有自己的目录,`${KIMI_SKILL_DIR}` 指向 Skills 目录本身,不便携带辅助文件——需要辅助文件时请改用目录形式。 ### 文件格式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F) `SKILL.md` 由 YAML frontmatter 和 Markdown 正文两部分组成: markdown --- name: code-style description: 项目代码风格规范,定义命名、缩进、注释和文件组织 type: prompt whenToUse: 当用户让我编写、修改或审查项目源代码时 disableModelInvocation: false arguments: - target - mode --- 请按下述规范处理代码: - 缩进使用 2 空格 - 变量名使用 `camelCase`,类型名使用 `PascalCase` - 公开函数必须带 TSDoc 注释 - 单行不超过 100 字符 ### Frontmatter 字段 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#frontmatter-%E5%AD%97%E6%AE%B5) | 字段 | 说明 | | --- | --- | | `name` | Skill 名称,大小写不敏感。目录型 `SKILL.md` 必填;扁平 `.md` 省略时取文件名(不含 `.md` 扩展名) | | `description` | 一行总结,模型用它判断何时使用。目录型必填,扁平 `.md` 省略时取正文第一行非空内容(截至 240 字符) | | `type` | 类型:`prompt`(默认)、`inline`(同 `prompt`)、`flow`(仅手动调用)。其他值被跳过 | | `whenToUse` | 触发场景描述,也接受 `when-to-use`、`when_to_use` 写法 | | `disableModelInvocation` | 设为 true 禁止模型自动调用,也接受 `disable-model-invocation`、`disable_model_invocation` 写法 | | `arguments` | 命名参数列表,字符串数组或空白分隔字符串(如 `arguments: target mode`)。声明后正文可用 `$` 读取 | 注意 目录型 `SKILL.md` 中 `name` 和 `description` **必须**显式填写,省略任意一项均会导致解析失败。 ### 正文占位符 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E6%AD%A3%E6%96%87%E5%8D%A0%E4%BD%8D%E7%AC%A6) 正文在发送给模型前会展开少量占位符: * `$ARGUMENTS`:调用时附带的完整原始参数字符串 * `$ARGUMENTS[0]`、`$ARGUMENTS[1]` 及简写 `$0`、`$1`:按空白分词后的位置参数(从 0 开始) * `$`:`arguments` 中声明的命名参数 * `${KIMI_SKILL_DIR}`:当前 Skill 文件所在目录 位置参数支持单双引号包裹:在 `/skill:commit "fix login" patch` 中,`$0` 展开为 `fix login`。若正文不含任何参数占位符,调用时附带的文本会以 `\n\nARGUMENTS: <文本>` 的形式追加到正文末尾。 Skill 存放位置 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#skill-%E5%AD%98%E6%94%BE%E4%BD%8D%E7%BD%AE) ---------------------------------------------------------------------------------------------------------------------------------- Kimi Code CLI 按作用域分四档扫描,越具体的作用域优先级越高:**Project > User > Extra > Built-in**。 **用户级**(对所有项目生效): * `$KIMI_CODE_HOME/skills/`(默认:`~/.kimi-code/skills/`) * `~/.agents/skills/` Kimi 专属用户级 Skill 目录会随 `KIMI_CODE_HOME` 移动,隔离数据根时也会隔离 Kimi 专属 Skills。通用 `~/.agents/skills/` 目录仍放在真实 OS home 下,以便跨工具共享。 **项目级**(项目根 = 工作目录向上最近的含 `.git` 的目录): * `.kimi-code/skills/` * `.agents/skills/` **额外目录**:通过 `config.toml` 顶层的 `extra_skill_dirs` 声明: toml extra_skill_dirs = ["~/team-skills", ".agents/team-skills"] **内置 Skills** 随 CLI 一起分发,优先级最低,为常见任务提供开箱即用的工作流,例如配置 MCP server、定制 TUI 主题和编辑配置文件。完整列表详见[内置 Skill 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E5%86%85%E7%BD%AE-skill-%E5%91%BD%E4%BB%A4) 。其中介绍 Kimi Code 自身的部分可以通过顶层 [`builtin_product_skills`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%A1%B6%E5%B1%82%E5%AD%97%E6%AE%B5) 字段关闭。 调用 Skill [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E8%B0%83%E7%94%A8-skill) -------------------------------------------------------------------------------------------------------------- 用户通过斜杠命令主动调用: /skill:code-style /skill:git-commits 修复登录接口的并发问题 模型也可以根据 `description` 和 `whenToUse` 自动调用 Skill。`disableModelInvocation` 设为 true 或 `type` 设为 flow 时不自动调用。Skill 调用最多允许嵌套 3 层,超过后会被终止。 完整示例 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E5%AE%8C%E6%95%B4%E7%A4%BA%E4%BE%8B) ---------------------------------------------------------------------------------------------------------------------- markdown --- name: review-pr description: 按团队标准审查一个 Pull Request,输出结构化的 review 报告 type: prompt whenToUse: 当用户让我审查 PR、检查代码变更或评估提交质量时 arguments: - pr_ref --- 请按照以下流程审查用户指定的 PR:$pr_ref 1. 拉取并阅读 `$pr_ref` 的全部 diff。 2. 对照以下检查项逐条核对: - 是否包含对应的测试用例 - 公开 API 是否有文档更新 - 是否引入了新的依赖;若有,说明引入理由 - 错误处理是否覆盖了边界情况 3. 参考同目录下的检查清单:`references/checklist.md` 4. 输出一份 review 报告,包含: - 总体结论(approve / request changes / comment) - 必须修改项(blocking) - 建议改进项(non-blocking) - 值得肯定的地方 将文件保存为 `$KIMI_CODE_HOME/skills/review-pr/SKILL.md`,未设置 `KIMI_CODE_HOME` 时为 `~/.kimi-code/skills/review-pr/SKILL.md`。检查清单放在同目录的 `references/checklist.md`。重开会话后即可调用,例如 `/skill:review-pr #1234`,其中的参数会展开到 `$pr_ref`。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------ * [Plugins](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html) — 把 Skills 打包成可安装单元,与团队共享 * [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — Skills 如何影响 subagent 的行为 --- # kimi 命令 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#VPContent) Return to top kimi 命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-%E5%91%BD%E4%BB%A4) ============================================================================================================== `kimi` 是 Kimi Code CLI 的主命令,用于在终端中启动一次交互式会话。不带任何参数运行时,它会在当前工作目录下开启一个新会话;配合不同的 flag,可以续上历史会话、跳过审批、从 Plan 模式开始,或者指定自定义的 Skills 目录。 sh kimi [options] kimi [options] 主命令选项 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E4%B8%BB%E5%91%BD%E4%BB%A4%E9%80%89%E9%A1%B9) ---------------------------------------------------------------------------------------------------------------------------------- 所有 flag 都是可选的,直接运行 `kimi` 即可进入交互式会话: | 选项 | 简写 | 说明 | | --- | --- | --- | | `--version` | `-V` | 打印版本号并退出 | | `--help` | `-h` | 显示帮助信息并退出 | | `--session [id]` | `-S` | 恢复一个会话。带 ID 时直接打开指定会话;不带 ID 时进入交互式选择器 | | `--continue` | `-c` | 继续当前工作目录下最近一次的会话,无需手动指定 ID | | `--model ` | `-m` | 为本次启动指定模型别名。省略时新会话使用配置文件中的 `default_model` | | `--prompt ` | `-p` | 非交互执行单次 prompt,并把 Assistant 输出流式写到 stdout。该模式不会打开 TUI | | `--output-format ` | | 设置非交互输出格式,支持 `text` 与 `stream-json`。仅可与 `--prompt` 一起使用,默认 `text` | | `--yolo` | `-y` | 以 "Ask When Needed" 模式启动:常规修改和命令自动完成;高危操作、提问和计划仍会问你 | | `--auto` | | 以 "Never Ask" 模式启动:完全不打断,所有操作和判断自动完成 | | `--plan` | | 以 Plan 模式启动新会话,AI 会优先使用只读工具进行探索和规划 | | `--skills-dir ` | | 从指定目录加载 Skills,替换自动发现的用户和项目目录。可重复传入 | | `--agent ` | | 以指定 Agent 作为 main agent 启动新会话。不能与 `--session`/`--continue` 同时使用 | | `--agent-file ` | | 从 Markdown 文件加载自定义 Agent 并为新会话选中它。不可重复传入,也不能与 `--agent`、`--session` 或 `--continue` 同时使用 | | `--add-dir ` | | 为本次会话添加额外的工作目录。相对路径按当前工作目录解析。可重复传入 | `-r` / `--resume` 是 `--session` 的隐藏别名;`--yes` 和 `--auto-approve` 是 `--yolo` 的隐藏别名,在帮助信息中不显示。 注意 `--yolo` 会跳过普通工具调用的人工确认,包括文件写入和 Shell 命令执行,请只在受信任的工作目录下使用。Plan 模式的退出审批不会被 `--yolo` 跳过;Plan 模式下的 `Bash` 按普通放行规则处理。 ### flag 冲突规则 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#flag-%E5%86%B2%E7%AA%81%E8%A7%84%E5%88%99) 以下组合会在启动时被拒绝: * `--continue` 与 `--session` 互斥——两者都表示"恢复历史会话" * `--yolo` 和 `--auto` 互斥——两种权限模式互斥 * `--prompt` 不能与 `--yolo`、`--auto` 或 `--plan` 同时使用——非交互模式固定使用 `auto` 权限 * `--output-format` 只能与 `--prompt` 一起使用 恢复会话时,可以通过 `--auto`、`--yolo` 或 `--plan` 覆盖原会话保存的权限或计划模式。例如,`kimi --continue --auto` 会恢复最近会话并切换到 "Never Ask" 模式。 典型用法 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E5%85%B8%E5%9E%8B%E7%94%A8%E6%B3%95) ------------------------------------------------------------------------------------------------------------------------ 直接运行开启新会话: sh kimi 从上次中断的地方继续(自动找到当前目录最近的会话): sh kimi --continue 从历史会话列表中挑选,或直接指定已知 ID: sh kimi --session kimi --session 01HZ...XYZ 跳过审批确认,适合已知安全的批处理任务: sh kimi --yolo 让 Agent 自行处理一切,不再向用户提问: sh kimi --auto 先阅读代码、产出实现计划,而不是立刻动手修改文件: sh kimi --plan ### 自定义 Skills 目录 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E8%87%AA%E5%AE%9A%E4%B9%89-skills-%E7%9B%AE%E5%BD%95) 有两种方式指定 Skills 目录,语义不同: * **`--skills-dir `**(CLI flag):**替换**自动发现的用户和项目目录,仅对本次启动生效。可重复传入以叠加多个目录: sh kimi --skills-dir /path/to/team-skills --skills-dir ./local-skills * **`extra_skill_dirs`**(`config.toml`):**叠加**到自动发现的目录之上,长期生效,适合配置团队共享 Skills。详见 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 。 ### 自定义 Agent [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) `--agent` 和 `--agent-file` 用于选择驱动新会话的 Agent,在 print 模式(`kimi -p`)和交互式 TUI 中均可使用: sh kimi --agent reviewer kimi -p --agent reviewer "审查这个分支上的改动" `--agent-file` 以最高优先级注册单个 Agent 文件(仅本次启动)并选中它;该 flag 不可重复传入,`--agent` 与 `--agent-file` 互斥。两个 flag 都仅在新建会话时有效——都不能与 `--session`/`--continue` 组合,因为 Agent 在会话创建时绑定,恢复会话时会自动还原已绑定的 Agent。选择在会话首次绑定后即固定,之后不可切换;在 TUI 中,这些 flag 只绑定启动时的会话,之后在同一进程内新建的会话(例如通过 `/new`)使用默认 Agent。Agent 文件格式与发现目录详见 [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) 。 非交互执行 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E9%9D%9E%E4%BA%A4%E4%BA%92%E6%89%A7%E8%A1%8C) ---------------------------------------------------------------------------------------------------------------------------------- 在脚本或 CI 中运行单次 prompt 时,使用 `-p`: sh kimi -p "Summarize the current repository status" 输出采用 transcript 样式:thinking 内容和 Assistant 正文都以 `•` 开头,换行后两个空格缩进。Assistant 正文输出到 stdout;thinking、工具进度和"恢复会话"提示输出到 stderr。`-p` 模式不会请求人工审批,普通工具调用按 `auto` 权限策略处理,静态 deny 规则仍然生效。 临时切换模型: sh kimi -m kimi-code/kimi-for-coding -p "Explain the latest diff" 需要结构化读取输出时,使用 `stream-json` 格式——stdout 每行都是一个 JSON 对象: sh kimi -p "List changed files" --output-format stream-json `stream-json` 模式下,普通回复输出 Assistant 消息;模型调用工具时,先输出带 `tool_calls` 的 Assistant 消息,再输出对应的 Tool 消息,最后继续输出后续 Assistant 消息。thinking 内容不会写入 JSONL;工具进度和恢复会话提示仍写到 stderr。 子命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E5%AD%90%E5%91%BD%E4%BB%A4) -------------------------------------------------------------------------------------------------------------- `kimi` 提供以下子命令:`login`(非交互式登录)、`acp`(ACP IDE 模式)、`web`(前台运行本地 REST/WebSocket/web 服务并打开 web UI)、`doctor`(校验配置文件)、`export`(导出会话)、`migrate`(迁移旧版数据)、`upgrade`(检查更新)、`provider`(管理供应商)。 ### `kimi login` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-login) 通过 RFC 8628 device-code 流程登录 Kimi Code OAuth,无需进入 TUI。命令会发起一次 device authorization 请求,将验证地址和用户码打印到 stderr,然后轮询直到浏览器侧完成授权。生成的 token 写入与 TUI `/login` 相同的本地位置,下次启动 `kimi` 时会自动加载。 sh kimi login 该子命令没有任何 flag。在轮询期间随时按 `Ctrl-C` 可取消登录;取消或失败时退出码为 `1`,成功为 `0`。 ### `kimi acp` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-acp) 把 Kimi Code CLI 切换到 ACP(Agent Client Protocol)模式,在标准输入/输出上以 JSON-RPC 形式与 IDE 对话,让编辑器直接驱动 kimi 的会话和工具调用。通常不需要手动运行——IDE 会把它作为子进程入口启动。配置方式见[在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) ,技术细节见 [kimi acp 参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html) 。 sh kimi acp ### `kimi web` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) 在当前终端前台运行本地 Kimi 服务 —— 同一个进程同时挂载 REST + WebSocket API 与 web UI —— 并在服务就绪后用默认浏览器打开 web UI。命令会一直挂在终端,直到收到 `SIGINT` / `SIGTERM`(如 `Ctrl-C`)时干净退出。 服务运行时,`GET /openapi.json` 会返回 REST OpenAPI 文档,`GET /asyncapi.json` 会返回本地 WebSocket 协议的 AsyncAPI 文档。用 API 驱动会话的完整流程见[服务 API:用 API 驱动一个会话](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E7%94%A8-api-%E9%A9%B1%E5%8A%A8%E4%B8%80%E4%B8%AA%E4%BC%9A%E8%AF%9D) ,协议细节见[服务 API](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html) 。 sh kimi web # 前台运行服务并打开浏览器 kimi web --no-open # 不打开浏览器 kimi web --port 58628 # 指定绑定端口 同一 home 目录下可以同时运行多个实例:每个实例注册到 `~/.kimi-code/server/instances/`,端口被占用时自动 +1 重试(58628、58629……)。 | 选项 | 说明 | | --- | --- | | `--port ` | 绑定端口;默认 `58627`;被占用时自动 +1 重试 | | `--host [host]` | 绑定地址;缺省 `127.0.0.1`(仅本机),裸 `--host` 绑 `0.0.0.0`(所有网卡) | | `--allowed-host ` | DNS 重绑定检查额外允许的 Host 头,可重复或逗号分隔 | | `--log-level ` | 按所选级别开启服务日志;默认不输出 | | `--debug-endpoints` | 挂载 `/api/v1/debug/*` 调试路由(默认关闭) | | `--dangerous-bypass-auth` | 关闭所有 REST 与 WebSocket 路由的 bearer token 鉴权,使 web UI 无需 token 即可连接;仅用于可信网络或自有鉴权代理之后 | | `--web-title ` | 自定义 web UI 的浏览器标签页标题;默认为工作区目录名 | | `--no-open` | 就绪后不自动打开浏览器 | `kimi web` 默认只绑定本机 loopback 地址,并在启动横幅中打印 bearer token;web UI 通过 URL 的 `#token=` 片段自动完成鉴权。 提示 `kimi server` 命令树已废弃:任何 `kimi server …` 调用(含全部旧子命令)只会打印弃用提示并以退出码 1 结束,请改用 `kimi web`。唯一的例外是 `kimi server kill`,它仍然可用,仅用于停止 0.28.0 之前版本启动的服务。该提示将在 Kimi Code 下个大版本移除。 警告 `--dangerous-bypass-auth` 会彻底关闭鉴权。任何能访问该端口的人都能完全控制你的会话、文件系统和 shell。请仅在可信网络或自有鉴权反向代理之后使用,用完后按 `Ctrl+C` 停止服务。 #### `kimi server kill` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-server-kill) 已废弃——仅用于停止 0.28.0 之前的 Kimi Code 版本启动的服务。那些版本可能在后台遗留服务进程,记录在 legacy 单实例锁文件 `~/.kimi-code/server/lock` 中;该命令先请求 `POST /api/v1/shutdown` 优雅退出,再对锁中记录的 pid 发 SIGTERM、必要时升级为 SIGKILL,并在确认进程退出后删除锁文件。`kimi web` 启动的服务在前台运行,直接用 `Ctrl+C` 停止即可。 #### `kimi web rotate-token` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web-rotate-token) 生成新的持久化 bearer token(写入 `~/.kimi-code/server.token`),旧 token 立即失效。token 是整个 home 目录共享的,所有运行中的实例会在下一次鉴权校验时自动换用新 token,无需重启。 ### `kimi install-desktop` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) 打印 Kimi Code 桌面端页面地址并在默认浏览器中打开,无需离开终端即可下载并安装桌面端应用。页面地址随当前区域而定:国内区域为 `https://www.kimi.com/code`,全球区域为 `https://www.kimi.ai/code`。 sh kimi install-desktop 该子命令没有任何选项。旧名称 `kimi install-app` 仍可作为隐藏别名使用。在 TUI 中也可以通过斜杠命令 `/desktop`(别名 `/install-desktop`)打开同一页面。 ### `kimi doctor` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-doctor) 校验 `config.toml` 和 `tui.toml`,不会启动 TUI,也不会修改任一文件。默认检查 `KIMI_CODE_HOME` 下的文件;未设置该环境变量时检查 `~/.kimi-code`。默认路径缺失时会显示为跳过,因为内置默认值仍可生效。 sh kimi doctor | 命令 | 说明 | | --- | --- | | `kimi doctor` | 校验默认 `config.toml` 和 `tui.toml` | | `kimi doctor config [path]` | 只校验 `config.toml`;传入 `path` 时使用该文件而不是默认文件 | | `kimi doctor tui [path]` | 只校验 `tui.toml`;传入 `path` 时使用该文件而不是默认文件 | 显式传入路径时,文件必须存在。所有被检查的文件都有效或被跳过时,退出码为 `0`;任何指定文件缺失或配置无效时,退出码为 `1`。 sh # 检查默认配置文件 kimi doctor # 只检查默认运行时配置 kimi doctor config # 替换正式 TUI 配置前,先检查候选文件 kimi doctor tui ./tui.toml ### `kimi export` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-export) 把一个会话打包成 ZIP 文件,便于分享、归档或提交问题反馈。 sh kimi export [sessionId] [options] | 参数 / 选项 | 简写 | 说明 | | --- | --- | --- | | `sessionId` | | 要导出的会话 ID。省略时自动选择当前工作目录下最近一次的会话,并要求确认 | | `--output <path>` | `-o` | 输出 ZIP 文件路径。省略时写入当前目录下的默认文件名 | | `--yes` | `-y` | 跳过默认会话的确认提示,直接导出 | | `--no-include-global-log` | | 不打包全局诊断日志。默认包含 | 导出包含目标会话目录内的所有文件。全局诊断日志(`~/.kimi-code/logs/kimi-code.log`)默认包含,因为它可能含有其他会话或项目的事件;不想分享时加 `--no-include-global-log`。 sh # 导出当前工作目录最近一次会话,跳过确认 kimi export -y # 导出指定会话到自定义路径 kimi export 01HZ...XYZ -o ./bug-report.zip # 排除全局诊断日志 kimi export 01HZ...XYZ -o ./bug-report.zip --no-include-global-log ### `kimi migrate` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-migrate) 将旧版 kimi-cli 的本地数据迁移到 kimi-code,包括历史会话和配置文件。纯交互式运行,会引导你完成全流程。 sh kimi migrate 完整迁移说明见[从 kimi-cli 迁移](https://www.kimi.com/code/docs/kimi-code-cli/guides/migration.html) 。 ### `kimi upgrade` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-upgrade) 立即检查最新版本并展示更新提示,选择操作后退出。也可以使用别名 `kimi update`。 sh kimi upgrade [-y] 对全局 npm、pnpm、yarn、bun 安装,`kimi upgrade` 会展示更新选项;选择 `Install update now` 后运行对应的前台安装命令。对 native 安装(含 Windows),会在前台下载并校验新二进制,并在下次启动时替换生效。当前安装方式无法自动升级时,改为打印手动更新命令。传入 `-y, --yes` 可跳过确认提示,直接安装更新。 ### `kimi vis` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-vis) 在浏览器中启动会话可视化工具,直观查看一次会话的全过程。命令会启动一个指向本地会话的进程内服务器,打印访问地址并打开浏览器,持续运行直到你按下 `Ctrl-C`。 sh kimi vis [sessionId] [options] | 参数 / 选项 | 说明 | | --- | --- | | `sessionId` | 直接打开指定会话的可视化页面。省略时打开列出所有会话的首页 | | `--port <number>` | 绑定的端口。默认自动挑选一个空闲端口 | | `--host <host>` | 绑定的主机。默认 `127.0.0.1` | | `--no-open` | 不自动打开浏览器,仅打印访问地址 | sh # 启动可视化工具并在浏览器中打开首页 kimi vis # 直接打开指定会话 kimi vis 01HZ...XYZ # 绑定固定主机和端口且不打开浏览器(例如在远程主机上) kimi vis --host 0.0.0.0 --port 8123 --no-open ### `kimi provider` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider) 在 shell 中管理供应商,相当于 TUI 中 `/provider` 的非交互版本。适合脚本化部署、CI 初始化,以及在新机器上一行完成配置。 sh kimi provider <action> [options] 包含五个动作: #### `kimi provider add <url>` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider-add-url) 从自定义 registry(`api.json`)批量导入所有供应商。命令会拉取 registry,为每个条目创建 `[providers.<id>]` 和 `[models.<alias>]`,并写入 `source` 元数据,使 TUI 下次启动时自动刷新同一 registry 地址下的供应商和模型。当 registry 条目声明了 `env` 字段时,命令会打印一条提示,指明声明的变量名——想用就在 `config.toml` 里设置 `api_key_env`,详见[平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 。 | 参数 / 选项 | 说明 | | --- | --- | | `<url>` | Registry 地址 | | `--api-key <key>` | 访问 registry 时携带的 Bearer token。未传时回退到环境变量 `KIMI_REGISTRY_API_KEY`;可选,两者都不传即可导入公开 registry | sh kimi provider add https://registry.example.com/v1/models/api.json --api-key YOUR_KEY # 或通过环境变量(适合 CI / .envrc) KIMI_REGISTRY_API_KEY=YOUR_KEY kimi provider add https://registry.example.com/v1/models/api.json # 公开 registry:无需密钥 kimi provider add https://registry.example.com/v1/models/api.json 如果某个 provider id 已存在,会先删除再重新写入。不会自动设置默认模型,后续可用 `-m` 或 TUI 内的 `/model` 选择。 #### `kimi provider remove <providerId>` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider-remove-providerid) 删除指定供应商及其所有模型 alias。如果被删除的供应商正好是 `default_model` 所属,则同时清空 `default_model`。 sh kimi provider remove kohub #### `kimi provider list` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider-list) 按行打印每个已配置的供应商,含类型、模型数量、来源。加 `--json` 可输出原始的 `providers` 和 `models` 表,便于程序化处理。 sh kimi provider list kimi provider list --json | jq '.providers | keys' #### `kimi provider catalog list [providerId]` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider-catalog-list-providerid) 在不修改任何配置的情况下浏览公开的 [models.dev](https://models.dev/) 模型目录。不传参数时列出所有供应商及协议类型和模型数量;传 `providerId` 时列出该供应商下所有模型的上下文窗口和能力。目录地址不可达时会使用内置目录快照。 | 参数 / 选项 | 说明 | | --- | --- | | `[providerId]` | 可选,要查看的供应商 id | | `--filter <substring>` | 按 id 或 name 大小写不敏感子串过滤 | | `--url <url>` | 覆盖 catalog 地址,默认 `https://models.dev/api.json` | | `--json` | 以 JSON 形式输出匹配片段 | sh kimi provider catalog list kimi provider catalog list --filter anthropic kimi provider catalog list anthropic #### `kimi provider catalog add <providerId>` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-provider-catalog-add-providerid) 按 id 从 catalog 直接导入一个已知供应商,协议类型、base URL、模型信息均由 catalog 提供,只需提供 API key。catalog 未声明协议的供应商(如 xai、openrouter 这类厂商专用 SDK)按 OpenAI 兼容协议导入,并在输出中标注 "guessed";catalog 未提供可用端点时需用 `--base-url` 显式指定。专有协议(如 Amazon Bedrock)无法导入。公共目录不可达时会回退到内置目录快照,离线或网络受限环境下也能导入。 | 参数 / 选项 | 说明 | | --- | --- | | `<providerId>` | catalog 中的供应商 id,如 `anthropic`、`openai` | | `--api-key <key>` | 供应商 API key。未传时回退到 `KIMI_REGISTRY_API_KEY`,必填 | | `--default-model <modelId>` | 可选,导入后把 `default_model` 设为 `<providerId>/<modelId>` | | `--base-url <url>` | 覆盖 catalog 声明的端点;catalog 未提供端点(或仅有环境变量占位符)时必填 | | `--url <url>` | 覆盖 catalog 地址,默认 `https://models.dev/api.json` | sh kimi provider catalog list anthropic # 先看可选的模型 kimi provider catalog add anthropic --api-key sk-ant-... --default-model claude-opus-4-7 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------------- * [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) — 交互式 TUI 内的控制命令速查 * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) — `default_model`、权限模式等启动参数的持久化配置 * [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) — `--skills-dir` 加载的 Skill 文件格式 * [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — 内置 subagent、自定义 Agent 文件与通过 `--agent` 选择 main agent --- # 配置文件 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#VPContent) Return to top 配置文件 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6) ============================================================================================================================ Kimi Code CLI 的长期偏好都写在 `~/.kimi-code/` 下的 TOML 文件里:运行时设置放 `config.toml`,终端界面偏好放配套的 `tui.toml`。 配置文件位置 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E4%BD%8D%E7%BD%AE) ------------------------------------------------------------------------------------------------------------------------------------------------ CLI 从 `~/.kimi-code/config.toml` 读取配置,首次运行时自动创建。如需把数据目录迁移到别处,可用 `KIMI_CODE_HOME` 环境变量覆盖: sh export KIMI_CODE_HOME=/path/to/kimi-home 此时配置文件路径变为 `$KIMI_CODE_HOME/config.toml`。无论目录在哪里,文件名固定是 `config.toml`。 TIP TOML 字段名一律用下划线(snake\_case),如 `default_model`、`max_context_size`。字段名里若含 `.`,需用引号包住,例如 `[models."gpt-4.1"]`;否则 TOML 会把 `.` 解释为嵌套表分隔符。 完整示例 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E5%AE%8C%E6%95%B4%E7%A4%BA%E4%BE%8B) ---------------------------------------------------------------------------------------------------------------------------- 以下示例覆盖最常用的配置项,可直接复制后按需修改: toml default_model = "kimi-code/k3" default_permission_mode = "manual" default_plan_mode = false merge_all_available_skills = true telemetry = true [providers."managed:kimi-code"] type = "kimi" base_url = "https://api.kimi.com/coding/v1" api_key = "" [models."kimi-code/k3"] provider = "managed:kimi-code" model = "k3" max_context_size = 1048576 capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ] display_name = "K3" support_efforts = [ "low", "high", "max" ] default_effort = "max" [models."kimi-code/kimi-for-coding"] provider = "managed:kimi-code" model = "kimi-for-coding" max_context_size = 262144 capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ] [models."kimi-code/kimi-for-coding-highspeed"] provider = "managed:kimi-code" model = "kimi-for-coding-highspeed" max_context_size = 262144 capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ] [thinking] enabled = true effort = "high" keep = "all" [loop_control] max_attempts_per_step = 10 reserved_context_size = 50000 [background] max_running_tasks = 4 keep_alive_on_exit = false [services.moonshot_search] base_url = "https://api.kimi.com/coding/v1/search" api_key = "" [services.moonshot_fetch] base_url = "https://api.kimi.com/coding/v1/fetch" api_key = "" [[permission.rules]] decision = "allow" pattern = "Read" [[permission.rules]] decision = "deny" pattern = "Bash(rm -rf*)" [[hooks]] event = "PreToolUse" matcher = "Bash" command = "node ~/.kimi-code/hooks/check-bash.mjs" timeout = 5 顶层字段 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%A1%B6%E5%B1%82%E5%AD%97%E6%AE%B5) ---------------------------------------------------------------------------------------------------------------------------- 配置文件里的字段分两类:**顶层标量**直接控制默认行为,**嵌套表**(`providers`、`models`、`thinking` 等)各有独立结构,在下文各节单独说明。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `default_model` | `string` | — | 默认模型别名,必须在 `models` 中定义 | | `default_permission_mode` | `string` | `manual` | 新会话的默认权限模式,可选 `yolo` / `auto`,见 [交互与权限](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) | | `default_plan_mode` | `boolean` | `false` | 新会话是否默认以 [Plan 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#plan-%E6%A8%A1%E5%BC%8F)<br>启动 | | `merge_all_available_skills` | `boolean` | `true` | 是否合并所有目录中的 Agent Skills | | `extra_skill_dirs` | `array<string>` | — | 额外 Skill 搜索目录,叠加到默认目录之上 | | `extra_agent_dirs` | `array<string>` | — | 额外自定义 Agent 搜索目录,叠加到默认目录之上 | | `builtin_product_skills` | `boolean` | `true` | 是否向模型提供介绍 Kimi Code 自身的内置 Skills | | `telemetry` | `boolean` | `true` | 是否启用匿名遥测;显式设为 `false` 时关闭 | | `auto_session_title` | `boolean` | `true` | 是否允许客户端自动生成会话标题;显式设为 `false` 时关闭 | | [`providers`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#providers) | `table` | `{}` | API 供应商表 | | [`models`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) | `table` | — | 模型别名表 | | [`thinking`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#thinking) | `table` | — | Thinking 模式默认参数 | | [`loop_control`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#loop-control) | `table` | — | Agent 循环控制参数 | | [`background`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#background) | `table` | — | 后台任务运行参数 | | [`tools`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tools) | `table` | — | 全局工具开关 | | [`image`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#image) | `table` | — | 图片压缩参数 | | [`services`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#services) | `table` | — | 内置外部服务配置 | | [`permission`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) | `table` | — | 初始权限规则 | | [`hooks`](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) | `array<table>` | — | 生命周期 hook | | [`identity`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#identity) | `table` | — | 自定义 Agent 身份 | `providers` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#providers) -------------------------------------------------------------------------------------------------------- `providers` 表的每一项定义一个 API 供应商,以唯一名称为 key。CLI 只从这里读取凭证,**不会**从 shell 环境变量自动取后备值。在终端里 `export KIMI_API_KEY` 不会让供应商自动获得密钥,必须显式写在配置文件里,或者用 `api_key_env` 指定一个变量名(详见[配置覆盖](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) )。 | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `type` | `string` | 是 | 供应商类型:`kimi`、`anthropic`、`openai`、`openai_responses`、`google-genai`、`vertexai` | | `api_key` | `string` | 否 | API 密钥,明文写在配置文件里 | | `api_key_env` | `string` | 否 | 指定一个 shell 环境变量名,从该变量读取 API 密钥,密钥不写入配置文件;每次请求时读取。与 `api_key`、`oauth` 互斥;变量未设置或为空时请求报错并指明变量名 | | `base_url` | `string` | 否 | API 基础 URL | | `oauth` | `table` | 否 | OAuth 凭据引用(`storage`、`key` 两个字段),由登录流程自动注入,通常无需手写 | | `env` | `table<string, string>` | 否 | 供应商凭证的备用来源,见 `env` 子表 | | `custom_headers` | `table<string, string>` | 否 | 每次请求附加的自定义 HTTP 头 | **`env` 子表**:可以把供应商惯用的键名(如 `KIMI_API_KEY`)写在 `[providers.<name>.env]` 里,作为 `api_key` / `base_url` 的备用来源。这个子表**只在配置文件里读取**,不会修改 shell 环境: toml [providers.kimi.env] KIMI_API_KEY = "sk-xxx" KIMI_BASE_URL = "https://api.moonshot.ai/v1" 优先级:`api_key` 或 `api_key_env`(互斥替代项,只能设置其中一个)> `env` 子表键(两者都不存在时才读)> 全部缺失时启动报错。刷新 `/models` 时,声明的变量未设置或为空的供应商会被记为失败,不影响其他供应商。 `models` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) -------------------------------------------------------------------------------------------------- `models` 表的每一项定义一个模型别名(即 `default_model` 或 `-m` 参数里使用的名称),以唯一名称为 key。 | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `provider` | `string` | 是 | 使用的供应商名称,必须在 `providers` 中定义 | | `model` | `string` | 是 | 调用 API 时实际传给服务端的模型 ID | | `max_context_size` | `integer` | 是 | 最大上下文长度(token 数),必须 ≥ 1 | | `max_input_size` | `integer` | 否 | 模型声明的单次请求输入上限;压缩、溢出检查与用量比率优先使用它,补全预算仍用总窗口 | | `max_output_size` | `integer` | 否 | 单次请求的输出 token 上限(对应 `max_tokens`),目前仅 `anthropic` 供应商读取 | | `capabilities` | `array<string>` | 否 | 显式追加的能力标签:`thinking`、`always_thinking`、`image_in`、`video_in`、`audio_in`、`tool_use`、`dynamically_loaded_tools`,只能追加不能移除 | | `support_efforts` | `array<string>` | 否 | 模型接受的 Thinking 档位;解析时配置值不受支持会回落到模型的 `default_effort` 并同步给 UI;选列表外的值会报错,managed 刷新会改写(固定请用 overrides) | | `default_effort` | `string` | 否 | 模型的默认 Thinking 档位;managed/open-platform 刷新可能改写,固定请用 [模型覆盖项](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E6%A8%A1%E5%9E%8B%E8%A6%86%E7%9B%96%E9%A1%B9) | | `off_effort` | `string` | 否 | 关闭 Thinking 时在线上传输的 effort 编码(如 xai grok 的 `none`);对默认就会推理的模型,这是真正关闭推理的唯一方式 | | `base_url` | `string` | 否 | 模型级端点覆盖(catalog 导入网关模型时写入);解析时优先于供应商的 `base_url`,仅与 `protocol` 配合时生效 | | `display_name` | `string` | 否 | UI 中显示的名称,未设时回退到 `model` | | `reasoning_key` | `string` | 否 | 仅 `openai` 供应商;网关用非标准字段名返回推理内容时才需要设置,默认自动识别 `reasoning_content` 等 | | `adaptive_thinking` | `boolean` | 否 | 仅 `anthropic` 供应商;强制开关 adaptive thinking,省略时按模型名自动推断(Claude ≥ 4.6 用 adaptive) | 别名中含 `.` 时需要加引号: toml [models."gpt-4.1"] provider = "openai" model = "gpt-4.1" max_context_size = 1047576 ### 模型覆盖项 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E6%A8%A1%E5%9E%8B%E8%A6%86%E7%9B%96%E9%A1%B9) 如果某些用户覆盖需要在 provider-model 刷新后保留,请写到 `[models."<alias>".overrides]`。运行时读取的是 effective 值:有 override 时用 override,否则用顶层字段。 toml [models."kimi-code/kimi-for-coding"] provider = "managed:kimi-code" model = "kimi-for-coding" max_context_size = 262144 [models."kimi-code/kimi-for-coding".overrides] max_context_size = 131072 display_name = "Kimi for Coding (custom)" `[models."<alias>".overrides]` 接受普通模型字段,例如 `max_context_size`、`max_input_size`、`max_output_size`、`capabilities`、`display_name`、`reasoning_key`、`adaptive_thinking`、`support_efforts`、`default_effort` 和 `off_effort`。不接受身份 / 路由字段:`provider`、`model`、`protocol`、`beta_api` 和 `base_url`。 无需修改配置文件也可以临时切换模型:通过 `KIMI_MODEL_*` 环境变量在内存里合成一个临时供应商,详见[用环境变量定义模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8Bkimi-model) 。 `secondary_model` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#secondary-model) -------------------------------------------------------------------------------------------------------------------- subagent 默认继承 main agent 正在运行的模型。`[secondary_model]` 节把这件事变成可配置的:为 subagent 准备一批候选模型(模型池)并指定默认绑定。典型用法是给不需要主模型能力的子任务换一个更便宜的模型。 ### subagent 模型池 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) 模型池始终可用,无需任何开启动作;未配置 `[secondary_model]` 时,subagent 继承调用方模型。 最小配置只有一行:单独写下的 `default_model` 就是只含一个条目的模型池: toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `default_model` | `string` | — | subagent 的默认模型 | | `models` | `table<string, string>` | — | subagent 模型池;key 为 [`[models]`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models)<br> 条目别名,value 为挑选提示 | | `force` | `boolean` | `false` | 把所有 subagent 固定到 `default_model`,收回 main agent 的选择权 | | `default_effort` | `string` | — | 每次派生的 subagent 绑定的 Thinking 档位,优先于所绑定模型自带的 `default_effort` | 字段之间的约束: * `default_model`:配置 `models` 表时必填,且必须是其中的 key。 * `models`:value 中英文均可;空字符串表示只列出别名、不给提示。 * `force`:必须搭配 `default_model`,且不能与 `models` 表同用:表的意义在于提供选择,而 force 取消了选择。 * `default_effort` 是节级设置:无论派生绑定到池中哪个条目(或 force 固定的模型)都生效。想按条目区分档位时不要设置它,改用下文的模型「变体」。 * `primary` 是保留字(含义见下文),不能作为池中 key。 池别名引用的是 `[models]` 表的当前内容:如果之后删除供应商、登出账号,或其刷新后的模型列表不再包含某个别名,会话启动时会报出指明失效别名的配置错误,修正或移除对应条目即可恢复。系统不会自动改写 `[secondary_model]` 节。 在交互式 TUI 中,也可以用 [`/secondary-model`](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 命令(别名 `/subagent-model`)打开模型选择器:选择后写入 `default_model`(已有 models 表而所选别名不在其中时,会一并补一条空描述条目),之后派生的 subagent 立即按新默认值绑定,无需重启会话。 配置了模型池(显式的 `models` 表或隐式的单条目池)即启用模型选择:`Agent` / `AgentSwarm` 工具会获得 `model` 参数,工具描述中列出模型池(默认模型标注 `[default]`),main agent 可按次派生选择模型。池 key 只能引用已配置的 [`[models]`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 条目。下面的 `kimi-code/*` 别名由 `/login` 自动提供: toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" [secondary_model.models] "kimi-code/k3" = "难题选它。擅长复杂推理、算法设计、深度调试、数学和系统性难题。" "kimi-code/kimi-for-coding-highspeed" = "速度快但单价较高。适合日常重构、代码解释、小改动、总结等看重响应速度的任务。" "kimi-code/kimi-for-coding" = "均衡的编码主力。适合大多数功能开发和代码修改任务。" 派生时按以下顺序解析 subagent 的模型: 1. 工具调用显式传入的 `model` 2. `default_model` `model` 参数的取值规则: * 接受池中任意别名,或 `"primary"`,即调用方自己正在运行的模型,始终合法,即使不在池中。 * `default_model` 与 `models` 都未配置时该参数不存在,subagent 继承调用方模型。 * 绑定池中别名时不继承调用方的 Thinking 档位。本节设置了 `default_effort` 时以它为准;否则,`[thinking].enabled = false` 会保持关闭 Thinking;开启 Thinking 时,再依次使用所绑定模型条目的 `default_effort`、全局 `[thinking].effort`、所绑定模型 `support_efforts` 的中间项。 * `"primary"` 则连模型带档位一起继承调用方。 * 传入的值既不是池中别名也不是 `"primary"` 时,本次派生报错并列出可选值。 要收回 main agent 的选择权、让所有 subagent 固定跑同一个模型,加上 `force = true`: toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" force = true 设置 `force` 后不再提供 `model` 参数(与完全未配置时一样),每次派生都绑定 `default_model`;显式传入 `model`(包括 `"primary"`)会报错。 ### 为池内条目配置不同 Thinking 档位 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E4%B8%BA%E6%B1%A0%E5%86%85%E6%9D%A1%E7%9B%AE%E9%85%8D%E7%BD%AE%E4%B8%8D%E5%90%8C-thinking-%E6%A1%A3%E4%BD%8D) 绑定池中别名时,subagent 的 Thinking 档位会落到所绑定模型的默认 effort。利用这一点,可以为同一底层模型注册一个「变体」条目,让 main agent 选别名时同时选定档位: 1. 在 [`[models]`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 中为同一底层模型再注册一个条目,用 [`[models."<alias>".overrides]`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E6%A8%A1%E5%9E%8B%E8%A6%86%E7%9B%96%E9%A1%B9) 只覆盖 `default_effort`。 2. 把原别名和变体别名都放进模型池。 toml # "kimi-code/k3" 由 /login 提供(默认 high 档);这里为同一模型注册一个 max 档位变体 [models.k3-max] provider = "managed:kimi-code" model = "k3" max_context_size = 1048576 capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ] support_efforts = [ "low", "high", "max" ] [models.k3-max.overrides] default_effort = "max" [secondary_model] default_model = "kimi-code/k3" [secondary_model.models] "kimi-code/k3" = "默认 high 档位。适合大多数实现、分析和多轮交互任务。" k3-max = "同一模型的 max Thinking 档位。适合最难的子任务。" 两个前提: * 底层模型必须声明了 `support_efforts`(`managed:kimi-code` 下目前只有 k3 系列声明了档位)。 * 变体是独立条目,不会继承被指向条目的字段:`capabilities`、`support_efforts` 等元数据要完整照抄,否则 `default_effort` 不生效(它必须是 `support_efforts` 列表中的值)。 另外注意 main agent 与 subagent 的不对称:对 main agent,全局 `[thinking].effort` 一旦设置就压过变体的 `default_effort`;对绑定池内别名的 subagent,变体的 `default_effort` 优先于全局值,只有 `[secondary_model].default_effort` 的优先级更高。取值与回落规则同 [`[models]` 条目的 `default_effort`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 。 注意 配置错误一律直接报错,不做静默回退。出现以下情况时,会话的创建、恢复(resume)与 fork 都会在启动时失败: * `default_model` 缺失、不是池中 key,或池中 key 无法解析到已配置的 [`[models]`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#models) 条目; * `force` 未搭配 `default_model`,或与 `models` 表同时使用。 `thinking` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#thinking) ------------------------------------------------------------------------------------------------------ `thinking` 设置 Thinking 模式的全局默认行为。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | `boolean` | `true` | 新会话是否默认开启 Thinking,设为 `false` 可强制关闭 | | `effort` | `string` | — | Thinking 强度:`low`/`medium`/`high`/`xhigh`/`max`;不在模型支持列表时回落默认档 | | `keep` | `string` | `"all"` | 保留思考透传;`kimi` 以 `thinking.keep` 发送,`anthropic` 以 `clear_thinking_20251015` 编辑发送(走 beta API);关值可禁用;Thinking 开启时注入,可被同名环境变量覆盖 | 已废弃字段 | 字段 | 废弃版本 | 描述 | | --- | --- | --- | | `default_thinking` | 0.21.0 | 顶层布尔值,由 `[thinking] enabled` 取代,值不变 | | `thinking.mode` | 0.21.0 | 可选值 `auto`/`on`/`off`,由 `[thinking] enabled` 取代;`off` 改 `enabled = false`,其余可删 | | `loop_control.max_retries_per_step` | 0.32.0 | 由 `loop_control.max_attempts_per_step` 取代(本就是含首次尝试的总次数);旧 key 不生效并警告 | | `loop_control.max_steps_per_run` | 0.32.0 | 由 `loop_control.max_steps_per_turn` 取代;旧 key 不生效,启动警告,请手动改名 | `loop_control` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#loop-control) -------------------------------------------------------------------------------------------------------------- `loop_control` 控制 Agent 执行循环的步数上限、单步尝试次数上限,以及上下文自动压缩的触发阈值和尝试次数上限。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `max_steps_per_turn` | `integer` | — | 单轮最大步数;不设或设为 `0` 则无上限 | | `max_attempts_per_step` | `integer` | `10` | 单步失败后的最大总尝试次数(含首次尝试) | | `reserved_context_size` | `integer` | — | 预留给模型输出的 token 数;上下文窗口剩余量低于此值时触发自动压缩 | | `compaction_max_attempts` | `integer` | `5` | 压缩请求失败后的最大总尝试次数(含首次尝试) | `max_steps_per_turn` 可被环境变量 `KIMI_LOOP_MAX_STEPS_PER_TURN` 覆盖,`max_attempts_per_step` 可被 `KIMI_LOOP_MAX_ATTEMPTS_PER_STEP` 覆盖,优先级均高于配置文件。旧的 `KIMI_LOOP_MAX_RETRIES_PER_STEP` 已废弃,但在新变量未设置时仍生效(启动时会给出警告)。 重试仅针对瞬时故障:连接错误、超时、HTTP 429 限流和 5xx 服务端错误。账户额度耗尽或余额不足导致的 429 不会重试,会立即失败:在充值之前重试不可能成功。 `token_counting` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#token-counting) ------------------------------------------------------------------------------------------------------------------ `token_counting` 决定对外上报的上下文 token 计数,即上下文大小显示所基于的值。内部逻辑(自动压缩触发、预算、超限退避)始终同时使用供应商实测与估算,不受本配置影响。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `strategy` | `"measured+estimated" \| "measured" \| "estimated"` | `"measured+estimated"` | 上下文 token 计数策略:`measured+estimated` 为实测加估算兜底,`measured` 仅实测(请求完成后更新),`estimated` 纯估算(供应商不上报用量时用) | `strategy` 可被环境变量 `KIMI_TOKEN_COUNTING_STRATEGY` 覆盖,优先级高于 `config.toml`。 `background` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#background) ---------------------------------------------------------------------------------------------------------- `background` 控制后台任务(通过 `Bash` 工具或 `Agent` 工具的 `run_in_background=true` 参数启动)的并发数。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `max_running_tasks` | `integer` | — | 同时运行的最大后台任务数 | | `keep_alive_on_exit` | `boolean` | `false` | 会话关闭时是否保留仍在运行的后台任务;print 模式下仅作 `print_background_mode` 的回退:`true` 等价于 `drain` | | `kill_grace_period_ms` | `integer` | `5000` | 任务被请求正常终止后,等待自行结束的宽限时间(毫秒),超时后强制停止 | | `bash_auto_background_on_timeout` | `boolean` | `true` | 前台 `Bash` 命令超时后转为后台任务而非终止;设为 `false` 恢复超时即终止 | | `bash_task_timeout_s` | `integer` | `600` | 后台 `Bash` 任务默认超时(秒);`0` 表示无超时,任务运行到自行结束或被手动停止;显式传入的 timeout 不受影响,print 模式默认 0 | | `print_background_mode` | `"exit" \| "drain" \| "steer"` | `"steer"` | 仅 print 模式生效;`"exit"` 立即退出、`"drain"` 等待终态(结果不回馈)、`"steer"` 由后台任务合成消息继续 turn(合成消息续跑至无未决任务) | | `print_wait_ceiling_s` | `integer` | `2147483` | 等待/steer 循环的墙钟上限(秒),非 print 模式或 `"exit"` 时无效 | | `print_max_turns` | `integer` | `100000` | steer 模式下后台任务触发新 turn 的数量上限,防止 steer 循环失控 | `keep_alive_on_exit` 可被环境变量 `KIMI_CODE_BACKGROUND_KEEP_ALIVE_ON_EXIT` 覆盖,`max_running_tasks` 可被 `KIMI_CODE_BACKGROUND_MAX_RUNNING_TASKS` 覆盖,`bash_task_timeout_s` 可被 `KIMI_CODE_BACKGROUND_BASH_TASK_TIMEOUT_S` 覆盖,`print_background_mode`、`print_wait_ceiling_s`、`print_max_turns` 可分别被 `KIMI_CODE_BACKGROUND_PRINT_BACKGROUND_MODE`、`KIMI_CODE_BACKGROUND_PRINT_WAIT_CEILING_S`、`KIMI_CODE_BACKGROUND_PRINT_MAX_TURNS` 覆盖,优先级均高于配置文件。 在 print 模式(`kimi -p "<prompt>"`)下,只要还有未决的后台任务,Kimi Code 在 main agent 的 turn 结束后不会退出:每个任务完成都会以合成 user 消息回馈给 main agent,steer 出新的 turn(默认 `print_background_mode = "steer"`),直到某 turn 结束时没有任何未决任务才退出。该循环受 `print_wait_ceiling_s` 与 `print_max_turns` 约束,默认值都近似不设限。print 模式下后台工作也不会被墙钟超时杀掉:后台 `Bash` 任务默认无超时(`bash_task_timeout_s = 0`),subagent 默认无超时(`[subagent] timeout_ms` 与 `[swarm] timeout_ms` 未显式设置时均为 `0`),只有模型自己能停止任务。将 `print_background_mode` 设为 `"drain"` 可等待任务结束但不回馈结果,设为 `"exit"` 则在 main agent 结束后立即退出。 `subagent` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent) ------------------------------------------------------------------------------------------------------ `subagent` 控制 `Agent` 工具派生的 subagent 的运行方式。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `timeout_ms` | `integer` | `7200000`(2 小时) | 单个 `Agent` subagent 允许运行的最长时间(毫秒);超时以 `timed_out` 收尾,`0` 表示无超时 | `timeout_ms` 可被环境变量 `KIMI_SUBAGENT_TIMEOUT_MS` 覆盖,优先级高于配置文件。 `swarm` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#swarm) ------------------------------------------------------------------------------------------------ `swarm` 控制 `AgentSwarm` 工具启动的 subagent 的运行方式,与 `[subagent]` 相互独立、互不影响。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `timeout_ms` | `integer` | `7200000`(2 小时) | `AgentSwarm` 单个 subagent 允许运行的最长时间(毫秒);超时后中止,聚合报告标记 `Subagent timed out.`;0 为无超时 | `timeout_ms` 可被环境变量 `KIMI_CODE_SWARM_TIMEOUT_MS` 覆盖,优先级高于配置文件。 `mcp` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#mcp) -------------------------------------------------------------------------------------------- | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `startup_timeout_ms` | `integer` | `30000`(30 秒) | 所有 MCP server 的全局默认连接(启动 + 工具发现)超时(毫秒);`mcp.json` 的 `startupTimeoutMs` 优先于本节 | | `tool_timeout_ms` | `integer` | `60000`(60 秒) | 所有 MCP server 的全局默认单次工具调用超时(毫秒);`mcp.json` 的 `toolTimeoutMs` 优先于本节 | `startup_timeout_ms` 和 `tool_timeout_ms` 可分别被环境变量 `KIMI_MCP_STARTUP_TIMEOUT_MS` 和 `KIMI_MCP_TOOL_TIMEOUT_MS` 覆盖,优先级高于配置文件。MCP server 的完整配置方式见 [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) 。 `identity` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#identity) ------------------------------------------------------------------------------------------------------ 自定义 Agent 的身份标识。不设置时行为完全不变。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `name` | `string` | — | Agent 在系统提示词中的自称(填充 `${product_name}` 变量,你自己的 `SYSTEM.md` 和 agent 文件同样适用) | | `slug` | `string` | 由 `name` 派生 | 协议字段中的机器标识:`User-Agent` 产品名与 MCP 客户端名;省略时由 `name` 派生(转小写,非字母数字折叠为 `-`) | toml [identity] name = "Acme Dev Agent" slug = "acme-dev" # 可选 两个字段都可以通过 `KIMI_CODE_IDENTITY_NAME` 和 `KIMI_CODE_IDENTITY_SLUG` 环境变量设置,优先级高于 `config.toml`,且不会被写回配置文件,适合不便写配置文件的容器和 CI 场景。 如果名称中不含任何 ASCII 字母或数字(例如纯中文名称),就无法派生出 slug,此时回退为 `agent`;需要特定协议标识请显式填写 `slug`。 身份在启动时解析一次,进程生命周期内保持不变:建立连接时它已宣告给 MCP 服务器和 provider,中途无法更换。修改本节配置在下次启动时对新会话生效;resume 的会话保留录制时的系统提示词,因为其历史轮次本就以原身份自称。同理,已完成的 MCP OAuth 授权保留其授予时的客户端注册;重置该服务器的认证即可在新身份下重新注册。 本节由 `agent-core-v2` 引擎读取,Kimi Code 的所有界面都运行在该引擎上。 `tools` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tools) ------------------------------------------------------------------------------------------------ `tools` 设置全局工具开关,对所有会话中的每个 Agent 生效,并在 Agent 自身的 `tools` / `disallowedTools` 策略之上再取一次交集。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | `array<string>` | — | 全局允许列表:非空时仅列出的工具可用;省略或设为空数组均表示不约束 | | `disabled` | `array<string>` | — | 全局禁止列表,在 `enabled` 之后应用 | 工具名匹配规则与 Agent 文件中的同名字段一致:内置工具按名称精确匹配(如 `Read`),MCP 工具用 glob 匹配(如 `mcp__github__*`)。有三种写法永远匹配不到任何工具,出现时会给出警告:`mcp__` 模式之外使用通配符(`enabled = ["*"]` 会禁用所有工具,而 `disabled = ["*"]` 什么也禁不掉);缺少工具段的 `mcp__` 字面量(`mcp__github`,匹配整个服务器要用 `mcp__github__*`);以及任何已注册或内置工具都没有的名字(匹配区分大小写)。 toml [tools] disabled = ["EnterPlanMode", "ExitPlanMode", "mcp__github__*"] 注意 与 Agent 文件中的 `tools` / `disallowedTools` 一样,本节不仅决定模型能"看到"哪些工具,还会在执行前再次强制检查。[权限规则](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) 仍是独立的控制层,用于决定哪些操作需要审批。 `read` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#read) ---------------------------------------------------------------------------------------------- `read` 控制 [`Read` 工具](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html) 的字符额度,包含文件正文、行号和状态信息,不额外叠加行数或 UTF-8 字节数上限。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `default_max_chars` | `integer` | `100000` | 工具调用未指定 `max_chars` 时的字符额度 | | `max_chars` | `integer` | `500000` | 单次工具调用可申请的最大字符额度 | toml [read] default_max_chars = 100000 max_chars = 500000 两个值都必须是正整数。调用中的 `max_chars` 覆盖默认值,但不会超过配置的最大值;结果会说明实际生效的额度。如果配置的默认值超过最大值,默认读取也会按最大值执行。如果希望较大的文档默认就能一次返回,无需 Agent 主动申请更大额度,可以提高 `default_max_chars`。 `image` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#image) ------------------------------------------------------------------------------------------------ `image` 控制图片发送给模型前的压缩行为,对所有图片入口生效(粘贴图片、`ReadMediaFile` 读图、MCP 工具结果里的图片等)。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `max_edge_px` | `integer` | `2000` | 图片最长边上限(像素)。超过时按比例缩小到该值以内;调大可保留更多细节,代价是更大的请求体积 | | `read_byte_budget` | `integer` | `262144`(256 KB) | 模型自行读取图片的单图字节预算(`ReadMediaFile` 默认读取);`region` 与 `full_resolution` 回读不受此限制 | `max_edge_px` 可被环境变量 `KIMI_IMAGE_MAX_EDGE_PX` 覆盖,`read_byte_budget` 可被 `KIMI_IMAGE_READ_BYTE_BUDGET` 覆盖,优先级均高于配置文件。 `database` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#database) ------------------------------------------------------------------------------------------------------ `database` 控制会话索引和全局搜索背后的嵌入式存储引擎。两个字段默认值都是 `true`,设为 `false` 时回退到旧有行为。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `base` | `boolean` | `true` | 会话索引使用基于 minidb 的读模型;`false` 回退为直接读取会话元数据 | | `search` | `boolean` | `true` | 在独立 worker 线程中运行全局搜索索引;`false` 在服务器进程内运行 | `base` 可被环境变量 `KIMI_CODE_PERSISTENCE_MINIDB_READMODEL` 覆盖,`search` 可被 `KIMI_CODE_SEARCH_WORKER` 覆盖,优先级均高于配置文件。 `watch` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#watch) ------------------------------------------------------------------------------------------------ `watch` 控制 local.toml、AGENTS.md、skills、MCP 配置以及 `config.toml` 自身的文件系统热更新。默认关闭。把 `enabled` 设为 `true` 后进程内才会挂 watcher;关闭时改文件要重启才会再读。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | `boolean` | `false` | 是否挂文件系统 watch;`false` 关闭进程内全部 `watch()` | `enabled` 可被环境变量 `KIMI_CODE_WATCH` 覆盖,优先级高于配置文件。 `services` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#services) ------------------------------------------------------------------------------------------------------ `services` 配置网页搜索(`moonshot_search`)和网页抓取(`moonshot_fetch`)两项内置服务。只识别这两个固定 key,其他 key 会被忽略。两项字段相同: | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `base_url` | `string` | 否 | 服务 API URL | | `api_key` | `string` | 否 | API 密钥 | | `oauth` | `table` | 否 | OAuth 凭据引用,结构同 `providers.*.oauth` | | `custom_headers` | `table<string, string>` | 否 | 请求时附加的自定义 HTTP 头 | `base_url` 和 `api_key` 也可由环境变量提供,环境变量优先于配置文件:`KIMI_WEB_SEARCH_BASE_URL` / `KIMI_WEB_SEARCH_API_KEY` 对应 `moonshot_search`,`KIMI_WEB_FETCH_BASE_URL` / `KIMI_WEB_FETCH_API_KEY` 对应 `moonshot_fetch`。`KIMI_WEB_SEARCH_BASE_URL` 和 `KIMI_WEB_FETCH_BASE_URL` 定义的是独立服务端点,因此文件中持久化的 API 密钥、OAuth 引用和自定义 header 都不会发送给它;该端点需要鉴权时,请同时设置对应的环境变量 API 密钥。只设置环境变量 API 密钥时,配置中的端点和自定义 header 保持不变,但两种配置凭据都会被替换。不写配置段、只通过环境变量设置 base URL 和 API 密钥,也可以启用对应服务。 toml [services.moonshot_search] base_url = "https://api.moonshot.cn/v1/search" api_key = "sk-xxx" [services.moonshot_fetch] base_url = "https://api.moonshot.cn/v1/fetch" api_key = "sk-xxx" `permission` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) ---------------------------------------------------------------------------------------------------------- `permission` 设置会话启动时自动加载的权限规则,控制 Agent 调用工具时是否需要用户确认。规则用 `[[permission.rules]]` 数组表写出,按顺序匹配,第一条命中即生效。 也可以在 `[permission]` 下设置 `dangerous_command_guard = false` 完全关闭内置危险命令策略("Always Ask" 和 "Ask When Needed" 模式下不再触发危险命令审批;"Never Ask" 模式本就不启用该策略),默认 `true`。环境变量 `KIMI_CODE_DANGEROUS_COMMAND_GUARD=false` 会覆盖文件设置并恢复策略引入前的行为。此开关只适用于已经在 Agent 之外统一命令限权的环境。 | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `decision` | `string` | 是 | 匹配后的处置:`allow`(直接放行)、`deny`(直接拒绝)、`ask`(每次询问) | | `scope` | `string` | 否 | 规则有效范围:`turn-override`、`session-runtime`、`project`、`user`,默认 `user` | | `pattern` | `string` | 是 | 匹配模式,格式为 `工具名` 或 `工具名(参数模式)`,如 `Read`、`Bash(rm -rf*)` | | `reason` | `string` | 否 | 规则说明,仅用于调试和审计 | 内置工具名见[内置工具](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html) 。大多数支持规则参数的内置工具会定义自己的匹配对象,例如 `Bash(command-pattern)` 或 `Read(path-pattern)`。`AgentSwarm`、MCP 工具和自定义工具只能按工具名匹配,不支持参数模式。 toml [[permission.rules]] decision = "allow" pattern = "Read" [[permission.rules]] decision = "allow" pattern = "Grep" [[permission.rules]] decision = "deny" pattern = "Bash(rm -rf*)" [[permission.rules]] decision = "ask" pattern = "Bash" TIP MCP server 的声明配置写在 `~/.kimi-code/mcp.json` 或项目内 `.kimi-code/mcp.json` 中,不在 `config.toml` 里。交互式配置入口是 `/mcp-config`,详见 [Model Context Protocol](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) 。 `tui.toml` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tui-toml) ------------------------------------------------------------------------------------------------------ 除了 `config.toml`,CLI 还在同一目录下用一份配套的 `tui.toml` 保存终端界面与客户端偏好(`~/.kimi-code/tui.toml`,或覆盖后的 `$KIMI_CODE_HOME/tui.toml`)。它在首次运行时以默认值创建,交互式命令 `/config`、`/theme`、`/editor` 会自动写入,通常无需手动编辑。文件格式有误时,CLI 会回退到默认值并给出提示,而不是启动失败。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `theme` | `string` | `auto` | 配色主题:`auto`、`dark`、`light` 或[自定义主题](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html)<br>名 | | `tui_mode` | `string` | `regular` | 界面布局:`regular` 渲染进终端滚动缓冲区;`fullscreen`(实验性)部分组件支持鼠标交互,交互更顺手 | | `render_latex` | `boolean` | `true` | 将 Markdown 中的 LaTeX 公式渲染为 Unicode 文本;`false` 保留原始源码 | | `disable_paste_burst` | `boolean` | `false` | 禁用非 bracketed paste 的粘贴突发兜底;默认开启,避免快速多行粘贴被逐行提交 | | `cache_expiry_hint` | `boolean` | `true` | resume 或长时间空闲后发消息时,若上下文缓存可能过期则提醒,可先压缩或新建会话(仅 v2 引擎) | | `disable_feedback_survey` | `boolean` | `false` | 关闭输入框上方偶尔出现的会话评分提示 | | `[editor].command` | `string` | `""` | 编写长输入用的外部编辑器命令;留空则回退到 `$VISUAL` / `$EDITOR` | | `[notifications].enabled` | `boolean` | `true` | 是否发送桌面通知 | | `[notifications].notification_condition` | `string` | `unfocused` | 何时通知:`unfocused`(仅终端失去焦点时)或 `always`(总是) | | `[upgrade].auto_install` | `boolean` | `true` | 是否自动安装新版本 | | `[status_line].items` | `string[]` | `[]` | 底部状态栏第一行的内置槽位及顺序:`mode`、`goal`、`model`、`tasks`、`cwd`、`git`、`tips`,未知 id 跳过并告警 | | `[status_line].command` | `string` | `""` | 自定义状态栏命令:stdout 首行替换状态栏,stdin 收 JSON 快照;上限 300ms、每秒一次,失败回退内置布局 | command 的 stdin 输入 model、cwd、git 分支、permission 模式、plan 模式、上下文用量、session id、版本。 toml # ~/.kimi-code/tui.toml theme = "auto" # "auto" | "dark" | "light" | 自定义主题名 tui_mode = "regular" # "regular" | "fullscreen"("fullscreen" 为实验性) render_latex = true # false 表示消息中的 LaTeX 公式保留原始源码 disable_paste_burst = false # true 表示禁用非 bracketed paste 的粘贴突发兜底 cache_expiry_hint = true # false 表示关闭 resume / 空闲提交时的"缓存已过期"提醒弹窗 disable_feedback_survey = false # true 表示关闭偶发的会话评分提示 [editor] command = "" # 留空则使用 $VISUAL / $EDITOR [notifications] enabled = true notification_condition = "unfocused" # "unfocused" | "always" [upgrade] auto_install = true # [status_line] # items = ["mode", "goal", "model", "tasks", "cwd", "git", "tips"] # command = "~/.kimi-code/statusline.sh" 修改在下次启动时生效,或用 `/reload-tui` 立即生效(只重载 `tui.toml`);`/reload` 会同时重载 `config.toml` 和 `tui.toml`。 项目级本地配置 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E9%A1%B9%E7%9B%AE%E7%BA%A7%E6%9C%AC%E5%9C%B0%E9%85%8D%E7%BD%AE) ---------------------------------------------------------------------------------------------------------------------------------------------------------- 除了 `~/.kimi-code` 下的用户级文件,Kimi Code 还会读取位于 `<项目根目录>/.kimi-code/local.toml` 的项目级本地配置文件。它保存的是与某一个项目检出相关、通常不应与队友共享的设置。 该文件会在你通过 [`/add-dir`](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) 添加额外工作目录并选择记入项目时自动创建,通常无需手动编辑。 ### `[workspace]` [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#workspace) `[workspace]` 表用于存放项目级的工作区设置: | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `additional_dir` | `array<string>` | 否 | 额外工作目录列表(绝对路径);在 `/add-dir` 确认"记住此目录"时自动写入,该项目每个会话可用 | toml [workspace] additional_dir = ["/absolute/path/to/shared"] 目录以绝对路径存储,与具体机器相关。因此建议把 `.kimi-code/local.toml` 加入项目的 `.gitignore`,避免被提交。 `.kimi-code/local.toml` 受工作区信任门控:只有在启动时的信任提示中信任该项目文件夹后才会生效;工作区未信任时,其中的 `additional_dir` 条目会被忽略。解析后指向用户主目录或文件系统根目录的条目会被拒绝。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------------ * [平台与模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) — 各供应商类型(Kimi、Claude、OpenAI、Gemini)的接入示例 * [配置覆盖](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html) — CLI 选项、配置文件、环境变量的优先级规则 * [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) — `KIMI_CODE_HOME` 等运行时变量的完整列表 --- # 斜杠命令 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#VPContent) Return to top 斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) ========================================================================================================================== 斜杠命令是 Kimi Code CLI 在交互式 TUI 中提供的内置控制命令,涵盖账号配置、会话管理、模式切换、信息查询等操作。在输入框中输入 `/` 即可触发命令补全,候选列表随后续字符实时过滤;命令的别名也会一并参与匹配。 输入完整命令名后按 `Enter` 执行。如果输入的 `/` 开头内容不匹配任何内置或 Skill 命令,则按普通消息发送给 Agent。 提示 部分命令仅在空闲(idle)状态下可用。会话正在流式输出或压缩上下文时执行这些命令会被拦截,需先按 `Esc` 或 `Ctrl-C` 中断。下表「随时可用」列标注了流式输出期间也可用的命令。 账号与配置 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E8%B4%A6%E5%8F%B7%E4%B8%8E%E9%85%8D%E7%BD%AE) ------------------------------------------------------------------------------------------------------------------------------------ | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/login` | — | 选择账号或平台并登录:Kimi Code 走 OAuth 验证码流程,Kimi Platform 通过 API 密钥登录 | 否 | | `/logout` | — | 清除当前所选账号的凭据 | 否 | | `/provider` | — | 打开交互式供应商管理器,查看、添加和删除已配置的供应商。详见[平台与模型 — `/provider` 与供应商管理](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html#provider-%E2%80%94-%E4%BA%A4%E4%BA%92%E5%BC%8F%E4%BE%9B%E5%BA%94%E5%95%86%E7%AE%A1%E7%90%86) | 是 | | `/model` | — | 切换当前会话使用的 LLM 模型 | 是 | | `/secondary-model` | `/subagent-model` | 选择 subagent 的默认模型(写入 `[secondary_model] default_model`,详见[subagent 模型池](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0)<br>) | 是 | | `/settings` | `/config` | 打开 TUI 内的设置面板 | 是 | | `/experiments` | `/experimental` | 打开实验功能面板 | 是 | | `/permission` | — | 选择权限模式 | 是 | | `/editor` | — | 配置 `Ctrl-G` 调起的外部编辑器 | 是 | | `/theme` | — | 切换终端 UI 配色主题 | 是 | 会话管理 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86) -------------------------------------------------------------------------------------------------------------------------- | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/new` | `/clear` | 开启全新会话,丢弃当前上下文 | 否 | | `/sessions` | `/resume` | 浏览历史会话并切换/恢复 | 否 | | `/tasks` | `/task` | 浏览后台任务列表 | 是 | | `/fork` | — | 基于当前会话 fork 一份新会话,保留完整对话历史;fork 后仍停留在当前会话 | 否 | | `/title [<text>]` | `/rename` | 不带参数时显示当前会话标题;带参数时设置为新标题(最长 200 字符) | 是 | | `/compact [<instruction>]` | — | 压缩当前对话上下文,释放 token 占用;可附带自定义指令,提示模型压缩时保留哪些信息 | 否 | | `/undo [<count>]` | — | 从当前上下文撤销最近的提示词。不带数量时打开选择器;带数量时撤销对应条数。最后一次上下文压缩之前的提示词不能撤销。撤销会一并回滚这些提示词产生的 todo 列表和计划模式状态(不回滚代码改动) | 否 | | `/init` | — | 分析当前代码库并生成 `AGENTS.md` | 否 | | `/export-md [<path>]` | `/export` | 将当前会话导出为 Markdown 文件 | 否 | | `/export-debug-zip` | — | 将当前会话导出为调试用 ZIP 压缩包(与 [`kimi export`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-export)<br> 行为一致) | 否 | | `/copy` | — | 将最后一条 AI 回复复制到剪贴板 | 否 | | `/add-dir [<path>]` | — | 为当前会话添加额外的工作目录。不带路径(或传入 `list`)运行时列出已配置的目录。添加时可选择是否将目录记入项目的 `.kimi-code/local.toml` | 否 | | `/web` | — | 在 web UI 中打开当前会话:选择一个运行中的实例进行连接,或在 TUI 退出后新开一个前台服务器。参见 [`kimi web`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) | 是 | | `/desktop` | `/install-desktop` | 在浏览器中打开 Kimi Code 桌面端页面(地址随当前区域而定:`https://www.kimi.com/code` 或 `https://www.kimi.ai/code`)。参见 [`kimi install-desktop`](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-install-desktop) | 是 | 模式与运行控制 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E6%A8%A1%E5%BC%8F%E4%B8%8E%E8%BF%90%E8%A1%8C%E6%8E%A7%E5%88%B6) -------------------------------------------------------------------------------------------------------------------------------------------------------- | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/yolo` | `/yes` | 打开权限模式列表并预选 "Ask When Needed",按 `Enter` 确认开启。该模式下常规修改和命令自动完成;高危操作、提问和计划仍会问你 | 是 | | `/auto` | — | 打开权限模式列表并预选 "Never Ask",按 `Enter` 确认开启。该模式下完全不打断,所有操作和判断自动完成 | 是 | | `/plan [on\|off]` | — | 切换 Plan 模式。不带参数时翻转;显式传 `on`/`off` 时强制设置。单纯切换不会创建空计划文件 | 是 | | `/plan clear` | — | 清除当前 plan 方案 | 否 | | `/swarm on\|off` | — | 开启或关闭 swarm mode,但不发送提示词。 | 是 | | `/swarm <task>` | — | 先开启 swarm mode,再把 `<task>` 作为普通提示词发送。如果该轮次正常完成,swarm mode 会自动关闭。若当前是 `manual` 权限模式,启动前会提示是否切换到 "Ask When Needed" 或 "Never Ask" 模式。 | 否 | | `/goal [...]` | — | 开始或管理目标模式 | 见下文 | 注意 `/yolo` 会跳过普通工具调用的审批确认,使用前请确保了解可能的风险。Plan 模式的退出审批不会被 `/yolo` 跳过;Plan 模式下的 `Bash` 也按 `/yolo` 的普通放行规则处理。 目标模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) -------------------------------------------------------------------------------------------------------------------------- `/goal` 用于开始或管理目标模式:Kimi Code 会在自动续跑的轮次中持续朝一个持久目标工作。使用指导和示例见[交互与输入:目标模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E7%9B%AE%E6%A0%87%E6%A8%A1%E5%BC%8F) 。 sh /goal 更新 checkout 文档,运行 docs build,如果 20 轮后仍被阻塞就停止 | 命令 | 作用 | 可用性 | | --- | --- | --- | | `/goal` 或 `/goal status` | 显示当前目标及其状态、已用时间、轮次数、token 数 | 随时可用 | | `/goal pause` | 暂停当前的目标,但不删除 | 随时可用 | | `/goal resume` | 继续被暂停或被阻塞的目标 | 仅空闲时 | | `/goal cancel` | 移除当前目标 | 随时可用 | | `/goal replace <objective>` | 用新目标替换已保存的目标 | 仅空闲时 | | `/goal next <objective>` | 为当前会话安排一个后续目标。如果当前没有目标,则立即开始它。当前目标完成前,Agent 不会看到已排队的目标 | 随时可用 | | `/goal next manage` | 打开后续目标管理器。用 ↑ / ↓ 浏览,Space 选择一个目标以便移动,选中后用 ↑ / ↓ 调整顺序,E 编辑,D 删除,Esc 取消。编辑输入框中,用 Shift-Enter 或 Ctrl-J 添加新行,用 Enter 保存 | 随时可用 | `status`、`pause`、`resume`、`cancel`、`replace` 和 `next` 只有作为 `/goal` 后的第一个词时才是子命令。如果你的目标需要以这些词开头,请在目标前加 `--`: sh /goal -- cancel 函数需要在订单失败时返回可重试错误,并补充测试 如果后续目标需要以 `manage` 开头,请在 `next` 后加 `--`: sh /goal next -- manage 发布检查清单 在非交互式 prompt 模式中,只有创建形式会启动目标模式: sh kimi -p "/goal 修复 checkout 测试失败" Prompt 模式在目标完成时以退出码 `0` 退出,在目标阻塞时以 `3` 退出,在目标暂停时以 `6` 退出。其它 `/goal` 子命令,包括 `next`,都是 TUI 控制命令,不由 `kimi -p` 处理。 信息与状态 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%BF%A1%E6%81%AF%E4%B8%8E%E7%8A%B6%E6%80%81) ------------------------------------------------------------------------------------------------------------------------------------ | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/help` | `/h`、`/?` | 显示快捷键和所有可用命令 | 是 | | `/btw [问题]` | — | 在 fork 出的 subagent 中打开旁路对话,不改变当前 main agent 轮次;不带问题时会先打开面板等待输入 | 是 | | `/usage` | — | 显示 token 用量、上下文占用以及配额信息 | 是 | | `/status` | — | 显示当前会话运行时状态:版本、模型、工作目录、权限模式等 | 是 | | `/mcp` | — | 列出当前会话中的 MCP server 及连接状态 | 是 | | `/plugins` | — | 打开交互式 plugin 管理器 | 是 | | `/version` | — | 显示 Kimi Code CLI 版本号 | 是 | | `/feedback` | `/bug` | 提交反馈,可附加诊断日志和代码库上下文 | 是 | 退出 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E9%80%80%E5%87%BA) ------------------------------------------------------------------------------------------------------ | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/exit` | `/quit`、`/q` | 退出 Kimi Code CLI | 否 | 内置 Skill 命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E5%86%85%E7%BD%AE-skill-%E5%91%BD%E4%BB%A4) ---------------------------------------------------------------------------------------------------------------------------------------- Kimi Code CLI 随包内置了一组 Skill,直接以 `/<name>` 形式出现在斜杠命令面板中。与外部 Skill 不同,它们不需要 `skill:` 前缀,开箱即用。 | 命令 | 说明 | | --- | --- | | `/mcp-config` | 配置 MCP server 并处理 MCP OAuth 登录。详见 [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) | | `/custom-theme [<text>]` | 创建或编辑自定义 TUI 配色主题。详见 [主题](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html) | | `/update-config` | 查看或编辑 `config.toml`(模型、供应商、权限、hooks)和 `tui.toml`(主题、编辑器、通知、自动更新) | | `/check-kimi-code-docs` | 依据官方文档回答 Kimi Code 产品问题(CLI 用法、配置、会员、错误码) | | `/import-from-cc-codex` | 从 Claude Code 和 Codex 导入 instructions、skills 和 MCP 设置 | | `/sub-skill` | 发现并将本地 skill 库存重组为分层子 skill 包。包含 `/sub-skill.review`(只读提案)和 `/sub-skill.consolidate`(执行重组) | 所有内置 Skill 命令仅在空闲状态下可用。 Skill 动态命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#skill-%E5%8A%A8%E6%80%81%E5%91%BD%E4%BB%A4) -------------------------------------------------------------------------------------------------------------------------------------- 已激活的外部 Skill 会自动注册为斜杠命令。普通外部 Skill 以 `skill:` 作为命名空间前缀: /skill:<name> [附加文本] 例如 `/skill:code-style` 加载名为 `code-style` 的 Skill 并发送给 Agent;命令后附带的文本拼接到 Skill 提示词之后。 外部子 Skill 会直接以点分名称出现在斜杠命令面板中: /<parent-skill>.<sub-skill> [附加文本] 例如,父 Skill 名为 `code-style`,其中子 Skill 的本地名称为 `review`,面板中显示为 `/code-style.review`。点分命令名由层级自动生成,子 Skill 的 `SKILL.md` 可以保留本地 `name`。 为方便输入,外部 Skill 命令同时支持省略 `skill:` 前缀的简写形式 `/<name>`,前提是该名称未被系统斜杠命令占用——即 `/code-style` 会回退匹配到 `/skill:code-style`。 Kimi Code CLI 随包内置的 Skill 会直接以 `/<name>` 形式出现在斜杠命令面板中。例如,`/mcp-config` 用于配置 MCP server 和处理 MCP OAuth 登录,`/custom-theme [附加文本]` 用于进入自定义主题流程,创建或编辑 TUI 主题。 说明 Agent 忙碌时输入的外部 Skill 命令不会被拒绝,而是排队等待当前轮次结束——按 `Ctrl-S` 可让排队的命令立即插入正在运行的轮次。`flow` 类型的 Skill 同样通过 `/skill:<name>` 暴露,没有独立的 `/flow:` 命名空间。 Skill 的安装与编写详见 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------------------------- * [键盘快捷键](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html) — TUI 键盘操作速查 * [内置工具](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html) — Agent 可调用的工具完整参考 --- # 内置工具 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#VPContent) Return to top 内置工具 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%86%85%E7%BD%AE%E5%B7%A5%E5%85%B7) ================================================================================================================= 内置工具是 Kimi Code CLI 随核心引擎提供的工具集,无需安装 MCP server 即可使用。Agent 在每次对话中会根据任务需要自动选择并调用这些工具;用户可以通过权限审批界面查看每次工具调用的细节。 与 MCP 工具相比,内置工具由运行时直接管理,生命周期与会话绑定,无需外部进程。两者都遵循统一的审批机制:**只读类工具**(如 `Read`、`Grep`、`Glob`)默认自动放行,**写入与执行类工具**(如 `Write`、`Edit`、`Bash`)默认需要用户审批。"Ask When Needed" 模式下普通工具调用的审批会被跳过,但 Plan 模式下的退出审批不受影响。 文件类 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E6%96%87%E4%BB%B6%E7%B1%BB) ------------------------------------------------------------------------------------------------------- 文件类工具负责读取、写入、搜索本地文件系统,是代码分析和修改任务的基础工具。 | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `Read` | 自动放行 | 读取文本文件内容 | | `Write` | 需审批 | 创建或覆盖文件 | | `Edit` | 需审批 | 精确字符串替换 | | `Grep` | 自动放行 | 基于 ripgrep 的全文搜索 | | `Glob` | 自动放行 | 按 glob 模式查找文件 | | `ReadMediaFile` | 自动放行 | 读取图片或视频文件 | **`Read`** 接受文件路径(`path`)以及可选的 `line_offset`(起始行号,支持负数从末尾倒数)、`column_offset`(正向读取时,起始行内从 0 开始的位置)、`n_lines`(请求读取的源文件行数)和 `max_chars`(结果的字符上限,包含行号和状态信息)。省略 `n_lines` 时向文件末尾读取。默认上限为 100,000 字符,调用可申请到 500,000 字符;两个值都可通过 [`read` 配置](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#read) 修改。字符数和列偏移按显示文本的 JavaScript 字符串长度计算,列偏移不包含行号前缀:常见字母和汉字各计 1,许多 emoji 计 2。 `Read` 优先返回完整行,结果不会再被通用工具输出限制缩短。如果单独一行也无法在一页中容纳,工具会返回片段,并在状态中说明列范围及 `Next Read` 参数,无需提高额度即可继续读取。拼接同一行的片段时不要额外插入换行。一行只返回部分内容时,仍会计入剩余的 `n_lines` 范围,直到行尾返回为止。非法列偏移会明确报错,不会跳过内容。 尾读优先返回请求范围中较新的完整行。如果连一条完整行都无法容纳,结果会给出未读范围的正向 `Next Read` 参数;`column_offset` 不能与负数 `line_offset` 同时使用。续读位置针对文件的当前内容,文件变化后应重新读取。如果尾读提示读取期间文件发生变化,请基于更新后的文件重试。10 MiB 以内的 UTF-16 LE/BE 文件会先尝试严格解码;失败后,`Read` 会将损坏序列替换为 `�` 并返回可读文本,同时在每一页提示发生了有损解码、文本可能与原文不同。告警也计入字符额度;有效文件中原本就有的 `�` 不会触发告警。图片和视频请使用 `ReadMediaFile`。 **`Write`** 接受 `path`、`content` 和可选的 `mode`(`overwrite` 或 `append`,默认覆盖)。缺失的父目录会自动创建;`append` 模式将内容追加到文件末尾,不自动添加换行。写入已存在的文件(无论 `overwrite` 还是 `append` 模式)要求本会话中先用 `Read` 读过该文件——若文件自上次读取后在磁盘上发生变化,写入会被拒绝;新建文件不受此限。 **`Edit`** 接受 `path`、`old_string`(要替换的精确文本)和 `new_string`(替换后的文本)。默认只替换唯一一处匹配,若文件中存在多处相同内容会报错并提示使用 `replace_all: true`。`old_string` 与 `new_string` 不能相同。目标文件必须在本会话中先用 `Read` 读过;若文件自读取后在磁盘上发生变化,编辑会被拒绝。 **`Grep`** 调用 ripgrep 搜索文件内容,支持正则表达式(`pattern`)、搜索路径(`path`)、文件类型过滤(`type`,如 `ts`、`py`)、glob 过滤(`glob`)和输出模式(`output_mode`:`files_with_matches` / `content` / `count_matches`,默认 `files_with_matches`)。`content` 模式支持上下文行(`-A`、`-B`、`-C`)、忽略大小写(`-i`)、行号(`-n`,默认 true)、跨行匹配(`multiline`)。所有模式支持 `offset` + `head_limit` 分页,`head_limit` 默认 250、传 0 表示不限。`.env`、私钥等敏感文件会被自动过滤;`include_ignored=true` 可搜索被 `.gitignore` 忽略的文件,但敏感文件仍保持过滤。 **`Glob`** 按 glob 模式(`pattern`)在指定目录(`path`,默认工作目录)中匹配文件,结果按修改时间倒序排列,默认返回 100 条。默认尊重 `.gitignore`、`.ignore` 和 `.rgignore`;设置 `include_ignored=true` 可包含构建产物等被忽略的文件,但敏感文件仍会被过滤。支持 `*.{ts,tsx}` 这类花括号模式,也允许宽泛通配符模式。 使用 `offset`(默认 0)和 `head_limit`(默认 100)对匹配路径分页;有更多结果时,工具会给出下一页的 offset。设置 `head_limit: 0` 可取消条数限制,但字符上限仍然有效:达到上限时,页面会在完整路径处结束,并给出下一页的 offset。较大的页面会保存到文件,Agent 可用 `Read` 读取。每次调用都会重新搜索当前文件系统,因此文件变化可能导致跨页结果移动。超时、目录无法读取或输出采集上限仍可能造成搜索不完整;结果会提示这些情况,增加 offset 无法恢复尚未收集的路径。 **`ReadMediaFile`** 将图片或视频以多模态内容发送给模型。它接受 `path`,以及 `region`、`full_resolution` 等可选的图片细节参数;文件大小上限为 100 MB。默认读图会按配置的模型限制压缩;如果自动压缩无法安全满足限制,工具会返回错误且不发送原图,并提示模型先创建更小的副本再读取。是否可用取决于当前模型的视觉能力(`image_in` / `video_in`)。 Shell [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#shell) ----------------------------------------------------------------------------------- | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `Bash` | 需审批 | 执行 Shell 命令 | **`Bash`** 是权限要求最严格的工具,也是功能最通用的工具。参数: * `command`(必填):要执行的 Shell 命令 * `cwd`:工作目录 * `timeout`:超时时间(毫秒);前台默认 60 秒、最长 5 分钟 * `run_in_background`:是否以后台任务运行;后台默认 10 分钟超时(print 模式 `kimi -p` 下默认无超时) * `description`:后台任务描述,`run_in_background=true` 时必填 * `disable_timeout`:后台任务是否取消超时限制 前台模式会阻塞当前轮次,直到命令结束或超时;命令运行期间,TUI 会把 stdout 和 stderr 流式显示在正在运行的 `Bash` 工具卡片中。前台命令超时后默认不会被终止,而是转为后台任务继续运行(受 600 秒默认后台超时约束);如需恢复超时即终止的行为,将 `[background]` 的 [`bash_auto_background_on_timeout`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#background) 设为 `false`。600 秒的默认后台超时可通过 [`bash_task_timeout_s`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#background) 配置(`0` = 无超时),且在 print 模式(`kimi -p`)下默认无超时。后台模式立即返回任务 ID,任务结束时自动通知 Agent。stdin 始终被关闭,交互式命令会立即收到 EOF。任务被停止或后台超时时采用两阶段终止策略(SIGTERM → 5 秒宽限期 → SIGKILL),确保进程可靠结束。Windows 平台默认使用 Git Bash。 网络类 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E7%BD%91%E7%BB%9C%E7%B1%BB) ------------------------------------------------------------------------------------------------------- | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `WebSearch` | 自动放行 | 网络搜索 | | `FetchURL` | 自动放行 | 获取指定 URL 的内容 | **`WebSearch`** 接受 `query`(搜索词)。需要宿主提供搜索实现,未注入时不会出现在工具列表中。 **`FetchURL`** 接受单个 `url` 参数,返回页面内容。对 HTML 页面,宿主会提取正文而非返回完整 HTML;纯文本或 Markdown 页面直接透传。同样需要宿主注入实现。 Plan 模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#plan-%E6%A8%A1%E5%BC%8F) ------------------------------------------------------------------------------------------------------- | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `EnterPlanMode` | 自动放行 | 进入 Plan 模式 | | `ExitPlanMode` | 自动放行(需用户确认计划) | 退出 Plan 模式并提交计划 | Plan 模式是一种受约束的工作状态:进入后 `Write` 与 `Edit` 只允许写入当前的计划文件,`TaskStop` 被完全拦截。其余工具(包括 `Bash`)仍按当前权限规则处理。 **`EnterPlanMode`** 不接受任何参数,进入成功后返回工作流指引及计划文件路径。 **`ExitPlanMode`** 读取当前计划文件内容,将计划呈现给用户审批后退出 Plan 模式。可选参数 `options` 允许 Agent 提供 1–3 个备选方案(每项含 `label` 与 `description`,`label` 最长 80 字符),供用户在审批时选择;`label` 不能重复,也不能使用 `Approve`、`Reject`、`Reject and Exit`、`Revise` 等保留词。 状态管理 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E7%8A%B6%E6%80%81%E7%AE%A1%E7%90%86) ----------------------------------------------------------------------------------------------------------------- | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `TodoList` | 自动放行 | 管理任务待办列表 | **`TodoList`** 在多步骤操作中维护一份可见的子任务列表,状态存储在 Agent 会话内。`todos` 参数接受一个数组,每项含 `title` 和 `status`(`pending` / `in_progress` / `done`);省略 `todos` 则仅查询当前列表,传入空数组则清空列表。 协作类 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%8D%8F%E4%BD%9C%E7%B1%BB) ------------------------------------------------------------------------------------------------------- 协作类工具负责 Agent 间协作、用户交互和 Skill 调用。 | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `Agent` | 自动放行 | 派生 subagent 执行子任务 | | `AgentSwarm` | swarm mode 中自动放行,否则需审批 | 启动基于 item 的 subagent,或恢复已有 subagent | | `AskUserQuestion` | 自动放行 | 向用户提问以获取结构化输入 | | `NotifyUser` | 自动放行 | 在轮次进行中向用户展示一条简短的进展更新 | | `Skill` | 自动放行 | 调用已注册的 inline Skill | **`Agent`** 将子任务委托给 subagent 执行。必填参数:`prompt`(完整任务描述)和 `description`(3–5 个词的简短说明)。可选参数:`subagent_type`(默认 `coder`)、`resume`(恢复已有 Agent 的 ID,与 `subagent_type` 互斥)、`run_in_background`(默认 false)和 `model`(在配置 [subagent 模型池](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) 后可用——`[secondary_model.models]` 表或仅一行 `default_model`:池中别名,或 `"primary"` 表示调用方自己运行的模型;resume 时无效)。未传入时 subagent 绑定池的 `default_model`;未配置模型池时,subagent 一律继承调用方模型。Agent 任务默认 2 小时超时,可通过 `config.toml` 的 `[subagent] timeout_ms`(`0` = 无超时,或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时。前台模式下父 Agent 等待 subagent 完成再继续;后台模式立即返回任务 ID,完成时通过合成 User 消息自动回到 main agent。多个前台 `Agent` 调用在同一步运行时,TUI 会合并展示,并为每个 subagent 显示运行、等待、完成或失败状态以及已耗时长。subagent 体系细节见 [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) 。 **`AgentSwarm`** 可以从共享的 `prompt_template` 和 `items` 数组启动 subagent,也可以通过 `resume_agent_ids` 恢复已有 subagent,或在一次调用中同时使用两者。模板必须包含 占位符;每个 item 会替换该占位符,并启动一个新的 subagent。传入 `subagent_type` 可以指定整个 swarm 中所有新启动的 subagent 使用的 profile;省略时默认使用 `coder`。传入 `model`(在配置 [subagent 模型池](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) 后可用——`[secondary_model.models]` 表或仅一行 `default_model`)可以让新启动的 subagent 运行在池中别名指定的模型或调用方自己的模型(`"primary"`)上。未传入时新启动的 subagent 绑定池的 `default_model`;未配置模型池时则继承调用方模型。恢复的 subagent 保持其原有模型。不传 `resume_agent_ids` 时,本工具要求至少 2 个 item;传入 `resume_agent_ids` 时,可以恢复 1 个或多个已有 subagent。本工具最多支持 128 个 subagent,会等待全部 subagent 完成,并返回聚合报告。每个 subagent 默认 2 小时超时,可通过 `config.toml` 的 [`[swarm] timeout_ms`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#swarm) (`0` = 无超时,或 `KIMI_CODE_SWARM_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时;超时的 subagent 会被中止,并在聚合报告中标记为失败。在 TUI 中,前台 swarm 会在输入框上方显示实时 `Agent swarm` 进度面板。若一次模型响应调用 `AgentSwarm`,该调用必须是该响应中的唯一工具调用;如需运行多个 swarm,应先调用一个 `AgentSwarm` 并等待结果,再调用下一个,若单个模板可以覆盖这些工作,也可以合并为一个 swarm。在 `manual` 权限模式下,未处于 swarm mode 时调用 `AgentSwarm` 会触发审批,除非已有权限规则允许;swarm mode 已开启时,`AgentSwarm` 本身会自动放行。权限规则只能按工具名 `AgentSwarm` 匹配,不支持 `AgentSwarm(swarm)` 这类参数模式。默认情况下,本工具会逐步提升并发且不设上限(立即启动 5 个 subagent,之后每 700 毫秒再启动 1 个);将 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 设为正整数可限制该阶段同时运行的 subagent 数量,不设置则表示不限制。若设置为非正整数的值,本次 AgentSwarm 调用会立即失败。 **`AskUserQuestion`** 以结构化多选题的形式向用户提问,适用于需要消歧或选择方案的场景。`questions` 参数接受 1–4 道题,每道题需提供 `question`(以 `?` 结尾)、`options`(2–4 个选项,每项含 `label` 和 `description`)以及可选的 `header`(最多 12 字符)和 `multi_select`(默认 false)。系统自动附加"其他"选项。`background` 为 true 时启动后台问题任务并立即返回任务 ID;问题在本轮结束后仍保持待答,用户作答后答案会以通知形式直接送回 Agent。宿主未实现交互式提问能力时返回失败提示,Agent 应改为在文本回复中直接提问。 **`NotifyUser`** 让 main agent 和 subagent 发送简短进展更新,唯一参数 `message` 接受轻量 Markdown。TUI 的 `Updates` 面板会按顺序保留每条更新,同一来源的多条消息也不会互相覆盖。subagent 的消息使用已有的 agent ID(如 `[agent-7]`)作为同一行的来源标签;main agent 的消息不加前缀。完整消息通过分页阅读,不会被替换为一行摘要。 面板默认显示最新页,从末尾向前将渲染后的正文分组,每页最多八行。例如,十条单行更新会分为第一页两条、最后一页八条;不足八行的页面按实际内容占用空间。按 `Ctrl-P` 查看上一页,按 `Ctrl-N` 查看下一页。翻页直接在原面板中进行,不切换输入焦点、不改变草稿;到达第一页或最后一页时停止,不循环跳转。阅读旧页时,新追加的更新保持已有分页边界,并提示新增数量;回到最新页后,重新从末尾填满页面,并恢复跟随新更新。只有一页时,这两个按键保持原有编辑器行为。 轮次结束后,消息和当前页继续保留显示;下一次 main agent 轮次开始时才清空,subagent 自己的轮次不会清空面板。新会话、`/clear` 和重新打开会话时,面板从空白开始。只有工具成功返回并确认展示后,消息才会进入面板;等待审批时不会展示参数片段。失败、中断或被关闭开关抑制的通知不会进入面板,对话中的工具调用记录会保留实际展示结果。重要发现仍须写入最终回复或 subagent 的最终汇报。 整个功能都是默认关闭的实验特性。请在创建 TUI 会话前,通过 `KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1`、`config.toml` 中的 `[experimental] notify_user = true` 或 `/experiments` 启用。关闭状态下创建的会话不会提供该工具,也不会包含相关提示词指导。 已有会话的通知工具可用性和提示词保持不变,重新打开会话后也一样。关闭功能会隐藏面板并停用翻页快捷键;已有的 `NotifyUser` 调用仍正常结束,并返回更新未展示的说明。重新开启后,已具有该工具的会话恢复展示;如果会话是在关闭状态下创建的,需要新建会话才能使用 Updates。在 `/experiments` 中仅修改这个开关不会重载会话。 **`Skill`** 允许 Agent 主动调用已注册的 inline 类型 Skill。接受 `skill`(Skill 名称)和可选的 `args`(附加参数文本)。只有 `type = "inline"` 的 Skill 能通过此工具调用;`disableModelInvocation: true` 的 Skill 会被拒绝。嵌套调用深度上限 3 层。Skill 体系细节见 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 。 后台任务 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1) ----------------------------------------------------------------------------------------------------------------- 后台任务工具用于管理通过 `Bash`、`Agent` 或 `AskUserQuestion` 启动的后台任务。任务进入终止状态时会自动把状态和已保存的输出路径(问题任务则直接送回答案)送回 Agent;如需提前检查进度,使用 `TaskOutput`;如果下一步必须等待某个任务的结果,使用 `WaitFor` 在当前轮次内等待。 | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `TaskList` | 自动放行 | 列出后台任务 | | `TaskOutput` | 自动放行 | 查看后台任务的输出 | | `TaskStop` | 需审批 | 停止正在运行的后台任务 | | `WaitFor` | 自动放行 | 等待后台任务结束 | **`TaskList`** 返回后台任务列表。可选参数 `active_only`(默认 true,仅列出运行中的任务)和 `limit`(默认 20,取值范围 1–100)。 **`TaskOutput`** 根据 `task_id` 返回任务状态与输出。内联预览最多包含最近 32 KB 的内容;完整日志保存在磁盘上,工具会一并返回 `output_path` 并提示通过 `Read` 分页读取。该调用始终是非阻塞的——立即返回当前快照,任务完成会通过自动通知送达。 **`TaskStop`** 接受 `task_id` 和可选的 `reason`(默认 `Stopped by TaskStop`)。对已处于终止状态的任务也能安全调用。 **`WaitFor`** 把当前轮次挂起,直到后台任务结束、超时或收到 steer 消息。参数:`timeout`(必填,单位秒,上限 600)和可选的 `task_id`。不传 `task_id` 时,调用时刻运行中的任意一个后台任务结束即返回;当前没有运行中的后台任务时立即返回。超时不是错误——结果会列出仍在运行的任务,Agent 可以再次等待,也可以先处理其他工作。Steer(终端中按 `Ctrl-S`)会提前结束本次等待,后台任务继续运行,完成后仍会自动通知。已通过 `WaitFor` 汇报结果的任务不会再推送自动完成通知。 定时任务 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1) ----------------------------------------------------------------------------------------------------------------- 定时任务工具允许 Agent 把一段 prompt 在未来某个时间重新注入到当前会话——既可以是一次性提醒,也可以是按 cron 周期触发的任务(定期巡检、每日报表、部署监控等)。计划绑定到会话,用 `kimi --session` 恢复会话后仍然有效,但不会带入全新的会话。单个会话最多保留 50 个生效中的定时任务。设置 `KIMI_DISABLE_CRON=1` 可整体禁用,详见[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E8%BF%90%E8%A1%8C%E6%97%B6%E5%BC%80%E5%85%B3) 。 | 工具 | 默认审批 | 说明 | | --- | --- | --- | | `CronCreate` | 需审批 | 安排一个在未来时刻触发的 prompt | | `CronList` | 自动放行 | 列出已安排的定时任务 | | `CronDelete` | 需审批 | 取消已安排的定时任务 | **`CronCreate`** 接受 `cron`(用户本地时区下标准的 5 段 cron 表达式:`minute hour day-of-month month day-of-week`)、`prompt`(触发时要注入的文本,UTF-8 上限 8 KB)以及可选的 `recurring`(默认 `true`;传 `false` 表示一次性提醒,触发后自动删除)。成功时返回 8 位 16 进制 `id`、人类可读的 `humanSchedule`(如 `every 5 minutes`)和 `nextFireAt`(下次触发时间的 ISO 时间戳)。 为避免整批用户在整点同时触发,调度器会做确定性抖动:周期任务向后偏移 `min(周期的 10%, 15 分钟)`;一次性任务若恰好落在 `:00` 或 `:30` 则向前提前最多 90 秒。如果调度器错过了若干触发时刻(如笔记本合盖),唤醒后只会触发一次,prompt 会包裹在 `<cron-fire>` 信封里并附带 `coalescedCount`。周期任务存活超过 7 天后会以 `stale="true"` 做最后一次触发后自动删除;想继续保留时,再次调用 `CronCreate` 即可。 **`CronList`** 是只读工具,不接受任何参数。为每个生效中的任务返回一条记录,字段包括 `id`、`cron`、`humanSchedule`、`nextFireAt`、`recurring`、`ageDays` 和 `stale`。记录用 `---` 分隔,按调度时间排列。 **`CronDelete`** 只接受一个 `id`。对周期任务,未来所有触发立即停止;对一次性任务,挂起的那次触发会被取消。已触发的一次性任务会自动删除,因此对已触发过的一次性任务调用 `CronDelete` 会返回 `No cron job with id ...`。删除不可撤销,需要还原时只能再次 `CronCreate`。`CronDelete` 在 Plan 模式下同样会被拦截。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------- * [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — `Agent` 工具的调度机制与上下文隔离 * [Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) — 在工具调用前后触发本地脚本 * [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) — TUI 内置控制命令速查 --- # 键盘快捷键 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#VPContent) Return to top 键盘快捷键 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E9%94%AE%E7%9B%98%E5%BF%AB%E6%8D%B7%E9%94%AE) ============================================================================================================================== Kimi Code CLI 的 TUI 交互模式支持一套键盘快捷键。键位按使用场景分为五组:通用输入、模式切换、流式输出期间、工具输出控制、审批面板,以及弹窗浏览。在 TUI 中输入 `/help` 可随时打开内置快捷键清单。 通用快捷键 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E9%80%9A%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE) ------------------------------------------------------------------------------------------------------------------------------ 以下键位在输入框中始终可用: | 快捷键 | 功能 | | --- | --- | | `Enter` | 提交当前输入 | | `Shift-Enter` / `Ctrl-J` | 在输入中插入换行 | | `↑` / `↓` | 浏览输入历史 | | `Esc` | 关闭弹窗 / 取消补全 / 中断流式输出或上下文压缩 | | `Ctrl-C` | 中断当前流式输出,或清空输入框 | | `Ctrl-D` | 在输入框为空时退出 Kimi Code CLI | | `Ctrl-T` | 待办列表被截断时,展开或折叠完整列表 | | `Ctrl-P` | 实验性 `Updates` 面板有多页时,查看上一页 | | `Ctrl-N` | 实验性 `Updates` 面板有多页时,查看下一页 | **流式输出期间**按 `Ctrl-C` 会立即取消,无需二次确认。 **退出程序**(输入框为空时按 `Ctrl-C`,或按 `Ctrl-D`)使用「双击确认」机制:第一次按下后状态栏会出现提示,再按一次相同的键才真正退出。中途按其他键会清除确认状态。 模式切换 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E6%A8%A1%E5%BC%8F%E5%88%87%E6%8D%A2) -------------------------------------------------------------------------------------------------------------------- | 快捷键 | 功能 | | --- | --- | | `Shift-Tab` | 切换 Plan 模式 | | `!` | 在空输入框中进入 Shell 模式 | 按 `Shift-Tab` 可开启或关闭 Plan 模式。开启后,Agent 会优先使用只读工具进行研究和规划,并可写入当前计划文件;`Bash` 按当前权限模式和普通规则处理,不会因 Plan 模式额外发起独立审批。单纯切换模式不会创建空计划文件。再次按 `Shift-Tab` 退出 Plan 模式。 在空输入框中键入 `!` 进入 Shell 模式,可直接运行终端命令;命令运行期间按 `Ctrl+B` 可将其转为后台任务。详见[交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#shell-%E6%A8%A1%E5%BC%8F) 。 输入与编辑 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E8%BE%93%E5%85%A5%E4%B8%8E%E7%BC%96%E8%BE%91) ------------------------------------------------------------------------------------------------------------------------------ | 快捷键 | 功能 | | --- | --- | | `Ctrl-G` | 在外部编辑器中编辑当前输入 | | `Ctrl-V` | 粘贴剪贴板中的图片或视频(Unix / macOS) | | `Alt-V` | 粘贴剪贴板中的图片或视频(Windows) | | `Ctrl--` | 撤销(Undo) | | `Esc` `Esc` | 双击打开撤销选择框(空闲状态下) | 按 `Ctrl-G` 会打开外部编辑器,编辑器按以下优先级选择: 1. `/editor` 命令配置的编辑器 2. `$VISUAL` 环境变量 3. `$EDITOR` 环境变量 保存并退出后,编辑内容替换输入框;不保存退出则保持原样。 粘贴图片或视频时,输入框中显示占位符,实际媒体数据在提交时一并发送给模型。优先从系统剪贴板读取;Linux 上会尝试 Wayland 与 X11,WSL 下还会通过 PowerShell 兜底读取 Windows 剪贴板。 流式输出期间 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E6%B5%81%E5%BC%8F%E8%BE%93%E5%87%BA%E6%9C%9F%E9%97%B4) ---------------------------------------------------------------------------------------------------------------------------------------- 流式输出(streaming)期间,输入框依然可以接收输入,并支持以下额外操作: | 快捷键 | 功能 | | --- | --- | | `Ctrl-S` | Steer:将当前输入立即注入正在运行的轮次 | | `Esc` | 中断当前流式输出 | | `Ctrl-C` | 中断当前流式输出 | 按 `Ctrl-S` 时,模型会在下一个可中断的时机立刻看到你的消息,无需等待当前轮次结束。 工具输出 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E5%B7%A5%E5%85%B7%E8%BE%93%E5%87%BA) -------------------------------------------------------------------------------------------------------------------- | 快捷键 | 功能 | | --- | --- | | `Ctrl-O` | 展开或折叠工具输出、Shell 命令输出和压缩摘要 | 历史中存在折叠的工具调用结果或 Shell 命令输出时,按 `Ctrl-O` 可在折叠和展开之间切换。压缩完成后,同一个快捷键也会在压缩块中显示或隐藏压缩摘要。 审批面板 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E5%AE%A1%E6%89%B9%E9%9D%A2%E6%9D%BF) -------------------------------------------------------------------------------------------------------------------- 当 Agent 发起需要确认的工具调用时,TUI 会弹出审批面板。详细审批流程见[交互与输入](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E5%AE%A1%E6%89%B9%E6%B5%81%E7%A8%8B) ,面板内可用键位如下: | 快捷键 | 功能 | | --- | --- | | `↑` / `↓` | 在候选选项之间移动光标 | | `Enter` | 确认当前选中的选项 | | `1` ~ `9` | 直接选择对应序号的选项 | | `Esc` / `Ctrl-C` / `Ctrl-D` | 拒绝当前请求 | | `Ctrl-E` | 面板包含 diff 或文件内容预览时,展开或折叠完整内容 | | `Ctrl-O` | 切换其他工具输出的折叠状态 | 需要附带反馈的选项(如「Reject」「Revise」)会在确认后切换到反馈输入态:直接输入反馈文本,按 `Enter` 提交;按 `Esc` 退出反馈输入并回到候选列表。 弹窗模式 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E5%BC%B9%E7%AA%97%E6%A8%A1%E5%BC%8F) -------------------------------------------------------------------------------------------------------------------- 输入 `/help` 打开帮助面板后,可使用以下键位浏览和关闭面板: | 快捷键 | 功能 | | --- | --- | | `↑` / `↓` | 单行滚动 | | `PageUp` / `PageDown` | 每次滚动 10 行 | | `Esc` / `Enter` / `q` / `Q` | 关闭面板 | 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/keyboard.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------------------- * [斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/slash-commands.html) — TUI 内置的控制命令速查 * [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html) — 启动参数与子命令完整参考 --- # 配置覆盖 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#VPContent) Return to top 配置覆盖 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E9%85%8D%E7%BD%AE%E8%A6%86%E7%9B%96) ========================================================================================================================= Kimi Code CLI 有三个地方可以影响运行参数:配置文件、命令行选项、环境变量。三者并非简单的优先级叠加,而是面向不同场景、作用范围互不相同: * **配置文件** 保存长期偏好(模型、密钥、循环控制等),每次启动都生效 * **命令行选项** 做本次启动的临时切换,退出后失效 * **环境变量** 主要负责数据目录定位、OAuth 端点切换,以及少数运行时开关。它**不是配置字段的通用后备来源** 凭证解析不读取 shell 环境变量:在终端 `export KIMI_API_KEY=xxx` 不会生效。原因见下文[供应商凭证](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) 。 环境变量的三类作用 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E7%9A%84%E4%B8%89%E7%B1%BB%E4%BD%9C%E7%94%A8) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 环境变量按作用分三类,不能合并成一条线性优先级: 1. **定位配置文件**:`KIMI_CODE_HOME` 决定数据根目录,配置文件路径因此变为 `$KIMI_CODE_HOME/config.toml`。这一步先于其他所有解析,不是普通参数的后备来源。 2. **运行时开关**:`KIMI_DISABLE_TELEMETRY` 等少量变量直接关闭对应子系统。即使 `config.toml` 里 `telemetry = true`,只要这个变量是真值,遥测就会被禁用。语义是"额外禁用",不是"普通覆盖"。 3. **运行端点与诊断**:`KIMI_CODE_OAUTH_HOST`、`KIMI_CODE_BASE_URL`、`KIMI_LOG_LEVEL` 等在 OAuth 或日志子系统初始化时读取。完整列表见[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 。 普通运行参数的优先级 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E6%99%AE%E9%80%9A%E8%BF%90%E8%A1%8C%E5%8F%82%E6%95%B0%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 对模型别名、[Plan 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#plan-%E6%A8%A1%E5%BC%8F) 、[yolo 模式](https://www.kimi.com/code/docs/kimi-code-cli/guides/interaction.html#%E4%B8%89%E7%A7%8D%E6%9D%83%E9%99%90%E6%A8%A1%E5%BC%8F) 、Skills 目录等普通运行参数,优先级从高到低: 1. **命令行选项**(`-m`、`--plan`、`--yolo` 等):仅对本次启动生效 2. **用户配置文件**(`~/.kimi-code/config.toml`):保存长期偏好 少数环境变量明确覆盖特定配置字段,例如 `KIMI_CODE_BACKGROUND_KEEP_ALIVE_ON_EXIT` 的优先级高于 `[background].keep_alive_on_exit`。这类例外在[环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 和[配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) 对应字段里都有标注。 WARNING **普通运行参数不会从 shell 环境变量取后备值。** 供应商的 `api_key` / `base_url` 只从 `config.toml`(包括 `[providers.<name>.env]` 子表)读取,不会回退到 shell 里 `export` 的变量。例外有两处:`KIMI_MODEL_*` 系列和供应商的 `api_key_env` 字段,这两个显式通道_确实_会从 shell 读取凭证,详见[用环境变量定义模型](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%AE%9A%E4%B9%89%E6%A8%A1%E5%9E%8Bkimi-model) 和[供应商凭证](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) 。 目前 CLI 只读取一份用户级配置文件,没有项目级配置文件机制。需要在不同项目间隔离配置时,用 `KIMI_CODE_HOME` 指向不同的数据目录,见下文[典型场景](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E5%85%B8%E5%9E%8B%E5%9C%BA%E6%99%AF) 。 供应商凭证 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81) ----------------------------------------------------------------------------------------------------------------------------------- 供应商凭证(`api_key`、`base_url`)有独立的解析规则,不走普通参数的优先级链。 对单个供应商,凭证按以下顺序解析: 1. `[providers.<name>].api_key`:配置文件里直接写的密钥 2. `[providers.<name>].api_key_env`:指定一个 shell 环境变量名,从该变量读取密钥 3. `[providers.<name>.env]` 子表里的对应键(`KIMI_API_KEY`、`ANTHROPIC_API_KEY` 等):上面两个字段都不存在时才读这里 4. 三者都缺 → 启动报错,提示该供应商缺少凭证 `api_key` 和 `api_key_env` 是互斥的替代项,不是优先级回退链:只能设置其中一个——同时设置会被判为配置冲突,`api_key_env` 与 `oauth` 同设同样会被拒绝。 `api_key_env` 是「不从 shell 环境变量取凭证」唯一有意开放的例外:密钥在每次请求时从进程自身的环境中重新读取,不会被缓存到进程生命周期之外,也不写进 `config.toml`。注意,运行中的进程只能看到它启动时的环境——轮换变量需要重启 kimi / TUI 或 kap-server 进程;在父 shell 里重新 `export` 只影响新启动的进程。声明了 `api_key_env` 但变量未设置或为空时,会快速失败并报错,指明供应商和变量名——会话就绪检查(print 模式、kap-server 会话创建)和请求发送时都会拦截——绝不静默忽略,也不回退到其他凭证来源。 `base_url` 的解析方式相同:先读 `[providers.<name>].base_url`,再读 `[providers.<name>.env]` 里的 `*_BASE_URL` 键。 > `[providers.<name>.env]` 子表只是配置文件里的一段 TOML,不会真正写入 shell 环境变量。仅当对应的直接字段(`api_key` / `base_url`)为空时,CLI 才会读取该子表。 完整的凭证键名列表见[环境变量:供应商凭证键](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html#%E4%BE%9B%E5%BA%94%E5%95%86%E5%87%AD%E8%AF%81%E9%94%AE%E5%86%99%E5%9C%A8-configtoml-%E9%87%8C) 。 命令行选项 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E5%91%BD%E4%BB%A4%E8%A1%8C%E9%80%89%E9%A1%B9) ----------------------------------------------------------------------------------------------------------------------------------- 启动时传入的选项优先级最高,只对本次启动生效: | 选项 | 作用 | | --- | --- | | `-S, --session [id]` | 恢复指定会话;不带 id 时进入交互式选择 | | `-c, --continue` | 续上当前目录的上一次会话 | | `-y, --yolo` | 自动批准普通工具调用,Agent 仍可能提问 | | `--auto` | 以 auto 权限模式启动:完全自主,Agent 不会向用户提问 | | `--plan` | 以 Plan 模式启动 | | `-m, --model <model>` | 指定本次使用的模型别名 | | `-p, --prompt <prompt>` | 非交互模式:执行单条提示词后退出 | | `--output-format <format>` | `-p` 模式的输出格式:`text` 或 `stream-json` | | `--skills-dir <dir>` | 替换自动发现的 Skills 目录(可重复,仅本次生效) | 互斥规则(违反时启动报错): * `--output-format` 只能配合 `-p` 使用 * `--prompt` 不能同时用 `--yolo` 或 `--plan` * `--continue` 和 `--session` 不能同时用 * 非 prompt 模式下,`--yolo` 和 `--plan` 不能配合 `--continue` 或 `--session` TIP `--skills-dir` 是一次性替换,只影响本次启动。如需长期追加搜索目录,在 `config.toml` 里写 `extra_skill_dirs`(详见 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) )。 典型场景 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E5%85%B8%E5%9E%8B%E5%9C%BA%E6%99%AF) ------------------------------------------------------------------------------------------------------------------------- **隔离测试环境**:用单独的数据目录,避免污染主配置和会话: sh KIMI_CODE_HOME="$PWD/.kimi-sandbox" kimi **一次性使用测试密钥**:由于供应商凭证只从配置文件读,把测试密钥写进 `env` 子表: toml [providers.kimi.env] KIMI_API_KEY = "sk-test" **跳过审批运行批处理任务**: sh kimi --yolo -p "批量重命名以下文件..." **临时进入 Plan 模式**(若想永久生效,在配置文件设 `default_plan_mode = true`): sh kimi --plan 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/configuration/overrides.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) --------------------------------------------------------------------------------------------------------------- * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html) — 所有可配置字段的完整参考 * [环境变量](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) — `KIMI_CODE_HOME` 等变量的完整列表与说明 --- # 常见使用案例 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#VPContent) On this page 常见使用案例 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E5%B8%B8%E8%A7%81%E4%BD%BF%E7%94%A8%E6%A1%88%E4%BE%8B) ====================================================================================================================================== 本页收录 Kimi Code CLI 的典型使用场景和配套的 prompt 示例,可以直接复制使用或按需修改。 理解陌生项目 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E7%90%86%E8%A7%A3%E9%99%8C%E7%94%9F%E9%A1%B9%E7%9B%AE) -------------------------------------------------------------------------------------------------------------------------------------- 接手陌生仓库时,建议先用 `kimi --plan` 或按 `Shift-Tab` 进入 Plan 模式,让 Agent 先输出调研计划再动手,避免读到一半就开始改文件: 帮我梳理这个仓库的整体架构。重点说清楚: 1. 入口在哪里,启动后做了什么 2. 主要模块之间的依赖关系 3. 配置和数据的加载流程 最后画一张简单的模块关系图。 也可以聚焦到具体问题: src/runtime 下的 event loop 是怎么工作的?事件从哪里产生、又被谁消费? 这个项目里「权限审批」是怎么实现的?涉及哪些文件,关键类型是什么? 大型调研可以让 main agent 派发**subagent** 并行处理子任务,详见 [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) 。 实现新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E5%AE%9E%E7%8E%B0%E6%96%B0%E5%8A%9F%E8%83%BD) ---------------------------------------------------------------------------------------------------------------------------- 描述清楚需求和验收标准,复杂需求建议先用 Plan 模式确认方案再执行: 在 src/utils 下新增一个 retry 工具: - 函数签名 retry<T>(fn: () => Promise<T>, options): Promise<T> - 支持 maxAttempts、initialDelayMs、backoffFactor 三个选项 - 失败时抛出最后一次的错误 - 补一组单元测试覆盖成功、重试后成功、全部失败三种情况 如果结果不满意,直接描述改动即可,无需手动编辑: backoff 算了一个固定值,我希望加一点抖动,避免雷击效应。改一下并更新测试。 修复 bug [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E4%BF%AE%E5%A4%8D-bug) ------------------------------------------------------------------------------------------------------ 把现象、复现条件和期望行为一次性说清楚,可以省去来回澄清的时间: 跑 npm test 时偶发地报这个错: TypeError: Cannot read properties of undefined (reading 'id') at SessionStore.update (src/session/store.ts:142:18) 只在并发触发多个 update 的用例里出现。帮我定位原因并修复,最后跑一次完整测试确认。 不确定原因时,先让 Agent 调查再动手: 用户反馈:登录成功后第一次刷新页面会回到登录页,再刷一次就正常了。先帮我排查可能的原因,列出几个最可疑的位置,等我确认方向后再动手改。 纯机械任务可以直接放手: 跑一遍测试,失败的用例都修掉,跑完再跑一次确认全绿。 写测试与重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E5%86%99%E6%B5%8B%E8%AF%95%E4%B8%8E%E9%87%8D%E6%9E%84) -------------------------------------------------------------------------------------------------------------------------------------- 边界清晰、验收标准明确的任务特别适合交给 Agent: src/parser/markdown.ts 目前几乎没有测试。请补一组单元测试,覆盖正常段落、嵌套列表、代码块、表格、引用块和混合场景。用项目里已有的测试风格。 把 src/handlers 下重复的「读 body → 校验 → 写日志 → 返回」逻辑抽成一个中间件。改完跑一遍测试,保证现有行为不变。 多文件重构建议先用 Plan 模式确认方案,也可以用 `/fork` 派生一个试验分支,再从 `/sessions` 切换过去尝试;fork 本身不影响原会话,不满意切回来即可。 一次性脚本与自动化任务 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E4%B8%80%E6%AC%A1%E6%80%A7%E8%84%9A%E6%9C%AC%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E4%BB%BB%E5%8A%A1) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 批量改文件、跑统计、调研对比等任务用一段 prompt 就能完成: 把 src 目录下所有 .js 文件里的 var 声明改成 const 或 let,能用 const 的优先用 const。改完跑一次 lint 确认。 分析 logs/ 下最近 7 天的访问日志,按接口路径统计调用次数、p50 和 p99 响应时间,结果输出成一个 markdown 表格。 帮我调研一下 TypeScript 里几种主流的依赖注入方案(tsyringe、inversify、awilix),从 API 风格、装饰器依赖、运行时开销三个维度对比,给一份不超过一页的建议。 对于确定安全的批处理任务,可以用 `--yolo` 或 `/yolo` 跳过审批,也可以在[配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#permission) 里给特定工具预置白名单规则。 定时任务与提醒 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E4%B8%8E%E6%8F%90%E9%86%92) ------------------------------------------------------------------------------------------------------------------------------------------------ 在交互式会话内,可以让 Agent 设置一次性提醒或按周期运行的任务。Agent 会生成本地时区的 cron 表达式,并在触发时把 prompt 重新注入到同一个会话中: 下午 2:30 提醒我去查一下部署。 每个工作日上午 9 点,帮我汇总最近的 CI 失败情况。 每小时巡检一次生产环境的健康端点,看到异常就告诉我。 大约 10 分钟之后再回来,确认一下构建是否结束。 定时计划绑定在会话内:关掉终端没关系,用 `kimi --session` 恢复同一个会话时会重新加载并继续触发;但它们不会带入全新的会话。周期任务在 7 天后会自动过期——Agent 会在最后一次触发时收到 `stale` 提示,可根据你之前的指示决定结束还是续期。 想查看当前有哪些挂起的任务,直接问 Agent 即可(它会调用只读的 `CronList` 工具);要取消某个任务,让 Agent 删除它或引用对应的 8 位 id。完整工具说明见[定时任务](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html#%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1) ;整体关停开关是 `KIMI_DISABLE_CRON=1`。 生成与维护文档 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E7%94%9F%E6%88%90%E4%B8%8E%E7%BB%B4%E6%8A%A4%E6%96%87%E6%A1%A3) ------------------------------------------------------------------------------------------------------------------------------------------------ 我刚改了 src/auth/login.ts 的接口签名,把对应的 JSDoc、README 里的示例代码、还有 docs/zh/guides 下提到这个接口的段落都同步更新一遍。 src/api 下所有公开函数里,凡是没有 docstring 的都补上文档注释,风格参考已有的注释。 根据 src/cli 下的命令实现,生成一份命令参考的草稿,列出每个子命令、参数和默认值,放到 docs/zh/reference 下我后续审阅。 需要留档或复盘时,用 `kimi export <sessionId>` 打包为 ZIP,或在 TUI 中用 `/export-md` 导出为可读的 Markdown 对话记录。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/guides/use-cases.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------------- * [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — 如何让 Agent 派发子任务并行处理 * [Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) — 在任务完成等节点触发本地脚本 * [内置工具](https://www.kimi.com/code/docs/kimi-code-cli/reference/tools.html) — Agent 可调用的全部工具参考 --- # 服务 API | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#VPContent) Return to top 服务 API [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%9C%8D%E5%8A%A1-api) ========================================================================================================== `kimi web` 启动的本地服务暴露两组程序化接口:REST API(`/api/v1`,另有 `/api/v2/sessions` 和 `/api/v2/mcp`)和 WebSocket 事件流(`/api/v1/ws`)。本页是这两组接口的协议参考。如何启动服务及其命令行选项见 [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) 参考;端到端的上手流程见下文「[用 API 驱动一个会话](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E7%94%A8-api-%E9%A9%B1%E5%8A%A8%E4%B8%80%E4%B8%AA%E4%BC%9A%E8%AF%9D) 」。 本页是一份经过整理、面向人阅读的参考:下文逐一记录每个端点的参数、请求体与响应结构。每个端点精确的机器可读 schema 以服务的在线规范文档为准:`GET /openapi.json`(OpenAPI)与 `GET /asyncapi.json`(AsyncAPI),两者都由服务运行时实际执行的校验 schema 生成。两者都需要鉴权;当本页与在线规范不一致时,以在线规范为准。 注意 本页描述的 REST 与 WebSocket API 为实验性特性:不保证接口稳定性,端点、字段与事件类型可能随任何版本更改。集成时请以你所用版本服务的 `/openapi.json` 与 `/asyncapi.json` 文档为准。 基础约定 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%9F%BA%E7%A1%80%E7%BA%A6%E5%AE%9A) ---------------------------------------------------------------------------------------------------------------------- ### 地址 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%9C%B0%E5%9D%80) 默认地址为 `http://127.0.0.1:58627`。端口被占用时,服务会用下一个端口重试(至多 100 次);可用 `--port` / `--host` 修改绑定。同一 home 目录下可并存多个实例,运行中的实例登记在 `~/.kimi-code/server/instances/`。 ### 鉴权 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E9%89%B4%E6%9D%83) 除以下例外,所有 `/api/*` 路径(含 `/openapi.json` 与 `/asyncapi.json`)都要求 bearer token: * `OPTIONS` 预检请求 * `GET /api/v1/healthz`(探活) * 静态 web 资源(非 `/api/` 路径) 携带方式:REST 用 `Authorization: Bearer <token>` 请求头;WebSocket 升级请求接受同一请求头,或子协议 `kimi-code.bearer.<token>`。token 的生成与轮换见 [在网页中使用:开始使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8) 。 鉴权失败返回 HTTP 401,信封 `code` 为 `40101`。在非 loopback 绑定上,同一来源 60 秒内鉴权失败 10 次会被封禁 60 秒,期间每个请求都返回 HTTP 429(`code` 为 `42901`)。 ### 响应信封 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%93%8D%E5%BA%94%E4%BF%A1%E5%B0%81) 所有 JSON 响应统一包在信封里: json { "code": 0, "msg": "success", "data": {}, "request_id": "01JZX4A6E7M8V0R3Q0N2K2M5Q9" } * `code`:业务结果,`0` 表示成功;错误码分段见下文。 * `data`:成功时的业务数据。注意部分「错误」信封也携带非空 `data`——例如重复解决审批返回 `40902` 且 `data.resolved` 为 `false`——客户端应先判 `code` 再看 `data`。 * `request_id`:本次请求的 ULID;客户端可用 `X-Request-Id` 请求头指定,非法值会被服务端重新生成。 HTTP 状态码几乎总是 200,业务结果以 `code` 为准。例外情况: | 场景 | HTTP 状态 | | --- | --- | | 鉴权失败 / 触发限流 | 401 / 429 | | 创建供应商、导入供应商目录成功 | 201 | | 删除供应商成功 | 204 | | 二进制与流式端点 | 支持时返回 206(Range 分段)/ 304(ETag 未变),各端点能力不同,详见「[二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9)<br>」 | | `GET /api/v1/files/{file_id}` 下载错误 | 真实 404 / 500(响应体仍为信封) | 其中 201 的响应体仍是标准信封(`code` 为 `0`),只是状态行遵循 REST 的资源创建惯例;204 按定义没有响应体,删除成功以状态码本身为准。 ### 错误码 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E9%94%99%E8%AF%AF%E7%A0%81) 错误码按段位分组: | 段位 | 含义 | 示例 | | --- | --- | --- | | `0` | 成功 | | | `400xx` | 请求参数错误 | `40001` 校验失败(`details` 逐字段说明)、`40003` 供应商由 OAuth 托管 | | `401xx` | 鉴权与就绪状态 | `40101` 未授权、`40110` 未配置供应商、`40113` 模型未解析 | | `404xx` | 资源不存在 | `40401` 会话、`40408` MCP 服务、`40409` 文件路径 | | `409xx` | 状态冲突 | `40901` 会话忙、`40902` 审批已解决、`40922` 分页条件与 `page_token` 不符 | | `410xx` | 资源已过期 | `41001` 审批超时、`41002` 提问超时、`41003` 临时文件过期 | | `413xx` | 体积或边界超限 | `41302` 读取文件超 10 MB、`41304` 路径越出会话目录 | | `429xx` | 限流 | `42901` 鉴权失败封禁、`42902` 文件监听数超限 | | `500xx` | 服务端内部错误 | `50001` 未捕获异常、`50003` 持久化失败 | | `6xxxx` / `7xxxx` / `8xxxx` | 工具运行时 / LLM 供应商 / MCP 透传错误,`msg` 保留上游原文 | | ### 分页 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%88%86%E9%A1%B5) 列表端点有两种分页风格: * **游标式**:`before_id` / `after_id`(互斥)加 `page_size`(1–100),响应为 `{ items, has_more }`。用于会话列表、消息列表、转录等。 * **`page_token`**:不透明令牌(绑定了查询条件的指纹),用于 `POST /api/v1/search` 与 `GET /api/v2/sessions`。翻页途中改变任何查询条件会使令牌失效:v2 返回 `40922`,search 返回 `40001`。`GET /api/v2/sessions` 另提供无状态的 `page` 页码模式作为替代。 用 API 驱动一个会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E7%94%A8-api-%E9%A9%B1%E5%8A%A8%E4%B8%80%E4%B8%AA%E4%BC%9A%E8%AF%9D) -------------------------------------------------------------------------------------------------------------------------------------------------------------- 下面用 curl 走一遍最小流程:确认服务状态 → 创建会话 → 订阅事件 → 提交提示词 → 回读历史。示例假设服务跑在默认地址,token 已存入 shell 变量 `TOKEN`。 1. 确认服务状态: sh curl -s -H "Authorization: Bearer $TOKEN" http://127.0.0.1:58627/api/v1/meta 所有 JSON 响应都包在统一信封里——`{ "code": 0, "msg": "success", "data": ..., "request_id": "..." }`,业务结果以 `code` 为准(`0` 表示成功),HTTP 状态码只表达传输层结果。 2. 创建会话,`metadata.cwd` 指定工作目录: sh curl -s -X POST http://127.0.0.1:58627/api/v1/sessions \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"metadata": {"cwd": "/path/to/project"}}' 返回的 `data.id`(形如 `session_...`)就是后续所有请求要用的会话 id。 3. 连接 WebSocket 并订阅会话事件。任何 WebSocket 客户端都可以;下面是一个零依赖的 Node.js 脚本(Node.js 22+ 内置 `WebSocket` 客户端): js // subscribe.mjs —— 用法:TOKEN=... node subscribe.mjs session_... const ws = new WebSocket('ws://127.0.0.1:58627/api/v1/ws', [\ `kimi-code.bearer.${process.env.TOKEN}`,\ ]); ws.onmessage = (e) => console.log(e.data); ws.onopen = () => ws.send( JSON.stringify({ type: 'subscribe', id: '1', payload: { session_ids: [process.argv[2]] }, }), ); 4. 提交提示词: sh curl -s -X POST http://127.0.0.1:58627/api/v1/sessions/<session_id>/prompts \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"content": [{"type": "text", "text": "用一句话介绍这个仓库"}]}' 订阅端会依次看到 `turn.started`(轮次开始)→ `assistant.delta`(流式文本增量)→ 发生工具调用时的 `tool.call.started` / `tool.result` → `turn.ended`(轮次结束)。 5. 随时可以用 REST 回读历史消息: sh curl -s -H "Authorization: Bearer $TOKEN" \ "http://127.0.0.1:58627/api/v1/sessions/<session_id>/messages?page_size=20" REST 端点 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#rest-%E7%AB%AF%E7%82%B9) ------------------------------------------------------------------------------------------------------------ 下文按资源分组列出端点。路径里的 `:{action}` 后缀是动作约定——对单个资源 POST 到 `路径:动作` 执行非 CRUD 操作(如会话的 `:fork`、`:archive`)。 ### 服务与元信息 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%9C%8D%E5%8A%A1%E4%B8%8E%E5%85%83%E4%BF%A1%E6%81%AF) | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/healthz` | 探活,免鉴权 | | `GET /api/v1/meta` | 服务版本、能力集、`server_id`、实验开关 | | `POST /api/v1/shutdown` | 优雅退出(先回 200 再关闭);仅 loopback 绑定时挂载 | #### `GET /api/v1/healthz` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-healthz) 供脚本与进程管理器使用的探活端点。它是唯一豁免 bearer token 的 `/api` 端点(见 [鉴权](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E9%89%B4%E6%9D%83) ),应答时不触碰配置与引擎。 成功时 `data` 为 `{ "ok": true }`。 #### `GET /api/v1/meta` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-meta) 返回本实例的身份信息与能力集。大多数字段在启动时即固定;`experimental_flags` 与 `features` 按请求实时解析,因此开关翻转或某个 feature 失败会体现在下一次响应中。 成功时 `data` 携带: | 字段 | 类型 | 说明 | | --- | --- | --- | | `server_version` | string | 服务版本 | | `capabilities` | object | 能力集——`websocket`、`file_upload`、`fs_query`、`mcp`、`tasks`、`terminal`,均恒为 `true` | | `server_id` | string | 本服务实例的唯一 id | | `started_at` | string | 启动时间,ISO 8601 格式 | | `open_in_apps` | array | 可作为 `open-in` 目标的宿主应用(`finder` / `cursor` / `vscode` / `iterm` / `terminal`);目前恒为空 | | `dangerous_bypass_auth` | boolean | 服务是否以 `--dangerous-bypass-auth` 启动(客户端可跳过 token 提示) | | `backend` | string | 引擎后端,`v1` 或 `v2`;本服务恒为 `v2` | | `web_title` | string | 来自 `--web-title` 的自定义浏览器标签页标题;未设置时省略 | | `experimental_flags` | object | 实验开关 id → 是否启用,按请求时解析 | | `features` | array | 引擎 feature,形如 `{ name, state, meta }`;`state` 为 `Pending` / `Activating` / `Active` / `Unloading` / `Failed` | #### `POST /api/v1/shutdown` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-shutdown) 请求服务优雅退出。响应先发出,随后立即执行关闭,因此调用方可以信任收到的响应。该路由仅在 loopback 绑定时挂载——非 loopback 绑定时它根本不会被注册(请求得到 404),除非服务以 `--allow-remote-shutdown` 启动。 成功时 `data` 为 `{ "ok": true }`。 ### 登录与用量 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E7%99%BB%E5%BD%95%E4%B8%8E%E7%94%A8%E9%87%8F) 这组端点驱动托管 Kimi OAuth 登录的生命周期,并暴露账号级信息。托管供应商名为 `managed:kimi-code`;下面每个端点上可选的 `provider` 参数都默认取它。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/auth` | 鉴权状态快照 | | `POST /api/v1/oauth/login` | 发起 OAuth device-code 登录流程 | | `GET /api/v1/oauth/login` | 轮询登录流程状态 | | `DELETE /api/v1/oauth/login` | 取消进行中的登录流程 | | `POST /api/v1/oauth/logout` | 登出托管供应商 | | `GET /api/v1/oauth/usage` | 套餐额度与加油包 | | `GET /api/v1/oauth/userinfo` | 账号资料 | | `GET /api/v1/oauth/region` | 解析客户端所属区域(`mainland-cn` / `global`) | #### `GET /api/v1/auth` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-auth) 鉴权状态快照:默认模型能否解析到可用的供应商配置,以及托管供应商的登录状态。当全局 `default_model` 别名存在于模型表中且能解析到已配置的供应商时,`models_ready` 为 `true`——包括自带 `base_url` 的平铺(providerless)模型,以及通过 `KIMI_MODEL_*` 环境变量注入的模型。它不做凭据校验,因此此后的对话请求仍可能以 `40111` / `40112` 失败。 成功时 `data` 携带 `models_ready`(布尔值)、`providers_count`(已配置供应商数量)与 `managed_provider`(`null`,或 `{ name, status }`,其中 `status` 为 `authenticated` / `expired` / `revoked` / `unauthenticated` 之一)。全局默认模型别名本身改从 `GET /api/v1/config` 的 `default_model` 读取,本端点不再携带。 #### `POST /api/v1/oauth/login` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-oauth-login) 为托管供应商发起 OAuth device-code 登录流程;发起新流程会中止同一供应商进行中的流程。账号已登录时无需用户交互,响应会立即报告 `authenticated`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | body | string | 托管供应商名称。默认 `managed:kimi-code` | | `region` | body | string | `mainland-cn` 或 `global`;覆盖 `GET /api/v1/oauth/region` 一节描述的区域解析结果,仅对本次流程生效 | 成功时 `data` 有两种形态。进行中的流程——`{ flow_id, provider, status: "pending", verification_uri, verification_uri_complete, user_code, expires_in, interval, expires_at }`:打开 `verification_uri_complete`(或打开 `verification_uri` 并输入 `user_code`),然后每隔 `interval` 秒轮询 `GET /api/v1/oauth/login`,直到流程完结或超过 `expires_at`(`expires_in` 是以秒表示的同一时限)。已登录的快速路径——`{ flow_id, provider, status: "authenticated" }`。 #### `GET /api/v1/oauth/login` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-oauth-login) 轮询某供应商的登录流程状态。尚未发起过流程时返回 `null`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | query | string | 托管供应商名称。默认 `managed:kimi-code` | 成功时 `data` 为 `null` 或流程快照:`{ flow_id, provider, status, verification_uri, verification_uri_complete, user_code, expires_in, expires_at, interval }`,其中 `status` 为 `pending` / `authenticated` / `denied` / `expired` / `cancelled`。流程离开 `pending` 后,`resolved_at` 记录其到达终态的时间,`error_message` 描述失败的流程。 #### `DELETE /api/v1/oauth/login` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#delete-api-v1-oauth-login) 取消某供应商进行中的登录流程。没有进行中的流程时,该调用为空操作,返回最近一次已知状态。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | query | string | 托管供应商名称。默认 `managed:kimi-code` | 成功时 `data` 为 `{ cancelled, status }`:只有确实中止了一个 `pending` 流程时 `cancelled` 才为 `true`,`status` 为调用后的流程状态。 #### `POST /api/v1/oauth/logout` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-oauth-logout) 登出托管供应商:丢弃已存储的 OAuth 凭据、中止进行中的登录流程,并把托管供应商从配置中移除。OAuth 托管的供应商拒绝手动编辑与删除(见下文 `PUT` / `DELETE /api/v1/providers/{provider_id}`),因此要移除它需先登出。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | body | string | 托管供应商名称。默认 `managed:kimi-code` | 成功时 `data` 为 `{ logged_out: true, provider }`。 #### `GET /api/v1/oauth/usage` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-oauth-usage) 托管账号的套餐额度与加油包,实时取自账号服务。上游失败不会让信封失败——它以 `kind: "error"` 的形式带内返回。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | query | string | 托管供应商名称。默认 `managed:kimi-code` | 成功时 `data` 为 `{ kind: "ok", quota }` 或 `{ kind: "error", message, status? }`,其中 `status` 为上游 HTTP 状态码(如存在)。在 `ok` 形态中,`quota` 为 `{ usages, extraUsage }`:`usages` 按窗口携带 `{ usedRatio, resetAt? }` 条目——`limit5h`、`limit7d`、`monthTotal`、`monthCode`——其中 `usedRatio` 为 0–1 浮点数,`resetAt` 为 RFC3339 重置时间,客户端按实际下发的条目渲染;`extraUsage`(可空)是按量付费钱包:`{ balanceCents, totalCents, monthlyChargeLimitEnabled, monthlyChargeLimitCents, monthlyUsedCents, currency }`。 #### `GET /api/v1/oauth/userinfo` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-oauth-userinfo) 托管账号的资料,带内 `kind: "error"` 约定与 `GET /api/v1/oauth/usage` 相同。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider` | query | string | 托管供应商名称。默认 `managed:kimi-code` | 成功时 `data` 为 `{ kind: "ok", userInfo }` 或 `{ kind: "error", message, status? }`。`userInfo` 始终携带 `userId`、`nickname`、`status`、`region`、`userLevel`、`userLevelName`、`domain`、`domainName`,并可能附加 `globalId`、`bio`、`avatar`、`username`、`email`、`phone`(`{ countryCode, number }`)、`createdTime` 与 `lastLoginTime`。 #### `GET /api/v1/oauth/region` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-oauth-region) 解析该客户端所属的 Kimi 区域。结果在本地推导,不经网络探测:优先取环境变量或配置固定的 OAuth host,其次是已配置的 OAuth key,再次是 home 目录中的区域标记文件;默认为 `mainland-cn`。 成功时 `data` 为 `{ region }`,`region` 为 `mainland-cn` / `global` 之一。 ### 配置 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E9%85%8D%E7%BD%AE) | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/config` | 读取全局配置(密钥字段脱敏) | | `POST /api/v1/config` | 合并式更新配置,并广播 `event.config.changed` | #### `GET /api/v1/config` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-config) 返回解析后的全局配置——`config.toml` 叠加覆盖层后的生效结果。密钥已脱敏:每个供应商只报告 `has_api_key`,绝不返回存储的密钥。 成功时 `data` 为配置对象;其字段与 [顶层字段](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#top-level-fields) 记录的顶层域一一对应: | 字段 | 类型 | 说明 | | --- | --- | --- | | `providers` | object | 供应商 id → `{ type, base_url?, default_model?, has_api_key }` 的映射 | | `default_provider` | string | 全局默认供应商 id | | `default_model` | string | 全局默认模型别名 | | `models` | object | 模型别名 → 模型记录的映射 | | `thinking` | object | Thinking 模式的默认参数 | | `plan_mode` | boolean | Plan 模式开关 | | `yolo` | boolean | 派生值:`default_permission_mode` 为 `yolo` 时为 `true` | | `default_permission_mode` | string | 新会话的默认权限模式 | | `default_plan_mode` | boolean | 新会话是否以 Plan 模式启动 | | `permission` | object | 初始权限规则 | | `hooks` | array | 生命周期钩子 | | `services` | object | 内置外部服务配置 | | `merge_all_available_skills` | boolean | 是否合并所有可用目录中的 Agent Skills | | `extra_skill_dirs` | array | 额外的 Skill 搜索目录 | | `loop_control` | object | Agent 循环控制参数 | | `background` | object | 后台任务运行参数 | | `subagent` | object | subagent 配置 | | `secondary_model` | object | subagent 的次级模型池 | | `experimental` | object | 实验开关 id → 是否启用 | | `telemetry` | boolean | 是否启用匿名遥测 | | `auto_session_title` | boolean | 是否允许客户端自动生成会话标题 | | `raw` | object | 原始解析的 `config.toml` 内容,包含未建模字段 | #### `POST /api/v1/config` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-config) 合并式更新全局配置:请求体中的每个顶层域被深合并进对应域,未出现在请求体中的域保持不动。把 `yolo` 设为 `true` 是 `default_permission_mode: "yolo"` 的简写;被拒绝的补丁(值非法或持久化失败)返回 `40001` 与底层错误信息。 每一次配置变更——经本端点成功更新、在进程外编辑 `config.toml`,或服务端内部写入(如 OAuth 登录刷新)——都会广播全局 `event.config.changed` 事件。短时间窗内的多次变更会合并为一个事件,其 `changedFields` 携带受影响的域名(camelCase 配置域,例如 `defaultModel`),`config` 携带当前完整的配置投影(与 `GET /api/v1/config` 响应同形状)。 请求体是部分配置对象——上述响应域中除 `raw` 外的任意子集,均为可选: | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `providers` | body | object | 供应商 id → 供应商表的映射 | | `default_provider` | body | string | 全局默认供应商 id | | `default_model` | body | string | 全局默认模型别名 | | `models` | body | object | 模型别名 → 模型记录的映射 | | `thinking` | body | object | Thinking 模式的默认参数 | | `plan_mode` | body | boolean | Plan 模式开关 | | `yolo` | body | boolean | `true` 映射为 `default_permission_mode: "yolo"`;`false` 被忽略 | | `default_permission_mode` | body | string | `manual` / `yolo` / `auto` | | `default_plan_mode` | body | boolean | 新会话是否以 Plan 模式启动 | | `permission` | body | object | 初始权限规则 | | `hooks` | body | array | 生命周期钩子 | | `services` | body | object | 内置外部服务配置 | | `merge_all_available_skills` | body | boolean | 是否合并所有可用目录中的 Agent Skills | | `extra_skill_dirs` | body | array | 额外的 Skill 搜索目录 | | `loop_control` | body | object | Agent 循环控制参数 | | `background` | body | object | 后台任务运行参数 | | `subagent` | body | object | subagent 配置 | | `secondary_model` | body | object | subagent 的次级模型池 | | `experimental` | body | object | 实验开关 id → 是否启用 | | `telemetry` | body | boolean | 是否启用匿名遥测 | | `auto_session_title` | body | boolean | 是否允许客户端自动生成会话标题 | 成功时 `data` 为完整的更新后配置,形态与 `GET /api/v1/config` 相同。 ### 模型与供应商 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%A8%A1%E5%9E%8B%E4%B8%8E%E4%BE%9B%E5%BA%94%E5%95%86) 这组端点管理模型配置的两半——`config.toml` 的 [供应商](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 表与模型别名表——外加一个由服务端代理的 models.dev 目录,用于一次性导入。模型别名 id 就是配置中的别名键:通过供应商管理端点创建的别名形如 `provider_id/model`(例如 `my-provider/kimi-for-coding`),而模型别名表中的裸键(如 `turbo`)原样使用;API 中任何接收 `model_id` 的地方(包括全局 `default_model`)指的都是这个别名 id。`:{action}` 路由上不支持的动作返回 `40001`。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/models` | 列出已配置的模型别名 | | `POST /api/v1/models/{model_id}:set_default` | 设置全局默认模型 | | `GET /api/v1/providers` | 列出供应商 | | `POST /api/v1/providers` | 创建供应商(201) | | `GET /api/v1/providers/{provider_id}` | 读取供应商(含已存密钥) | | `PUT /api/v1/providers/{provider_id}` | 整体替换供应商配置 | | `DELETE /api/v1/providers/{provider_id}` | 删除供应商(204) | | `POST /api/v1/providers/{provider_id}:refresh` | 刷新该供应商的模型元数据 | | `POST /api/v1/providers:{action}` | 集合级动作:`refresh` / `refresh_oauth` / `import_catalog` / `import_registry` | | `GET /api/v1/catalog/providers` | 浏览 models.dev 目录(服务端代理) | | `GET /api/v1/catalog/providers/{catalog_id}` | 读取目录中单个条目 | #### `GET /api/v1/models` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-models) 列出所有供应商下已配置的模型别名。 成功时 `data.items` 为 `{ provider, model, display_name?, max_context_size, capabilities?, support_efforts?, default_effort? }` 数组:`model` 是别名 id(供应商管理的别名为 `provider_id/model`,否则为裸键),`provider` 是所属供应商 id,`max_context_size` 是以 token 计的上下文窗口,`capabilities` / `support_efforts` / `default_effort` 描述能力标志与 Thinking 模式的 effort 支持。 #### `POST /api/v1/models/{model_id}:set_default` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-models-model-id-set-default) 把全局 `default_model` 设为一个已存在的别名。`model_id` 是配置中的别名键原样——裸键如 `POST /api/v1/models/turbo:set_default`;当 id 含 `/` 时需做 URL 编码,如 `POST /api/v1/models/my-provider%2Fkimi-for-coding:set_default`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `model_id` | path | string | **必填。** 配置中的模型别名键原样;含 `/` 时需 URL 编码 | 成功时 `data` 为 `{ default_model, model }`——当前生效的别名及其目录项(形态与 `GET /api/v1/models` 的单项相同)。 * `40001`:路径中的动作后缀非法或不支持 * `40413`:不存在该 id 的模型别名 #### `GET /api/v1/providers` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-providers) 列出每个已配置供应商及其凭据与模型发现状态,不泄露任何密钥。这也是其他供应商端点引用的供应商条目形态。 成功时 `data.items` 为如下结构的数组: | 字段 | 类型 | 说明 | | --- | --- | --- | | `id` | string | 供应商 id | | `type` | string | 通信协议:`kimi` / `openai` / `openai_responses` / `anthropic` / `google-genai` / `vertexai` | | `base_url` | string | API 基础 URL,如已设置 | | `default_model` | string | 该供应商的默认模型别名,如已设置 | | `has_api_key` | boolean | 是否已存储凭据 | | `status` | string | 存在 API 密钥或缓存的 OAuth token 时为 `connected`,否则为 `unconfigured`(`error` 在 schema 中保留) | | `models` | array | 该供应商的模型别名 id | #### `POST /api/v1/providers` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers) 一次保存创建供应商及其模型别名;响应为 HTTP 201 加标准信封。当全局 `default_model` 完全未配置时(全新安装),会以新供应商的 `default_model`(或第一个模型)播种;已有默认值绝不被修改。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `id` | body | string | **必填。** 供应商 id——字母、数字、`-`、`_` 与空格;必须以字母或数字开头 | | `type` | body | string | **必填。** 通信协议:`kimi` / `openai` / `openai_responses` / `anthropic` / `google-genai` / `vertexai` | | `api_key` | body | string | API 密钥,存储于 `config.toml` | | `base_url` | body | string | API 基础 URL;不得包含环境变量占位符(`${...}`) | | `default_model` | body | string | 该供应商的默认模型;必须是 `models[].model` 之一 | | `models` | body | array | **必填。** 至少一条,不允许重复的 `model` 值;条目结构见下文 | 每个 `models[]` 条目声明一个别名,其 id 为 `id/model`: | 字段 | 类型 | 说明 | | --- | --- | --- | | `model` | string | **必填。** 上游模型名 | | `max_context_size` | integer | **必填。** 以 token 计的上下文窗口,≥ 1 | | `display_name` | string | 显示名 | | `capabilities` | array | 能力标志,如 `thinking` 或 `image_in` | | `max_output_size` | integer | 最大输出 token 数,≥ 1 | | `support_efforts` | array | 支持的 Thinking 模式 effort 档位 | | `adaptive_thinking` | boolean | 自适应 thinking 开关 | 成功时 `data` 为创建好的供应商条目(形态与 `GET /api/v1/providers` 的单项相同)。 * `40921`:已存在该 `id` 的供应商 #### `GET /api/v1/providers/{provider_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-providers-provider-id) 读取单个供应商。与列表路由不同,设置了密钥时响应会暴露存储的 `api_key`,以便本地编辑表单预填——暴露端口时请牢记这一点。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider_id` | path | string | **必填。** 供应商 id | 成功时 `data` 为供应商条目,存有密钥时附带 `api_key`。 * `40412`:供应商不存在 #### `PUT /api/v1/providers/{provider_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#put-api-v1-providers-provider-id) 一次保存整体替换供应商:`type`、`base_url` 与模型列表被重写,该供应商的别名按 `models` 重建——不再列出的别名从 `config.toml` 中消失,其他供应商的别名不受影响。`api_key` 是三态的:省略表示保留已存密钥,`""` 表示清除,其他值表示替换。除 `new_id` 重命名迁移外,全局默认指针绝不被修改。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider_id` | path | string | **必填。** 当前供应商 id | | `new_id` | body | string | 重命名供应商;providers 键、模型别名、`default_provider`、指向旧别名的 `default_model` 以及 subagent 次级模型池都会随之迁移。id 规则与 `POST /api/v1/providers` 相同 | | `type` | body | string | **必填。** 通信协议:`kimi` / `openai` / `openai_responses` / `anthropic` / `google-genai` / `vertexai` | | `api_key` | body | string | 三态,见上文 | | `base_url` | body | string | API 基础 URL;不得包含环境变量占位符(`${...}`) | | `default_model` | body | string | 该供应商的默认模型;必须是 `models[].model` 之一 | | `models` | body | array | **必填。** 至少一条,不允许重复的 `model` 值;条目结构与 `POST /api/v1/providers` 相同 | 成功时 `data` 为 `{ provider }`,即保存后的供应商条目。 * `40001`:重命名后的别名 id 会与其他供应商的别名冲突 * `40003`:供应商由 OAuth 托管——请改用 `POST /api/v1/oauth/logout` 登出 * `40412`:供应商不存在 * `40921`:`new_id` 已被占用 #### `DELETE /api/v1/providers/{provider_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#delete-api-v1-providers-provider-id) 删除供应商及其全部模型别名;subagent 次级模型池会级联清理。全局 `default_provider` / `default_model` 指针保持不动,即使它们指向被删的供应商——那是用户的设置,不由本端点代为回收。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider_id` | path | string | **必填。** 供应商 id | 成功时服务应答 204 且无响应体——状态行本身即表示删除成功(见 [响应信封](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%93%8D%E5%BA%94%E4%BF%A1%E5%B0%81) )。 * `40003`:供应商由 OAuth 托管——请改用 `POST /api/v1/oauth/logout` 登出 * `40412`:供应商不存在 #### `POST /api/v1/providers/{provider_id}:refresh` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers-provider-id-refresh) 从上游来源重新发现单个供应商的模型元数据,并重写该供应商的别名。模型来源为静态的供应商不经任何网络调用直接报告 `unchanged`。至少一个供应商的别名发生变化时,服务会广播全局 `event.model_catalog.changed` 事件。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `provider_id` | path | string | **必填。** 供应商 id | 成功时 `data` 为刷新报告:`changed` 是 `{ provider_id, provider_name, added, removed }`(新增 / 移除的别名数)的数组,`unchanged` 是无差异的供应商 id 数组,`failed` 是 `{ provider, reason }` 的数组。 * `40001`:路径中的动作后缀非法或不支持 * `40412`:供应商不存在 #### `POST /api/v1/providers:refresh` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers-refresh) 刷新每个供应商的模型元数据。请求体可选且被忽略。 成功时 `data` 为与 `POST /api/v1/providers/{provider_id}:refresh` 相同的刷新报告(`changed` / `unchanged` / `failed`)。 #### `POST /api/v1/providers:refresh_oauth` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers-refresh-oauth) 与 `POST /api/v1/providers:refresh` 相同的刷新,仅限 OAuth 凭据的供应商。请求体可选且被忽略。 成功时 `data` 为刷新报告(`changed` / `unchanged` / `failed`)。 #### `POST /api/v1/providers:import_catalog` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers-import-catalog) 把一个 models.dev 目录条目导入为已配置供应商;响应为 HTTP 201 加标准信封。通信协议与端点来自目录解析,目录中的每个模型都写为一个别名。导入已存在的 id 等同于刷新——供应商条目及其别名按目录重写,省略 `api_key` 表示保留已存密钥。全局默认指针绝不被修改,仅在完全未配置默认模型时,以第一个导入的模型播种 `default_model`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `catalog_id` | body | string | **必填。** 来自 `GET /api/v1/catalog/providers` 的目录条目 id | | `id` | body | string | 覆盖目录 id 作为本地供应商 id。id 规则与 `POST /api/v1/providers` 相同 | | `api_key` | body | string | 导入供应商的 API 密钥 | | `base_url` | body | string | 覆盖目录解析出的端点;条目的 `needs_base_url` 为 `true` 时必填 | 成功时 `data` 为 `{ provider, models_imported }`——供应商条目与写入的别名数量。 * `40001`:缺少 `catalog_id` 或其他请求体校验失败 * `40003`:目标供应商已存在且由 OAuth 托管 * `40004`:条目无法导入(被拒绝、要求 `base_url`、没有可导入的模型,或其 id 不能用作供应商 id) * `40417`:不存在该 `catalog_id` 的目录条目 * `50004`:models.dev 目录不可用 #### `POST /api/v1/providers:import_registry` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-providers-import-registry) 把一个 models.dev 形态的私有注册表——一个 `api.json` URL 加可选的 Bearer key——导入为已配置供应商;响应为 HTTP 201 加标准信封。每个列出的供应商都带 `source` 记录写入,以便定时刷新重新发现。重复导入同一 URL 会移除上游已消失的供应商——URL 是注册表的稳定身份,因此轮换 key 是安全的。全局默认指针遵循与 `:import_catalog` 相同的规则。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `url` | body | string | **必填。** 注册表 `api.json` 的 URL | | `api_key` | body | string | 注册表的 Bearer key;省略时复用上一次导入同一 URL 所用的 key | 成功时 `data` 为 `{ providers, models_imported }`——供应商条目数组与写入的别名总数。 * `40001`:缺少 `url` 或其他请求体校验失败 * `40003`:某个列出的供应商已存在且由 OAuth 托管 * `40005`:注册表无法获取或解析,或未列出可导入的供应商 #### `GET /api/v1/catalog/providers` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-catalog-providers) 浏览 models.dev 目录,由服务端代理,带 10 分钟内存缓存与内置快照兜底。条目保持上游目录顺序。服务无法导入的条目携带 `rejected: true` 与机器可读的 `reject_reason`;`needs_base_url: true` 的条目在导入时要求提供 base URL。 成功时 `data.items` 为 `{ id, name, wire_type, base_url, guessed, needs_base_url, rejected, reject_reason, env_key, models }` 数组:`wire_type` 是解析出的协议(可空,枚举与供应商 `type` 相同),`base_url` 是解析出的端点(可空;`needs_base_url` 或被拒绝的条目为 null),`guessed` 标记启发式解析,`env_key` 是上游约定的 API 密钥环境变量(可空),`models` 是 `{ id, name?, max_context_size, capabilities?, reasoning }` 的数组。 * `50004`:目录不可用(在线拉取与内置快照均失败) #### `GET /api/v1/catalog/providers/{catalog_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-catalog-providers-catalog-id) 按 catalog id 读取单个 models.dev 目录条目——条目形态与 `GET /api/v1/catalog/providers` 相同。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `catalog_id` | path | string | **必填。** 目录条目 id | 成功时 `data` 为该目录条目(形态与 `GET /api/v1/catalog/providers` 的单项相同)。 * `40417`:不存在该 `catalog_id` 的目录条目 * `50004`:目录不可用 ### 会话 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BC%9A%E8%AF%9D) 这些端点用于创建、列出和查看会话,执行会话级动作(fork、compact、undo 等),并读取会话级汇总。其中大多数返回的会话采用 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 中统一说明的线上格式;非 CRUD 操作使用上文介绍的 `:{action}` 约定。 | 方法与路径 | 说明 | | --- | --- | | `POST /api/v1/sessions` | 创建会话(需 `workspace_id` 或 `metadata.cwd`) | | `GET /api/v1/sessions` | 列出会话,游标分页,支持 `busy` / `archived_only` 等过滤 | | `GET /api/v1/sessions/{session_id}` | 读取单个会话 | | `GET /api/v1/sessions/{session_id}/profile` | 读取会话档案 | | `POST /api/v1/sessions/{session_id}/profile` | 更新标题、元数据、Agent 配置 | | `POST /api/v1/sessions/{session_id}/title/generate` | 通过托管的 `chat_title` 工具生成标题 | | `POST /api/v1/sessions/{session_id}:{action}` | 会话动作:`fork` / `compact` / `undo` / `abort` / `btw` / `archive` / `restore` | | `GET /api/v1/sessions/{session_id}/children` | 列出子会话 | | `POST /api/v1/sessions/{session_id}/children` | 创建子会话(fork 并打标) | | `GET /api/v1/sessions/{session_id}/status` | 实时状态汇总 | | `GET /api/v1/sessions/{session_id}/goal` | 当前目标快照(无则 `null`) | | `GET /api/v1/sessions/{session_id}/warnings` | 会话级告警 | | `GET /api/v1/sessions/{session_id}/runtime` | 读取 main agent 的运行时绑定 | | `POST /api/v1/sessions/{session_id}/runtime` | 切换 main agent 的运行时绑定 | | `POST /api/v1/sessions/{session_id}/export` | 导出会话与诊断信息(zip 流,不走信封) | | `GET /api/v1/sessions/{session_id}/snapshot` | 客户端重建用全量快照(含 `as_of_seq` 与 `epoch`) | | `GET /api/v1/sessions/{session_id}/media/{file_id}` | 按文件 id 下载提示词媒体(二进制) | #### session 对象 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 每个返回会话的端点都使用这种线上格式。实时状态字段(`busy`、`main_turn_active`、`pending_interaction`、`last_turn_reason`)由会话的活动聚合解析得出:未加载到本服务进程中的会话(冷会话)始终上报为不忙碌且无待处理交互。少数字段在当前投影中是占位值——已逐字段注明。 | 字段 | 类型 | 说明 | | --- | --- | --- | | `id` | string | 会话 id(`session_...`) | | `workspace_id` | string | 所属工作区 id | | `title` | string | 会话标题;无标题时为 `""` | | `created_at` / `updated_at` | string | 创建时间与最后更新时间,ISO 8601 | | `archived` | boolean | 会话是否已归档(归档后从默认会话列表中隐藏) | | `archived_at` | string | 归档时间,ISO 8601;仅在已归档时存在 | | `busy` | boolean | 是否有任一 Agent 存在进行中的轮次或后台任务 | | `main_turn_active` | boolean | main agent 是否有进行中的轮次 | | `pending_interaction` | string | `none` / `approval` / `question`——有未答复的交互在等待 | | `last_turn_reason` | string | main agent 最近一次轮次的结果:`completed` / `cancelled` / `failed` | | `last_prompt` | string | 最近一条用户提示词文本(如有) | | `metadata` | object | 自定义元数据;始终携带 `cwd`(会话的工作目录) | | `agent_config` | object | 投影为 `{ model }`;`model` 在大多数响应中为 `""`,仅由 `GET /api/v1/sessions/{session_id}/snapshot` 填入实时模型 | | `usage` | object | token 汇总 `{ input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens, context_tokens, context_limit?, total_cost_usd?, turn_count? }`;在 snapshot 端点之外全为零 | | `permission_rules` | array | 会话权限规则;当前始终为 `[]` | | `message_count` | integer | 消息数;当前始终为 `0` | | `last_seq` | integer | 最后的事件序列号;当前始终为 `0` | #### `POST /api/v1/sessions` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions) 创建会话并返回。目标目录来自 `workspace_id`(已注册的工作区)或 `metadata.cwd`(首次使用时注册该工作区);两者同时提供时必须一致。创建时会广播全局 `event.session.created` 事件。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | body | string | 未提供 `metadata.cwd` 时**必填**。已注册的工作区 id;会话创建于该工作区的根目录 | | `metadata` | body | object | 自定义元数据。`metadata.cwd` 为工作目录,未提供 `workspace_id` 时**必填**;两者同时提供时必须等于工作区根目录 | | `title` | body | string | 初始标题(至少 1 个字符);否则会话无标题 | | `agent_config` | body | object | schema 接受该字段但当前不会应用——模型与各模式请通过 `POST /api/v1/sessions/{session_id}/profile` 设置 | 成功时,`data` 为新会话的 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40001`:`workspace_id` 与 `metadata.cwd` 都未提供,或 `metadata.cwd` 与工作区根目录不一致(`details` 会列出该字段) * `40409`:工作目录不存在或不是目录 * `40410`:没有以该 `workspace_id` 注册的工作区 #### `GET /api/v1/sessions` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions) 跨工作区列出会话,按 `updated_at` 最新在前。游标分页遵循 [分页](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%88%86%E9%A1%B5) ,但有一个特例:不提供 `page_size`(且不提供 `archived_only`)时,响应是单个不分页的窗口,其 `has_more` 恒为 `false`,因此要真正翻页请传入 `page_size`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `before_id` | query | string | 只保留早于该 id 的会话;与 `after_id` 互斥 | | `after_id` | query | string | 只保留晚于该 id 的会话;与 `before_id` 互斥 | | `page_size` | query | integer | 1–100。分页生效时默认为 `20`;不分页的默认行为见上文说明 | | `busy` | query | boolean | 只保留忙碌(或只保留空闲)的会话 | | `include_archive` | query | boolean | 在活跃会话之外同时包含已归档会话。默认 `false` | | `archived_only` | query | boolean | 只保留已归档会话;与 `include_archive` 互斥;即使不提供 `page_size` 也会启用游标分页 | | `exclude_empty` | query | boolean | 去掉没有任何用户提示词的会话 | | `workspace_id` | query | string | 限定到单个工作区(别名会被解析) | 成功时,`data` 为 `{ items, has_more }`,其中每个元素为 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40001`:校验失败——例如 `before_id` 与 `after_id` 同用,或 `archived_only` 与 `include_archive` 同用 * `40410`:未知的 `workspace_id` #### `GET /api/v1/sessions/{session_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id) 从索引中读取单个会话。会话已加载到本进程时会包含实时状态字段;冷会话上报为不忙碌,并携带其最后持久化的轮次结果。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40401`:会话不存在,或其工作区已无法解析 #### `GET /api/v1/sessions/{session_id}/profile` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-profile) 读取会话档案——与 `GET /api/v1/sessions/{session_id}` 相同的线上载荷。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/profile` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-profile) 更新会话档案:标题、自定义元数据以及 main agent 的配置。在这里设置的标题会成为自定义标题,优先级高于生成的标题;设置标题会广播全局 `session.meta.updated` 事件。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `title` | body | string | 新标题(至少 1 个字符);会成为自定义标题 | | `metadata` | body | object | 合并进会话自定义元数据的键 | | `agent_config` | body | object | main agent 的部分配置;字段如下,均为可选 | 每个 `agent_config` 字段都会立即应用到 main agent: | 字段 | 类型 | 说明 | | --- | --- | --- | | `model` | string | 模型别名 id;空字符串会被忽略 | | `thinking` | string | Thinking 强度等级 | | `permission_mode` | string | `manual` / `yolo` / `auto` | | `plan_mode` | boolean | 进入或退出 Plan 模式 | | `swarm_mode` | boolean | 进入或退出 swarm 模式 | | `goal_objective` | string | 以该文本为内容创建一个目标 | | `goal_control` | string | `pause` / `resume` / `cancel` 当前目标 | schema 还接受 `agent_config` 内的 `system_prompt`、`tools`、`mcp_servers`,以及顶层的 `permission_rules` 数组,但更新路由当前不会应用它们。 成功时,`data` 为更新后的 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/title/generate` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-title-generate) 通过托管供应商的 `chat_title` 工具根据会话的提示词生成标题并应用,同时广播 `session.meta.updated`。生成需要托管 OAuth 登录;未提供 `force` 时,已有自定义标题或已生成标题的会话会上报为不可用,而不会被覆盖。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `force` | body | boolean | 即使已有自定义或生成的标题也重新生成。默认 `false` | | `source` | body | string | 标题输入:`user_prompts`(默认)/ `first_turn` / `digest` | 成功时,`data` 为 `{ title }`——当前应用到会话的标题。 * `40401`:会话不存在 * `40923`:生成不可用——开关未开启、没有托管 OAuth 登录或尚无任何提示词内容、已有标题但未提供 `force`,或后端请求失败 #### `POST /api/v1/sessions/{session_id}:{action}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-action) 会话动作通过同一条路由分发:路径尾部解析为 `{session_id}:{action}`,请求体按该动作的 schema 校验,动作缺失或未知时返回 `40001`(`unsupported action: ...`)。每个动作都会先解析会话,因此会话未知时都可能返回 `40401`。支持的动作在下面逐一说明。 #### `POST /api/v1/sessions/{session_id}:fork` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fork) 将会话——其转录、Agent 状态与文件——复制到同一工作区中的新会话,并广播 `event.session.created`。当会话中任一 Agent 有进行中的轮次时,fork 会被拒绝。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `title` | body | string | fork 的标题(至少 1 个字符)。默认 `Fork: <source title>` | | `metadata` | body | object | fork 的自定义元数据 | 成功时,`data` 为新会话的 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40901`:会话有进行中的轮次,无法 fork #### `POST /api/v1/sessions/{session_id}:compact` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-compact) 对 main agent 的上下文发起一次手动全量压缩。调用立即返回;进度与完成通过 `compaction.*` WebSocket 事件投递。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `instruction` | body | string | 给压缩摘要的额外指引;空值会被忽略 | 成功时,`data` 为空对象。 * `40910`:有轮次或其他上下文变更正在进行,或历史中没有可压缩的内容 #### `POST /api/v1/sessions/{session_id}:undo` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-undo) 将 main agent 的对话回退 `count` 个轮次,并同步修正派生的会话状态(包括会话的 `last_prompt`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `count` | body | integer | 要撤销的轮次数;正整数。默认 `1` | | `page_size` | body | integer | 返回的历史窗口大小,1–100。默认 `50` | 成功时,`data` 为 `{ messages, status }`:`messages` 是剩余上下文消息按最新在前的 `{ items, has_more }` 分页,`status` 与 `GET /api/v1/sessions/{session_id}/status` 的汇总相同。 * `40901`:有轮次正在进行或压缩正在运行——等其结束后重试 * `40911`:无法撤销那么多轮次(遇到压缩边界或检查点丢失);`data` 携带 `{ reason, requestedCount, undoableCount }` #### `POST /api/v1/sessions/{session_id}:abort` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-abort) 取消 main agent 正在运行的轮次——等同于用户在 TUI 中中止轮次的程序化版本。 成功时,`data` 为 `{ aborted: true }`。 #### `POST /api/v1/sessions/{session_id}:btw` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-btw) 开启一个 `"by the way"` 旁路对话:把 main agent fork 成一个仅可使用只读工具(`Read`、`Grep`、`Glob`)的子 Agent,让快速的临时问题在隔离环境中运行,不触碰工作上下文。需要可用的模型配置。 成功时,`data` 为 `{ agent_id }`——新子 Agent 的 id。 #### `POST /api/v1/sessions/{session_id}:archive` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-archive) 将会话标记为已归档:它从默认会话列表中消失(使用 `include_archive` 或 `archived_only` 时仍会列出),并且服务端广播全局 `event.session.archived` 事件。 成功时,`data` 为 `{ archived: true }`。 #### `POST /api/v1/sessions/{session_id}:restore` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-restore) 取消会话的归档状态并恢复它。 成功时,`data` 为 `archived: false` 的 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 #### `GET /api/v1/sessions/{session_id}/children` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-children) 列出会话的子会话——即通过 `POST /api/v1/sessions/{session_id}/children` 创建的会话。游标分页遵循 [分页](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%88%86%E9%A1%B5) 。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `before_id` | query | string | 只保留早于该 id 的子会话;与 `after_id` 互斥 | | `after_id` | query | string | 只保留晚于该 id 的子会话;与 `before_id` 互斥 | | `page_size` | query | integer | 1–100。默认 `100` | | `busy` | query | boolean | 只保留忙碌(或只保留空闲)的子会话 | 成功时,`data` 为 `{ items, has_more }`,其中每个元素为 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) 。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/children` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-children) 创建子会话:fork 当前会话并记录为其子会话,因此会出现在 `GET /api/v1/sessions/{session_id}/children` 下。适用与 `:fork` 相同的进行中轮次限制。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `title` | body | string | 子会话的标题(至少 1 个字符)。默认 `Child: <source title>` | | `metadata` | body | object | 子会话的自定义元数据 | 成功时,`data` 为新会话的 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) ,并且服务端广播 `event.session.created`。 * `40901`:会话有进行中的轮次,无法 fork #### `GET /api/v1/sessions/{session_id}/status` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-status) main agent 的实时状态汇总;读取它会在会话为冷态时将其恢复。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `{ busy, model?, thinking_level, permission, plan_mode, swarm_mode, context_tokens, max_context_tokens?, context_usage? }`:`busy` 表示是否有进行中的轮次,`model` / `thinking_level` / `permission` 为当前生效的 Agent 设置,`plan_mode` / `swarm_mode` 为模式标志,`context_tokens` 与 `max_context_tokens`、`context_usage`(0–1)描述上下文窗口的占用情况。 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/goal` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-goal) 读取会话当前的目标快照;没有活跃目标时为 `null`。注意,与本 API 的大多数载荷不同,该载荷使用 camelCase 键。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `null` 或 `{ goalId, objective, completionCriterion?, status, turnsUsed, tokensUsed, wallClockMs, budget, terminalReason? }`,其中 `status` 为 `active` / `paused` / `blocked` / `complete`,`budget` 报告 token、轮次与 wall-clock 三项预算,以及各自的剩余量与每项预算的 reached 标志(未设置对应预算时各项为 null)。 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/warnings` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-warnings) 读取会话级告警。目前的产生者只有 `AGENTS.md` 过大检查(`agents-md-oversized`),因此大多数会话的列表为空。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `{ warnings }`,每个条目为 `{ code, message, severity }`,其中 `severity` 为 `info` / `warning` / `error` 之一。 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/runtime` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-runtime) 读取 main agent 的运行时绑定——即该会话的 Agent 循环运行在哪个运行时上。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `{ workspace_id, runtime_id }`。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/runtime` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-runtime) 切换 main agent 的运行时绑定。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `runtime_id` | body | string | **必填。** 目标运行时 id | 成功时,`data` 为新的绑定 `{ workspace_id, runtime_id }`。 * `40420`:不存在该 `runtime_id` 的运行时 * `40926`:运行时存在但不可用 #### `POST /api/v1/sessions/{session_id}/export` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-export) 将会话连同诊断日志一起导出为 zip 附件(`kimi-session-<id>.zip`)。响应是二进制流,不是 JSON 信封——能力与失败语义见 [二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) 。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `web_log` | body | string | 要包含在归档中的客户端日志文本,最多 256 KB UTF-8 | | `desktop` | body | boolean | 同时包含桌面宿主的日志。默认 `false` | #### `GET /api/v1/sessions/{session_id}/snapshot` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-snapshot) 为重新同步后重建客户端组装一份原子快照:会话、最近的消息、进行中的轮次、存活的 subagent 以及待处理交互,全部盖上 `as_of_seq` 水位与用于重新订阅的 `epoch`——见 [断线恢复](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%96%AD%E7%BA%BF%E6%81%A2%E5%A4%8D) 。与普通的会话端点不同,内嵌的会话携带实时的 `agent_config.model` 与真实的 `usage` 总计。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `{ as_of_seq, epoch, session, messages, in_flight_turn, subagents?, pending_approvals, pending_questions }`:`session` 为 [session 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#session-%E5%AF%B9%E8%B1%A1) ,`messages` 为最新 100 条消息的 `{ items, has_more }`,`in_flight_turn` 为已部分流式输出的轮次(空闲时为 `null`,已知时带 `current_prompt_id`),`subagents` 列出存活的 subagent 任务,`pending_approvals` / `pending_questions` 承载未答复的交互。 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/media/{file_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-media-file-id) 按文件 id 下载提示词媒体文件(会话提示词引用的图片或其他附件);尚未提交到会话的 id 会回退到暂存的上传中查找。响应为二进制并支持 `Range`(范围请求返回 206)——共享约定见 [二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) ;与那里走信封的端点不同,会话或文件不存在时会返回真正的 404 状态码并携带信封体。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `file_id` | path | string | **必填。** 媒体文件 id | ### 消息与转录 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%B6%88%E6%81%AF%E4%B8%8E%E8%BD%AC%E5%BD%95) `messages` 端点分页返回 main agent 的扁平化消息历史,`transcript` 端点则提供按 Agent 组织的结构化转录——轮次、任务、交互、附件——即 WebSocket [转录协议](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E8%BD%AC%E5%BD%95%E5%8D%8F%E8%AE%AE) 实时流式推送的内容。历史分页与补漏用这些端点,实时尾部用 WebSocket 订阅。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/messages` | 消息分页(`before_id` / `after_id` / `role`) | | `GET /api/v1/sessions/{session_id}/messages/{message_id}` | 读取单条消息 | | `GET /api/v1/sessions/{session_id}/transcript` | 按轮次分页的转录(需 `agent_id`);全局状态不分页随响应返回 | | `GET /api/v1/sessions/{session_id}/transcript/ops` | op 批次补漏(`since_seq`);`complete: false` 表示需要全量刷新 | | `GET /api/v1/sessions/{session_id}/transcript/user-messages` | 各轮次起始的用户输入,不分页 | | `GET /api/v1/sessions/{session_id}/transcript/plan` | ExitPlanMode 计划内容、路径与审阅结果 | #### `GET /api/v1/sessions/{session_id}/messages` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-messages) 分页返回 main agent 的消息历史——与会话快照共享的扁平化上下文转录——最新在前。游标分页遵循 [分页](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%88%86%E9%A1%B5) ;读取历史会在会话为冷态时将其恢复。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `before_id` | query | string | 只保留早于该消息 id 的消息;与 `after_id` 互斥 | | `after_id` | query | string | 只保留晚于该消息 id 的消息;与 `before_id` 互斥 | | `page_size` | query | integer | 1–100。默认 `50` | | `role` | query | string | 只保留单一角色:`user` / `assistant` / `tool` / `system`。过滤在分页切片之后应用,因此过滤后的一页可能少于 `page_size` 条而 `has_more` 仍为 `true`——持续翻页直到 `has_more` 为 `false` | 成功时,`data` 为 `{ items, has_more }`,其中每个元素是消息对象 `{ id, session_id, role, content, created_at, prompt_id?, parent_message_id?, metadata? }`;`content` 是按 [提示词](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%8F%90%E7%A4%BA%E8%AF%8D) 中说明的线上格式组成的内容块数组(`text`、`tool_use`、`tool_result`、`image`、`video`、`file`、`thinking`)。 * `40001`:校验失败——例如 `before_id` 与 `after_id` 同用 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/messages/{message_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-messages-message-id) 按 id 从同一历史中读取单条消息。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `message_id` | path | string | **必填。** 消息 id | 成功时,`data` 为上文 `GET /api/v1/sessions/{session_id}/messages` 中说明的元素形态的消息对象。 * `40401`:会话不存在 * `40403`:该会话中不存在此 id 的消息 #### `GET /api/v1/sessions/{session_id}/transcript` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-transcript) 返回某个 Agent 的结构化转录中的一页:轮次(含其步骤与帧)以及轮次之间的标记与任务引用。活跃会话从内存存储应答(先回填所请求 Agent 的持久化历史);冷会话则从持久化的线上记录重建 Agent。这是转录能力的历史半边——实时流式半边是 [转录协议](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E8%BD%AC%E5%BD%95%E5%8D%8F%E8%AE%AE) 订阅。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `agent_id` | query | string | **必填。** 要读取其转录的 Agent;必须是纯文本形式的 agent id(字母、数字、`.`、`_`、`-`——不含路径分隔符) | | `before_turn` | query | string | 只保留早于该轮次 id 的轮次;与 `after_turn` 互斥 | | `after_turn` | query | string | 只保留晚于该轮次 id 的轮次;与 `before_turn` 互斥 | | `page_size` | query | integer | 1–100 个轮次。默认 `20` | 分页单位是轮次:不带游标时返回最新的一页,`has_more` 表示还有更早的轮次。成功时,`data` 为 `{ agent_id, items, has_more, tasks, interactions, attachments, todos, meta, agents, pending_interactions, seq? }`——`items` 是本次分页的轮次切片,`tasks` / `interactions` / `attachments` / `todos` / `meta` / `agents` / `pending_interactions` 是不分页、随每次响应一起返回的全局 Agent 状态,`seq` 是该 Agent 用于恢复流的 op 批次水位(仅活跃会话)。 * `40001`:校验失败——`before_turn` 与 `after_turn` 同用,或 `agent_id` 不是纯文本形式 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/transcript/ops` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-transcript-ops) 从服务端的 op 日志提供点对点的补漏:某个 Agent 的 `seq > since_seq` 的已记录 op 批次,最旧在前。它是 [转录协议](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E8%BD%AC%E5%BD%95%E5%8D%8F%E8%AE%AE) 中 `transcript_since` 恢复游标的 REST 对应物,共享同一份有界日志,因此适用相同的回退规则。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `agent_id` | query | string | **必填。** Agent id(纯文本形式,约束与转录端点相同) | | `since_seq` | query | integer | **必填。** 调用方已应用的最后一个 op 批次 seq,最小为 `0`;返回其之后的批次 | 成功时,`data` 为 `{ agent_id, batches, latest_seq, complete }`,每个批次为 `{ seq, ops }`。`complete: true` 表示直到 `latest_seq` 的每个批次都在;`complete: false` 表示日志已不再覆盖到 `since_seq`(或会话根本不是活跃状态),调用方必须回退为一次完整的 `GET .../transcript` 刷新。 * `40001`:校验失败 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/transcript/user-messages` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-transcript-user-messages) 列出会话中每个开启轮次的输入,按 Agent 分组且不分页:真实用户文本、以斜杠命令形式使用的 Skill 与插件命令、以及 cron 提示词——可通过 `origin` 区分——另有仅含附件的提示词,其 `prompt` 投影为空。所列消息引用的附件实体会随响应一起返回(仅元数据,绝不包含字节内容)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `agent_id` | query | string | 只读取一个 Agent(纯文本 id)。默认读取所有在册 Agent | 成功时,`data` 为 `{ agents }`,每个条目为 `{ agent_id, messages, attachments }`;消息为 `{ turn_id, ordinal, state, origin, prompt, attachment_ids?, started_at? }`,其中 `state` 为轮次状态(`queued` / `running` / `completed` / `failed` / `cancelled`)。 * `40001`:校验失败——`agent_id` 不是纯文本形式 * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/transcript/plan` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-transcript-plan) 按时间线顺序读取某个 Agent 的 `ExitPlanMode` 工具调用的计划信息——计划内容、计划文件路径、提供的选项以及审阅结果。内容投影自第一个可用的事实来源:关联的审批交互(交互式审阅)、实时工具帧的展示(auto 模式),或工具结果的输出文本;每个条目在 `source` 中记录了具体来源。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `agent_id` | query | string | **必填。** Agent id(纯文本形式) | | `tool_call_id` | query | string | 将读取范围限定到单次 `ExitPlanMode` 调用;不提供时列出所有可恢复计划内容的调用 | 成功时,`data` 为 `{ agent_id, plans }`,每个计划为 `{ tool_call_id, turn_id, source, plan, path?, options?, review? }`:`source` 为 `interaction` / `display` / `output`,`options` 是审阅选项,形如 `{ label, description? }`,`review`(仅交互式审阅时存在)为 `{ state, selected_option?, feedback? }`,其中 `state` 为 `pending` / `approved` / `rejected` / `cancelled` 之一。 * `40001`:校验失败 * `40401`:会话不存在 * `40416`:提供了 `tool_call_id`,但不存在该 id 的 `ExitPlanMode` 调用 ### 提示词 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%8F%90%E7%A4%BA%E8%AF%8D) 提示词是一次用户输入的单位:提交一条提示词会把它排入会话的 main agent(或指定 Agent)的队列,排队中的提示词可以插入进行中的轮次,运行中的提示词可以中止。轮次进度本身通过 WebSocket [事件](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8B%E4%BB%B6) 流式推送,不经过这些端点。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/prompts` | 进行中与排队中的提示词 | | `POST /api/v1/sessions/{session_id}/prompts` | 提交提示词(内容块数组,可带模型 / 权限模式覆盖) | | `POST /api/v1/sessions/{session_id}/prompts:steer` | 把排队的提示词插入进行中的轮次 | | `POST /api/v1/sessions/{session_id}/prompts/{prompt_id}:abort` | 中止运行中的提示词 | | `POST /api/v1/sessions/{session_id}/prompts/{prompt_id}:steer` | 插入单条排队的提示词 | #### `GET /api/v1/sessions/{session_id}/prompts` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-prompts) 读取 main agent 的提示词队列快照。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时,`data` 为 `{ active, queued }`:`active` 是运行中的提示词(空闲时为 `null`),`queued` 按顺序列出等待中的提示词。提示词为 `{ prompt_id, user_message_id, status, content, created_at }`,其中 `status` 为 `running` / `queued` / `blocked` 之一,`content` 采用 `POST /api/v1/sessions/{session_id}/prompts` 接受的内容块格式。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/prompts` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-prompts) 向会话提交一条用户提示词。先校验媒体引用,然后把可选的覆盖项应用到目标 Agent——`profile`(与 `model` / `thinking` 一起绑定),接着是 `model`、`thinking`、`permission_mode` 和 `disabled_tools`——随后提示词入队;响应在提示词被接受后立即返回,不等待轮次执行。提供 `skills` 时,提示词以打包的 Skill 激活方式运行,而不是普通用户提示词。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `content` | body | array | **必填。** 非空的内容块数组;变体见下 | | `agent_id` | body | string | 目标 Agent。默认为 main agent | | `prompt_id` | body | string | 客户端选定的提示词 id,用于幂等提交;已被进行中提示词占用的 id 返回 `40927`,已完成的返回 `40903`。不能与 `skills` 同用 | | `skills` | body | array | 打包的 Skill 激活,至少 1 个 `{ name, args? }` 条目;每个 Skill 必须存在且可由用户激活 | | `profile` | body | string | 提交前要绑定的 Agent 档案 | | `model` | body | string | 要切换到的模型别名 | | `thinking` | body | string | Thinking 强度等级 | | `permission_mode` | body | string | `manual` / `yolo` / `auto` | | `disabled_tools` | body | array | 要为会话禁用的工具名 | schema 还接受 `metadata`、`plan_mode`、`swarm_mode`、`goal_objective` 和 `goal_control`,但提交路由当前不会应用它们。每个 `content` 内容块是按 `type` 区分的对象: | 内容块 | 字段 | 说明 | | --- | --- | --- | | `text` | `text` | 纯文本 | | `image` / `video` | `source` | 媒体输入;`source` 为 `{ kind: "url", url, id? }`、`{ kind: "base64", media_type, data }`、`{ kind: "file", file_id }`(来自 `POST /api/v1/files` 的上传)或 `{ kind: "session_media", file_id }`(已提交到本会话的媒体)之一 | | `file` | `file_id`、`name`、`media_type`、`size` | 通过 `POST /api/v1/files` 上传的文件附件 | schema 还接受共享消息格式中的 `tool_use`、`tool_result` 和 `thinking` 内容块,但它们在用户提示词中没有意义。未知或 kind 不匹配的 `file_id` 引用会在提示词创建之前、任何覆盖项应用之前被拒绝。 成功时,`data` 为被接受的提示词 `{ prompt_id, user_message_id, status, content, created_at }`。 * `40001`:校验失败——例如 `prompt_id` 与 `skills` 同用,或未知的 `profile` * `40110`:尚未配置供应商——请先完成登录 * `40111`:解析出的供应商没有凭据(`details.provider_id`) * `40112`:供应商的凭据被拒绝(`details.provider_id`) * `40113`:模型无法解析(已知时带 `details.model_id` / `details.provider_id`) * `40401`:会话不存在 * `40407`:引用的 `file_id` 不存在(或与内容块的媒体 kind 不匹配) * `40415`:某个 `skills` 条目指向未知的 Skill * `40903`:`prompt_id` 属于已完成的提示词;`data` 携带 `{ aborted: false }` * `40912`:Skill 存在但无法由用户激活 * `40927`:`prompt_id` 已被进行中的提示词占用 #### `POST /api/v1/sessions/{session_id}/prompts:steer` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-prompts-steer) 把排队的提示词插入进行中的轮次,让运行中的轮次立即消费它们,而不是先运行结束。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `prompt_ids` | body | array | **必填。** 非空的排队提示词 id 数组 | 成功时,`data` 为 `{ steered: true, prompt_ids }`。 * `40001`:校验失败 * `40401`:会话不存在 * `40402`:所列提示词 id 不在队列中 #### `POST /api/v1/sessions/{session_id}/prompts/{prompt_id}:abort` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-prompts-prompt-id-abort) 中止运行中的提示词。本端点与下面的 `:steer` 通过同一条路由 `POST /api/v1/sessions/{session_id}/prompts/{tail}` 分发:尾部解析为 `{prompt_id}:{action}`,动作缺失或未知时返回 `40001`(`unsupported action: ...`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `prompt_id` | path | string | **必填。** 提示词 id | 成功时,`data` 为 `{ aborted: true }`。 * `40401`:会话不存在 * `40402`:不存在该 id 的提示词 * `40903`:提示词已完成;`data` 携带 `{ aborted: false }` #### `POST /api/v1/sessions/{session_id}/prompts/{prompt_id}:steer` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-prompts-prompt-id-steer) 把单条排队的提示词插入进行中的轮次——是 `POST /api/v1/sessions/{session_id}/prompts:steer` 的单提示词形式。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `prompt_id` | path | string | **必填。** 排队中的提示词 id | 成功时,`data` 为 `{ steered: true, prompt_ids: [prompt_id] }`。 * `40401`:会话不存在 * `40402`:没有该 id 的排队提示词 ### 审批与提问 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%AE%A1%E6%89%B9%E4%B8%8E%E6%8F%90%E9%97%AE) 审批与提问是会话的两类待处理交互:审批是为工具调用请求许可,提问是请求带标签选项的结构化输入。这些端点用于列出和答复它们;新的请求通过 WebSocket 以 `event.approval.requested` 与 `event.question.requested` 到达。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/approvals` | 列出待处理的审批请求(必须 `status=pending`) | | `POST /api/v1/sessions/{session_id}/approvals/{approval_id}` | 答复审批 | | `GET /api/v1/sessions/{session_id}/questions` | 列出待处理的提问(必须 `status=pending`) | | `POST /api/v1/sessions/{session_id}/questions/{question_id}` | 回答提问 | | `POST /api/v1/sessions/{session_id}/questions/{question_id}:dismiss` | 忽略提问 | #### `GET /api/v1/sessions/{session_id}/approvals` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-approvals) 列出会话待处理的审批请求——即工具调用发起的权限提示。读取列表会在会话为冷态时将其恢复。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `status` | query | string | **必填。** 必须为 `pending` | 成功时,`data` 为 `{ items }`,每个元素为 `{ approval_id, session_id, agent_id, turn_id?, tool_call_id, tool_name, action, tool_input_display, created_at, expires_at }`:`agent_id` 是发起审批的 agent id(主 agent 为 `main`);`tool_name` / `action` / `tool_input_display` 描述等待许可的调用,`expires_at` 为 `created_at` 之后 24 小时。 * `40001`:`status` 缺失或不是 `pending` * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/approvals/{approval_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-approvals-approval-id) 答复一个待处理的审批请求,让等待中的工具调用继续执行(或不执行)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `approval_id` | path | string | **必填。** 审批请求 id | | `decision` | body | string | **必填。** `approved` / `rejected` / `cancelled` | | `scope` | body | string | 配合 `approved` 使用,`session`(唯一取值)还会让该审批规则在会话的剩余时间内被记住 | | `feedback` | body | string | 回传给 Agent 的自由文本反馈 | | `selected_label` | body | string | 当请求提供了带标签的选项时(例如计划审阅),所选选项的标签 | 成功时,`data` 为 `{ resolved: true, resolved_at }`。 * `40001`:校验失败 * `40401`:会话不存在 * `40404`:没有该 id 的待处理审批 * `40902`:审批已被答复;`data` 携带 `{ resolved: false }` #### `GET /api/v1/sessions/{session_id}/questions` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-questions) 列出会话待处理的提问。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `status` | query | string | **必填。** 必须为 `pending` | 成功时,`data` 为 `{ items }`,每个元素为 `{ question_id, session_id, agent_id?, turn_id?, tool_call_id?, questions, created_at }`。`agent_id?` 是发起提问的 agent id(已知时;主 agent 为 `main`)。`questions` 包含 1–4 个 `{ id, question, header?, body?, options, multi_select?, allow_other?, other_label?, other_description? }` 条目,每个条目带 2–4 个 `{ id, label, description? }` 形式的 `options`;`multi_select` 允许选择多个选项,`allow_other` 允许自由文本回答。 * `40001`:`status` 缺失或不是 `pending` * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/questions/{question_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-questions-question-id) 回答一个待处理的提问。两个提问端点通过同一条路由 `POST /api/v1/sessions/{session_id}/questions/{tail}` 分发:单独的提问 id 表示回答问题,`{question_id}:dismiss` 尾部表示忽略问题,其他情况返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `question_id` | path | string | **必填。** 提问 id | | `answers` | body | object | **必填。** 提问条目 id(`q_0`……)到答案对象的映射;变体见下 | | `method` | body | string | 答案的产生方式:`enter` / `space` / `number_key` / `click` | | `note` | body | string | 附在回答上的自由文本备注 | 每个答案是按 `kind` 区分的对象: | kind 值 | 字段 | 说明 | | --- | --- | --- | | `single` | `option_id` | 选中的单个选项 | | `multi` | `option_ids` | 选中的多个选项(至少 1 个) | | `other` | `text` | 自由文本回答 | | `multi_with_other` | `option_ids`、`other_text` | 选项加自由文本 | | `skipped` | — | 跳过了该条目 | 成功时,`data` 为 `{ resolved: true, resolved_at }`。 * `40001`:校验失败(`details` 列出每个字段) * `40401`:会话不存在 * `40405`:没有该 id 的待处理提问 * `40902`:提问已被答复;`data` 携带 `{ resolved: false }` #### `POST /api/v1/sessions/{session_id}/questions/{question_id}:dismiss` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-questions-question-id-dismiss) 忽略一个待处理的提问,不作回答。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `question_id` | path | string | **必填。** 提问 id | 成功时信封的 `code` 是 `40909`(`question dismissed`)而不是 `0`,`data` 为 `{ dismissed: true, dismissed_at }`——客户端必须特殊处理该端点的成功码。 * `40401`:会话不存在 * `40405`:没有该 id 的待处理提问 * `40902`:提问已被答复;`data` 携带 `{ resolved: false }` ### 后台任务 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1) 后台任务是会话的异步单元——后台 Shell、subagent 与长时间运行的工具任务。注册表仅包含实时数据:未加载到本服务进程中的会话会返回空列表。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/tasks` | 列出后台任务 | | `GET /api/v1/sessions/{session_id}/tasks/{task_id}` | 读取任务(可选输出预览) | | `POST /api/v1/sessions/{session_id}/tasks/{task_id}:cancel` | 取消任务 | | `POST /api/v1/sessions/{session_id}/tasks/{task_id}:detach` | 将前台任务转入后台 | #### `GET /api/v1/sessions/{session_id}/tasks` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-tasks) 列出会话的后台任务。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `status` | query | string | 只保留单一状态:`running` / `completed` / `failed` / `cancelled` | 成功时,`data` 为 `{ items }`,每个元素是任务对象 `{ id, session_id, kind, description, status, created_at, started_at?, completed_at?, command?, model?, thinking_effort?, agent_id?, subagent_type?, parent_tool_call_id?, output_preview?, output_bytes? }`。`kind` 为 `bash` / `subagent` / `tool`;`command` 仅在 `bash` 任务时设置,模型与 Agent 字段仅在 `subagent` 任务时设置,输出字段仅在以 `with_output` 读取任务时设置。超时与丢失的任务上报为 `failed`;被杀死的任务上报为 `cancelled`。 * `40001`:校验失败——未知的 `status` * `40401`:会话不存在 #### `GET /api/v1/sessions/{session_id}/tasks/{task_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-tasks-task-id) 读取单个后台任务,可选携带输出的末尾片段。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `task_id` | path | string | **必填。** 任务 id | | `with_output` | query | boolean | 在响应中包含输出末尾片段。默认 `false` | | `output_bytes` | query | integer | 请求的输出末尾片段的字节大小,最小 `0`。默认 `32768` | 成功时,`data` 为上文 `GET /api/v1/sessions/{session_id}/tasks` 中说明的任务对象;当 `with_output=true` 且输出非空时,`output_preview` 携带末尾片段文本,`output_bytes` 为其字节长度。 * `40001`:校验失败 * `40401`:会话不存在 * `40406`:没有该 id 的任务(冷会话完全没有实时任务) #### `POST /api/v1/sessions/{session_id}/tasks/{task_id}:cancel` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-tasks-task-id-cancel) 取消运行中的任务。它通过 `POST /api/v1/sessions/{session_id}/tasks/{tail}` 分发,支持 `cancel` / `detach` 两个动作——单独的任务 id 或未知动作返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `task_id` | path | string | **必填。** 任务 id | 成功时,`data` 为 `{ cancelled: true }`。 * `40001`:动作后缀缺失或未知 * `40401`:会话不存在 * `40406`:没有该 id 的任务 * `40904`:任务已结束;`data` 携带 `{ cancelled: false }`,`details.current_status` 为最终状态 #### `POST /api/v1/sessions/{session_id}/tasks/{task_id}:detach` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-tasks-task-id-detach) 将运行中的前台任务转入后台而不终止它:等待该任务的工具调用会立即以后台任务结果返回,轮次继续推进,任务则在后台任务注册表下继续运行(输出持久化,完成时以任务通知投递)。已在后台或已结束的任务为幂等空操作。它通过 `POST /api/v1/sessions/{session_id}/tasks/{tail}` 分发,支持 `cancel` / `detach` 两个动作——单独的任务 id 或未知动作返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `task_id` | path | string | **必填。** 任务 id | 成功时,`data` 为 `{ detached, status }`:本次调用确实将运行中的前台任务转入后台时 `detached` 为 `true`,幂等空操作时为 `false`;`status` 为调用后的任务状态。 * `40001`:动作后缀缺失或未知 * `40401`:会话不存在 * `40406`:没有该 id 的任务 ### 技能、工具与 MCP [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%8A%80%E8%83%BD%E3%80%81%E5%B7%A5%E5%85%B7%E4%B8%8E-mcp) 这组端点暴露会话或工作区可见的技能目录、当前生效 agent 的工具列表及其 MCP 服务。技能激活与 MCP 重启使用 `:{action}` 约定;激活即斜杠命令 `/<skill>` 的 REST 等价形式。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/skills` | 会话级技能目录 | | `GET /api/v1/workspaces/{workspace_id}/skills` | 无会话的工作区技能目录 | | `POST /api/v1/sessions/{session_id}/skills/{skill_name}:activate` | 激活技能(开启一个轮次) | | `GET /api/v1/tools` | 列出当前生效 agent 的工具 | | `GET /api/v1/mcp/servers` | 列出 MCP 服务 | | `POST /api/v1/mcp/servers/{mcp_server_id}:restart` | 重启 MCP 服务 | #### `GET /api/v1/sessions/{session_id}/skills` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-skills) 列出单个会话可用的技能,按会话的优先级合并所有来源(内置、插件、extra、用户、项目)。会话处于冷态时,读取目录会恢复该会话。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时 `data` 为 `{ skills }`,每项是一个技能描述符 `{ name, description, path, source, type?, disable_model_invocation? }`:`source` 为 `project` / `user` / `extra` / `builtin`;`type` 标识技能类别(只有用户可激活的类型才能被激活);`disable_model_invocation` 会让技能对模型不可见。 * `40401`:会话不存在(或未激活) #### `GET /api/v1/workspaces/{workspace_id}/skills` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-workspaces-workspace-id-skills) 列出该工作区中的会话将看到的技能目录,但不创建或恢复会话——即针对工作区根目录计算出的同一套内置、插件、extra、用户、项目来源合并结果。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 已注册工作区 id | 成功时 `data` 为 `{ skills }`,技能描述符见上文 `GET /api/v1/sessions/{session_id}/skills` 的说明。 * `40410`:工作区不存在 #### `POST /api/v1/sessions/{session_id}/skills/{skill_name}:activate` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-skills-skill-name-activate) 在会话中激活技能——即斜杠命令 `/<skill>` 的 REST 等价形式——以技能内容加上 `args` 与附件在 main agent 上开启一个轮次。该端点经单一路由 `POST /api/v1/sessions/{session_id}/skills/{tail}` 分发:尾部按 `{skill_name}:{action}` 解析,`activate` 是唯一动作;只给名称或动作未知时返回 `40001`(`unsupported action: ...`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `skill_name` | path | string | **必填。** 要激活的技能名 | | `args` | body | string | 传给技能的自由文本参数,相当于斜杠命令后的文本 | | `attachments` | body | array | 随激活携带的媒体块。`image` / `video` 块带 `source` 对象(`kind` 为 `url` / `base64` / `file` / `session_media`,与提示词内容块同形);`file` 块带顶层 `file_id`、`name`、`media_type`、`size` | 成功时 `data` 为 `{ activated: true, skill_name }`。 * `40001`:校验失败或动作后缀不支持 * `40401`:会话不存在(或未激活) * `40407`:引用的附件文件不存在 * `40415`:没有该名称的技能 * `40912`:技能存在,但其类型不允许用户激活 #### `GET /api/v1/tools` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-tools) 列出当前生效 agent 的工具——即 `session_id` 指定会话的 main agent;省略参数时取最近创建的会话。若该会话不在本服务进程中存活,列表为空。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | query | string | 要查看其 main agent 的会话。默认最近创建的会话 | 成功时 `data` 为 `{ tools }`,每项为 `{ name, description, input_schema, source, mcp_server_id?, active? }`:`source` 为 `builtin` / `skill` / `mcp`;`mcp_server_id` 仅 MCP 工具携带(从 `mcp__<server>__<tool>` 名称解析);`active` 报告工具策略的判定结果。`input_schema` 目前恒为 `null`。 #### `GET /api/v1/mcp/servers` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-mcp-servers) 列出当前生效 agent 配置的 MCP 服务(与 `GET /api/v1/tools` 相同,取最近创建的存活会话的 main agent)。没有存活会话时列表为空。 成功时 `data` 为 `{ servers }`,每项为 `{ id, name, transport, status, last_error?, tool_count }`:`transport` 为 `stdio` / `http` / `sse`;`status` 为 `connected` / `connecting` / `disconnected` / `error`;服务处于 `error` 时 `last_error` 携带失败信息。 #### `POST /api/v1/mcp/servers/{mcp_server_id}:restart` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-mcp-servers-mcp-server-id-restart) 重新连接当前生效 agent 的某个 MCP 服务。该端点经 `POST /api/v1/mcp/servers/{tail}` 分发,`restart` 是唯一动作——只给服务 id 或动作未知时返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `mcp_server_id` | path | string | **必填。** MCP 服务 id(即其配置名称) | 成功时 `data` 为 `{ restarting: true }`。 * `40001`:缺少动作后缀或动作未知 * `40408`:没有该 id 的 MCP 服务(无存活会话时同样返回此错误) ### 能力与插件 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E8%83%BD%E5%8A%9B%E4%B8%8E%E6%8F%92%E4%BB%B6) 能力是带有分层就绪状态的内置特性——由检测步骤加后台安装组成;当前版本注册了 `kimi-cu`(Kimi Computer Use)与 `kimi-webbridge`(Kimi Browser Extension)。插件是已安装的技能、MCP 服务、hook 与命令的打包集合。这组端点报告能力状态、驱动能力安装,并管理插件从市场列表到移除的整个生命周期。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/capabilities` | 列出内置能力及其就绪状态 | | `GET /api/v1/capabilities/{capability_id}` | 读取单个能力的状态 | | `POST /api/v1/capabilities/{capability_id}:install` | 开始安装能力(后台进行,轮询 GET 查看进度) | | `GET /api/v1/plugins` | 列出已安装插件 | | `POST /api/v1/plugins` | 从本地路径、zip URL 或 GitHub 仓库安装插件 | | `GET /api/v1/plugins/marketplace` | 插件市场目录,合并实时安装状态 | | `POST /api/v1/plugins/{plugin_id}:{action}` | 插件动作:`enable` / `disable` / `remove` | #### `GET /api/v1/capabilities` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-capabilities) 列出所有已注册能力及其就绪状态。 成功时 `data` 为 `{ capabilities }`,每项是一个能力状态对象 `{ id, pluginId?, displayName, description, supported, state, version?, steps, install }`。`state` 为 `ready`(所有必需检测步骤均为 `ok`)/ `partial`(部分步骤 `ok`)/ `not_installed` / `unsupported`(当前平台/架构不可用);`steps` 以 `{ id, state, detail?, optional? }` 列出各检测步骤,其 `state` 为 `ok` / `missing` / `failed` 之一;`install` 为安装进度 `{ running, step?, percent?, error?, note? }`,其中 `percent` 取值 0 到 100。 #### `GET /api/v1/capabilities/{capability_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-capabilities-capability-id) 读取单个能力的就绪状态——即 `:install` 动作的轮询对应端点。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `capability_id` | path | string | **必填。** 能力 id | 成功时 `data` 为上文 `GET /api/v1/capabilities` 说明的能力状态对象。 * `40418`:没有该 id 的能力 #### `POST /api/v1/capabilities/{capability_id}:install` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-capabilities-capability-id-install) 在后台开始安装能力并立即返回当前状态(`install.running` 为 `true`);轮询 `GET /api/v1/capabilities/{capability_id}` 查看进度。该端点经 `POST /api/v1/capabilities/{tail}` 分发,`install` 是唯一动作——只给 id 或动作未知时返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `capability_id` | path | string | **必填。** 能力 id | 成功时 `data` 为上文 `GET /api/v1/capabilities` 说明的能力状态对象。 * `40001`:缺少动作后缀或动作未知 * `40418`:没有该 id 的能力 * `40924`:该能力的安装已在进行中 * `40925`:当前平台/架构不支持该能力 #### `GET /api/v1/plugins` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-plugins) 列出已安装插件。 成功时 `data` 为 `{ plugins }`,每项为 `{ id, displayName, version?, enabled, state, skillCount, mcpServerCount, enabledMcpServerCount, hookCount, commandCount, hasErrors, source, originalSource?, github? }`:`state` 为 `ok` / `error`(加载失败也会置 `hasErrors`);`source` 为 `local-path` / `zip-url` / `github`;GitHub 来源的插件由 `github` 携带来源信息 `{ owner, repo, ref, installedSha? }`,其中 `ref` 为 `{ kind: branch|tag|sha, value }`。 #### `POST /api/v1/plugins` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-plugins) 安装插件并返回其摘要。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `source` | body | string | **必填。** 安装来源:本地绝对路径、指向 zip 压缩包的 `http(s)` URL,或 GitHub URL——`https://github.com/<owner>/<repo>`,可选地用 `/tree/<branch-or-sha>`、`/releases/tag/<tag>` 或 `/commit/<sha>` 锁定版本 | 成功时 `data` 为上文 `GET /api/v1/plugins` 说明的插件摘要。 * `40001`:校验失败——例如 `source` 既不是 URL 也不是绝对路径,或插件加载失败 * `40409`:本地路径不存在 #### `GET /api/v1/plugins/marketplace` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-plugins-marketplace) 列出插件市场目录并合并实时安装状态。目录按请求从配置的市场 URL 拉取(超时 10 秒);使用默认目录时,目录中缺少的内置能力会作为条目合并进来(带 `capabilityId`),而当前平台不支持的能力对应条目会被剔除。 成功时 `data` 为 `{ entries }`,每项为 `{ id, tier, displayName, description?, homepage?, keywords?, version?, source, installed?, updateAvailable?, capabilityId? }`:`tier` 为 `official` / `curated` / `third-party`;插件已安装时 `installed` 为 `{ version?, enabled }`;`updateAvailable` 标记目录版本新于已安装版本的条目。条目的 `source` 即 `POST /api/v1/plugins` 的 `source` 字段取值。 * `50001`:市场不可达或返回了非法目录 #### `POST /api/v1/plugins/{plugin_id}:enable` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-plugins-plugin-id-enable) 启用一个已安装插件。插件动作经单一路由 `POST /api/v1/plugins/{tail}` 分发:尾部按 `{plugin_id}:{action}` 解析,动作为 `enable` / `disable` / `remove`;只给 id 或动作未知时返回 `40001`(`unsupported action: ...`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `plugin_id` | path | string | **必填。** 已安装插件 id | 成功时 `data` 为 `{ ok: true }`。 * `40001`:缺少动作后缀或动作未知 * `40419`:没有该 id 的已安装插件 #### `POST /api/v1/plugins/{plugin_id}:disable` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-plugins-plugin-id-disable) 停用一个已安装插件但不移除它;分发约定同上文 `:enable`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `plugin_id` | path | string | **必填。** 已安装插件 id | 成功时 `data` 为 `{ ok: true }`。 * `40001`:缺少动作后缀或动作未知 * `40419`:没有该 id 的已安装插件 #### `POST /api/v1/plugins/{plugin_id}:remove` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-plugins-plugin-id-remove) 移除一个已安装插件;分发约定同上文 `:enable`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `plugin_id` | path | string | **必填。** 已安装插件 id | 成功时 `data` 为 `{ ok: true }`。 * `40001`:缺少动作后缀或动作未知 * `40419`:没有该 id 的已安装插件 ### 终端 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E7%BB%88%E7%AB%AF) PTY 终端接口;仅在 loopback 绑定时挂载(非 loopback 绑定会跳过它们,除非传入 `--allow-remote-terminals`)。终端的输入、输出与尺寸调整经 WebSocket 的 `terminal_*` 帧传输——REST 侧只管理终端生命周期。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/sessions/{session_id}/terminals` | 列出终端 | | `POST /api/v1/sessions/{session_id}/terminals` | 创建终端 | | `GET /api/v1/sessions/{session_id}/terminals/{terminal_id}` | 读取终端 | | `POST /api/v1/sessions/{session_id}/terminals/{terminal_id}:close` | 关闭终端 | #### `GET /api/v1/sessions/{session_id}/terminals` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-terminals) 列出会话的终端。会话处于冷态时,读取列表会恢复该会话。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | 成功时 `data` 为 `{ items }`,每项是一个终端对象 `{ id, session_id, cwd, shell, cols, rows, status, created_at, exited_at?, exit_code? }`:`status` 为 `running` / `exited`;已退出的终端携带 `exited_at` 与 `exit_code`(进程未报告退出码时为 `null`,例如因信号终止)。回滚缓冲不属于该对象——输出经 WebSocket 回放与流式推送。 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/terminals` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-terminals) 为会话创建一个 PTY 终端。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `runtime_id` | body | string | 生成终端进程的运行时。默认 `local` | | `cwd` | body | string | 工作目录,相对于会话工作区(传绝对路径会校验失败)。默认工作区根目录 | | `shell` | body | string | Shell 可执行文件。默认该运行时的 shell | | `cols` | body | integer | 终端宽度,正数。默认 `80` | | `rows` | body | integer | 终端高度,正数。默认 `24` | 成功时 `data` 为上文 `GET /api/v1/sessions/{session_id}/terminals` 说明的终端对象。 * `40001`:校验失败(`details` 逐字段说明) * `40401`:会话不存在 * `41304`:`cwd` 解析后越出会话工作区 #### `GET /api/v1/sessions/{session_id}/terminals/{terminal_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-terminals-terminal-id) 读取单个终端。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `terminal_id` | path | string | **必填。** 终端 id | 成功时 `data` 为上文 `GET /api/v1/sessions/{session_id}/terminals` 说明的终端对象。 * `40401`:会话不存在 * `40414`:没有该 id 的终端 #### `POST /api/v1/sessions/{session_id}/terminals/{terminal_id}:close` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-terminals-terminal-id-close) 关闭终端并结束其进程。该端点经 `POST /api/v1/sessions/{session_id}/terminals/{tail}` 分发,`close` 是唯一动作——只给 id 或动作未知时返回 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `terminal_id` | path | string | **必填。** 终端 id | 成功时 `data` 为 `{ closed: true }`。 * `40001`:缺少动作后缀或动作未知 * `40401`:会话不存在 * `40414`:没有该 id 的终端 ### 工作区 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%B7%A5%E4%BD%9C%E5%8C%BA) 工作区是已注册的项目目录,会话都落在其中。这组端点管理注册表——列出、注册、重命名、注销——以及控制项目级 MCP 配置是否加载的每工作区信任状态。所有返回工作区的端点都使用 [workspace 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#workspace-%E5%AF%B9%E8%B1%A1) 中统一说明的传输结构。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/workspaces` | 列出已注册工作区 | | `POST /api/v1/workspaces` | 注册工作区(按根路径幂等) | | `PATCH /api/v1/workspaces/{workspace_id}` | 重命名 | | `DELETE /api/v1/workspaces/{workspace_id}` | 注销(保留磁盘内容) | | `GET /api/v1/workspaces/{workspace_id}/trust` | 读取信任状态 | | `POST /api/v1/workspaces/{workspace_id}/trust` | 授予信任 | | `POST /api/v1/workspaces/{workspace_id}/untrust` | 撤销信任 | | `POST /api/v1/workspaces/{workspace_id}/add-dir` | 添加附加目录 | #### workspace 对象 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#workspace-%E5%AF%B9%E8%B1%A1) 所有返回工作区的端点都使用此传输结构。注册与重命名会广播全局事件 `event.workspace.created` / `event.workspace.updated`。 | 字段 | 类型 | 说明 | | --- | --- | --- | | `id` | string | 工作区 id,由根路径派生的 `wd_<slug>_<hash12>` 字符串 | | `root` | string | 项目目录的绝对路径 | | `name` | string | 显示名,1–100 个字符;默认取根目录的基名 | | `created_at` | string | 注册时间,ISO 8601 | | `last_opened_at` | string | 最近一次打开或重新注册工作区的时间,ISO 8601 | | `session_count` | integer | 工作区内的会话数 | #### `GET /api/v1/workspaces` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-workspaces) 列出所有已注册工作区。 成功时 `data` 为 `{ items }`,每项是一个 [workspace 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#workspace-%E5%AF%B9%E8%B1%A1) 。 #### `POST /api/v1/workspaces` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspaces) 注册工作区并返回它。注册按根路径幂等:重复注册同一根路径会返回已存在的工作区,仅刷新 `last_opened_at`(保留已存名称),并广播 `event.workspace.updated` 而非 `event.workspace.created`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `root` | body | string | **必填。** 已存在目录的绝对路径 | | `name` | body | string | 显示名,1–100 个字符。默认根目录的基名 | 成功时 `data` 为 [workspace 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#workspace-%E5%AF%B9%E8%B1%A1) 。 * `40001`:`root` 缺失或不是绝对路径(`details` 会列出该字段) * `40409`:`root` 不存在或不是目录 #### `PATCH /api/v1/workspaces/{workspace_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#patch-api-v1-workspaces-workspace-id) 重命名工作区——仅修改显示名,根路径不变。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | | `name` | body | string | **必填。** 新的显示名,1–100 个字符 | 成功时 `data` 为 [workspace 对象](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#workspace-%E5%AF%B9%E8%B1%A1) 。 * `40001`:校验失败(`details` 逐字段说明) * `40410`:工作区不存在 #### `DELETE /api/v1/workspaces/{workspace_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#delete-api-v1-workspaces-workspace-id) 注销工作区。只移除注册表条目——磁盘上的目录不受影响。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | 成功时 `data` 为 `{ deleted: true }`。 * `40410`:工作区不存在 #### `GET /api/v1/workspaces/{workspace_id}/trust` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-workspaces-workspace-id-trust) 读取工作区信任状态。信任状态决定是否为该工作区加载项目级 MCP 配置。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | 成功时 `data` 为 `{ trusted }`。 * `40410`:工作区不存在 #### `POST /api/v1/workspaces/{workspace_id}/trust` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspaces-workspace-id-trust) 将工作区标记为信任,并加载其项目级 MCP 配置。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | 成功时 `data` 为 `{ trusted: true }`。 * `40410`:工作区不存在 #### `POST /api/v1/workspaces/{workspace_id}/untrust` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspaces-workspace-id-untrust) 撤销工作区信任,并卸载其项目级 MCP 配置。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | 成功时 `data` 为 `{ trusted: false }`。 * `40410`:工作区不存在 #### `POST /api/v1/workspaces/{workspace_id}/add-dir` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspaces-workspace-id-add-dir) 为工作区添加附加目录,语义与 CLI `--add-dir` 及 TUI `/add-dir` 一致。路径支持绝对路径、相对路径(相对工作区根目录解析)与 `~` 展开。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace_id` | path | string | **必填。** 工作区 id | | `path` | body | string | **必填。** 要添加的目录 | | `persist` | body | boolean | 缺省 `true`:追加到 `<项目根>/.kimi-code/local.toml` 的 `workspace.additional_dir`;为 `false` 时仅加入内存中的临时集合(同一工作区所有会话共享),不写盘 | 成功时 `data` 为 `{ project_root, config_path, additional_dirs, persisted }`,其中 `additional_dirs` 是全部附加目录(含既有目录),`persisted` 表示本次是否写盘。 * `40001`:校验失败(`details` 逐字段说明),或项目本地配置损坏等引擎校验错误 * `40409`:`path` 不存在或不是目录 * `40410`:工作区不存在 ### 文件系统 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F) 会话内文件操作走 `POST /api/v1/sessions/{session_id}/fs:{action}`,请求体为 JSON;动作包括 `list` / `read` / `list_many` / `stat` / `stat_many` / `mkdir` / `search` / `grep` / `git_status` / `diff` / `open` / `open-in` / `reveal`。每个动作的请求体还接受可选的 `runtime_id`(string,默认 `local`),用于选择执行操作的运行时;`open`、`open-in` 与 `reveal` 仅在 `local` 运行时上可用。另有: | 方法与路径 | 说明 | | --- | --- | | `POST /api/v1/workspace/fs:search` | 无会话的工作区搜索(body 携带工作区引用) | | `POST /api/v1/workspace/fs:suggest` | 无会话的文件补全候选(用于 `@` 文件提及) | | `GET /api/v1/sessions/{session_id}/fs/{path}:download` | 下载会话文件(二进制,见下文) | | `GET /api/v1/fs:browse` | 列出本机目录(文件夹选择器用) | | `GET /api/v1/fs:home` | 用户主目录与最近工作区 | | `GET /api/v1/fs:content` | 读取本机任意文件原始字节(仅受 token 保护,谨慎暴露端口) | | `POST /api/v1/fs:mkdir` | 按绝对路径创建目录 | #### `POST /api/v1/sessions/{session_id}/fs:list` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-list) 列出会话工作区目录下的条目,可选递归子目录。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | 要列出的目录,相对于会话工作目录。默认 `.` | | `depth` | body | integer | 递归深度,1–10。默认 `1` | | `limit` | body | integer | 最大条目数,1–1000。默认 `200` | | `show_hidden` | body | boolean | 包含点文件。默认 `false` | | `follow_gitignore` | body | boolean | 跳过 gitignore 的路径。默认 `true` | | `exclude_globs` | body | string\[\] | 额外要跳过的 glob | | `sort` | body | string | `type_first`(默认)/ `name_asc` / `name_desc` / `mtime_desc` / `size_desc` | | `include_git_status` | body | boolean | 附带每个条目的 git 状态。默认 `false` | 成功时 `data` 为 `{ items, truncated }`——`depth` 大于 1 时另附 `children_by_path`(路径 → 条目的映射)。每项是一个条目对象 `{ path, name, kind, size?, modified_at, etag?, mime?, language_id?, is_binary?, is_symlink_to?, git_status?, child_count? }`,其中 `kind` 为 `file` / `directory` / `symlink`;`git_status`(仅 `include_git_status: true` 时存在)为 `clean` / `modified` / `added` / `deleted` / `renamed` / `untracked` / `ignored` / `conflicted` 之一;`truncated` 表示 `limit` 截断了列表。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在(包括 `path` 不是目录的情况) * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:read` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-read) 以文本或 base64 读取会话文件的一段内容。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 文件路径,相对于会话工作目录 | | `offset` | body | integer | 起始字节偏移。默认 `0` | | `length` | body | integer | 读取字节数,1–10485760(10 MiB)。默认 `1048576`(1 MiB) | | `encoding` | body | string | `auto`(默认)/ `utf-8` / `base64` | 成功时 `data` 为 `{ path, content, encoding, size, truncated, etag, mime, language_id?, line_count?, is_binary }`,其中 `encoding` 报告实际使用的编码(`utf-8` 或 `base64`),`size` 为文件完整大小。`encoding: "auto"` 时文本以 `utf-8` 返回(非 UTF-8 文本会被转码),二进制内容以 `base64` 返回;`encoding: "utf-8"` 强制按文本读取并拒绝二进制文件。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在 * `40906`:路径是目录 * `40907`:二进制文件却指定了 `encoding: "utf-8"` * `41302`:文件超过 10 MiB 读取上限 * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:list_many` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-list-many) 一次调用列出多个会话目录;失败的路径会折进响应里,而不是让整个请求失败。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `paths` | body | string\[\] | **必填。** 要列出的目录,1–100 条 | 其余请求体字段(`depth`、`limit`、`show_hidden`、`follow_gitignore`、`exclude_globs`、`sort`、`include_git_status`)的类型、取值范围与默认值同 `fs:list`。成功时 `data` 为 `{ results }`——每个请求路径到其条目数组(条目对象见 `fs:list` 的说明)的映射,另附 `truncated_paths`(达到 `limit` 的路径)与 `partial_errors`(失败路径到其 `{ code, msg }` 错误的映射)。 * `40001`:请求体校验失败 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/fs:stat` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-stat) 查询会话工作区内单个路径的元信息。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 要查询的路径,相对于会话工作目录 | 成功时 `data` 为 `fs:list` 中说明的条目对象。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在 * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:stat_many` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-stat-many) 一次调用查询多个会话路径的元信息;不存在的路径返回 `null`,不会让整个请求失败。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `paths` | body | string\[\] | **必填。** 要查询的路径,1–1000 条 | 成功时 `data` 为 `{ entries }`——每个请求路径到其条目对象(见 `fs:list` 的说明)的映射,路径不存在时为 `null`。 * `40001`:请求体校验失败 * `40401`:会话不存在 #### `POST /api/v1/sessions/{session_id}/fs:mkdir` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-mkdir) 在会话工作区内创建目录。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 要创建的目录,相对于会话工作目录 | | `recursive` | body | boolean | 创建缺失的父目录。默认 `false` | 成功时 `data` 为所建目录的条目对象(见 `fs:list` 的说明)。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:父目录不存在(非递归创建) * `40919`:路径已存在(非递归创建) * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:search` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-search) 在会话工作区内模糊搜索文件与目录名。`query` 为空时改为列出顶层条目。当 `{session_id}` 位置携带的是工作区引用(已注册工作区 id 或绝对根路径)而非会话 id 时,搜索针对该工作区执行——这是为尚未创建的草稿会话准备的无会话形式;正式的无会话端点是 `POST /api/v1/workspace/fs:search`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id,或工作区引用 | | `query` | body | string | **必填。** 搜索文本;`""` 表示列出顶层 | | `limit` | body | integer | 最大命中数,1–200。默认 `50` | | `include_globs` | body | string\[\] | 只保留匹配这些 glob 之一的路径 | | `exclude_globs` | body | string\[\] | 跳过匹配这些 glob 的路径 | | `follow_gitignore` | body | boolean | 跳过 gitignore 的路径。默认 `true` | 成功时 `data` 为 `{ items, truncated }`,每项为 `{ path, name, kind, score, match_positions }`——`kind` 为 `file` / `directory` / `symlink`,`score` 为 0 到 1 之间的模糊匹配得分,`match_positions` 列出匹配到的字符偏移。命中按得分排序(同分按路径),`truncated` 表示超出 `limit` 的命中被丢弃。 * `40001`:请求体校验失败 * `40401`:该引用既不是会话,也不是可解析的工作区 #### `POST /api/v1/sessions/{session_id}/fs:grep` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-grep) 在会话工作区内搜索文件内容——默认按字面字符串,`regex: true` 时按正则表达式。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `pattern` | body | string | **必填。** 要搜索的文本或正则 | | `regex` | body | boolean | 将 `pattern` 视为正则表达式。默认 `false` | | `case_sensitive` | body | boolean | 默认 `true` | | `include_globs` | body | string\[\] | 只保留匹配这些 glob 之一的文件 | | `exclude_globs` | body | string\[\] | 跳过匹配这些 glob 的文件 | | `follow_gitignore` | body | boolean | 跳过 gitignore 的路径。默认 `true` | | `max_files` | body | integer | 最多扫描的文件数,1–10000。默认 `200` | | `max_matches_per_file` | body | integer | 每个文件保留的匹配数,1–10000。默认 `50` | | `max_total_matches` | body | integer | 总共保留的匹配数,1–100000。默认 `5000` | | `context_lines` | body | integer | 每个匹配携带的上下文行数,0–10。默认 `2` | 成功时 `data` 为 `{ files, files_scanned, truncated, elapsed_ms }`,其中 `files` 的每项为 `{ path, matches }`,每个匹配为 `{ line, col, text, before, after }`(`before` / `after` 最多携带 `context_lines` 行上下文);`truncated` 表示某个匹配配额截断了结果。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `41305`:搜索超时 #### `POST /api/v1/sessions/{session_id}/fs:git_status` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-git-status) 读取会话工作区的 git 状态,可选限定在一组路径内。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `paths` | body | string\[\] | 将状态限定在这些路径;省略表示整个工作区 | 成功时 `data` 为 `{ branch, ahead, behind, entries, additions, deletions, pullRequest }`,其中 `entries` 把每个变更路径映射到其状态(`clean` / `modified` / `added` / `deleted` / `renamed` / `untracked` / `ignored` / `conflicted`),`pullRequest` 为 `{ number, state, url }`(`state` 为 `open` / `merged` / `closed` / `draft`)或 `null`。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40908`:git 不可用(不是仓库,或没有 git 可执行文件) #### `POST /api/v1/sessions/{session_id}/fs:diff` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-diff) 返回会话工作区内单个文件的 unified git diff。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 要 diff 的文件,相对于会话工作目录 | 成功时 `data` 为 `{ path, diff, truncated }`,其中 `diff` 为 unified diff 文本,`truncated` 表示过长的 diff 被截断。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40908`:git 不可用(不是仓库,或没有 git 可执行文件) * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:open` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-open) 用宿主操作系统的默认程序打开会话文件。仅限 local 运行时。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 要打开的文件,相对于会话工作目录 | | `line` | body | integer | 在处理程序支持时跳转到的行号(正整数) | 成功时 `data` 为 `{ opened: true }`。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在 * `41304`:路径越出会话工作区 #### `POST /api/v1/sessions/{session_id}/fs:open-in` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-open-in) 在指定的宿主应用程序中打开会话文件或目录。仅限 local 运行时。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `app_id` | body | string | **必填。** 目标应用:`finder` / `cursor` / `vscode` / `iterm` / `terminal` | | `path` | body | string | **必填。** 要打开的文件或目录,相对于会话工作目录 | | `line` | body | integer | 在应用支持时跳转到的行号(正整数) | 成功时 `data` 为 `{ opened: true }`。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在 * `41304`:路径越出会话工作区 * `50001`:应用启动失败 #### `POST /api/v1/sessions/{session_id}/fs:reveal` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-sessions-session-id-fs-reveal) 在宿主操作系统的文件管理器中显示会话文件。仅限 local 运行时。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | body | string | **必填。** 要显示的文件,相对于会话工作目录 | 成功时 `data` 为 `{ revealed: true }`。 * `40001`:请求体校验失败 * `40401`:会话不存在 * `40409`:路径不存在 * `41304`:路径越出会话工作区 #### `GET /api/v1/sessions/{session_id}/fs/{path}:download` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-sessions-session-id-fs-path-download) 从会话工作区下载文件;`{path}` 是相对于工作区的文件路径,并带字面量 `:download` 后缀。响应为支持 Range 与 ETag 的二进制流——见 [二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) 。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `session_id` | path | string | **必填。** 会话 id | | `path` | path | string | **必填。** 相对于工作区的文件路径,加 `:download` 后缀 | | `runtime_id` | query | string | 从哪个运行时读取。默认 `local` | * `40001`:路径缺失或为空 * `40401`:会话不存在 * `40409`:路径不存在 * `41304`:路径越出会话工作区 #### `POST /api/v1/workspace/fs:search` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspace-fs-search) `fs:search` 的无会话形式:工作区改由请求体而非 URL 携带。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace` | body | string | **必填。** 已注册工作区 id 或绝对根路径(当场注册) | | `query` | body | string | **必填。** 搜索文本;`""` 表示列出顶层 | | `limit` | body | integer | 最大命中数,1–200。默认 `50` | | `include_globs` | body | string\[\] | 只保留匹配这些 glob 之一的路径 | | `exclude_globs` | body | string\[\] | 跳过匹配这些 glob 的路径 | | `follow_gitignore` | body | boolean | 跳过 gitignore 的路径。默认 `true` | | `runtime_id` | body | string | 在哪个运行时上搜索。默认 `local` | 成功时 `data` 为 `{ items, truncated }`,命中结构与排序同 `fs:search`。 * `40001`:请求体校验失败 * `40410`:工作区不存在,且不是可用的绝对路径 #### `POST /api/v1/workspace/fs:suggest` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-workspace-fs-suggest) 在无会话的情况下给出工作区内的文件与目录补全候选——即输入框中 `@` 文件提及的后端。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `workspace` | body | string | **必填。** 已注册工作区 id 或绝对根路径(当场注册) | | `query` | body | string | **必填。** 要补全的部分路径文本 | | `limit` | body | integer | 最大候选数,1–200。默认 `50` | | `follow_gitignore` | body | boolean | 跳过 gitignore 的路径。默认 `true` | | `show_hidden` | body | boolean | 包含点文件。默认 `false` | | `include_globs` | body | string\[\] | 只保留匹配这些 glob 之一的路径 | | `exclude_globs` | body | string\[\] | 跳过匹配这些 glob 的路径 | | `runtime_id` | body | string | 在哪个运行时上补全。默认 `local` | 成功时 `data` 为 `{ items, truncated }`,每项为 `{ path, name, kind, score, match_positions }`,命中结构同 `fs:search`。 * `40001`:请求体校验失败 * `40410`:工作区不存在,且不是可用的绝对路径 #### `GET /api/v1/fs:browse` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-fs-browse) 列出某个本机目录的子目录——文件夹选择器的后端。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `path` | query | string | 绝对目录路径。默认用户主目录 | 成功时 `data` 为 `{ path, parent, entries }`,其中 `path` 为解析后的目录,`parent` 为其父目录(文件系统根处为 `null`),每条目为 `{ name, path, is_dir: true }`。 * `40001`:`path` 不是绝对路径 * `40409`:路径不存在 * `40411`:权限不足 #### `GET /api/v1/fs:home` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-fs-home) 返回文件夹选择器的落地数据。无参数。 成功时 `data` 为 `{ home, recent_roots }`,其中 `home` 为用户主目录,`recent_roots` 列出已注册工作区的根目录。 #### `GET /api/v1/fs:content` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-fs-content) 以流式返回本机文件系统上任意文件的原始字节——仅受 API token 保护,暴露端口时务必谨慎。支持 Range 请求与 ETag 缓存;见 [二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) 。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `path` | query | string | **必填。** 绝对文件路径 | * `40001`:`path` 不是绝对路径,或不是普通文件 * `40409`:路径不存在 * `40411`:权限不足 * `40906`:路径是目录 #### `POST /api/v1/fs:mkdir` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-fs-mkdir) 按绝对路径在本机文件系统上创建一个目录——文件夹选择器「新建文件夹」的后端。非递归:父目录必须已存在。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `path` | body | string | **必填。** 绝对目录路径 | 成功时 `data` 为 `{ path }`。 * `40001`:`path` 不是绝对路径 * `40409`:父路径不存在 * `40411`:权限不足 * `40919`:路径已存在 ### 文件上传 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0) | 方法与路径 | 说明 | | --- | --- | | `POST /api/v1/files` | multipart 上传(字段 `file`,可选 `name`、`expires_in_sec`),返回文件元信息 | | `GET /api/v1/files/{file_id}` | 下载(二进制,错误用真实 HTTP 状态码) | | `DELETE /api/v1/files/{file_id}` | 删除 | #### `POST /api/v1/files` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-files) 以 `multipart/form-data` 上传文件,供后续引用(例如作为提示词附件)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `file` | body | binary | **必填。** multipart 的文件部分 | | `name` | body | string | 存储的显示名。默认上传文件名 | | `expires_in_sec` | body | number | 文件过期前的秒数(非负)。默认永不过期 | 成功时 `data` 为文件元信息 `{ id, name, media_type, size, created_at, expires_at? }`,其中 `media_type` 取自上传的内容类型。 * `40001`:multipart 请求体缺少 `file` 字段 #### `GET /api/v1/files/{file_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-files-file-id) 下载已上传的文件。响应为二进制流,支持 Range 请求但不处理 `If-None-Match`;失败使用真实 HTTP 状态码——见 [二进制与流式端点](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) 。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `file_id` | path | string | **必填。** 上传响应返回的文件 id | * `40407`(HTTP 404):没有该 id 的文件(包括已过期的文件) #### `DELETE /api/v1/files/{file_id}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#delete-api-v1-files-file-id) 删除已上传的文件。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `file_id` | path | string | **必填。** 上传响应返回的文件 id | 成功时 `data` 为 `{ deleted: true }`。 * `40407`(HTTP 404):没有该 id 的文件 ### GUI 存储 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#gui-%E5%AD%98%E5%82%A8) 由服务端支撑的键值存储,接口对齐浏览器的 `localStorage`,持久化在服务的 home 目录下;web UI 用它保存跨客户端的 UI 状态。值是不透明字符串——序列化由调用方负责。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v1/gui/store/length` | 已存键的数量 | | `GET /api/v1/gui/store/getItem` | 按键读取值 | | `POST /api/v1/gui/store/setItem` | 按键写入值 | | `POST /api/v1/gui/store/removeItem` | 按键删除值 | | `POST /api/v1/gui/store/clear` | 删除所有值 | #### `GET /api/v1/gui/store/length` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-gui-store-length) 返回已存键的数量(对齐 `localStorage.length`)。无参数。 成功时 `data` 为 `{ length }`。 #### `GET /api/v1/gui/store/getItem` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-gui-store-getitem) 读取一个值(对齐 `localStorage.getItem`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `key` | query | string | **必填。** 要读取的键,1–256 个字符 | 成功时 `data` 为 `{ value }`——已存字符串,键不存在时为 `null`。 #### `POST /api/v1/gui/store/setItem` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-gui-store-setitem) 写入一个值(对齐 `localStorage.setItem`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `key` | body | string | **必填。** 要写入的键,1–256 个字符 | | `value` | body | string | **必填。** 要存储的值 | 成功时 `data` 为 `null`。 #### `POST /api/v1/gui/store/removeItem` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-gui-store-removeitem) 删除一个值(对齐 `localStorage.removeItem`)。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `key` | body | string | **必填。** 要删除的键,1–256 个字符 | 成功时 `data` 为 `null`。 #### `POST /api/v1/gui/store/clear` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-gui-store-clear) 删除所有已存值(对齐 `localStorage.clear`)。无参数。 成功时 `data` 为 `null`。 ### 全局搜索与其他 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%85%A8%E5%B1%80%E6%90%9C%E7%B4%A2%E4%B8%8E%E5%85%B6%E4%BB%96) | 方法与路径 | 说明 | | --- | --- | | `POST /api/v1/search` | 跨会话全文搜索,`mode` 为 `terms`(默认)或 `literal`(精确子串),`page_token` 分页 | | `GET /api/v1/connections` | 列出当前在线的 WebSocket 连接 | | `GET /api/v2/sessions` | 新一代会话列表,见下文 | | `POST /api/v2/sessions:archive` | 批量归档会话,见下文 | | `POST /api/v2/sessions:restore` | 批量恢复已归档会话,见下文 | | `/api/v2/mcp/*` | 统一的 MCP 管理面,见下文 | | `/api/v1/debug/*` | 反射式调试 RPC,仅 `--debug-endpoints` 且 loopback 时挂载,不属于稳定协议 | #### `POST /api/v1/search` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v1-search) 跨会话全文搜索,覆盖 User 消息、Assistant 回复与会话标题,由服务端的持久搜索索引支撑。当 `container.session_id` 指向本服务进程中存活的会话时,搜索改为直接扫描该会话的内存转录,响应的 `source` 字段(`index` 或 `live`)会报告本页结果由哪条路径提供。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `query` | body | string | **必填。** 搜索文本 | | `mode` | body | string | `terms`(默认)/ `literal` | | `op` | body | string | `terms` 模式下的词项组合符:`AND`(默认)/ `OR` | | `container` | body | object | 将搜索限定在 `{ session_id?, agent_id? }` | | `role` | body | string | 限定 `user` / `assistant` / `title` 命中 | | `start_time` | body | integer | 只看不早于该时间的命中(epoch 毫秒) | | `end_time` | body | integer | 只看不晚于该时间的命中(epoch 毫秒) | | `sort` | body | string | `score`(默认)/ `time_desc` / `time_asc`;`literal` 模式忽略此参数,始终最新在前 | | `page_size` | body | integer | 每页命中数,1–50。默认 `20` | | `page_token` | body | string | 上一页响应返回的令牌 | `terms` 模式下查询会被分词(ASCII 词加 CJK n-gram)、去重,并以至多 32 个词项匹配倒排索引;`literal` 模式是零误报的精确子串搜索。成功时 `data` 为 `{ items, has_more, page_token?, index_state, source }`,每项为 `{ session_id, workspace_id, session_title, agent_id, role, snippet, time, turn?, step_id?, score }`。`index_state` 为 `{ state, indexed_sessions, total_sessions, documents, stale?, degraded? }`,其中 `state` 为 `building` / `ready` / `readonly` 之一;`stale` 标记仍在追赶的落后视图,`degraded` 携带最近一次刷新失败的信息。超出预算的页会额外携带 `incomplete`,取值为 `candidate_cap` / `postings_budget` / `deadline` 之一。分页令牌锁定索引代际与查询条件——索引重建或查询变更会使其失效。 * `40001`:请求体校验失败、查询不可用(为空或超过 32 个词项),或分页令牌非法 #### `GET /api/v1/connections` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v1-connections) 列出当前连接到本服务的 WebSocket 客户端,按连接时间最早在前。无参数。 成功时 `data` 为 `{ connections }`,每项为 `{ id, connected_at, remote_address, user_agent, has_client_hello, subscriptions }`:`connected_at` 为 ISO 8601 时间戳;`remote_address` 与 `user_agent` 未知时为 `null`;`has_client_hello` 报告客户端是否已发送握手帧;`subscriptions` 列出该连接订阅的会话 id。 ### `GET /api/v2/sessions` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v2-sessions) 面向列表页的新一代会话查询,筛选、排序、字段组都在查询参数里: | 参数 | 说明 | | --- | --- | | `workspace.id` | 按工作区过滤,可重复 | | `activity.status` | 按活动状态过滤:`running` / `approval` / `question` / `failed` / `idle`,可重复 | | `meta.updated_after` | 只看该时间(epoch 毫秒)之后更新过的会话 | | `meta.updated_before` | 只看该时间(epoch 毫秒)之前更新过的会话 | | `meta.archived` | `true` / `false`(默认)/ `all` | | `meta.has_prompt` | `true` 只保留有用户 prompt 的会话,`false` 只保留空会话(等价 `GET /api/v1/sessions` 的 `exclude_empty`) | | `view` | `flat`(默认)/ `by_workspace`,见下文 | | `group.page_size` | `view=by_workspace` 时每个工作区返回的会话数:1–100,默认 5(使用 `id,archived` 投影时上限 10000);未开分组视图时传入返回 `40001` | | `sort` | `meta.updated_at_desc`(默认)/ `meta.updated_at_asc` / `meta.created_at_desc` | | `include` | 逗号分隔的附加字段组;目前支持 `git`(分支与 PR 信息,按目录去重并缓存 60 秒) | | `fields` | 逗号分隔的字段投影;目前仅支持 `id,archived`,每项裁剪为 `{ id, archived }`(用于全选匹配场景)。不可与 `include=git` 同传(`40001`) | | `page_size` | 1–100,默认 50;使用 `id,archived` 投影时上限放宽至 10000。`view=by_workspace` 时按组计数 | | `page_token` | 上一页返回的翻页令牌 | | `page` | 无状态的 1 起始页码;与 `page_token` 互斥(同传返回 `40001`) | 响应每项固定包含 `workspace`、`meta`、`activity` 三组,`include=git` 时附加 `git` 组;`fields=id,archived` 时仅返回 `{ id, archived }`。`activity` 组还会带上 `model`:会话仍加载在当前进程时为其绑定的模型别名,冷会话(未加载)为 `null`。每页额外携带 `total`,即过滤后的集合大小。翻页令牌绑定首页查询条件(含投影),中途改条件返回 `40922`。`page` 模式是跳页用的无状态替代:每次请求都是独立快照,不签发令牌,`next_page_token` 恒为 `null`。 `view=by_workspace` 时,同一份过滤、排序后的集合会重新投影为按工作区分组的形态,概览页因此可以用一次请求替代「每个工作区各一轮询」: json { "code": 0, "msg": "success", "data": { "groups": [\ {\ "workspace": { "id": "wd_my-app_a1b2c3d4e5f6", "cwd": "/Users/dev/my-app" },\ "sessions": [ { "id": "session_...", "workspace": { "id": "wd_my-app_a1b2c3d4e5f6", "cwd": "/Users/dev/my-app" }, "meta": { "title": "Fix the login page", "last_prompt": "adjust the button spacing", "created_at": 1787000000000, "updated_at": 1787000100000, "archived": false, "archived_at": null }, "activity": { "status": "idle", "model": "kimi-for-coding" } } ],\ "total": 42\ }\ ], "total": 7, "has_more": true, "next_page_token": "eyJ2IjoxLCJmIjoi..." }, "request_id": "req_..." } 每组携带该工作区按请求 `sort` 排序的前 `group.page_size` 条会话,以及该工作区匹配过滤条件的会话总数 `total`(用作「查看全部」入口)。只有至少有一条匹配会话的工作区才会出现;组间按组内首条会话的 sort key 排序,相同则按工作区 id。`page` 与 `page_token` 按组翻页(外层 `total` 为组数),指纹绑定规则相同:令牌同时覆盖 `view` 与分组参数,翻页途中变更同样返回 `40922`。 ### `POST /api/v2/sessions:archive` 与 `POST /api/v2/sessions:restore` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v2-sessions-archive-%E4%B8%8E-post-api-v2-sessions-restore) 面向会话管理页的批量归档/恢复。请求体为 `{ "ids": ["session_..."] }`——非空、去重后不超过 5000 条。仍在线的会话走完整生命周期;未加载的冷会话直接改写磁盘上的元数据,不会被加载。 只有请求体校验失败才会让整个请求失败(`40001`);其余情况按条返回:`data.results` 保持输入顺序,每项为 `{ id, ok }` 或 `{ id, ok: false, error }`(不存在的 id 在自身条目里报 `40401`),并附 `succeeded` / `failed` 计数。 json { "code": 0, "msg": "success", "data": { "results": [\ { "id": "session_a", "ok": true },\ { "id": "session_b", "ok": false, "error": { "code": 40401, "message": "session session_b does not exist" } }\ ], "succeeded": 1, "failed": 1 }, "request_id": "req_..." } ### MCP 管理(`/api/v2/mcp`) [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#mcp-%E7%AE%A1%E7%90%86-api-v2-mcp) `/api/v2/mcp/*` 路由是服务的统一 MCP 管理面:独立于任何会话,直接管理 MCP server 注册表本身——全局(用户级)CRUD 与逐条校验、连接测试探测、locator 寻址的检查目录、按 server 的授权状态列表,以及完整的 OAuth 流程生命周期。 | 方法与路径 | 说明 | | --- | --- | | `GET /api/v2/mcp/servers` | 列出所有已知 MCP server | | `GET /api/v2/mcp/servers/{name}` | 按运行时名称获取单个 server | | `POST /api/v2/mcp/servers` | 向用户级 `mcp.json` 添加 server | | `PUT /api/v2/mcp/servers/{name}` | 替换一个用户级条目 | | `DELETE /api/v2/mcp/servers/{name}` | 删除一个用户级条目 | | `POST /api/v2/mcp/servers:test` | 对单个 server 发起真实连接探测 | | `POST /api/v2/mcp/servers:inspect` | locator 寻址的目录及批量连接探测 | | `GET /api/v2/mcp/auth-statuses` | 目录中各 server 的 OAuth 状态 | | `POST /api/v2/mcp/auth:begin` | 开始一次交互式 OAuth 流程 | | `POST /api/v2/mcp/auth:complete` | 等待浏览器回调并完成 code 交换 | | `POST /api/v2/mcp/auth:cancel` | 终止已开始的 OAuth 流程 | | `POST /api/v2/mcp/auth:reset` | 清除某个 server 已存储的凭据 | 该管理面有两种寻址方式。CRUD 路由与 `servers:test` 使用普通的运行时 `name`;检查与 OAuth 路由使用 **locator**——文件层条目用 `{ "source": "global", "name" }`,插件清单条目用 `{ "source": "plugin", "pluginId", "serverName" }`——因为插件条目和文件条目可能共用同一个运行时名称。检查条目还带有一个稳定的 `serverId` 线上标识:`global:<name>` 或 `plugin:<pluginId>:<serverName>`(URL 编码)。 大多数路由接受可选的 `cwd`(查询参数,`:`\-action 路由则为请求体字段)。不传时目录只覆盖用户级文件与插件清单;传入后,该目录的项目根层与项目本地层会并入——但仅当工作区受信任时,否则项目层会被跳过。对 stdio server 执行 `servers:test` 时,`cwd` 同时是子进程的工作目录。连接探测与 OAuth 调用会等待服务配置加载完成后再执行。 #### `GET /api/v2/mcp/servers` 与 `GET /api/v2/mcp/servers/{name}` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v2-mcp-servers-%E4%B8%8E-get-api-v2-mcp-servers-name) 列出管理面已知的全部 MCP server;第二个路由返回该运行时名称对应的单个条目。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `name` | path | string | **必填(仅 get)。** server 的运行时名称 | | `cwd` | query | string | 并入该(受信任)目录的项目层 | 成功时 `data` 是受管 server 数组(get 路由为单个对象),每项为 `{ name, config, source, origin, mutable, plugin? }`: * `source`:`global`(配置文件层)或 `plugin`(插件清单) * `origin`:条目的定义位置——文件路径或插件 id * `mutable`:只有用户级条目可变;插件与项目层条目均为只读 * `config`:可变条目携带完整配置,便于编辑界面预填;只读条目被脱敏为排序后的键名列表(`envKeys` / `headerKeys`),绝不泄露密钥值 * `plugin`:`{ id, name }`,仅插件条目携带 * `40001`:校验失败 * `40408`:不存在该名称的 server #### `POST` / `PUT` / `DELETE /api/v2/mcp/servers` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-put-delete-api-v2-mcp-servers) 针对用户级 `mcp.json` 的全局 CRUD。新增请求体是包含 `name` 的完整 server 配置——`transport`(`stdio` / `http` / `sse`)决定配置形状,每条配置写入前都会校验。更新请求体携带同样的配置但不含 `name`(由路径指定条目);删除无请求体。三者都在 `data` 中返回刷新后的 server 列表。若写入与项目层的同名条目冲突,会因只读被拒绝——请改为编辑定义它的文件;与同名的插件条目冲突并不阻止写入,新的文件条目会将其遮蔽。 * `40001`:校验失败,或目标条目为只读 * `40408`:(更新/删除)不存在该名称的 server #### `POST /api/v2/mcp/servers:test` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v2-mcp-servers-test) 对单个 server 发起真实连接探测,不持久化任何内容。传 `name` 探测注册表条目(含插件与受信任的项目层),或传 `server`(包含 `name` 的完整内联配置)按原样探测;两者都传或都不传会报 `40001`。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `name` | body | string | 注册表条目的运行时名称 | | `server` | body | object | 按原样探测的内联 server 配置 | | `cwd` | body | string | 项目层并入解析;同时是 stdio 的工作目录 | 成功时 `data` 为 `{ success, output }`:连接成功时 `output` 列出该 server 的可用工具,否则携带失败信息。 * `40001`:两种目标形式都传或都不传、内联配置无效,或运行时名称被多个启用的 server 共用 * `40408`:不存在该名称的 server #### `POST /api/v2/mcp/servers:inspect` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v2-mcp-servers-inspect) locator 寻址的目录(脱敏配置),外加对每个 OAuth 候选的批量真实连接探测。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `targets` | body | array | 缩小目录范围的 locator 数组;不传则检查全部 server | | `cwd` | body | string | 并入该(受信任)目录的项目层 | 成功时 `data` 是检查结果数组,每项为 `{ serverId, locator, runtimeName, canonicalUrl?, origin, config, enabled, editable, authStatus, checkedAt?, error? }`:`canonicalUrl` 是远程 server 的凭据 URL,`config` 为脱敏视图,`authStatus` 取值为 `not-applicable` / `bearer-token` / `oauth-required` / `oauth-authorized` / `oauth-expired` / `unavailable` 之一。运行时名称被多个启用的 server 共用时无法无歧义地探测,会报告 `unavailable` 并在 `error` 中给出说明。探测遇到过期授权时,可能刷新或作废已存储的凭据。 * `40001`:校验失败 * `40408`:`targets` 中有 locator 未匹配到任何条目 #### `GET /api/v2/mcp/auth-statuses` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#get-api-v2-mcp-auth-statuses) 注册表目录中各 server 的 OAuth 状态——只需要授权维度时,这是比 `servers:inspect` 更轻量的选择。 | 参数 | 位置 | 类型 | 说明 | | --- | --- | --- | --- | | `cwd` | query | string | 并入该(受信任)目录的项目层 | | `verify` | query | string | `true` 对每个 OAuth 候选发起真实连接验证;`false` 完全离线(仅凭配置与已存储 token 分类);缺省保留隐式 OAuth 探测,只探测未固定且没有已存储凭据的远程 server | 成功时 `data` 是 `{ name, authStatus }` 数组,`authStatus` 取值与 `servers:inspect` 相同。验证探测可能刷新或作废已存储的凭据。 #### `POST /api/v2/mcp/auth:begin` / `:complete` / `:cancel` / `:reset` [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#post-api-v2-mcp-auth-begin-complete-cancel-reset) 远程 server 的 OAuth 流程生命周期。`auth:begin` 接受 locator 请求体(外加可选的 `cwd` 查询参数),返回 `data` 为 `{ status: "authorization-required", flowId, authorizationUrl }`——在浏览器中打开该 URL 完成授权——或当授权已存在时返回 `{ status: "already-authorized" }`。目标 server 必须使用远程传输(`http` / `sse`)且不含静态 bearer token;静态请求头仅当配置显式设置 `auth: "oauth"` 时允许。 `auth:complete` 等待已开始流程的浏览器回调并完成 code 交换。请求体为 `{ flowId, timeoutMs? }`:等待默认 15 分钟(`timeoutMs` 可覆盖),空闲流程无论如何都会在 15 分钟后过期,关闭 HTTP 连接会中止等待。成功时 `data` 为 `null`。 `auth:cancel` 在未完成的情况下终止已开始的流程(`{ flowId }`);未知流程会被忽略。`auth:reset` 接受 locator 请求体,清除该 server 已存储的凭据——失效事件会送达存活的会话。 * `40001`:校验失败——包括 `:complete` 的 `flowId` 未知,或 `:begin` 的 server 无法使用 OAuth(stdio 传输、静态 bearer token,或未设置 `auth: "oauth"` 的静态请求头) * `40408`:(`:begin` / `:reset`)locator 未匹配到任何条目 * `40929`:OAuth 流程本身失败 WebSocket 协议 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#websocket-%E5%8D%8F%E8%AE%AE) ---------------------------------------------------------------------------------------------------------------------- ### 建立连接 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5) 唯一端点是 `ws://<host>:<port>/api/v1/ws`;鉴权在升级请求时完成(见上文 [鉴权](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E9%89%B4%E6%9D%83) )。连接建立后服务端立即发送 `server_hello`: json { "type": "server_hello", "timestamp": "2026-01-01T00:00:00.000Z", "payload": { "ws_connection_id": "conn_01JZX4...", "protocol_version": 2, "max_event_buffer_size": 1000, "capabilities": { "event_batching": false, "compression": false } } } 注意服务端不发送心跳,也不会主动断开空闲连接——保活与重连由客户端自己负责。 ### 控制帧 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%8E%A7%E5%88%B6%E5%B8%A7) 客户端发送 JSON 帧 `{ "type", "id"?, "payload" }`;每个请求帧都会收到应答 `{ "type": "ack", "id", "code", "msg", "payload" }`,`code` 为 `0` 表示成功。 | 帧 | payload | 说明 | | --- | --- | --- | | `subscribe` | `{ session_ids, cursors?, agent_filter? }` | 订阅会话事件;带 `cursors`(每会话 `{seq, epoch}`)时回放错过的持久事件 | | `unsubscribe` | `{ session_ids }` | 取消会话订阅 | | `subscribe_v2` | `{ session_id, transcript, transcript_since? }` | 订阅转录流(唯一的转录订阅通道),`transcript` 按 agent 指定粒度 | | `unsubscribe_v2` | `{ session_id, agent_ids? }` | 退订转录流;省略 `agent_ids` 表示整个会话 | | `client_hello` | `{ client_id }` | 握手帧,其余字段为遗留兼容 | ### 事件 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8B%E4%BB%B6) 事件帧形状为 `{ "type", "seq", "epoch"?, "volatile"?, "offset"?, "session_id"?, "timestamp", "payload" }`,`type` 即事件类型。按投递范围分两类: * **全局事件**:发送到每个已建立连接,无需订阅——`session.meta.updated`、`event.session.created`、`event.session.archived`、`event.session.work_changed`、`event.session.status_changed`、`event.workspace.*`、`event.config.*`、`event.model_catalog.*`。 * **会话事件**:只发给订阅了该会话的连接,受 `agent_filter` 过滤。主要事件族: | 事件族 | 主要事件 | | --- | --- | | 轮次 | `turn.started`、`turn.ended`、`turn.step.started` / `completed` / `interrupted` / `retrying` | | 流式文本 | `assistant.delta`、`thinking.delta`(带 `offset` 用于对齐) | | 工具调用 | `tool.call.started`、`tool.call.delta`、`tool.progress`、`tool.result` | | 交互 | `event.approval.requested` / `resolved`、`event.question.requested` / `answered` / `dismissed` | | subagent | `subagent.spawned` / `started` / `suspended` / `completed` / `failed` | | 后台 | `task.started` / `terminated`、`shell.started` / `output` / `completed` | | 其他 | `compaction.*`、`skill.activated`、`goal.updated`、`prompt.*`、`error`、`warning` | 有三个全局生命周期事件可以让跨工作区概览免掉逐工作区轮询。`event.session.archived` 在在线归档与冷归档两条路径上都会发出;其事件帧 `session_id` 是全局水位 `__global__`,真实会话 id 在 payload 里:`{ "type": "event.session.archived", "workspace_id": "wd_...", "sessionId": "session_..." }`(payload 字段为 `workspace_id` / `sessionId`)。`event.workspace.created` / `updated` 携带完整工作区对象(`{ id, root, name, created_at, last_opened_at, session_count }`——会话创建触碰工作区时也会发 `updated`),`event.workspace.deleted` 携带 `{ "workspace_id", "root" }`。这些事件只覆盖本服务进程内的变更;其他进程(例如写同一 home 目录的 CLI)的变更要等索引 reconcile(约一分钟)才可见,因此概览客户端应保留低频兜底轮询。目前没有会话删除事件。 事件另分持久与易失两种:持久事件带严格递增的 `seq`,落盘并可回放;易失事件(各 `*.delta`、`tool.progress`、`shell.*` 等)标 `volatile: true`,不回放。消费易失文本流时用 `offset`(该轮次内的累计字符偏移)与本地已累积文本比对:小于本地长度说明是重复帧,大于说明有缺漏、需走快照恢复。 ### 断线恢复 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E6%96%AD%E7%BA%BF%E6%81%A2%E5%A4%8D) 重连后在 `subscribe` 的 `cursors` 里带上每个会话最后应用事件的 `{seq, epoch}`,服务端会回放缺口;落后超过缓冲(1000 条)或游标失效时改为收到 `resync_required`。此时调用 `GET /api/v1/sessions/{session_id}/snapshot` 拿全量快照(含 `as_of_seq` 与 `epoch`),再以新游标重新订阅。 ### 转录协议 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E8%BD%AC%E5%BD%95%E5%8D%8F%E8%AE%AE) `subscribe_v2` 的 `transcript` 按 agent 指定粒度:`off` / `turn` / `block` / `delta`(键 `"*"` 表示默认粒度),粒度越高推送越细。粒度非 `off` 的 agent 走两帧推送:`transcript.reset`(基线快照,历史经 REST 分页回读)和 `transcript.ops`(增量批次,带每个 agent 连续递增的 `seq`);该 agent 的旧式事件在同一连接上被抑制,改由转录帧承载。断线时用 `transcript_since` 续传;服务端批次日志无法覆盖缺口时(REST 补漏返回 `complete: false`)需全量刷新。REST 侧对应 `GET .../transcript`(按轮次分页)与 `GET .../transcript/ops?since_seq=`(批次补漏)。 二进制与流式端点 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%8E%E6%B5%81%E5%BC%8F%E7%AB%AF%E7%82%B9) -------------------------------------------------------------------------------------------------------------------------------------------------------------- 以下端点返回二进制流而非 JSON 载荷,各端点的 HTTP 能力并不相同: | 方法与路径 | 说明 | Range 分段(206) | ETag / 304 | | --- | --- | --- | --- | | `GET /api/v1/files/{file_id}` | 下载已上传文件 | 支持 | 不支持(会发送 `etag` 头,但不处理 `If-None-Match`) | | `GET /api/v1/sessions/{session_id}/fs/{path}:download` | 下载会话工作区文件 | 支持 | 支持 | | `GET /api/v1/fs:content` | 读取本机任意文件(仅受 token 保护,谨慎暴露端口) | 支持 | 支持 | | `POST /api/v1/sessions/{session_id}/export` | 导出会话与诊断信息(zip 流) | 不支持 | 不支持 | 错误语义也不相同:`GET /api/v1/files/{file_id}` 对查找和存储失败返回真实 404 / 500 状态码(参数校验失败仍走 HTTP 200 信封),其余三个端点的所有失败都走标准 [响应信封](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E5%93%8D%E5%BA%94%E4%BF%A1%E5%B0%81) ——客户端在这三个端点上仍需检查信封中的 `code`。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/server-api.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------ * [在网页中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/web.html) — 启动服务并在浏览器中使用 Kimi Code * [kimi 命令](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html#kimi-web) — `kimi web` 的全部命令行选项 --- # 核心操作 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#VPContent) Return to top 核心操作 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%A0%B8%E5%BF%83%E6%93%8D%E4%BD%9C) ======================================================================================================================== 打开面板 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%89%93%E5%BC%80%E9%9D%A2%E6%9D%BF) ------------------------------------------------------------------------------------------------------------------------ ![Kimi Code Command Palette](https://www.kimi.com/code/docs/images/zh/vscode/kimi-code-command-palette.png) 点击活动栏中的 Kimi 图标,或通过命令面板执行 "Kimi Code" 命令。 * * * 输入与控制 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E8%BE%93%E5%85%A5%E4%B8%8E%E6%8E%A7%E5%88%B6) ================================================================================================================================== 文件引用 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%96%87%E4%BB%B6%E5%BC%95%E7%94%A8) ------------------------------------------------------------------------------------------------------------------------ 输入 `@` 后选择文件或文件夹名称。例如:`@src/handlers/` 引用文件夹,`@app.ts` 引用文件,`@src/app.ts:10-20` 引用特定行范围。 按 `Alt+K` 可快速插入当前文件或选中代码作为引用。 斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) ------------------------------------------------------------------------------------------------------------------------ 输入 `/` 打开命令菜单。使用 `/init` 扫描项目并生成文档,或使用 `/compact` 压缩过长的上下文。 输入历史 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E8%BE%93%E5%85%A5%E5%8E%86%E5%8F%B2) ------------------------------------------------------------------------------------------------------------------------ 在输入框中按 `↑` / `↓` 键可快速浏览最近发送过的消息历史,方便重复或修改提问。 媒体文件输入 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6%E8%BE%93%E5%85%A5) -------------------------------------------------------------------------------------------------------------------------------------------- 支持粘贴、拖拽或选择媒体文件。支持的格式包括:PNG、JPEG、GIF、WebP、HEIC 等图片格式,以及 MP4、WebM、MOV 等视频格式。 * **粘贴 / 拖拽**:单张图片原始大小不超过 5MB,系统会自动进行压缩(HEIC 转 JPEG、超尺寸缩放、质量压缩至约 2MB)。 * **文件选择器**:通过输入框的 "+" 按钮或 `@` 菜单选择文件时,图片不超过 10MB,视频不超过 20MB。 * **通用限制**:每条消息最多附加 9 个文件,总计不超过 80MB。当附加媒体文件时,不支持多模态的模型将被自动过滤。 消息队列 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97) ------------------------------------------------------------------------------------------------------------------------ 当 Kimi 正在回复时,你可以在输入框中继续输入并发送。这些消息不会丢失,而是会进入**消息队列**。底部工具栏会显示队列数量,点击可展开队列面板: * 查看待发送的消息列表 * 编辑或删除队列中的消息 * 调整消息顺序 * 在 Kimi 回复过程中,点击队列项的 ⚡ 图标可将该消息立即作为 **Steer** 插入,引导 Kimi 调整当前回复方向 模型切换 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%A8%A1%E5%9E%8B%E5%88%87%E6%8D%A2) ------------------------------------------------------------------------------------------------------------------------ 通过输入栏下拉菜单切换模型。 **使用高速版**:高速版(`kimi-for-coding-highspeed`)输出速度约为普通版的 5–6 倍、额度消耗约为普通版的 3 倍,需订阅 [Allegretto / Pro 及以上](https://www.kimi.com/membership/pricing?from=kfc_membership_topbar&track_id=a7764d49-73ad-4d08-b2f3-a8d7433917f8) 档位会员。若模型下拉中还没有高速版,**重启 VS Code 或重新安装插件**即可,之后在下拉菜单里选择 `kimi-for-coding-highspeed` 使用高速版。 深度思考模式 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%B7%B1%E5%BA%A6%E6%80%9D%E8%80%83%E6%A8%A1%E5%BC%8F) -------------------------------------------------------------------------------------------------------------------------------------------- 部分模型支持扩展推理能力。思考模式切换有两种状态:模型不支持思考模式时隐藏、用户可手动启用/禁用。 > **注意**:**K2.8 Preview** 支持思考程度(effort)档位调节,与 K3 的思考等级一致;关闭思考模式(Thinking)后,请求由 K2.8 Preview(无思考)处理。 启用后,思考步骤在响应中默认折叠,可展开查看推理过程。在设置中开启 `kimi.alwaysExpandThinking` 可默认展开思考过程。 * * * 工作模式 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E5%B7%A5%E4%BD%9C%E6%A8%A1%E5%BC%8F) ======================================================================================================================== 操作确认与工具执行 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%93%8D%E4%BD%9C%E7%A1%AE%E8%AE%A4%E4%B8%8E%E5%B7%A5%E5%85%B7%E6%89%A7%E8%A1%8C) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 当 Kimi 提议运行工具或写入文件时,将显示确认对话框,提供三个选项: * **Yes**:仅批准当前操作 * **Yes, for this session**:批准当前会话内同类操作,直至开启新会话 * **No**:拒绝执行操作 在设置中启用 `kimi.yoloMode` 可自动批准所有工具调用。适用于信任工作流程且追求效率的场景。 ### 问答弹窗(Question Dialog) [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E9%97%AE%E7%AD%94%E5%BC%B9%E7%AA%97-question-dialog) 在执行过程中,Kimi 可能会向你提出问题(例如让你选择实现方案)。此时底部会弹出问答卡片,你可以直接点选预设选项,或选择 "Custom response..." 输入自定义回复。回答后 Kimi 会继续执行。 计划模式(Plan Mode) [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E8%AE%A1%E5%88%92%E6%A8%A1%E5%BC%8F-plan-mode) --------------------------------------------------------------------------------------------------------------------------------------------- 点击输入框左侧的 📋 图标可进入计划模式。开启后,Kimi 在正式执行前会先输出一个可展开的计划卡片(Plan Card),列出它打算执行的步骤。你可以审阅计划后再让它继续。 * 计划模式按钮在每次新会话时保持上次的设置。 * 如果 Kimi 已经在流式回复中,退出计划模式需要二次确认,以免打断当前任务。 文件变更追踪 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%96%87%E4%BB%B6%E5%8F%98%E6%9B%B4%E8%BF%BD%E8%B8%AA) -------------------------------------------------------------------------------------------------------------------------------------------- Kimi 修改文件后,所有变更将被追踪并显示在"文件变更"栏中。您可以查看被修改文件的列表及其状态(新增、修改或删除),以及增删行数统计。 针对每个文件,您可在 VS Code 原生 diff 视图中查看变更、恢复至原始状态,或保留变更以清除追踪记录。支持批量操作,可一次性保留或撤销所有变更。基准状态在会话中首次修改时捕获,回退将恢复至此基准版本。 * * * 上下文管理 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AE%A1%E7%90%86) ================================================================================================================================== 历史会话 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E5%8E%86%E5%8F%B2%E4%BC%9A%E8%AF%9D) ------------------------------------------------------------------------------------------------------------------------ 点击面板顶部的历史下拉菜单可浏览过往会话。会话数据本地存储,支持关键词搜索。您可删除旧会话或加载会话以继续之前的对话。 状态栏显示上下文使用百分比及输入输出 token 计数。当上下文使用率较高时,请使用 `/compact` 命令进行压缩。 工作目录切换 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E5%B7%A5%E4%BD%9C%E7%9B%AE%E5%BD%95%E5%88%87%E6%8D%A2) -------------------------------------------------------------------------------------------------------------------------------------------- 点击输入框右侧的齿轮图标(Action Menu)→ **Working Directory**,可以在当前 Workspace 的不同子目录间切换工作目录。切换后会自动开启新会话,以便 Kimi 基于新的目录上下文工作。支持直接选择已注册的子目录,或通过 "Browse..." 浏览任意子文件夹。 * * * 操作菜单 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%93%8D%E4%BD%9C%E8%8F%9C%E5%8D%95) ======================================================================================================================== 操作菜单(Action Menu) [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/core-operations.html#%E6%93%8D%E4%BD%9C%E8%8F%9C%E5%8D%95-action-menu) ------------------------------------------------------------------------------------------------------------------------------------------------- 输入框右侧的齿轮图标是操作菜单入口,包含以下功能: * **Working Directory**:切换当前工作目录(详见上文"工作目录切换") * **MCP Servers**:打开 MCP 服务器配置面板 * **General Config**:打开 VS Code 设置中的 Kimi 配置页 * **Show Logs**:打开 Kimi Code 输出日志面板,便于排查问题 * **Reset Kimi**:重置 Kimi Webview,适用于界面卡死或无响应的情况 * **Sign out / Sign in**:登出或重新登录 Kimi 账号 此外,你也可以在 VS Code 命令面板中执行 "Kimi Code: Run CLI",在集成终端中直接启动 Kimi Code CLI。 --- # 联系与反馈 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#VPContent) On this page 联系与反馈 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E8%81%94%E7%B3%BB%E4%B8%8E%E5%8F%8D%E9%A6%88) ============================================================================================================================ 遇到问题、有功能建议,或想直接和团队交流?先看能否自助解决,若仍需要帮助,再通过下方任一渠道联系我们。 反馈前的自助排查 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E5%8F%8D%E9%A6%88%E5%89%8D%E7%9A%84%E8%87%AA%E5%8A%A9%E6%8E%92%E6%9F%A5) ---------------------------------------------------------------------------------------------------------------------------------------------------------- [常见问题](https://www.kimi.com/code/docs/kimi-code/faq.html) 收录了高频疑问,[错误参考](https://www.kimi.com/code/docs/kimi-code/error-reference.html) 解释了常见的服务端报错,遇到问题可以先到这两处查一查。 也可以先自查几项,不少能就地解决: * CLI 是否为最新版本(运行 `kimi --version` 查看,必要时更新) * 网络能否连上 Kimi 服务:公司网络或代理有可能拦截 `api.kimi.com` * 是否已登录、API Key 是否有效 * 当前工作目录与文件读写权限是否正常 反馈渠道 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E5%8F%8D%E9%A6%88%E6%B8%A0%E9%81%93) ------------------------------------------------------------------------------------------------------------------ 若仍未解决,或想提交建议、直接与团队交流,可通过以下渠道联系我们。 ### 在线客服 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D) 前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,即可接入在线客服。产品使用、Bug、额度消耗、退款等问题都可以在这里咨询,咨询时请描述遇到的问题、操作步骤及相关日志信息。 ### 加入飞书交流群 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E5%8A%A0%E5%85%A5%E9%A3%9E%E4%B9%A6%E4%BA%A4%E6%B5%81%E7%BE%A4) 用飞书扫描下方二维码加入 Kimi Code 用户群,与团队和其他用户实时交流、获取帮助。 ![Kimi Code 用户群飞书二维码](https://www.kimi.com/code/docs/images/zh/kimi-code/contact-and-feedback/feishu-group.png) ### 在 CLI 中直接反馈(推荐) [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E5%9C%A8-cli-%E4%B8%AD%E7%9B%B4%E6%8E%A5%E5%8F%8D%E9%A6%88-%E6%8E%A8%E8%8D%90) 在 Kimi Code CLI 交互界面中输入 `/feedback`,按提示选择随反馈一起上传的内容: * **No attachment**:仅提交文字反馈 * **Logs only**:附带本次会话的 wire events 与诊断日志;**建议至少选这项**,方便我们定位问题 * **Logs + codebase**:进一步附带代码库以做深入诊断;`.env`、配置文件、密钥等敏感文件会自动排除,附件仅用于诊断、绝不外泄 提交成功后,CLI 会显示本次的 `Session` 与 `Feedback ID`。到上方的飞书交流群把这两个 ID 发出来即可跟进。 ### GitHub Issues [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#github-issues) 前往 Kimi Code CLI 仓库检索已有问题或新建 issue: * [https://github.com/MoonshotAI/kimi-code/issues](https://github.com/MoonshotAI/kimi-code/issues) ### 邮件 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E9%82%AE%E4%BB%B6) 发送邮件至 [code@moonshot.ai](mailto:code@moonshot.ai) 。为便于我们快速定位,建议在邮件中附上: * 问题描述 * 复现步骤 * 环境信息(可运行 `kimi --version` 获取) * 相关错误日志——在 CLI 中运行 `/export-debug-zip`(或命令行 `kimi export`)导出调试 ZIP,已自动打包诊断日志,作为附件发来即可 账号申诉 [​](https://www.kimi.com/code/docs/kimi-code/contact-and-feedback.html#%E8%B4%A6%E5%8F%B7%E7%94%B3%E8%AF%89) ------------------------------------------------------------------------------------------------------------------ 若账号被误封或需投诉举报,请发送邮件至 [support@moonshot.cn](mailto:support@moonshot.cn) ,并附上账号 ID、发生时间与相关情况说明。 --- # 配置 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#VPContent) Return to top 配置 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E9%85%8D%E7%BD%AE) ================================================================================================== 在 VS Code 设置的 "Kimi" 部分进行配置(也可通过操作菜单 → **General Config** 打开)。 ### 操作审批 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E6%93%8D%E4%BD%9C%E5%AE%A1%E6%89%B9) | 设置项 | 默认值 | 说明 | | --- | --- | --- | | `kimi.yoloMode` | `false` | 自动批准所有工具调用。适用于信任工作流程且追求效率的场景 | ### 文件与编辑器 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E6%96%87%E4%BB%B6%E4%B8%8E%E7%BC%96%E8%BE%91%E5%99%A8) | 设置项 | 默认值 | 说明 | | --- | --- | --- | | `kimi.autosave` | `true` | Kimi 读写文件前自动保存 | | `kimi.editorContext` | `never` | 控制何时共享当前编辑器的文件和光标位置(`never` / `onConversationStart` / `onFileChange`) | ### 输入与快捷键 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E8%BE%93%E5%85%A5%E4%B8%8E%E5%BF%AB%E6%8D%B7%E9%94%AE) | 设置项 | 默认值 | 说明 | | --- | --- | --- | | `kimi.useCtrlEnterToSend` | `false` | 使用 Ctrl/Cmd+Enter 发送消息 | | `kimi.enableNewConversationShortcut` | `false` | 启用 Cmd/Ctrl+N 新建对话快捷键(启用后将占用系统默认的"新建文件"快捷键) | ### 模型与推理 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E6%A8%A1%E5%9E%8B%E4%B8%8E%E6%8E%A8%E7%90%86) | 设置项 | 默认值 | 说明 | | --- | --- | --- | | `kimi.alwaysExpandThinking` | `false` | 默认展开思考/推理过程 | ### 高级 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/configuration.html#%E9%AB%98%E7%BA%A7) | 设置项 | 默认值 | 说明 | | --- | --- | --- | | `kimi.executablePath` | `""` | 自定义 Kimi Code CLI 路径(空值使用内置) | | `kimi.environmentVariables` | `{}` | 传递给 Kimi Code CLI 的环境变量 | --- # 定制化 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html#VPContent) Return to top 定制化 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html#%E5%AE%9A%E5%88%B6%E5%8C%96) ============================================================================================================ MCP 服务器 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html#mcp-%E6%9C%8D%E5%8A%A1%E5%99%A8) -------------------------------------------------------------------------------------------------------------------- MCP(Model Context Protocol)服务器可为 Kimi 扩展外部工具与服务。通过操作菜单(齿轮图标)→ **MCP Servers** 进行管理。 ### 传输类型 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html#%E4%BC%A0%E8%BE%93%E7%B1%BB%E5%9E%8B) 支持两种传输类型: * **stdio**:本地命令行工具,需指定命令、参数和环境变量 * **http**:远程服务,需指定 URL,可选 OAuth ### 推荐服务器 [​](https://www.kimi.com/code/docs/kimi-code-for-vscode/customization.html#%E6%8E%A8%E8%8D%90%E6%9C%8D%E5%8A%A1%E5%99%A8) ![Kimi Code MCP Servers](https://www.kimi.com/code/docs/images/zh/vscode/kimi-code-mcp.png) 提供推荐服务器的一键安装: | 服务器 | 用途 | | --- | --- | | Playwright | 浏览器自动化 | | Context7 | 实时文档 | | GitHub | API 访问 | 部分服务器需 OAuth 认证,点击授权按钮打开流程,或重置凭证。保存前可测试连接以验证服务器可用性。 --- # 在 OpenCode 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/opencode.html#VPContent) Return to top 在 OpenCode 中使用 [​](https://www.kimi.com/code/docs/third-party-tools/opencode.html#%E5%9C%A8-opencode-%E4%B8%AD%E4%BD%BF%E7%94%A8) ================================================================================================================================== [OpenCode](https://opencode.ai/) 是一款终端编程 Agent。本文介绍如何通过内置认证把 OpenCode 的模型请求转发到 Kimi For Coding,由 K3 或 K2.8 Preview 提供模型推理能力。 安装 OpenCode [​](https://www.kimi.com/code/docs/third-party-tools/opencode.html#%E5%AE%89%E8%A3%85-opencode) ------------------------------------------------------------------------------------------------------------ 通过安装脚本是最简单的安装方式: bash curl -fsSL https://opencode.ai/install | bash 也可通过 npm 安装: bash npm install -g opencode-ai 配置 API 密钥 [​](https://www.kimi.com/code/docs/third-party-tools/opencode.html#%E9%85%8D%E7%BD%AE-api-%E5%AF%86%E9%92%A5) ------------------------------------------------------------------------------------------------------------------------ 运行 `opencode auth login`,在提供商列表中选择 **Kimi For Coding**: bash $ opencode auth login ┌ 添加凭证 │ ◆ 选择提供商 │ ● Kimi For Coding │ ... └ 输入你的 Kimi For Coding API Key: bash $ opencode auth login ┌ 添加凭证 │ ◇ 选择提供商 │ Kimi For Coding │ ◇ 输入您的 API 密钥 │ _ └ > API Key 可在 [Kimi Code 控制台](https://www.kimi.com/code/console) > 创建和管理(最多 5 个,仅创建时显示一次,请妥善保存)。 启动并使用 [​](https://www.kimi.com/code/docs/third-party-tools/opencode.html#%E5%90%AF%E5%8A%A8%E5%B9%B6%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------------------ 配置完成后启动 OpenCode: bash $ opencode 在会话中输入 `/models`: bash /models 在 **Kimi For Coding** 列表下选择要用的模型。 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 使用前请了解自己的会员档位与可用权限(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ),使用超出权限的模型和上下文会触发报错: | 会员档位 | 可用模型 | 上下文窗口 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | K2.8 Preview | `1048576` | | Plus / Moderato | K3 <br>K3-256K <br>K2.8 Preview | K3:`262144` <br>K3-256K:`262144` <br>K2.8 Preview:`1048576` | | Pro 及以上 / Allegretto 及以上 | K3 <br>K3-256K <br>K2.8 Preview <br>K2.7 Code HighSpeed | K3:`1048576` <br>K3-256K:`262144` <br>K2.8 Preview:`1048576` <br>K2.7 Code HighSpeed:`262144` | 选中 K3 或 K2.8 Preview 后,可输入 `/variants` 切换思考程度(effort): bash /variants 思考程度(effort)映射 OpenCode 可选的 variant 有 `Default` / `low` / `high` / `max`,会按下表映射到 K3 实际档位(完整映射表见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html#switch-model) ): | OpenCode variant | K3 实际 effort | | --- | --- | | `Default` | `high`(K3 默认)/ `max`(K2.8 Preview 默认) | | `low` | `low` | | `high` | `high`(推荐) | | `max` | `max` | 当前 K3 与 K2.8 Preview 均支持 `low` / `high` / `max` 三档;K2.7 Code HighSpeed 无需配置该字段。 模型能力与配置细节见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) 。 下一步 [​](https://www.kimi.com/code/docs/third-party-tools/opencode.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 查看模型的能力对比和完整 effort 映射表 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) — 确认可用模型与档位要求 --- # 在 OpenCode 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/opencode#VPContent) Return to top 在 OpenCode 中使用 [​](https://www.kimi.com/code/docs/third-party-tools/opencode#%E5%9C%A8-opencode-%E4%B8%AD%E4%BD%BF%E7%94%A8) ============================================================================================================================= [OpenCode](https://opencode.ai/) 是一款终端编程 Agent。本文介绍如何通过内置认证把 OpenCode 的模型请求转发到 Kimi For Coding,由 K3 或 K2.8 Preview 提供模型推理能力。 安装 OpenCode [​](https://www.kimi.com/code/docs/third-party-tools/opencode#%E5%AE%89%E8%A3%85-opencode) ------------------------------------------------------------------------------------------------------- 通过安装脚本是最简单的安装方式: bash curl -fsSL https://opencode.ai/install | bash 也可通过 npm 安装: bash npm install -g opencode-ai 配置 API 密钥 [​](https://www.kimi.com/code/docs/third-party-tools/opencode#%E9%85%8D%E7%BD%AE-api-%E5%AF%86%E9%92%A5) ------------------------------------------------------------------------------------------------------------------- 运行 `opencode auth login`,在提供商列表中选择 **Kimi For Coding**: bash $ opencode auth login ┌ 添加凭证 │ ◆ 选择提供商 │ ● Kimi For Coding │ ... └ 输入你的 Kimi For Coding API Key: bash $ opencode auth login ┌ 添加凭证 │ ◇ 选择提供商 │ Kimi For Coding │ ◇ 输入您的 API 密钥 │ _ └ > API Key 可在 [Kimi Code 控制台](https://www.kimi.com/code/console) > 创建和管理(最多 5 个,仅创建时显示一次,请妥善保存)。 启动并使用 [​](https://www.kimi.com/code/docs/third-party-tools/opencode#%E5%90%AF%E5%8A%A8%E5%B9%B6%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------------- 配置完成后启动 OpenCode: bash $ opencode 在会话中输入 `/models`: bash /models 在 **Kimi For Coding** 列表下选择要用的模型。 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 使用前请了解自己的会员档位与可用权限(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ),使用超出权限的模型和上下文会触发报错: | 会员档位 | 可用模型 | 上下文窗口 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | K2.8 Preview | `1048576` | | Plus / Moderato | K3 <br>K3-256K <br>K2.8 Preview | K3:`262144` <br>K3-256K:`262144` <br>K2.8 Preview:`1048576` | | Pro 及以上 / Allegretto 及以上 | K3 <br>K3-256K <br>K2.8 Preview <br>K2.7 Code HighSpeed | K3:`1048576` <br>K3-256K:`262144` <br>K2.8 Preview:`1048576` <br>K2.7 Code HighSpeed:`262144` | 选中 K3 或 K2.8 Preview 后,可输入 `/variants` 切换思考程度(effort): bash /variants 思考程度(effort)映射 OpenCode 可选的 variant 有 `Default` / `low` / `high` / `max`,会按下表映射到 K3 实际档位(完整映射表见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html#switch-model) ): | OpenCode variant | K3 实际 effort | | --- | --- | | `Default` | `high`(K3 默认)/ `max`(K2.8 Preview 默认) | | `low` | `low` | | `high` | `high`(推荐) | | `max` | `max` | 当前 K3 与 K2.8 Preview 均支持 `low` / `high` / `max` 三档;K2.7 Code HighSpeed 无需配置该字段。 模型能力与配置细节见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) 。 下一步 [​](https://www.kimi.com/code/docs/third-party-tools/opencode#%E4%B8%8B%E4%B8%80%E6%AD%A5) ----------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 查看模型的能力对比和完整 effort 映射表 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) — 确认可用模型与档位要求 --- # 在 Codex 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/codex.html#VPContent) Return to top 在 Codex 中使用 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%9C%A8-codex-%E4%B8%AD%E4%BD%BF%E7%94%A8) ========================================================================================================================= [Codex](https://openai.com/zh-Hans-CN/codex/) 是 OpenAI 提供的编程 Agent。Kimi Code 服务端原生支持 OpenAI Responses API(流式/非流式、reasoning、function calling 均可用),Codex CLI、桌面端可以通过自定义 model provider 直连,无需任何本地路由或协议转换工具——本文介绍具体配置方法。 > OpenAI Responses API 支持文本和图片输入,暂不支持视频输入。如需分析视频,可先用 ffmpeg 提取关键帧后交给模型。 会员权限 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E4%BC%9A%E5%91%98%E6%9D%83%E9%99%90) ----------------------------------------------------------------------------------------------------------- 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 配置前先了解自己的会员档位(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ),再根据下表选择合适的模型: | 会员档位 | 可用模型 | 上下文窗口 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3` <br>`k3-256k` <br>`kimi-for-coding` | `k3`:`262144` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` | | Pro 及以上 / Allegretto 及以上 | `k3` <br>`k3-256k` <br>`kimi-for-coding` <br>`kimi-for-coding-highspeed` | `k3`:`1048576` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` <br>`kimi-for-coding-highspeed`:`262144` | 准备工作 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C) ----------------------------------------------------------------------------------------------------------- 1. 在 [Kimi Code 控制台](https://www.kimi.com/code/console) 创建并保存 API Key。 2. 安装 Codex CLI: bash npm install -g @openai/codex 第一步:创建模型目录 models.json [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E7%AC%AC%E4%B8%80%E6%AD%A5-%E5%88%9B%E5%BB%BA%E6%A8%A1%E5%9E%8B%E7%9B%AE%E5%BD%95-models-json) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 在 Codex 配置目录下创建 `models.json`: macOS / LinuxWindows text ~/.codex/models.json text C:\Users\<用户名>\.codex\models.json 写入以下内容(此处以 K3 系列模型为例): json { "models": [\ {\ "slug": "k3",\ "display_name": "K3",\ "description": "K3,1M 上下文",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 0,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 1048576,\ "max_context_window": 1048576,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ },\ {\ "slug": "k3-256k",\ "display_name": "K3 256K",\ "description": "K3 256K 上下文",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 1,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 262144,\ "max_context_window": 262144,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ }\ ] } 第二步:编写 config.toml [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E7%AC%AC%E4%BA%8C%E6%AD%A5-%E7%BC%96%E5%86%99-config-toml) ----------------------------------------------------------------------------------------------------------------------------------------------- Codex CLI 的配置文件路径: macOS / LinuxWindows text ~/.codex/config.toml text C:\Users\<用户名>\.codex\config.toml 写入以下内容(文件不存在则新建): toml model = "k3-256k" model_provider = "kimi" web_search = "live" model_catalog_json = "~/.codex/models.json" [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.com/coding/v1" env_key = "KIMI_API_KEY" wire_api = "responses" [desktop] enabled-reasoning-efforts = ["low", "high", "max"] 各字段含义: | 配置项 | 说明 | | --- | --- | | `model` | 默认使用的模型。推荐 `k3-256k`(更省配额),有 1M 上下文需求时用 `k3` | | `model_provider` | 默认使用的 provider,对应下方 `[model_providers.kimi]` 的表名 | | `web_search` | 联网搜索开关。Kimi Code 端点已支持联网搜索,设为 `"live"` 启用实时搜索 | | `model_catalog_json` | 上一步创建的模型目录文件路径,声明模型的上下文窗口与图片输入能力 | | `base_url` | Kimi Code 的 API 地址,国内 `https://api.kimi.com/coding/v1`,海外 `https://api.kimi.ai/coding/v1` | | `env_key` | 存放 API Key 的环境变量**名称**(这里填 `KIMI_API_KEY`,不是填 Key 本身)。Codex 启动时从同名环境变量读取密钥,变量的值在下一步设置 | | `wire_api` | 请求使用的协议,必须填 `"responses"` 以走 Responses API | | `enabled-reasoning-efforts` | 桌面端模型选择器中显示的思考档位,仅影响桌面端,CLI 无需此配置 | 第三步:设置 API Key [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E7%AC%AC%E4%B8%89%E6%AD%A5-%E8%AE%BE%E7%BD%AE-api-key) --------------------------------------------------------------------------------------------------------------------------------------- 推荐通过环境变量提供 Key(即上面的 `env_key` 方式):配置文件中不含明文密钥,可以安全分享、备份,也是 Codex 官方推荐的方式。 按操作系统选择对应命令: macOSLinuxWindows sh echo 'export KIMI_API_KEY="sk-kimi-你的key"' >> ~/.zshrc source ~/.zshrc sh echo 'export KIMI_API_KEY="sk-kimi-你的key"' >> ~/.bashrc source ~/.bashrc powershell setx KIMI_API_KEY "sk-kimi-你的key" 使用 Codex 桌面 App 时还需要一步:从 Dock 或访达启动的 App 读不到终端里的环境变量,需要把 Key 注入当前用户会话。在终端执行: sh launchctl setenv KIMI_API_KEY "sk-kimi-你的key" 执行后**完全退出**桌面 App(Cmd+Q)再重新打开,才会生效。注意:该变量在重启电脑后失效,需要重新执行。Windows 没有这一步——`setx` 写入的是系统环境变量,重启 App 即可。 ### 备选:写入配置文件(experimental\_bearer\_token) [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%A4%87%E9%80%89-%E5%86%99%E5%85%A5%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-experimental-bearer-token) 如果遇到环境变量不生效的问题(例如 GUI 应用读不到环境变量、CI 环境不便注入等),可以改用 `experimental_bearer_token`,把 Key 直接写在 provider 配置里代替 `env_key`: toml [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.com/coding/v1" wire_api = "responses" experimental_bearer_token = "sk-kimi-你的key" 明文密钥风险 此方式下 Key 以**明文**存储在配置文件中,请勿将该文件提交到版本仓库或随 dotfiles 公开分享,是否使用请自行权衡。`env_key` 与 `experimental_bearer_token` 两种方式不要同时配置。 第四步:启动并验证 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E7%AC%AC%E5%9B%9B%E6%AD%A5-%E5%90%AF%E5%8A%A8%E5%B9%B6%E9%AA%8C%E8%AF%81) ----------------------------------------------------------------------------------------------------------------------------------------------------- 新开一个终端,进入需要使用的项目目录,直接启动 Codex: bash cd /path/to/your/project codex 在会话里发一句 `hello`,能正常返回结果就说明配置已生效。 配置成功的标志: * 启动信息中显示 `model: k3-256k`(或你选用的模型)、`provider: kimi`; * 不再出现 `Model metadata not found` 警告(models.json 已生效)。 在 Codex 桌面端中使用 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%9C%A8-codex-%E6%A1%8C%E9%9D%A2%E7%AB%AF%E4%B8%AD%E4%BD%BF%E7%94%A8) ------------------------------------------------------------------------------------------------------------------------------------------------------- 桌面端与 CLI 读取同一份 `~/.codex/models.json` 和 `~/.codex/config.toml`,可按照 CLI 的配置过程完成前三步,随后操作下列步骤: 1. **(仅 macOS)注入环境变量**:GUI 应用读不到在终端里配置的变量,先执行下面的命令,把 `KIMI_API_KEY` 注入用户会话。Windows 的 `setx` 写入的是系统环境变量,无需这一步。 sh launchctl setenv KIMI_API_KEY "sk-kimi-你的key" 2. **重启桌面 App**:完全退出(macOS 为 Cmd+Q)再重新打开,新的配置才会被加载。 3. **选择模型开始对话**:在模型选择器里选择 Kimi 的模型,打开新线程即可开始使用。 TIP 桌面端运行时会自动向 `config.toml` 追加插件、MCP 等管理字段,属正常现象;手动添加的 Kimi Code 配置会被完整保留,请勿删除这些自动生成的区块。 切换思考程度(effort) [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%88%87%E6%8D%A2%E6%80%9D%E8%80%83%E7%A8%8B%E5%BA%A6-effort) ---------------------------------------------------------------------------------------------------------------------------------------------- K3 支持 `low` / `high` / `max` 三档思考程度。在 Codex CLI 会话中,输入 `/model` 重新选中当前模型,然后在 **Select Reasoning Level** 菜单中选择档位。 切换档位后建议新建会话,避免旧上下文缓存失效带来的额外消耗。 常见问题 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ----------------------------------------------------------------------------------------------------------- ### 报错 Missing environment variable: KIMI\_API\_KEY [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E6%8A%A5%E9%94%99-missing-environment-variable-kimi-api-key) 当前进程读不到环境变量。确认已写入正确的 shell 配置文件并新开终端;macOS 桌面 App 参考第三步的 `launchctl` 方法;仍有问题可改用 `experimental_bearer_token`。 ### codex exec 无法执行工具命令 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#codex-exec-%E6%97%A0%E6%B3%95%E6%89%A7%E8%A1%8C%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4) 在 user namespace 受限的环境(例如 bwrap 报 ENOSPC)下,Codex 的默认沙箱无法工作,`codex exec` 需要加上 `--sandbox danger-full-access` 才能执行工具命令,即 `codex exec --sandbox danger-full-access "你的任务"`。注意该参数会关闭沙箱隔离,命令将直接在你的真实环境中执行,请确认任务来源可信后再使用。 下一步 [​](https://www.kimi.com/code/docs/third-party-tools/codex.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 查看模型的能力对比和完整 effort 映射表 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) — 确认可用模型与档位要求 --- # 变更记录 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#VPContent) Return to top 变更记录 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E5%8F%98%E6%9B%B4%E8%AE%B0%E5%BD%95) =========================================================================================================== 本页记录 Kimi Code CLI 每个版本的变更内容。 2.1.0(2026-09-23) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_2-1-0-2026-09-23) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD) * 新增实验性全屏模式开关,可在 `/settings` 的 TUI mode 设置中开启,或在 `~/.kimi-code/tui.toml` 中设置 `tui_mode = "fullscreen"`,重启 Kimi Code 后生效。 * 全屏模式下,点击折叠块即可展开或收起。 * 全屏界面新增可点击的 "Jump to bottom" 指示器。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96) * 缩短 CLI 启动时间并降低内存占用。 * 默认关闭对配置文件和工作区文件的监听,如需开启可将 `[watch] enabled` 设为 `true` 或设置 `KIMI_CODE_WATCH=1`,详见 [`watch`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#watch) 。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D) * 加强工作区安全限制:文件工具无法再通过符号链接访问工作目录外的文件,项目本地配置仅在工作区受信任后生效,后台 git 操作不再执行仓库 git 配置中的命令,并拒绝解析结果为 home 目录或文件系统根目录的附加目录。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 2.0.2(2026-09-19) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_2-0-2-2026-09-19) ----------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-1) * 优化系统提示词:Agent 不再假设当前工作目录就是项目根目录。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-1) * 修复切换到上下文窗口更小的模型后 compaction 失败的问题。 * 修复恢复会话后新消息偶尔出现在对话中旧位置的问题。 * 修复 Agent 运行期间发送的消息有时在聊天中重复显示的问题。 * web:改进交互体验并修复已知问题。 2.0.1(2026-09-18) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_2-0-1-2026-09-18) ----------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-2) * 移除系统提示词中禁止访问工作目录以外所有文件的规则。 * 供应商可通过 `config.toml` 中的 [`api_key_env`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/providers.html) 从指定的环境变量读取 API 密钥。 * 工作区文件监听不再无上限地扫描项目根目录,并新增 `[watch] enabled` 配置与 `KIMI_CODE_WATCH` 环境变量,可完全关闭文件监听,详见 [`watch`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#watch) 。 * 「必要时询问」权限模式下,无法静态分析的 bash 命令不再触发审批请求。 * `kimi install-app` 子命令更名为 `kimi install-desktop`,旧名称仍作为隐藏别名可用。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-2) * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 2.0.0(2026-09-17) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_2-0-0-2026-09-17) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-1) * 新增 `/desktop` 斜杠命令(别名 `/install-desktop`)与 `kimi install-app` 子命令。 * Mermaid 代码块现在会在终端中渲染为图表;可在 `/settings` → Mermaid diagrams 中关闭,或在 tui.toml 的 `[markdown]` 配置段中设置 `mermaid = "off"`。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-3) * 内置浏览器插件更名为 "Kimi Browser Extension",插件面板、插件市场与文档中的名称同步更新。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-3) * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.43.1(2026-09-15) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-43-1-2026-09-15) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-2) * Linux X11 环境新增原生剪贴板支持,从终端界面复制内容不再依赖终端的 OSC 52 能力。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-4) * 减少同时运行大量 subagent 的会话中的事件循环卡顿与 GC 开销。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-4) * 修复在 subagent 运行时按 `Ctrl-C` 会直接退出整个 CLI 的问题,现在只会中断正在运行的 subagent。 * 修复大型 agent swarm 运行时渲染逐轮变慢的问题。 * 修复 subagent 运行结束后内存未释放的问题。 * 修复 tower 模式将新生成的 agent 误识别为历史会话 roster 条目的问题。 * 修复全局搜索在索引更新前仍会返回已删除会话的问题。 * 修复折行 markdown 表格中的链接颜色错误,以及 `@` 文件补全的排序问题。 0.43.0(2026-09-14) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-43-0-2026-09-14) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-3) * Web 版会话的 AI 标题功能默认开启:首轮对话后自动生成标题,并可在重命名输入框中重新生成。 * 会话选择器中可删除会话:在目标会话上按 `Ctrl-X`,再按 `y` 确认。 * `kimi upgrade`(别名 `kimi update`)新增 `-y, --yes` 选项,跳过确认提示直接安装更新。 * 新增 `loop_control.compaction_max_attempts` 配置项,可设置压缩请求失败后的最大总尝试次数(默认 5 次),详见 [`loop_control`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#loop-control) 。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-5) * 仅作用于 `/tmp` 或 `/temp` 路径的 `rm -rf` 命令不再弹出确认提示。 * 引导消息现在可以打断对后台任务的等待。 * 目标模式的时间预算不再计入会话关闭期间的时间,并取消 24 小时上限。 * 新增 `KIMI_CODE_PERMISSION_MODE_REMINDER` 环境变量:设为 `0` 后不再向模型上下文注入自动权限模式提醒。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-5) * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.42.0(2026-09-09) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-42-0-2026-09-09) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-4) * Remote Control 由实验性转为正式,无需再设置 `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL` 实验开关。详见 [Remote Control](https://moonshotai.github.io/kimi-code/zh/guides/remote-control.html) 。 * Web 版支持从会话行的右键菜单永久删除会话,删除前会要求确认。 * `/btw` 侧边聊天的 subagent 新增只读工具。 * Web 版输入框新增可排序的媒体预览栏,可在文本中按需引用图片和视频,排队与发送后预览仍然保留。 * 模型由 Kimi 提供时,支持在提示词附件与 `ReadMediaFile` 中使用 HEIC、HEIF 和 BMP 图片。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-6) * 消息记录中已完成的工具调用现折叠为标题加一行结果摘要:短输出完整展示,隐藏内容以 `N more lines`、`+N more` 计数并按 `Ctrl-O` 展开,页脚会在可用时提示。 * 符合条件的用户的默认思考强度升级为推荐级别。 * 子 Agent 模型池(`[secondary_model]`)现已始终开启,实验开关与 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` 退出选项已移除。 * `Read` 新增可配置的字符上限,长行文件可续读,输出不再被反复截断。详见 [`read`](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#read) 。 * minidb 会话索引读模型与全局搜索 worker 现已始终开启,实验开关由 `[database]` 配置段与 `KIMI_CODE_PERSISTENCE_MINIDB_READMODEL` / `KIMI_CODE_SEARCH_WORKER` 环境变量取代。详见 [`database`](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#database) 。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-6) * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.41.0(2026-09-04) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-41-0-2026-09-04) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-5) * Web 版新增 tower 多智能体协作模式(实验功能),可通过 `/tower` 命令或输入框加号菜单开启,`/tower <base-branch>` 可指定基准分支。 * Web 版新增划词标注:在消息、文件预览、diff 与每轮改动面板或终端中选中文字,即可添加评论或引用到对话。 * CLI 中新增会话评分提示,适时在输入框上方邀请为本次会话打分。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-7) * 自动权限模式不再拦截危险命令和无法静态分析的命令。 * 自动压缩前提醒模型关注上下文预算,压缩后指引其查阅会话事件日志获取精确细节。 * Web 版三档权限模式更名为「始终询问 / 必要时询问 / 完全自动」并更新描述;切换到「必要时询问」或「完全自动」权限模式后,提示该模式下文件可能被直接修改或删除。 * Web 版 Esc 不再关闭右侧详情面板。 * Web 版右侧面板中的 Bash 命令改为终端样式。 * 后台提问的回答直接送达 Agent,不再经输出文件中转。 * 子 Agent 的最终回复较短(200 字符以内)时不再被要求扩写。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-7) * 修复 `kimi -p` 在出错或收到终止信号退出时丢失会话记录的问题。 * 修复 `kimi -p` 忽略 `KIMI_DISABLE_TELEMETRY` 环境变量的问题。 * 修复 tower 模式(实验)在 config.toml 中通过 `[experimental] tower = true` 启用时不生效的问题;`/tower` 现可在非 git 仓库目录使用;启用失败时报错会指明具体原因。 * 修复后台提问在 Agent 回合结束即被取消的问题。 * 修复会话在新进程重开后无法按 agent id 恢复子 Agent 的问题;恢复的子 Agent 遵循当前权限模式。 * 修复一轮中多次编辑同一文件时,每轮改动预览出现从未真实存在的增删行且行数统计不准的问题;改动卡片现只展示精确统计。 * 修复设置中默认思考强度无法设为最高档(Max)的问题。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.40.1(2026-09-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-40-1-2026-09-02) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-8) * 修复 kimi-cli 迁移完成或关闭后仍重复弹出迁移提示的问题。 0.40.0(2026-09-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-40-0-2026-09-02) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-6) * Web 版设置新增「插件」面板:可浏览插件市场并安装、启停、移除插件。 * 支持在一条消息中同时激活多个技能。 * 新增 `kimi session list` 命令,可在命令行直接列出会话。 * Tower 模式(实验性)行为调整:agent 不再自行进入,需用 `/tower on` 或 `/tower <base-branch>` 显式开启。 * 子代理设置(`[secondary_model]`)功能由实验性转为正式。 * 新增危险命令护栏:Auto 模式直接拦截 shutdown、reboot、rm -rf 等危险命令,Manual 与 YOLO 模式执行前必定询问;可用 `[permission] dangerous_command_guard = false` 或 `KIMI_CODE_DANGEROUS_COMMAND_GUARD=false` 关闭。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-8) * 更新配置时完整保留 config.toml 的注释、键顺序与格式。 * Bash 工具的 cwd 参数不再限制在工作区内。 * 工作区信任弹窗默认选中「Trust this folder」。 * `kimi acp` 子命令不再识别 `KIMI_CODE_LEGACY_FLAG`,始终运行在默认 agent 引擎。 * Web 版 Diff 面板新增代码折行开关,并精简了面板头部。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-9) * 修复实验开关优先级:config.toml 中显式设为 `false` 的 `[experimental]` 条目现在稳定优先于 `KIMI_CODE_EXPERIMENTAL_FLAG` 总开关(单项 `KIMI_CODE_EXPERIMENTAL_<NAME>` 变量仍覆盖两者)。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.39.1(2026-08-28) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-39-1-2026-08-28) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-10) * 修复在一个会话中切换权限模式会改动所有会话的问题,权限模式现按会话独立生效。 * 修复登录相关问题 * 修复点击输入框占位提示后,输入法或键盘首个字符被吞的问题 * 修复新会话中附件上传完成后仍显示"上传中"的问题 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.39.0(2026-08-27) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-39-0-2026-08-27) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-7) * 新增实验性远程控制功能:可远程访问本地的 web 会话,设置 `KIMI_CODE_EXPERIMENTAL_REMOTE_CONTROL=1` 后运行 `kimi rc`、`kimi web --remote-control` 或 `/remote-control` 启动。 * 新增实验性 tower 多 Agent 编排模式:设置 `KIMI_CODE_EXPERIMENTAL_TOWER=1` 后运行 `/tower on` 和 `/tower <objective>` 启动。 * subagent 与 swarm 工具新增可选 `fork` 参数,子 Agent 以调用方当前对话历史的快照启动;设置 `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK=1` 或在 `config.toml` 的 `[experimental]` 下写 `subagent_fork = true` 启用。 * web: 运行卡片新增 "转到后台" 按钮,可把正在前台运行的 Bash 命令或子 Agent 转为后台运行。 * web: 移动端会话列表新增平铺/按工作区分组的切换标签。 * 内置插件市场新增 Tencent CloudBase 插件,通过 `/plugins` 安装。 * 新增 `[swarm] timeout_ms` 配置项(或环境变量 `KIMI_CODE_SWARM_TIMEOUT_MS`)。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-9) * web: 右侧边栏重构为多标签面板。 * web: 优化输入框交互,包括文件、文件夹和媒体附件的展示。 * web: 优化移动端 UI 样式。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-11) * 修复 Windows 上文件工具与 Shell 工作目录无法解析 Git Bash 路径(如 /c/Users、/tmp)的问题。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.38.0(2026-08-20) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-38-0-2026-08-20) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-8) * 支持 kimi.ai 与 kimi.com 两种 OAuth 登录方式。 * 新增 WaitFor 工具:Agent 可以在当前轮次内等待后台任务完成,无需结束轮次后再次被唤起。 * 官方 Kimi Datasource 插件新增 13 个数据源:中国政府数据(NDA/NBS)与标准(GB/HB/DB/TT)、八个国际组织数据集(WHO、FAO、UNSD、ECB、Eurostat、UNICEF、OECD、FRED)、新华财经和财新。在 /plugins 的 Official 标签页中更新插件。 * web: 聊天头部的更多菜单新增置顶操作。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-10) * Edit 和 Write 现在要求先读取已存在的文件再进行修改。 * 折叠过长的 `!` Shell 命令输出,避免刷屏;按 ctrl+o 可与工具输出一起展开或折叠。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-12) * 修复 config.toml 在存在语法错误或在应用外被编辑时条目丢失的问题。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.37.2(2026-08-19) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-37-2-2026-08-19) ------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-11) * web: 设置页新增 「实验室」标签页,上线「多标签侧边栏开关」功能;开启后侧边栏显示 Open / Done / Workspaces 标签页。 * 做了若干细节优化和内部改进。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.37.1(2026-08-18) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-37-1-2026-08-18) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-13) * 修复粘贴的图片和视频无法发送给模型的问题。 0.37.0(2026-08-18) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-37-0-2026-08-18) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-9) * 支持在单条提示词中激活多个 skill:在空白后输入 `/` 即可插入 skill 标记。 * Windows 原生(单文件)CLI 现支持自动更新。 * web: 侧边栏新增 Open / Done / Workspaces 标签页,会话可标记为 Done。 * web: 新增会话管理页面。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-12) * Agent 忙碌时输入的 skill 斜杠命令现在会排队执行,不再直接拒绝。 * web: 聊天消息中 @提及的文件、文件夹和 skill 现在渲染为图标胶囊。 * web: 浏览器标签页标题现在显示当前工作区目录名。 * web: 搜索对话框现在支持搜索工作区,选中结果后会展开侧边栏并滚动定位到该条目。 * web: Subagent 面板更名为 "Background Agent"。 * 输入的 `/goal` 目标超过 4000 字符限制时现在会给出警告,且被拒绝时保留已输入的内容。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-14) * 修复 Gemini 工具调用会话后续请求失败的问题。 * web: 修复 macOS 上输入框中 Ctrl+K 误打开会话搜索的问题,会话搜索现仅响应 Cmd+K。 * web: 修复 Background Agent 面板显示数量和状态不对的问题。 * web: 修复把复制的文件夹粘贴进输入框会导致上传报连接错误的问题,现在文件夹会被直接跳过。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.36.1(2026-08-14) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-36-1-2026-08-14) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-10) * web: AI 自动生成会话标题(实验性)。默认关闭,设置 `KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE=1`(或实验总开关 `KIMI_CODE_EXPERIMENTAL_FLAG=1`)开启。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-13) * web: 优化输入框的 Plan、Goal、Swarm 开关,现收进了输入框旁的 + 号菜单。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-15) * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.36.0(2026-08-13) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-36-0-2026-08-13) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-11) * 实验性的子 Agent 模型配置升级为模型池:现在可以在 `[secondary_model]` 中配置一组带描述的候选模型,由主 Agent 每次派生时按任务挑选。 启动前设置 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`(或实验总开关 `KIMI_CODE_EXPERIMENTAL_FLAG=1`)即可启用。 推荐用法: * 极简用法:在 TUI 中运行 `/secondary-model` 选择,或在 `config.toml` 中写一行 `default_model`,让所有子 Agent 默认跑同一个模型;再加 `force = true` 可彻底固定该选择,主 Agent 无法改选。 * 配置命名模型池,并为每个别名写一句适用场景的描述——描述会展示给主 Agent 作为挑选依据: toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" [secondary_model.models] "kimi-code/kimi-for-coding-highspeed" = "快速、便宜,适合日常重构、代码解释和小改动。" "kimi-code/k3" = "擅长复杂推理与深度调试,难题选它。" 详见 [子 Agent 模型池文档](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#subagent-%E6%A8%A1%E5%9E%8B%E6%B1%A0) 。 * 新增实验性全屏 TUI 模式,设置 `KIMI_CODE_TUI_FULL_SCREEN=1` 环境变量即可启用。 * TUI 支持渲染 LaTeX 数学公式(`$…$` 与 `$$…$$`),消息中的公式会显示为 Unicode 公式。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-16) * 修复未信任工作区可在信任确认前植入同名 `fd`/`stty` 可执行文件的风险;信任提示现在展示项目 MCP 的启动目标,并默认拒绝信任。 * 修复在严格的 OpenAI 兼容供应商(如 DeepSeek)下,模型思考阶段打断轮次后,后续每轮请求都报 400 错误的问题。 * 修复 API 请求失败自动重试期间按 Ctrl+C 无反应的问题。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.35.0(2026-08-12) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-35-0-2026-08-12) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-12) * 内置插件市场新增 Modern Web Guidance 插件,通过 `/plugins` 选择 Modern Web Guidance 安装。 * `/tasks` 面板现实时展示后台子 Agent 的工作进度。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-17) * 修复 coder 子 Agent 默认可继续派生子 Agent 的问题。 * 修复压缩后 token 数显示偏低的问题,现在与会话中看到的数字一致。 * 修复 Windows 上的两处二进制植入风险。 * 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) 。 0.34.0(2026-08-06) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-34-0-2026-08-06) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-13) * web: 侧边栏会话列表新增平铺视图。 * Kimi Computer Use 插件新增 Windows x64 支持,通过 `/plugins` 安装。 * 会话空闲过久后恢复或发送消息时,现将会弹出缓存过期提醒。将 [cache\_expiry\_hint](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#tui-toml) 设为 `false` 可关闭。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-14) * web: 子 Agent 任务显示所用模型与思考等级。 * web: 模型请求失败时会话内保留失败卡片,可一键恢复。 * web: 自动重试期间工作状态显示重试进度(第 N/M 次)。 * 安装 Kimi WebBridge 后现在会显示浏览器扩展链接与激活步骤。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-18) * 修复无法读取 UTF-16 LE/BE 文本文件(有无 BOM 均可)的问题。 * web: 修复附件随技能命令发送时被丢弃的问题。 * web: 修复模型较多时模型选择器溢出屏幕的问题。 * web: 修复 Windows 上路径含空格时打开 Documents 文件夹而非目标文件的问题。 * web: 修复新会话以技能命令开始时思考等级被重置为默认值的问题。 * web: 修复手动取消的会话在侧边栏被错误标记的问题,现在仅在上一回合失败时显示。 * web: 修复重命名会话时输入法组合中 Enter、Esc 误触发的问题。 * web: 修复重命名时拖动选择文本会移动整个列表项的问题。 * web: 修复计划审批对话框展开时后台任务与待办标签跳到窗口顶部的问题。 * web: 修复变更文件摘要卡片 "show less" 按钮箭头方向错误。 * 修复 `kimi -p` 未等待后台任务与子 Agent 完成就退出的问题。 * `/feedback` 不再受当前模型限制,所有已登录用户可用;未登录用户显示注册页与 GitHub Issues 链接。 * 修复移除 MCP 服务会破坏进行中会话的问题:工具保留但调用返回移除提示。 * 修复服务器重启后丢失回合结束状态的问题,会话列表与恢复的会话现在能正确标记失败的回合。 * 修复恢复的会话将后台任务完成通知显示为原始协议文本而非状态卡片的问题。 0.33.0(2026-08-05) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-33-0-2026-08-05) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-14) * `/plugins` 市场新增 Kimi Computer Use 与 Kimi WebBridge 官方内置插件,安装时自动配置托管运行时,中断后可重试。 * web: 支持在设置中添加和管理自定义供应商。 * web: 侧边栏支持将会话置顶。 * web: 会话标题支持设置 emoji。 * web: 显示登录账号信息与套餐用量。 * 新增 `/bug` 命令作为 `/feedback` 的别名,输入 `/bug` 即可提交反馈。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-15) * 启动时询问是否信任当前文件夹。 * `/fork` 不再切换到分叉会话,当前会话与后台任务保持运行,分叉结果可在 `/sessions` 中查看。 * web: 深度优化界面 UI/UX 并修复已知问题。 * 交互式 TUI 启动时不再立即创建会话。 * 插件市场的合作伙伴标签页更名为 Curated,并说明其内容为 Kimi 合作伙伴提供的第三方插件。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-19) * 修复 macOS 上技能目录文件过多时所有工具调用失败(spawn EBADF)的问题。 * 修复 MCP OAuth 重新授权总是因 `Invalid redirect URI` 失败的问题,现会自动清理过期注册并重新发起。 * 修复首条请求未等待 MCP 初始化完成的问题,界面仍可立即打开。 * 修复 MCP 工具结果中 `structuredContent` 与 `_meta` 元数据被静默丢弃的问题,现已正确传递给模型。 * 修复 `/plugins` 中内置能力的可用性与安装状态显示,更新时保留旧版 WebBridge 技能备份,并避免 Computer Use 更新导致 MCP 服务重复或断连。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84) * CLI 各界面(交互式 TUI、`kimi -p`、`kimi acp` 等)默认运行在 agent-core-v2 引擎上;设置 `KIMI_CODE_LEGACY_FLAG=1` 可回退旧引擎。 0.32.0(2026-08-04) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-32-0-2026-08-04) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-15) * 新增四个 hook 事件:`TurnStarted`、`UserPromptQueued`、`TaskStarted` 和 `SessionHeartbeat`。在 `config.toml` 的 `[[hooks]]` 下配置,详见 [Hooks](https://moonshotai.github.io/kimi-code/zh/customization/hooks.html) 。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-16) * `[loop_control]` 两个配置键改名:`max_retries_per_step` → `max_attempts_per_step`、`max_steps_per_run` → `max_steps_per_turn`;旧键不再生效,启动时会有改名警告,详见 [loop\_control](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#loop-control) 。 * 新增 `[token_counting]` 配置节:供应商不上报 token 用量时,可将上下文大小显示切换为本地估算,详见 [token\_counting](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#token-counting) 。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-20) * 修复部分 OpenAI 兼容网关返回含冒号的工具调用 ID 时,交互式提问无法提交答案的问题。 * 修复上下文自动压缩因请求过大反复重试直至失败的问题。 * models.dev 目录不可达时回退到内置快照,离线或网络受限时也能导入已知第三方供应商。 * 修复未配置模型时上下文窗口上限显示为 0 的问题,现回退到默认模型显示。 * web: 修复深色模式下单色控件显示异常,聊天输入框圆角与设计系统对齐。 * 修复 `/login` 已登录确认信息难以看清的问题,现以成功色显示。 0.31.1(2026-07-31) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-31-1-2026-07-31) ------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-17) * 减少 TUI 频繁的全屏重绘。 * 按 Esc 中断回合时保留 Assistant 已生成的部分输出,并提醒模型上一回合是被主动中断的。 * web: 各设置页面的权限模式按从严到宽排序,并修复状态面板与移动端设置中 yolo/auto 风险颜色颠倒的问题。 * web: 代码块启用基于 Monaco 的高亮渲染,并修复回退渲染时行号重叠或错位的问题。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-21) * 修复启动 kimi web 时偶发的 “model is not configured” 错误。 * web: 修复新会话显示思考等级(如 Max)但首条消息实际未开启思考的问题。 * web: 修复新会话草稿状态下(发送首条消息前)@ 文件提及不可用的问题。 * web: 修复 Markdown 渲染器升级后聊天代码块以 UI 字体、错误字号渲染的问题,加载回退与高亮块对齐。 0.31.0(2026-07-30) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-31-0-2026-07-30) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-16) * TUI 支持 Markdown 定义的自定义 Agent。 * 新增 /secondary\_model 斜杠命令,用于配置子 Agent 使用的辅助模型(实验性功能,需先在 /experiments 中开启)。 * 插件可贡献自定义 Agent,自动发现并可用于子 Agent 委派。 * 插件可贡献系统提示词,通过 `kimi.plugin.json` 中的 `systemPrompt` 或 `systemPromptPath` 声明。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-22) * 移除 TaskOutput 工具的阻塞式 `block`/`timeout` 等待。 * 修复会话元数据缓存早于 archived 标记时会话选择器缺少会话的问题。 * 修复部分请求未能正确传递请求头的问题。 0.30.0(2026-07-29) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-30-0-2026-07-29) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-17) * 新增可自定义的底部状态栏,可通过 `tui.toml` 中的 `[status_line]` 配置。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-18) * 安装会计入套餐额度的官方插件(如 Kimi Datasource)后,显示额度说明。 * 会话中使用的官方插件有可用更新时显示提示,可运行 /plugins 更新。 * 移除内置服务器文件上传的 50 MB 大小限制。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-23) * 修复账户额度或余额耗尽时静默重试约 3 分钟的问题,现在会立即报错。 * 修复工具调用反复无效时无限重试的问题,现在会终止当前回合。 * web: 修复代码块中行号乱码的问题。 0.29.2(2026-07-27) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-29-2-2026-07-27) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-24) * 修复目标执行在单轮达到步数上限(`loop_control.max_steps_per_turn`)后暂停的问题。 * 修复目标运行期间发送的消息被拒绝的问题。 * 修复 /undo 无法一致恢复对话历史、待办列表、计划模式和任务通知的问题。 * web: 修复纯 HTTP 环境下复制选中聊天文本时,剪贴板被事件占位符覆盖的问题。 0.29.1(2026-07-24) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-29-1-2026-07-24) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-18) * 支持在 `config.toml` 与环境变量中配置全局默认的 MCP 服务器超时时间。 * 新增用于配置网页搜索与网页抓取服务的环境变量,无需 OAuth 登录。 * 新增实验性的子 Agent 辅助模型绑定,支持按 Agent 设置模型偏好及仅对子 Agent 生效的模型覆盖。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-25) * 修复部分 OpenAI 兼容端点(如新版 vLLM)以其他字段名返回 reasoning 导致思考内容丢失的问题。 0.29.0(2026-07-22) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-29-0-2026-07-22) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-19) * web: 支持 Markdown 文件定义 agent,声明 system prompt、名称、描述和工具权限。[查看文档](https://moonshotai.github.io/kimi-code/en/customization/agents.html#agent-file-format) * web: 可通过 SYSTEM.md 永久覆盖主 agent 的系统提示。[查看文档](https://moonshotai.github.io/kimi-code/en/customization/agents.html#overriding-the-main-agent-s-system-prompt-with-system-md) * web: 可通过 config.toml 在所有会话中统一启用/禁用工具。[查看文档](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#tools) * 附加到提示词的视频现在会随提示词一起送达模型,无需额外的工具轮次。 * ACP 客户端现支持选择思考强度。 * 新增 Agent 循环与后台任务限制的环境变量覆盖:`KIMI_LOOP_MAX_STEPS_PER_TURN`、`KIMI_LOOP_MAX_RETRIES_PER_STEP` 和 `KIMI_CODE_BACKGROUND_MAX_RUNNING_TASKS`。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-19) * 从 models.dev 目录导入更多供应商。 * 提升 TUI 在长会话中的性能与恢复速度。 * 当 MCP 服务器的某个工具被调用时,若连接已断开可自动重连,并自动重试一次该调用。 * 移除代码预览与 Markdown 代码块语法高亮中的红色配色。 * 在更新提示中为第三方安装来源增加使用官方安装器的提醒。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-26) * 修复内容过滤响应后,会话卡住并报 "message must not be empty" 错误的问题。 * 修复被取消的模型请求被包装为可重试的供应商错误的问题。 * 修复为不支持的模型提供思考强度选项的问题。 * 修复环境变量覆盖值在环境变量设置期间被持久化到 config.toml 的问题。 * 将会话提示词缓存键发送给 OpenAI 与 OpenAI Responses 供应商。 * 修复当供应商没有文件上传通道时 `ReadMediaFile` 处理视频失败的问题。 * 修复恢复会话时目标模式续行提示词泄漏到对话记录中的问题。 * web: 在透明图片下方显示棋盘格画布。 * 移除定时任务工具描述中对不存在的 `kimi resume` 命令的引用。 0.28.1(2026-07-20) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-28-1-2026-07-20) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-20) * ACP 会话现支持使用已配置的非 OAuth 模型凭据启动,无需再在终端登录。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-20) * `kimi web` 服务器改为全程前台运行:`/web` 斜杠命令现在总是启动新服务器,`kimi web kill` 与 `kimi web ps` 子命令已移除,前台服务器按 Ctrl+C 即可停止。`kimi server kill` 保留为废弃回退,仅能停止 0.28.0 之前版本启动的服务器。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-27) * 修复权限模式切换对已在运行的子 Agent 不生效的问题。 0.28.0(2026-07-20) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-28-0-2026-07-20) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-21) * **破坏性变更:** * `kimi server` 命令树已被废弃,请使用 `kimi web` 代替。 * `kimi web` 现在在当前终端前台运行并打开浏览器,按 Ctrl+C 停止。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-21) * 思考强度仅持久化低于模型最高档(max)的等级。 * web: 模型切换器新增提示:切换模型或思考强度会使已有提示词缓存失效。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-28) * 修正 YOLO 与 Auto 权限模式的描述:YOLO 会自动批准工具操作,但 Agent 仍可能提问;Auto 完全自主,不会提问。 * 修复 web 后端在加载 AGENTS.md 和读取文件时忽略符号链接的问题。 0.27.0(2026-07-17) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-27-0-2026-07-17) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-22) * 新增 `/copy` 斜杠命令,可将上一条助手消息复制到剪贴板。 * 使用 API key 调用 Kimi 编程模型时,现在会自动拉取最新模型列表。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-22) * OAuth 连接失败时现在会显示底层网络原因(DNS、连接被拒、TLS、超时),不再是笼统的 `fetch failed`。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-29) * 修复打断模型回复后请求被反复拒绝的问题。 * 修复内置 URL 抓取工具的网络防护缺陷:恶意构造的域名与重定向链无法再访问回环地址或内网服务。 * web: 修复通过网络访问 web UI 时 LaTeX 公式渲染错乱重叠的问题。 * web: 修复重新打开会话时,排队消息会静默重发此前已上传文件的问题。 * web: 按模型分别记忆思考等级,修复模型不支持已存等级时选择器空白卡死的问题。 * web: 修复 Windows 下同一文件夹以不同路径写法打开时出现重复工作区分组的问题,现在统一归入单个分组。 * 修复 web 后端忽略以符号链接形式安装的 AGENTS.md 文件的问题。 * 修复 /btw 面板打开时,按 Esc 或 Ctrl+C 会取消 compaction 而不是关闭面板的问题。 * 修复纯空白思考内容在对话记录中渲染成空行的问题。 * 修复对同一会话重复执行 /export-debug-zip 或 kimi export 会覆盖上一份压缩包的问题;文件名现包含时间戳。 0.26.0(2026-07-16)Say hi to the BIIIG DAY! [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-26-0-2026-07-16-say-hi-to-the-biiig-day) ------------------------------------------------------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-23) * 扩展 coder 子 Agent 的工具集:新增后台任务、待办列表、Plan 模式、Skill 调用与嵌套 Agent 能力,与主 Agent 对齐。 * `/model` 与 `/effort` 选择器现在会提示切换会使已有提示词缓存失效,并建议使用 `/new` 以避免额外 token 开销。 * web: 打开模型选择器时刷新所有供应商的模型目录,新上线的模型现在总能显示。 * 优化上下文用量显示的单位格式。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-30) * 修复恢复的会话没有新活动却被标记为刚更新、跳到会话列表顶部的问题。 * 修复上下文大小指示器低估模型实际上下文用量的问题。 * 修复经 Anthropic 协议接入的 Kimi 供应商模型错误显示思考强度选项的问题。 * 修复 OpenAI 兼容(chat completions)供应商上显式关闭思考不生效的问题。 * 用户停止任务时现在会向模型报告,其他停止原因也会保留在模型上下文中。 * 修复后台子 Agent 被手动停止后立即恢复时可能因竞争报 `"already running"` 错误的问题。 * Anthropic 兼容与 Kimi 的 preserved-thinking 端点现在原样回放空思考内容,不再替换为占位空格。 * 旧版迁移在多个 Kimi 主目录之间保持幂等,损坏或无法映射的会话现在会明确报告,不再静默跳过。 * web: 修复侧边栏调整宽度的拖拽手柄被聊天输入框背景遮挡的问题。 0.25.0(2026-07-16) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-25-0-2026-07-16) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-23) * web: 聊天支持附加任意类型文件,可直接将文件拖放到窗口任意位置;发送的文件、图片、视频都会以附件标签显示在消息气泡中。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-24) * web: 模型请求失败时展示完整诊断信息。 * 应用 Anthropic 官方 effort 配置,未知模型回退到 128k 输出上限。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-31) * 修复 Web 服务器 bearer token 校验可被百分号编码的 API 路径绕过、导致所有 API 路由可被未认证访问的问题。 * 修复会话文件系统 API 可跟随指向工作区外的符号链接、导致宿主机文件被越权访问的问题。 * web: 会话活动指示器现与 Agent 实际工作保持同步;修复会话激活竞争或 LLM 重试后流式内容重复的问题。 * 修复 Anthropic 兼容供应商中自定义命名模型新会话思考强度被错误关闭、且 ACP 客户端不显示思考强度控件的问题。 * Anthropic 兼容模型现在正确遵循 `adaptive_thinking = false`,请求中不再携带 effort 参数。 * web: 修复服务器绑定非回环地址时 CSP 阻止 Web UI 主题初始化脚本与内置字体加载的问题。 * 修复工作区目录通过符号链接给出时会话创建失败的问题。 * 修复剪贴板图片读取失败导致 CLI 意外退出的问题,现在会回退为粘贴文本。 * web: 修复已完成的后台子 Agent 在会话重新加载后丢失最终输出的问题。 * web: 修复开发构建中 Enter 键无法确认模态对话框的问题。 * web: 修复流式输出期间后台子 Agent 在 agents dock 面板中显示为两行相同记录的问题。 * 修复 CLI 意外退出时诊断日志缺少实际错误信息的问题。 0.24.2(2026-07-15) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-24-2-2026-07-15) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-24) * 新增内置 `/check-kimi-code-docs` Skill,自动基于官方文档回答 Kimi Code 产品问题并附来源链接。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-25) * 对齐 `kimi -p` 在各引擎的行为:`print_background_mode` 与 `print_max_turns` 生效,`/goal` 会运行到目标结束。 * `kimi -p` 默认在后台任务未完成时保持运行,等待与轮次实际上不设上限,并把完成结果反馈给主 Agent。如需恢复旧的一轮后退出,可设置 `print_background_mode = "exit"` 或 `"drain"`。 * `kimi -p` 后台任务和子 Agent 默认不再超时(交互模式不变);如需恢复限制,可设置 `[background] bash_task_timeout_s` 或 `[subagent] timeout_ms`。 * 子 Agent 超时统一默认为 2 小时,可通过 `[subagent] timeout_ms` 或 `KIMI_SUBAGENT_TIMEOUT_MS` 覆盖。 * 每步 LLM 重试上限从 3 次提高到 10 次,供应商临时失败(429 / 过载)会在轮次失败前自动重试;可通过 `loop_control.max_retries_per_step` 调整。 * 工作区现在自动保持同步:新会话自动注册,缺失工作区启动时补全,已移除的不再重现。 * `kimi web` 现在会记录失败请求和关键操作,便于诊断服务问题。 * web: AgentSwarm 卡片在子 Agent 运行时保持展开。 * web: 最小化的计划审阅与问题卡片改用向上的 chevron 作为展开图标。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-32) * web: 修复 iOS 移动端布局问题,包括 composer、安全区和 toast。 * 修复新会话无法在旧版 CLI 中打开的问题。 * 修复子 Agent 完成时过早触发完成通知的问题。 * 修复 Web UI 显示错误 CLI 版本的问题。 * 修复 Gemini 模型的 tool call id 跨轮次冲突,导致 swarm 运行被合并到一张卡片的问题。 * web: 操作(如停止或归档会话)失败时现在会展示服务器错误详情。 * web: 修复标签页切换到后台后长响应卡住的问题。 * web: 修复纯 HTTP 下代码块复制按钮不可用的问题。 * web: 修复会话列表刷新失败时会话被清空的问题。 * web: 修复刷新页面后 AgentSwarm 成员列表丢失的问题。 * web: 修复首条消息为斜杠命令时会话标题不生成的问题。 * web: 修复重新加载会话后消息时间显示为会话创建时间的问题。 * 修复多个 `/goal` 模式问题,涉及预算与轮次上限、暂停与恢复、崩溃恢复、最终状态消息和无效的持久化目标记录。 * 修复被替换目标仍可能影响新目标预算的问题,并统一拒绝无效的子 Agent 目标。 * 修正目标无法暂停或恢复时显示的引导文案。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-1) * 将动态工具加载能力从 `select_tools` 重命名为 `dynamically_loaded_tools`,行为不变。 0.24.1(2026-07-14) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-24-1-2026-07-14) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-33) * 修复 preserved-thinking 历史包含空推理步骤时,Kimi 会话卡住的问题。 * 修复模型供应商在会话启动后才就绪时,内置工具不可用的问题。 * 修复思考强度(thinking effort)路由问题:非 Kimi 供应商现在保留配置值,Kimi 模型会校验运行时选择,并在模型解析时安全回退。 * web: 对齐 Web 端与 CLI 的思考级别处理:所选级别原样提交,不再被静默降级;未选择或切换模型时回退到模型自身的默认级别;显式选择会保存为默认值并被新会话继承。 * 修复目标完成摘要丢失的问题;步骤中断事件中的无类型 LLM 错误不再显示内部错误码前缀。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-26) * web: 模型标签只显示级别名称(如 Max),不再显示 "thinking: max"。 0.24.0(2026-07-14) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-24-0-2026-07-14) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-25) * web: 新增会话导出功能,运行 `/export` 或在会话的更多菜单中选择「导出会话」,可将会话与故障排查日志打包为 ZIP 下载(上限 64 MiB)。 * 前台 `Bash` 命令超时时不再被终止,而是转入后台继续运行,完成后回报结果。在 `config.toml` 的 `[background]` 下设置 `bash_auto_background_on_timeout = false` 可恢复超时即终止的行为。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-27) * web: 优化 `/goal` 模式控件,新增动画条交互、预算感知进度条,以及符合设计系统的取消确认。 * 优化会话关闭流程:先请求后台任务停止并留出宽限时间,再强制停止仍未退出的任务。 * 重写重复工具调用提醒,引导 Agent 采取其他动作,而不是禁止调用。 * 优化 `TaskOutput` 的工具提示词,避免 Agent 阻塞等待后台任务。 * 请求供应商 registry(api.json)和模型目录时携带 kimi-code-cli 的 User-Agent,便于 registry 识别客户端版本。 * Skill 解析失败时输出警告,不再静默丢弃;并修复 Skill 扫描结果的报告遗漏。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-34) * 修复超大图片读取污染会话的问题;已因请求过大报错的会话现在会自动恢复。 * 修复会话 fork 丢失内容的问题:fork 出的会话现在保留媒体附件、plan 文件、后台任务输出和 cron 任务,fork 失败也不再留下残缺副本。 * web: 修复重新打开、重连或重新同步会话时的多处渲染异常,包括上下文用量指示器归零、User 消息气泡重复,以及多步轮次中的文本重复。 * web: 修复通过非 localhost 地址连接服务器时,已上传的图片无法显示的问题。 * web: 修复从 `/goal` 控件恢复被阻塞的目标后,目标无法继续运行的问题。 * web: 修复子 Agent 仍在运行时刷新页面,AgentSwarm 成员列表消失的问题。 * web: 修复会话目标活跃时刷新页面,目标卡片消失的问题。 * web: 修复工作区选择器菜单宽度过窄、无法容纳内容的问题。 * web: 修复子 Agent 的瞬时速率限制被暴露为会话错误的问题,现在会自动恢复。 * 修复 Windows 上 git 来自原生 MSYS2 工具链(ucrt64/clang64/clangarm64)时 Bash 自动检测失败的问题。 * 修复登录过程中供应商配置发生变更时,OAuth 登录在浏览器授权完成后卡住的问题。 * 修复 OAuth 托管模型在 token 刷新后持续返回 401 时误显示重新登录提示的问题,现在会展示供应商的实际拒绝原因。 * 修复未配置 `base_url` 的供应商被拒绝的问题:anthropic/openai 等协议供应商现在会像以前一样回退到官方默认端点。 * 修复会话启动后的首个轮次无法使用 MCP 工具的问题。 * 修复粘贴的媒体和图片在 `/skill` 与插件命令参数中被丢弃的问题,以及使用 `Ctrl-S` 引导时图片被丢弃的问题。 * 修复空推理块在跨供应商时被丢弃、导致多步工具调用中断的问题。 * 修复自动权限模式下 plan 退出被标记为「用户已审阅」的问题:现在正确标记为自动批准,Agent 不会再误将其当作用户开始执行的信号。 * 修复恢复会话时后台任务可能丢失、或被错误标记为丢失的问题。 * 修复服务器关闭后可能残留实例文件的问题。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-2) * `kimi web` 默认切换到重构后的 Agent 引擎。 0.23.6(2026-07-12) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-6-2026-07-12) ------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-28) * web: 优化宽 Markdown 表格的显示,可超出阅读栏宽至 1040px,更宽时在表格内部横向滚动。 * web: 服务端访问令牌在关闭标签页或重启浏览器后最多保留 7 天,不再每次开新标签页都要求重新输入。 * web: 工作区选择器搜索框支持直接输入绝对路径添加工作区,输入时实时校验并给出补全建议。 * web: 切换到支持思考强度级别的模型时,自动启用默认思考强度。 * 导入自定义 registry 时识别 `support_efforts` 和 `default_effort` 字段,这些模型可设置思考强度(thinking effort)级别。 * 更新 `/plugins` 面板中打开的 WebBridge 安装页链接。 * 新增 `subagent.timeout_ms` 配置项(或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量),控制单个子代理的超时时间,默认从 30 分钟提高到 2 小时。 * 新增 print 模式后台策略:设置 `[background].print_background_mode = "steer"` 后,`kimi -p` 在后台任务完成后保持运行,继续引导主 Agent 进入后续轮次。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-35) * web: 修复断线重连后会话卡在发送状态的问题,断线期间完成的轮次现在能正常结束加载状态并发送下一条消息。 * web: 修复启动或更新 web UI 后首次访问时,初始鉴权检查失败跳转到登录页的问题;现在停留在连接界面,显示连接错误并持续重试。 * 修复 `kimi -p` 在目标仍活跃或有定时任务待触发时主轮次结束即退出的问题,目标续跑与定时任务触发现在能正常执行对应轮次。 * 修复关闭问题提示时默认选中推荐选项的问题,现在视为用户选择不回答。 * web: 修复恢复或重新加载会话后,ReadMediaFile 结果显示为普通工具卡片而非图片的问题。 * web: 修复滚动浏览对话历史时聊天视图向下跳动的问题。 * web: 修复模型下拉菜单中其他提供商的同名模型被错误勾选的问题,现在按唯一的模型 id 匹配当前模型。 * web: 修复会话较多时侧边栏卡顿的问题,移除了渲染期间重复的会话列表扫描。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-3) * 将动态工具加载的模型能力名称从 `select_tools` 重命名为 `dynamically_loaded_tools`。 0.23.5(2026-07-10) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-5-2026-07-10) ------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-29) * 优化 provider 429、过载等瞬时错误的重试可靠性,遵循服务端 Retry-After 等待时间,并在 `-p --output-format stream-json` 输出中展示重试事件。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-36) * 修复 AVIF、BMP、TIFF、ICO 等不支持的图片格式导致会话中断的问题,覆盖远程图片 URL、工具误标格式等所有入口。已卡住的会话会自动丢弃问题图片并重试,单张异常图片不再导致后续请求全部失败。 * web: 修复 “Turn finished” 桌面通知与完成提示音每轮触发两次的问题。 * web: 修复内部的图片压缩说明被当作用户消息文本显示的问题。 0.23.4(2026-07-10) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-4-2026-07-10) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-26) * web: 新增工具需要审批时的通知,并提升通知的可靠性。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-30) * web: 优化聊天界面,采用 Inter 字体、本地化标签与更紧凑的输入框和菜单样式。 * web: 优化会话侧边栏的布局、配色、图标与字体。 * `/usage` 和 `/status` 命令现显示 Extra Usage(加油包)余额。 * `/plugins` 面板的 Official 标签页新增 Kimi WebBridge 入口,可在浏览器中打开 WebBridge 安装页。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-37) * 控制图片较多会话的请求体积:超大体量的模型读取与粘贴图片(含 WebP)会自动压缩、缩小;HEIC/HEIF 图片会给出对应平台的转换命令,而非污染会话;HTTP 413 请求过大现可自动恢复——请求和 `/compact` 会用文本标记替换旧媒体后重试。相关限制可通过 `config.toml` 的 `[image]`(或 `KIMI_IMAGE_*` 环境变量)配置,且每个 core 独立保存设置,重新加载某客户端的配置不再影响其他客户端的图片压缩。 * 修复原工作目录已不存在的会话无法恢复的问题。 * 修复 prompt 模式目标未运行至完成的问题,并在发送 prompt 前校验并提示无效的目标命令。 * web: 修复新对话发送首条消息时偶发的 “another turn is active” 错误,并在发送过程中显示启动状态。 0.23.3(2026-07-08) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-3-2026-07-08) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-38) * 修复当前账户无法使用某模型时错误显示“OAuth 登录已过期”的问题。 0.23.2(2026-07-08) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-2-2026-07-08) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-27) * 内置插件市场新增 Vercel 插件,运行 `/plugins` 并选择 Vercel Plugin 即可安装。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-39) * 修复 `kimi -p` 在轮次失败时仍以退出码 0 退出的问题。 * 修复自主目标会被模型上报的状态更新暂停的问题。 * 修复启动自主目标的轮次未计入其轮次预算的问题。 * 将图片降采样上限从 2000px 提高到 3000px,并修复 EXIF 旋转(竖拍)照片在压缩说明与媒体读取备注中宽高互换的问题,使区域回读坐标正确对应。 * web: 修复从后台返回后,WebSocket 重连完成但连接错误提示仍残留的问题。 * 修复 Windows 上每次运行 hook 时控制台窗口闪烁的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-31) * web: 重新设计定时提醒界面。 * web: 在斜杠菜单中以 `/skill:<name>` 显示会话技能,便于与内置命令区分;直接输入技能名称仍然可用。 * web: 输入框的模型切换器在切换当前会话模型的同时,也会更新全局默认模型,使新会话继承该选择。 * web: 归档等确认对话框支持按 Enter 确认。 * 优化目标模式对阻塞与完成状态更新的指引。 * 渐进式工具加载(`select_tools`,实验功能):压缩后丢弃已加载的工具 schema,由模型重新选择仍需要的工具,使压缩后上下文保持精简;凭记忆调用未再加载的工具会被拒绝,并提示先选择。仅在启用 `tool-select` 实验标志且模型支持 `select_tools` 时生效。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-4) * web: 在构建时编译图标,使打包后的 web UI 仅包含实际渲染的图标。 0.23.1(2026-07-07) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-1-2026-07-07) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-40) * 修复 `kimi -p` 会丢弃启动较晚或运行时间较长的后台子 Agent、导致结果无法返回主 Agent 的问题。 * web: 修复后台标签页 WebSocket 失效后聊天流中断、必须刷新页面的问题,现在会自动恢复。 * 修复一些第三方模型如 Opus 4.8 错误回退到系列默认最大输出 token 数的问题,未收录的次要版本现在会沿用最近的已知较早版本的限制。 * 修复显式设置的 Anthropic `max_output_size` 被裁剪到内置上限的问题,现在会尊重用户配置。 * 修复工具输出中混入工具产生的 `<system>` 元数据的问题,失败的工具现在会显示其自身的错误信息。 * 修复目标完成或被阻塞时的更新行为,现在会从工具结果生成一条最终的、面向用户的结果摘要。 * 修复目标启动失败时未恢复权限模式、以及排队目标未等待新用户消息的问题。 * 修复目标 token 预算未计入模型补全 token 的问题,预算耗尽时现在会直接停止,不再执行额外的续跑步骤。 * 修复主 Agent 无法使用目标工具的问题,并为无效的目标控制调用返回清晰的提示信息。 * 修复交互模式下 `--skills-dir` 选项未生效的问题。 * web: 修复新会话页面上多个斜杠命令与 Skill 激活无效的问题:`/goal <objective>` 与斜杠 Skill 激活(如 `/pre-changelog`)之前毫无反应,`/btw [<question>]` 会打开一个空的侧聊。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-32) * Anthropic 供应商(Claude 与 Kimi 的 Anthropic 兼容模式)现在默认保留历史轮次的思考内容,与 Kimi 默认行为一致;可通过 `[thinking] keep = "off"` 或 `KIMI_MODEL_THINKING_KEEP=off` 关闭。 * 优化 `/permission`、`/auto`、`/yolo` 显示的权限模式描述,并在命令列表中调整 `/auto` 与 `/yolo` 的顺序。 * 长时间运行目标的运行时长预算提醒现在以小时为单位显示。 * 优化目标模式指引,使 Agent 在合理范围内跨轮次继续工作,避免过早结束目标。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-5) * 在会话 wire 日志中记录每次请求的追踪信息,以便在调试时还原模型请求。 0.23.0(2026-07-06) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-23-0-2026-07-06) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-28) * web: 在设置中新增「已归档会话」页面,可浏览并恢复已归档的会话,前往「设置 → 已归档」查看。 * 新增实验性的按需工具加载(`select_tools`):开启 `tool-select` 标志后,支持的模型会按需加载 MCP 工具,而非每次请求都发送全部工具,以保留供应商的 prompt cache。默认关闭,且仅对声明了 `select_tools` 能力的模型生效。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-41) * 修复会话已存在于磁盘却在会话列表中缺失、或直接访问时返回 404 的问题,服务器现在会在启动时重建会话索引。 * 修复 Bash 与 Edit 工具卡片在结果流式返回或输出较短时发生高度塌陷、跳动或闪烁的问题,并在视觉上分离 Bash 命令与其输出。 * 修复斜杠命令菜单关闭后输入框向上移位的问题。 * 修复 Ctrl+E 的编辑审批预览未包含上下文行的问题,现与摘要面板一致。 * 修复添加额外工作区目录后,大型项目中 `@` 文件补全会遗漏深层嵌套文件的问题。 * web: 修复多处 web 布局与动画问题:折叠的侧边栏现在会正确隐藏,打开会话时聊天记录不再重复播放入场动画,工具组件展开或折叠时不再顶动对话内容。 * web: 修复定时提醒(cron)触发时被隐藏的问题,现在以通知卡片形式显示在聊天中。 * web: 修复重新打开会话后回复末尾仍然缺失的问题。 * web: 修复排队的媒体消息无法重新载入输入框的问题,并在撤销消息时保留附件。 * web: 修复窄窗口与手机上输入框工具栏控件被裁切的问题,context ring 在任意宽度下均保持可见。 * web: 修复字体大小设置,使聊天文本、输入框文本与侧边栏文本均跟随所选字号。 * web: 修复输入框输入光标几乎不可见、已完成待办的删除线过于暗淡的问题。 * web: 修复 Windows 上会话搜索快捷键显示不正确的问题。 * 修复 Google Gemini 模型的工具调用,包括 Gemini 3 跨轮次的 thinking signature 往返。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-33) * web: 将 swarm 底部栏替换为单个内联工具卡片,实时展示子 Agent 进度与汇总结果,并使 swarm 进度条在刷新后保持稳定。 * TUI 在 compaction 后显示摘要,可按 Ctrl+O 显示或隐藏。 * web: 将 AskUserQuestion 的回答渲染为可读的选项列表并高亮已选项,替代原始 JSON。 * web: 在会话创建前,于输入框中显示可用的 skills。 * web: 在移动端设置面板新增「已归档会话」入口,并在归档确认提示中说明可从设置中恢复。 * web: 在桌面通知中显示 Kimi 图标与更清晰的标题。 * web: 让 markdown diff 代码块与设计系统对齐:代码文本保持正常文本颜色,由符号与柔和的行背景标识变更,与 `~/diff` 面板一致。 * web: 避免聊天文本在换行处断字,并渲染代码时不使用字体连字。 * web: 移除工具调用卡片正文多余的左缩进,使展开内容与标题对齐。 * AskUserQuestion 的回答现在以问题文本与选项标签的形式回传给模型,而非位置 id,模型无需再将其映射回原选项;每次调用的问题文本须唯一,每个问题的选项标签须唯一,现有客户端仍以选项 id 作答,无需修改。 * Kimi 模型开启 Thinking 时默认跨轮次保留推理,可设置 `[thinking] keep = "off"` 关闭。 0.22.3(2026-07-04) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-22-3-2026-07-04) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-42) * `kimi -p` 会在后台子 Agent 完成并返回结果后再退出,避免提前结束本轮。 * web: 修复 web 聊天中已上传视频无法播放的问题。 * 回退近期 TUI 对话渲染改动,恢复上游原始行为,修复相关渲染问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-34) * `kimi server run` 新增 `--dangerous-bypass-auth` 与 `--keep-alive` 选项,可在可信网络中跳过 token 校验运行服务器,并突破空闲超时保持存活。 * web: web 聊天中已上传的图片支持点击放大,点击消息中的图片即可在预览面板打开。 0.22.2(2026-07-03) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-22-2-2026-07-03) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-43) * 修复在一轮对话于工具调用与其结果之间被打断后,后续用户消息被静默丢弃的问题。 * 修复模型输出重复的工具调用 id 时,请求被严格供应商拒绝的问题。 * 修复 Windows 上 `kimi upgrade` 在安装新版本时因 spawn 错误而失败的问题。 * 修复流式输出期间滚动历史中对话内容重复出现的问题。 * 修复压缩图片的提示词会把内部 `<system>` 压缩说明泄露到可见消息和会话标题中的问题。 * 修复 Windows 上自动后台更新会弹出控制台窗口的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-35) * 优化 compaction 笔记:现在会记录剩余工作的后续计划(后续步骤、已确定的决策、可预见的障碍),而不仅是下一步,让 Agent 在自动压缩后更连贯地继续。 * 启动时从用户登录 shell 补充 PATH,使 shell 命令能找到用户自行安装的工具(如 Homebrew 的 `gh`),即使 kimi-code 启动时未继承完整的 profile PATH。 * 将语言匹配规则提升为系统提示词中的独立小节,使回复与推理在面对长篇英文工具输出时仍一致使用用户的语言,同时仓库产物仍遵循项目约定。 * TUI 新增一项偏好设置:当 bracketed paste 不可用时,避免快速多行粘贴被逐行提交。可在 `tui.toml` 中设置 `disable_paste_burst = true` 关闭该行为。 * 优化子 Agent 卡片,使其保持固定高度,并在紧凑的双行活动窗口内显示实时状态 spinner。 * `kimi -p` 运行时,若启用了 `background.keep_alive_on_exit`,退出前会等待后台子 Agent 完成。设置 `keep_alive_on_exit = true` 可让并发的后台子 Agent 执行完毕。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-6) * 在会话 wire 日志中记录模型响应 id,便于追踪单个模型请求。 0.22.1(2026-07-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-22-1-2026-07-02) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-44) * 修复 TUI 渲染错误导致屏幕空白、输入框消失的问题。 * 修复当输入包含 CJK 或 emoji 文本时,将终端调到极窄宽度会导致 TUI 崩溃的问题。 * 修复打开多个会话后 web UI 变得卡顿的问题。 * 通过 `/new`、`/clear` 或切换会话开启新会话时,现在会完整清空屏幕。 * 修复 web tooltip 在触发元素被移除时仍停留在屏幕上的问题。 * 修复侧边栏会话行在悬停时标题与状态徽章发生位移的问题。 * 修复会话搜索框在会话标题或摘要较长时出现横向滚动条的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-36) * 改进 compaction 交接摘要,使恢复会话更可靠:现在会保留最新意图、关键工具结果、决策、待解答问题以及需要复查的上下文。 * bash 模式新增 shell 命令历史:执行过的命令会保存到输入历史,在空的 `!` 提示符中按 Up 可浏览并回呼历史命令。 * 压缩超大图片时,会向模型说明原图与送达图片的信息,并保留原图,支持按裁剪区域或完整分辨率读取细节。 * 刷新 web UI 图标集,并统一消息复制与撤销按钮的悬停状态及 tooltip。 * web 侧边栏支持将已展开的工作区会话列表折叠回第一页。 * 精简 web UI 中冗余与不准确的 tooltip。 * web 输入框的发送按钮现在显示一个向上的箭头。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-7) * 移除实验性的 micro compaction 功能及其在实验面板中的开关。 * 移除 prompt 编辑器中重复的回车快捷键处理逻辑。 0.22.0(2026-07-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-22-0-2026-07-02) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-29) * 自动压缩超过模型限制的超大图片,在送达模型前降采样并重新编码,降低视觉 token 成本并避免供应商图片大小错误。 * 新增模型覆盖配置,在 `[models."<alias>".overrides]` 下配置模型元数据来覆盖供应商刷新结果。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-45) * 修复 web UI 中 plan、swarm 和 goal 模式在多个会话间共享的问题;现在每个会话各自保留独立的开关。 * 修复流式输出期间向上滚动历史记录时,transcript 会跳回顶部的问题。 * 在粘贴的图片与流式计时器不再显示后及时释放,避免长会话中内存持续增长。 * 修复崩溃或异常退出后终端停留在原始模式、光标隐藏且流控被禁用的问题。 * 修复活动工作区在加载时仅显示最近五个会话的问题;现在会从过去 12 小时内继续加载更早的会话。 * 修复默认开启 Thinking 的设置不生效的问题,新会话现在会正确以 Thinking 状态启动。 * 修复当操作已完成时,web 的 question、approval 和 task 操作会产生多余错误的问题,并新增加载反馈,使每次点击都立即得到确认。 * 草稿 pull request 现在显示独立的草稿状态,而不再被当作 open 展示。 * 当空间不足以展开标签时隐藏对话大纲,避免其被窗口边缘裁剪。 * 对于已提供多档思考强度的 always-on 模型,在 `/model` 思考切换器中隐藏不支持的 Off 选项。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-37) * 以全新设计系统刷新 web UI,包括更新的配色、字体与排版、间距、明暗调色板、重新设计的 tooltip,以及更细腻的进入/退出与展开/折叠动画。 * 将连续的工具调用归组为可折叠的堆栈,并为每个工具提供专属渲染:编辑显示 diff 行数标记,图片、视频和音频结果支持内联预览。 * 改进会话搜索,新增 Cmd/Ctrl+K 命令面板,可按标题、工作区和上一条 prompt 过滤并高亮匹配项。按 Cmd+K 或 Ctrl+K 打开。 * 在 web 聊天中将排队的 prompt 内联显示在当前轮次下方,并把 Stop 拆分为独立按钮,避免 Send 误中断。 * 对话大纲改为按每条用户提问显示为一项,悬停时展开为带标签的列表。 * 将 Explore 与 Native 主题选项替换为单一聊天布局,并提供 Blue 或 Black 强调色设置。 * 侧边栏新增工作区排序(按手动顺序或最后编辑时间),以及全部折叠/全部展开控件。 * web 错误与警告 toast 现在显示时间、耗时、连接与堆栈详情。 * web UI 的确认操作(归档会话、删除工作区、删除供应商、撤销消息、模式切换)统一使用一致的模态对话框。 * 缩小默认 TUI transcript 窗口,使长会话保持响应。 * 缩小 web 输入框的默认高度,使空状态更紧凑;并修复在多行草稿中编辑时 ArrowUp 会召回上一条消息的问题 —— 现在 ArrowUp 仅在文本最开头召回,且在展开的编辑器中禁用。 * 移除 web 聊天中撤销消息时的淡出动画。 0.21.1(2026-07-01) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-21-1-2026-07-01) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-46) * 修复加密推理流式输出期间,首个响应文本出现前等待 spinner 消失、留下一段空白的问题。 0.21.0(2026-07-01) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-21-0-2026-07-01) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-30) * 插件现支持在清单的 `commands` 字段中声明斜杠命令,注册为 `<plugin>:<command>` 形式,调用时展开 `$ARGUMENTS`。 * web 聊天新增 Mermaid 图表渲染,助手回复中的 `mermaid` 代码块会渲染为图表。KaTeX 数学公式与 Mermaid 图表的解析移至 Web Workers 执行,提升流式渲染时的界面响应速度。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-47) * 修复格式异常的消息历史会在严格供应商(Anthropic)上永久卡死会话的问题。发送前会修复请求:关闭孤立的工具调用、丢弃空白或纯空白文本块;若供应商仍拒绝其结构,则按 wire 协议合规格式重建并重发一次。 * 强制退出无头运行(`kimi -p`),以免运行残留的引用句柄让已完成的运行一直存活到外部超时;同时为 prompt 清理加上时限,避免某个卡住的关闭步骤拖挂整个关闭流程。 * 修复在斜杠命令参数中输入 `@` 文件提及时无法打开的问题。 * 修复 web UI 中通过路径添加工作区时,daemon 拒绝路径会静默失败的问题;现在会显示错误,而不是生成一个无法使用的工作区。 * 修复同一文件夹被重复注册时,web 侧边栏显示重复工作区的问题。 * 修复 web 工作区重命名在页面刷新后不保留的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-38) * 新增连按两次 Esc 打开撤销选择器的快捷键,空闲时连按两次 Esc 即可撤销。 * 在 shell 模式(`!`)下输入 `/` 时显示文件路径补全。 * web 设置中始终显示用量数据退出开关,并优化其标签与说明文案。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-8) * 重构对话压缩机制: * 仅保留最近的用户提示词与一条用户角色的摘要,丢弃助手与工具消息。 * 发送前修复 `tool_use`/`tool_result` 的相邻关系,修复工具调用与其结果不相邻时严格供应商返回 HTTP 400 的问题。 * 为严格供应商(Gemini/Vertex)合并连续的用户轮次,修复压缩后或在工具结果后立即插入引导轮次时出现的 HTTP 400("roles must alternate")问题。 * micro-compaction 现在默认关闭。 * 重构 thinking effort 系统。 * 新增服务端键值存储 API,用于将 web UI 偏好持久化到用户数据目录。 0.20.3(2026-06-30) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-20-3-2026-06-30) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-48) * 修复服务器返回 HTML 错误页面时,供应商错误消息在 TUI 中显示为空白行的问题。 * 修复 web 输入框被移动端 Safari 工具栏遮挡,以及输入框聚焦时页面自动放大的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-39) * 在后台自动刷新供应商模型列表,而非仅在启动时刷新,新上架的模型无需重启即可显示。 * Glob 现改用 ripgrep,默认遵循 .gitignore,支持花括号模式,仅返回文件,并在部分目录不可读时保留已有结果并给出警告。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-9) * 将格式错误的工具调用参数的处理与 schema 验证 fallback 对齐。 0.20.2(2026-06-29) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-20-2-2026-06-29) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-31) * Kimi Code 现支持 Anthropic 兼容协议,并支持视频输入。 * web UI 新增完成提示音与问题通知,并在设置中分别提供完成通知、问题通知和提示音的开关。问题通知默认关闭,仅在用户主动开启后才会将问题文本发送到桌面。 * 新增 `KIMI_CODE_CUSTOM_HEADERS` 环境变量,用于自定义出站 LLM 请求头,并向非 Kimi 供应商发送 `User-Agent` 请求头。将 `KIMI_CODE_CUSTOM_HEADERS` 设为由换行分隔的 `Name: Value` 行。 * 会话列表 API 新增可选的 `exclude_empty` 参数,用于省略没有任何消息的会话。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-49) * 遇到供应商 413 上下文溢出时,先压缩再重试以恢复。 * 默认将压缩输出限制在 128k token,避免供应商 `max_tokens` 错误。 * 修复压缩忽略已配置最大输出长度的问题。 * 修复在输入框输入或切换斜杠面板时不必要的全屏重绘。 * 在 web UI 中将未发送的输入框附件限定在所属会话内,切换会话时不再将其泄漏到另一个会话的下一条消息中。 * 修复 web 输入框在新会话发送首条消息后偶尔残留已输入文本的问题。 * 修复撤销轮次后调试计时输出残留的问题。 * 修复运行提示被挤压到 Agent Swarm 进度条上的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-40) * 将 web 询问用户问题卡片重做为分步向导,使多问题导航和最终的 Submit 操作更清晰。 * 在内置 web UI 中,现在仅在发送首条消息时才创建新会话,因此未选择工作区时点击 `+ New` 会打开输入框,而不是创建空会话。 * 在 web UI 中切换回某会话时恢复其滚动位置。 * 在 web UI 中切换会话时保持已打开的侧面板。 * 将 web 输入框的上下方向键输入历史限定在当前会话,不再跨会话共享。 * 在内置 web UI 中,`/new` 和 `/clear` 现在作为别名打开会话引导输入框并聚焦输入;文本输入框字号保持为 16px 即可避免 iOS 自动放大,无需再禁用视口缩放。 * 默认在 web 会话列表中隐藏未使用的 "New Session" 条目。 * 从 web UI 中移除 `/sessions` 斜杠命令,侧边栏已覆盖会话浏览功能。 * web 侧边栏每个工作区显示前五个会话,而非十个。 * 将 web 输入框附件按钮的加号图标替换为图片图标。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-10) * 将 Anthropic 兼容协议上的 Kimi Code 模型改走 beta Messages API。 * 升级 web Markdown 渲染器依赖(katex、markstream-vue、shiki),以修复问题并改进性能。 * 在轮次和 API 错误遥测中新增供应商类型与协议属性。 0.20.1(2026-06-26) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-20-1-2026-06-26) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-32) * 插件现支持在 `kimi.plugin.json` 中声明生命周期 hooks,在指定阶段运行脚本。详见[插件 Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E4%B8%AD%E7%9A%84-hooks) 。 * `/feedback` 现支持附加诊断日志与代码库上下文。 * 新增 `kimi update` 命令,等价于 `kimi upgrade`,可用于升级到最新版本。 * `kimi web` 新增 `--allowed-host <host>` 选项,可将指定 Host 加入 DNS 重绑定白名单;403 错误会提示如何通过 `--allowed-host` 或 `KIMI_CODE_ALLOWED_HOSTS` 放行,例如 `kimi web --allowed-host example.com`。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-50) * 修复 Windows 上 kimi server 首次运行后无法启动的问题。 * 修复 `/web` 命令打开的 Web UI 不会自动登录的问题,现在终端会打印访问 token。 * chat-completions 供应商的 `max_tokens` 现在不超过剩余上下文窗口,避免上下文溢出与无效参数错误。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-41) * 优化默认系统提示词与内置工具描述,避免 Agent 阻塞后台任务,统一各 profile 的工具指引,并补充展示工具结果详情(fetched-page 模式、Grep 匹配总数)。 * 缓存已渲染消息行,提升长对话下终端的响应速度。 * transcript 仅保留最近轮次并折叠早期步骤,保持长会话响应流畅。 * Web 聊天输入框支持随内容自动增高,长消息可使用可展开编辑器。 * 折叠待办面板时显示隐藏待办的状态明细(已完成 / 进行中 / 待处理)。 0.20.0(2026-06-26) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-20-0-2026-06-26) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-33) * TUI 新增 shell 模式。在输入框中键入 `!` 即可启用。对于长时间运行的命令,按 `Ctrl+B` 可将其移至后台。例如,你可以运行 `!gh auth login` 登录 GitHub CLI,无需打开新的终端。 * CLI 新增 `--host` 选项,可通过 `kimi web --host` 将服务器暴露到互联网,并加固 token 鉴权、限流等安全措施。 * Web UI 支持渲染 LaTeX 行间公式(`$$…$$`)。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-51) * 修复 Linux 上由未处理的原生剪贴板错误导致的启动崩溃。 * 修复当 CLI 通过 npm/pnpm 安装或从源码运行时,`kimi web` 和 `/web` 在 Windows 上因 `spawn EFTYPE` 无法启动后台服务器守护进程的问题。官方单二进制安装脚本不受影响。 * 修复终端窗口在 Linux Wayland 上反复失去焦点、导致输入法(IME)输入失效的问题。 * 不再在 60 秒后自动关闭 web UI 中的问题,使其等待用户的回答。 * 修复 explore 子 Agent 在 git 命令超时或目录不是仓库时静默丢失 git 上下文的问题。 * 修复压缩期间按 `Ctrl-C` 的问题,现在会先清除待处理的编辑器草稿,而不是立即取消。 * 修复会话由 web 服务器托管时 MCP 服务器工作目录的问题。 * 修复内置 web UI 在重新同步期间重复重新加载会话快照的问题。 * 修复模型的 Skill 列表中被截断的 Skill 描述缺少省略号的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-42) * 将 `/plugins` 重新设计为单个标签页面板:**Installed**(管理已安装插件——切换、移除、MCP、详情、重新加载)、**Official**(Kimi 维护的 marketplace 插件)、**Third-party**(来自其他发布者的 marketplace 插件)以及 **Custom**(直接从 GitHub URL、zip URL 或本地路径安装)。使用 `Tab` / `Shift-Tab` 切换标签页。 * 当 Agent 在 web 聊天中编辑或写入文件时,显示逐行 diff。 * 在 web UI 中退出 Plan 模式时,在计划审查卡片中显示计划正文和方案选项。 * 在子 Agent 的详情面板中显示其完整的累积进度,并以简洁的工具调用摘要替代原始 JSON。 * `/reload` 现在会刷新 Assistant 对插件 Skill 的视图,因此插件变更可在当前会话中生效,而无需启动新会话。 * 将静默的 AGENTS.md 截断替换为 TUI 状态栏和 web UI 中的可见警告。 * 在安装第三方插件前新增确认提示。 * 在 `/plugins` 的 Installed 标签页上显示更新徽章,现在按 `Enter` 安装可用更新,按 `I` 打开插件详情。 * 在 web 聊天的用户消息中新增复制按钮。 * 在预览被截断时保留完整的工具输出日志,并将后台任务完成通知链接到已保存的输出。 * 在服务器模式下,将会话标题变更同步到所有已连接的客户端。 * 在任务输出查看器中新增 `Ctrl+U` 和 `Ctrl+D` 作为向上翻页和向下翻页的快捷键。 * 在每轮步数上限错误中新增一条提示,指引用户查看 `loop_control.max_steps_per_turn` 配置项。 * 降低包含代码块的长 Assistant 消息的流式重绘开销。 * 按工作区分页加载 web 会话列表,使首屏不再预先获取全部会话。 * 避免 web 会话侧边栏在每个流式 token 上重新渲染,以提高渲染性能。 * 写入文件时自动创建缺失的父目录。 * 改进图片粘贴提示。 0.19.2(2026-06-24) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-19-2-2026-06-24) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-34) * 保持 web 侧边栏允许拖放工作区排序,排序结果在本地持久化;现在会话一旦收到新消息也会立即上浮到其分组顶部。 * 在模型选择器中新增 `Alt+S` 快捷键,仅切换当前会话的模型,而不保存为默认值。 * 新增 `Ctrl+T` 快捷键,用于展开和折叠被截断的待办列表。 * 新增 `-c` 作为 `--continue` 的简写。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-52) * 修复 web 应用中 YOLO 模式会自动批准计划审查和敏感文件访问的问题。 * 修复会话恢复时未重新对齐在历史中段被中断的工具调用的问题。 * 修复新会话首条消息之后,输入框的 `↑`/`↓` 输入历史回溯无效的问题。 * 修复偶发的陈旧行在较高内容收缩后留下重复输入框的问题。 * 修复内联图片在对话记录中被渲染为损坏的转义序列的问题。 * 修复嵌套在列表项中的代码块在 web 聊天的一轮生成结束后渲染为空白的问题。 * 修复 `Tab` 键意外打开文件补全列表的问题。 * 修复 web UI 通过普通 HTTP 提供时剪贴板复制操作失效的问题。 * 修复 web 问题提示缺少自由文本 Other 选项的问题。 * 修复 web 聊天停止操作,使过期的 prompt id 回退为取消当前会话。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-43) * 在受控内存中读取大型文本文件,并无需扫描整个文件即可读取尾部行。 * 在运行中的 Bash 工具卡片中显示命令,并允许在结果返回前使用 `Ctrl+O` 展开。 * 允许将 web 侧边栏和详情面板调整至可用视口宽度,并在窄窗口中保持其调整大小的手柄可达。 * 在 `Tab` 补全斜杠命令名称后显示子命令建议。 * 当剪贴板中检测到图片时显示一个短暂的底部提示,展示平台对应的粘贴快捷键。 * 在 web 侧边栏中跨页面重新加载持久化工作区分组的折叠状态。 * 在 web 侧边栏中新增用于本地开发的开发模式指示器。 * 优化加载提示的显示。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-11) * 将 web 应用的组件按功能子目录(chat/settings/dialogs/mobile)重组,并刷新组件路径注释。 * 将输入框的若干组件提取为可复用的 composable。 * 将纯轮次渲染辅助函数从对话面板中提取到独立模块。 * 将 beta 版对话大纲(目录)提取为独立组件。 * 将工作区分组渲染从侧边栏中提取为独立组件。 0.19.1(2026-06-23) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-19-1-2026-06-23) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-53) * 修复 ACP 编辑器(如 Zed)无法启动新会话的问题。 * 修复 web 侧边栏的未读圆点在不同浏览器标签页之间失去同步的问题。 * 在会话被归档或移除时清空该会话的全部状态,使已归档会话不再留下孤立数据。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-12) * 整合 web 客户端 localStorage 访问,并将根状态 store 与应用 shell 拆分为职责单一的 composable。 0.19.0(2026-06-22) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-19-0-2026-06-22) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-35) * 新增添加额外工作区目录的能力: * 使用 `/add-dir <path>` 命令将额外工作目录添加到当前会话,或将其记住到项目中。 * 使用 `kimi --add-dir <path>` 在启动时添加它们。 * 项目级本地配置现在由 `.kimi-code/local.toml` 管理;我们建议将其添加到你的 `.gitignore` 中。 * 允许使用 `Ctrl+B` 将长时间运行的前台命令和子 Agent 移动到后台任务,并通过 `/tasks` 面板查看它们。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-54) * 现在会显示供应商安全策略拦截,而不是将其静默视为已完成轮次,并防止在过滤响应后上下文 token 计数降为零。 * 修复当恢复的会话历史包含空文本内容块时供应商请求失败的问题。 * 在读取媒体时从文件内容检测真实图片格式,因此文件名扩展名不匹配不再会生成模型 API 拒绝的 data URL。 * 修复 Windows 上命令会闪现空白控制台窗口的问题。 * 停止在 web 侧边栏中为已取消或失败的会话显示未读圆点。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-44) * 通过直接磁盘读取器和请求超时保护加快会话快照加载,同时保留之前的路径作为遗留回退。 * 在 web 聊天标题中显示更长的分支名称,并在悬停时显示完整名称。 * 保持 web 页面标题固定,而不是随会话或工作区名称变化。 * 优化文件提及体验。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-13) * 在格式嗅探失败时统一图片格式检测。 * 整合 web 客户端 localStorage 访问,并将外观/通知状态解耦到专用模块中。 0.18.0(2026-06-18) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-18-0-2026-06-18) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-36) * 在 web 侧边栏中新增会话筛选,可过滤标题和最近一条用户提示词。 * 在 web 聊天会话视图中新增向上滚动时懒加载更早消息的功能。 * 新增环境变量以限制 AgentSwarm 在初始 ramp 阶段的并发数,使大型 swarm 更不容易触发供应商的速率限制。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-55) * 修复 web 应用只加载最近 20 个会话的问题。 * 修复 web 斜杠 Skill 选择会立即发送的问题,并允许斜杠搜索按子串匹配。 * 修复在浏览较长的斜杠菜单时高亮斜杠命令可见的问题。 * 修复最后一个会话归档错误的显示失败的问题。 * 修复 web 登录斜杠命令的描述,使其与浏览器授权流程相匹配。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-45) * 重新设计 web OAuth 登录对话框,使步骤顺序不再含糊。 * 在 web 设置中现在可以显示当前版本。 * 允许较长的 web 斜杠命令名称和描述自动换行,避免溢出斜杠菜单。 * 在插件变更提示中,增加 `/reload` 提示。 0.17.1(2026-06-17) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-17-1-2026-06-17) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-56) * 修复 `kimi web` 命令无法在后台启动的问题。 * 阻止后台本地服务器锁定启动时所在的目录。 * 防止点击背景时关闭 web 登录对话框。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-46) * 在 web 设置中按供应商对默认模型下拉框进行分组。 0.17.0(2026-06-17) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-17-0-2026-06-17) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-37) * 新增 Kimi Code Web 模式,可通过 `kimi web` 或 CLI 内的 `/web` 启动,在浏览器中的聊天界面继续会话。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-57) * 当 OAuth token 刷新在内部重试后失败时,显示底层连接错误,而不是提示登录。token 刷新失败不再在 agent 循环层级被重新重试。 * 在恢复会话时从持久化的循环事件中还原轮次计数器,避免恢复后的轮次重复使用历史中已存在的 turn id。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-47) * 当输出流太短而无法可靠测量时,跳过 debug TPS。 0.16.0(2026-06-16) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-16-0-2026-06-16) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-38) * 新增内置的 `kimi vis` 命令,可在浏览器中启动会话可视化工具,并指向本地会话。支持 `--port`/`--host`、`--no-open` 以及 `kimi vis <sessionId>` 深度链接。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-58) * 阻止 Anthropic 兼容供应商读取环境 Anthropic shell 凭证和自定义 header。 * 修复上下文仍超过阻塞阈值时的重复压缩处理问题。 * 防止会话关闭在停止后台任务时恢复 agent。 * 会话 replay 范围现在基于渲染后的 replay 记录构建,而非原始持久化记录。 * 在缓冲读取器被销毁时关闭被包装的输出流。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-48) * 将 `/btw` 侧面板的最大高度从终端的一半降低到三分之一。 * 优化队列面板样式。 * 新增可配置的横幅显示频率,并维护本地显示状态。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-14) * 移除冗余的 LLM 请求日志上下文传递。 0.15.0(2026-06-15) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-15-0-2026-06-15) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-39) * 新增全会话选择器视图,支持按名称搜索、分页浏览,以及为其他工作目录中的会话生成可复制的恢复命令。 * 新增对 legacy SSE MCP server 的支持,与 stdio 和 streamable HTTP 传输方式并存。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-59) * 修复中断的工具调用结果未被记录时,已恢复会话无法继续使用的问题。 * 停止将恢复版本标记写入持久化的 agent 元数据。 * 迁移后的配置文件中不再包含已废弃的 legacy loop、background、plan、yolo 或未知的实验性 flag。 * 修复 Xcode 26.5 MCP server 发出的 JSON Schema 类型与 Moonshot 不兼容的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-49) * 通过换行、压缩或截断可能超出渲染宽度的行,使 TUI 组件保持在窄终端宽度内。 * 在调用较重要的工具前,提示 CLI 以用户当前语言显示一句简短的状态说明。 * 将同语言规则扩展到模型的推理过程,使思考内容跟随用户语言,同时保留代码和技术术语的原始形式。 * 读取媒体文件时优先使用文件头检测到的类型,再回退到媒体扩展名。 * 在 Ctrl-C 取消活跃流之前,优先清除草稿编辑器文本。 * 在工作区提示词中折叠隐藏目录,并说明如何查看它们。 * 在已加载 skill 的上下文块中包含 skill 的目录,以便 agent 在调用 skill 后能够定位其打包资源(脚本、模板)。 * 当前工作目录没有会话时,显示全会话切换提示。 * 明确压缩摘要必须在最终答案中输出。 * 明确 AGENTS.md 提示词指导,并标记被截断的指令文件。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-15) * 通过静态查找而非实例化临时 provider 来解析模型能力。 * 将 agent skill 访问与 session 特定的注册表实现解耦。 * 优化 npm 打包系统。 0.14.3(2026-06-14) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-14-3-2026-06-14) ------------------------------------------------------------------------------------------------------- ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-50) * 在打开模型选择器前刷新供应商模型元数据。 0.14.2(2026-06-12) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-14-2-2026-06-12) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-60) * 修复 iTerm2 中无休止的桌面通知问题,仅向支持进度序列的终端发送终端进度序列。 * 在恢复会话时正确显示已完成和已取消的压缩记录。 * 丢弃无效的 `config.toml` 配置节并发出警告,而不是启动失败。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-51) * 在命令仍在运行时流式输出前台 Bash 的 stdout 和 stderr。 * 允许 `--auto`、`--yolo` 和 `--plan` 与 `--session` 或 `--continue` 组合使用,将请求的模式应用到恢复的会话。 * 为子 Skill 名称添加父前缀,并在 TUI 中将子 Skill 暴露为点状斜杠命令。 * 在启动刷新期间同步自定义 registry provider 的新增、移除和轮换的 registry key。 0.14.1(2026-06-12) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-14-1-2026-06-12) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-61) * 在会话关闭时取消活跃轮次,避免前台 shell 命令在 prompt 模式退出后继续运行。 * 会话关闭时默认停止后台任务。 * 防止重叠的交互式 Agent 请求使用错误的活跃 Agent。 * 修复 shell 进程超时或被终止时出现的过早流关闭错误。 * 将不支持的音频/视频降级为占位文本,并重新附加工具结果媒体,而不是静默丢弃它们。 * 将 OpenAI Responses 的系统提示词作为请求 instructions 发送。 * 在派生进程中透传已配置的执行环境覆盖项。 * 修复通过 IDE 客户端打开的 Windows 工作区中的 ACP 文件读取和编辑问题。 * 要求 AgentSwarm 工具调用在模型响应中单独运行。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-52) * 新增对动态 MCP server 更新、reference Skill、replay 时间戳和 Node 文件上传的运行时支持。 * 在从 Manual 模式启动 swarm 任务时新增 YOLO 选项。 * 优化内置 Skill。 * 在自动补全中通过别名查找斜杠命令 —— 输入 `/clear` 现在会提示 `new (clear)`。 * 在自动补全菜单中将过长的命令和 Skill 描述换行到第二行显示,而不是截断。 * 在启动时的欢迎面板下方显示提示横幅。 0.14.0(2026-06-10) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-14-0-2026-06-10) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-40) * 新增 `Interrupt` hook 事件,当用户中断某一轮次时(例如按 Esc)触发,让 hooks 可以观察到轮次正在停止,而不再卡在 working 状态。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-62) * 在使用 OpenAI 兼容的 Chat Completions 时保留工具输出的图像。 0.13.1(2026-06-10) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-13-1-2026-06-10) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-63) * 阻止在活跃 turn 期间 fork 会话,并将 wire protocol 定义整合到共享的内部包中。 * 修复 Kimi Datasource,使其在当前 Kimi Code 环境中使用匹配的 OAuth 凭证和服务端点。 * 修复 goal 标记文本超出终端宽度的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-53) * 在 Anthropic 供应商中新增对 Claude Fable 5 的支持。 * 新增交互式 undo 选择器和更清晰的 undo 限制提示消息。 * YOLO 模式在工作目录外写入或编辑文件时不再询问。 * 优化活跃 skill 提示词,使已加载的 skills 不再被表示为系统提醒。 * 收紧文件工具引导,使增量编辑通过 Edit 工具执行。 0.13.0(2026-06-10) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-13-0-2026-06-10) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-41) * 新增自定义颜色主题。在 `~/.kimi-code/themes/` 中以 JSON 文件定义自己的调色板,或使用内置的 `/custom-theme` Skill 命令生成。 * 新增 `/import-from-cc-codex` 命令,用于导入选定的 Claude Code 和 Codex 指令、Skills 以及 MCP 设置。 * 在 marketplace 中显示可用的 plugin 更新。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-64) * 修复 Windows 构建和开发启动可能因 package binary 解析到命令 shim 而失败的问题。 * 修复设备登录,在浏览器无法打开时保持 URL 和验证码可见。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-54) * 通过活跃状态细分和已用时间,更清晰地展示分组子 Agent 进度。 * 当排队消息超过终端宽度时,将其截断为单行并显示省略号。 0.12.1(2026-06-09) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-12-1-2026-06-09) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-65) * 允许过时的实验性配置条目保留而不阻塞启动。 * 为 OpenAI 兼容的 Chat Completions 请求透传 xhigh reasoning effort。 0.12.0(2026-06-09) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-12-0-2026-06-09) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-42) * 新增 `/swarm` 命令,用于运行 Agent Swarm,支持实时进度展示和速率限制感知重试。 * goals、background questions 和 sub-skill discovery 不再需要实验性开关即可使用。 * 支持标准环境变量 `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` / `NO_PROXY`(包括 SOCKS 代理)用于所有出站流量。 * 支持 Homebrew 安装。 * 默认启用 micro compaction,可在 `/experiments` 中关闭。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-66) * 修复 ACP 斜杠 Skill 路由、bootstrap 上下文读取、文件与权限边界情况、子 Agent 事件处理以及过期文件编辑消息的问题。 * 修复 goal 恢复行为,通过从 Agent 记录中恢复 goal 状态。 * 修复子 Agent 的 thinking 文本和工具输出显示。 * 修复 Windows 上由不一致的路径分隔符导致的会话工作目录不匹配问题。 * 修复 `/mcp` 状态面板边框被多行 MCP server 错误破坏的问题,现在会折叠到单行显示。 * 检测通过 Scoop 安装的 Git Bash 以及 Windows 上的其他 Git shim。 * 在迁移失败时显示底层错误。 * 允许通过重复按 Ctrl-C 或 Ctrl-D 退出启动会话选择器。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-55) * 移除每轮自动压缩上限,让长对话可以继续压缩而不是提前失败。 * 改进 goal 模式的结果处理,包括后续消息、更安全的错误暂停和更清晰的 TUI 对话记录展示。 * 直接展示完整 plan 卡片,并移除 Plan 卡片键盘快捷键。 * 在审批提示中换行显示过长的单行 shell 命令,以便完整命令始终可见。 * 重构 TUI 中的文件引用补全。 * 当设置了 `KIMI_CODE_HOME` 时,从该路径加载 Kimi 特定的用户 Skills 和全局 Agent 指令。 0.11.0(2026-06-05) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-11-0-2026-06-05) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-43) * 新增由环境变量 `KIMI_CODE_EXPERIMENTAL_SUB_SKILL` 控制的实验性子 Skill 发现能力。随附 `sub-skill` 内置包(`sub-skill.review`、`sub-skill.consolidate`),用于盘点 Skill 并将其整理为分层分组。 * 新增以下环境变量: * `KIMI_MODEL_TEMPERATURE`、`KIMI_MODEL_TOP_P` —— 全局应用于任意 `kimi` 供应商的采样参数(不绑定到 `KIMI_MODEL_NAME`)。 * `KIMI_MODEL_THINKING_KEEP` —— Moonshot 的 preserved-thinking 透传(`thinking.keep`),仅在开启 Thinking 时注入。 * `KIMI_CODE_NO_AUTO_UPDATE`(旧别名 `KIMI_CLI_NO_AUTO_UPDATE`)—— 完全禁用更新预检(不检查、不后台安装、不提示)。 * 将内置 Skill 显示为直接斜杠命令,并将其分组排在外部 Skill 命令之前。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-67) * 修复斜杠命令自动补全,让光标位于已有文本之前时也能提交目标文本。 * 修复已排队目标在晋升尝试失败时会丢失或重复的问题。 * 修复编辑或粘贴已排队目标时的待处理目标队列处理。 * 在 YOLO 模式下启动目标前进行询问,方便用户切换到 Auto 来处理无人值守工作。 * 当响应在产生可见输出前被拦截时,显示简洁的供应商过滤错误。 * 输入无效子命令时显示 “unknown command” 而不是 “too many arguments”。 * 将 OpenAI Chat Completions 的 `xhigh` 和 `max` thinking effort 限制为 `high`,除非模型在 `v1/chat/completions` 上支持 `xhigh`。 * 在压缩长对话时保留 thinking effort。 * 当能力变化而模型 ID 未变化时刷新供应商模型元数据。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-56) * 让待处理目标的确认样式与目标生命周期消息使用相同的强调处理。 * 当没有活跃目标需要等待时立即启动待处理目标。 支持在管理待处理目标时进行多行编辑。 * 为子 Agent 使用固定的 30 分钟超时,并在超时后显示简洁的恢复说明。 * 输入斜杠命令时高亮目标队列子命令。 0.10.1(2026-06-05) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-10-1-2026-06-05) ------------------------------------------------------------------------------------------------------- ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-68) * 修复在 TUI 中启动目标时的崩溃问题。 0.10.0(2026-06-04) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-10-0-2026-06-04) ------------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-44) * 用户现在可以为 Agent 准备多个目标,让它按顺序逐一处理。当前目标完成后,Agent 会自动从队列中取出下一个目标。使用 `/goal next <objective>` 将目标加入队列,使用 `/goal next manage` 交互式查看和修改队列。 * 新增内置的 `update-config` Skill —— 你现在可以让 Kimi 编辑它自己的配置文件。 * 新增持久化的实验性功能开关,以及一个 TUI 面板,确认后会通过重载当前会话来应用变更。 * 新增 `/reload` 以重载当前会话并应用更新后的配置文件,以及 `/reload-tui` 以仅重载 TUI 偏好设置。 * 新增 doctor 命令,用于校验 Kimi Code 的配置文件。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-69) * 将格式错误的 Responses 流速限错误规范化为供应商速率限制失败。 * 让托管的 OAuth 凭据始终限定在其配置的认证和 API 端点范围内。 * 阻止将活跃和已排队的目标带入派生会话。 * Windows 上若缺少 Git Bash,则在启动 CLI 会话前提前失败。 * 在展示前台更新提示前刷新更新目标,确保显示版本与安装版本一致。 * 将会话错误诊断指向 `/export-debug-zip` 命令。 * 设置终端标签页标题时不再重命名运行中的进程。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-57) * 启动时的更新检查一旦发现新版本,立即开始自动后台更新。 * 在启动期间将 CLI 进程标题设置为 `kimi-code`。 * 将编辑工具错误中的过期文件内容提示改为小写。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-16) * 确保 Nix 打包的 CLI 构建能够找到 ripgrep 和 fd。 ### 其他 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E5%85%B6%E4%BB%96) * 在 Windows 安装说明中补充 Git Bash 前置条件。 0.9.0(2026-06-03) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-9-0-2026-06-03) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-45) * 支持 `kimi acp` 子命令:kimi-code 现在可通过 stdio 使用 [Agent Client Protocol 0.23](https://agentclientprotocol.com/) ,因此 IDE(Zed、JetBrains AI Chat、自定义客户端)可以直接驱动会话;覆盖矩阵、Zed 配置和破坏性预发布说明见 [kimi acp 子命令页面](https://moonshotai.github.io/kimi-code/zh/reference/kimi-acp.html) 。 * 新增 `/btw`,用于进行不会引导当前主轮次的侧通道对话,并允许 `/btw` 在输入问题前打开侧通道面板。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-70) * 修复 Windows 上外部编辑器(Ctrl+G),移除对 `/bin/sh` 的依赖,并为临时文件路径使用平台感知的 shell 引号处理。 * 使用新版 Chat Completions 模型所需的 OpenAI completion token 字段。 * 使用已配置的模型输出上限作为 completion token 上限。 * 修复适用于 OpenAI 兼容供应商的 goal budget 工具 schema。 * 在访问已保存的子 Agent 时再惰性恢复它们。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-58) * 统一 TUI 对话框和选择器的交互与视觉效果。 * 启动时记录已启用的实验性 flag。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-17) * 允许 SDK 运行时创建使用单独的 RPC client,同时保留本地 CLI 启动流程。 0.8.0(2026-06-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-8-0-2026-06-02) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-46) * 新增实验性 goal 模式,用于需要多轮处理的较长任务。在启动 Kimi 前设置 `KIMI_CODE_EXPERIMENTAL_GOAL_COMMAND=1` 即可开启。 在终端界面中使用 `/goal <objective>` 让 Kimi 跨轮次持续专注于同一任务。例如: text /goal Fix the failing checkout test Kimi 会在终端界面中显示目标,并在工作过程中保持进度可见。使用 `/goal status`、`/goal pause`、`/goal resume`、`/goal cancel` 和 `/goal replace <objective>` 来管理该目标。该功能仍处于实验阶段,欢迎试用并反馈改进建议。 * 新增 `kimi provider` CLI 子命令,支持 `add`、`remove`、`list` 以及 `catalog list` / `catalog add` 操作,可在不启动终端界面的情况下导入和管理来自自定义 registry(api.json)或公开 models.dev 目录的供应商。 * 新增后台结构化提问,让 Agent 在等待用户回答时也能继续工作。 * 新增后台自动更新,可在 tui.toml 中关闭。 * 新增 `/undo` 斜杠命令,用于从对话历史中撤回上一条提示词,并在撤回时保持回放记录同步。 * 新增 `kimi upgrade` 命令,用于手动检查并升级 Kimi Code CLI。 * 新增审批生命周期 hook 事件,用于观察待处理和已完成的权限提示。 * 允许子 Agent 使用在其父 Agent 上注册的自定义工具。 * 支持用 glob 搜索显式的绝对路径(工作空间之外)。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-71) * 修复跨供应商回放时因不兼容的工具调用 ID 和未签名的 Claude thinking 历史导致失败的问题。 * 修复自定义 registry 供应商在重新导入时的处理问题,防止多供应商条目丢失,并移除过时的供应商及其模型别名和默认模型引用。 * 修复工具输出预览的渲染效果:去除尾部空行、为多行 Bash 命令标题附加省略号,并按视觉换行而非原始换行数裁切过长的单行输出。 * 修复斜杠激活的 skill 因缺少系统提示词包装器而未被模型识别的问题。 * 修复在过窄终端上 `/sessions` 选择器崩溃的问题,通过将每行渲染宽度限制在终端宽度内。 * 在括号展开前规范化 glob 模式,防止不正确的路径匹配。 * 防止退出 CLI 后仍出现修改过的键盘释放序列。 * 修复 Windows 上的 Git Bash 路径检测,额外搜索 `usr\bin\bash.exe` 路径,这是许多 Git for Windows 安装中 bash 所在的位置(这些安装中 `bin\bash.exe` 不存在)。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-59) * 在欢迎面板中展示 MCP server 摘要,并在 /mcp 命令输出中增加配置提示。 * 在欢迎界面及未配置模型时的提示中,将用户引导至 `/provider` 而非已移除的 `/connect` 命令。 * 将当前 todo 列表以 markdown 形式附加到压缩摘要中,再写入历史记录。 * 在页脚状态栏中显示完整模型名称,不再截断供应商前缀。 * 在长任务中提醒模型刷新 TodoList,并加强 TodoList 进度追踪引导。 * 将会话目录警告中的 chalk 具名颜色替换为主题感知的十六进制色值。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-18) * 将后台任务管理统一到 Agent 后台运行时中。 0.7.0(2026-06-02) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-7-0-2026-06-02) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-47) * 新增用于管理 AI 供应商的 `/provider` 命令,支持自定义 registry 导入,并引入标签页式模型选择器。该命令替代了已废弃的 `/connect`,请改用 `/provider`。 * 在终端界面中以独立样式渲染定时提醒,向 SDK 客户端暴露 cron 触发事件,并在报告 cron 触发时间时附带本地时区偏移。 * 新增 `KIMI_MODEL_ADAPTIVE_THINKING`(以及对应的 `adaptive_thinking` 模型别名字段),用于强制开启或关闭自适应 thinking(`thinking: { type: 'adaptive' }`),覆盖基于 Anthropic 模型名的版本推断。这样一来,背后由支持自适应能力的模型驱动、且使用自定义名称的兼容端点,即使模型名没有编码出可解析的 Claude 版本,也能选择启用该能力。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-72) * 清晰地报告被截断的压缩摘要,并在受支持的各供应商上应用有效的补全 token 额度。 * 修复 glob 模式的反斜杠转义,并在截断消息中包含匹配数量。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-60) * 明确 Kimi Platform API 密钥登录的标签和提示细节。 * 优化终端界面中的一处细微视觉交互。 0.6.0(2026-05-29) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-6-0-2026-05-29) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-48) * 新增 `KIMI_MODEL_*` 环境变量通道,让你无需编辑 `config.toml` 即可让 Kimi Code 使用指定模型(供应商类型、base URL、API 密钥、上下文大小、能力以及 thinking 设置)。 * 支持直接从 GitHub 仓库 URL 安装 plugin,并在 plugin 管理器中展示每次安装的来源和信任级别(kimi-official、curated、third-party)。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-73) * 在对话记录中显示后台 Agent 真实的最终状态,使丢失、失败和被终止的 Agent 不再显示为已完成;并在失败通知中包含用于恢复的 agent id 和恢复说明,让模型能够可靠地恢复。 * 在长对话中从供应商模型的 token 限制错误中恢复。 * 当模型响应流在传输中途被中断(`terminated` 错误)时自动重试,而不是让该轮次失败。 * 在各供应商的响应中一致地处理上下文溢出错误。 * 将失败的压缩重试按模型上下文窗口的固定一段进行退避。 * 修复原生自更新程序在安装命令实际失败时仍报告更新成功的问题。 * 将持久化的 hook 消息和被拦截的提示词消息投射到模型上下文中。 * 让被拦截的提示词 hook 的对话在后续的模型轮次中保持可用。 * 修复恢复不存在的会话时页脚泄漏到终端的问题。 * 修复当临时文件位于另一个文件系统上时 ripgrep 自动安装的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-61) * 移除每轮 1000 步的默认上限。用户仍可在配置中设置 `max_steps_per_turn` 来强制使用自定义上限。 * 支持在 listSessions 中通过 sessionId 或 workDir 查询会话,并在从其他工作目录恢复会话时显示一条便捷的 cd 命令。 * 扩充页脚轮换提示,展示更多命令和快捷键,并更突出地呈现较新和重要的内容。 * 改进终端界面中的用量信息展示。 * 将 plugin 信任徽章限制为仅匹配 Kimi 托管的 plugin CDN URL 模式。 * 明确子 Agent 和后台任务的停止消息为用户主动发起。 * 将数据源 plugin 对齐到通用的双工具工作流。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-19) * 引入 `ModelProvider` 接口和 `SingleModelProvider`,将 `Agent` 与 `ProviderManager` 解耦。 * 将 `RuntimeConfig` 拆分为 `Kaos` 和 `ToolServices`,并相应更新所有引用。 * 精简 LLM 诊断日志,使用更少、更紧凑的字段。 * 将共享的工具服务类型定义迁移到工具支持层。 0.5.0(2026-05-28) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-5-0-2026-05-28) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-49) * 新增定时任务: 你现在可以让 Agent 在指定时间提醒你、按重复的 cron 计划运行任务(例如每 5 分钟检查一次部署,或每个工作日上午 9 点生成一份日报),也可以让它在几分钟后自动回来继续之前的工作。 定时任务使用标准的 5 字段 cron 语法。 * 新增 `/auto` 斜杠命令和 `--auto` CLI 参数,用于启用 auto 权限模式。 * 在 `Write` 和 `Edit` 的审批提示中显示文件内容与 diff,并通过 `Ctrl-E` 在专用的全屏查看器中打开。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-74) * 修复压缩流程在无可压缩消息时的边界情况处理,并改进重试逻辑。 * 修复官方数据源工具,保留完整的响应内容,并写入返回的结果文件。 * 修复迁移把旧版 `default_yolo` 键映射到已废弃的 `yolo` 字段、而非 `default_permission_mode` 的问题。 ### 优化 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BC%98%E5%8C%96-62) * 在更新提示中新增可点击的变更记录链接。 * 用 `Ctrl-O` 展开 Bash 工具卡片时显示完整的 Bash 命令。卡片标题仍会将过长命令截断至 60 个字符,但展开后的视图现在会在输出上方显示完整的多行命令。 * 将写入终端窗口/标签页的会话标题从 80 个字符缩短到 32 个字符,避免较长的首条消息或粘贴内容把标签栏拉伸到难以阅读的宽度。 * 将嵌入式待办面板上限设为 5 行,并显示 `+N more` 指示器,避免较长的任务列表填满整个屏幕。 * 明确 plugin 管理器的键盘快捷键,并在原地显示 plugin 状态变化。 * 在 plugin 管理器的摘要中报告检测到的 plugin Skill。 * 将 `wire.jsonl` 中的大型 base64 媒体内容卸载到外部 blob 文件,减小 wire 体积,降低会话回放时的内存压力。同时为 `BlobStore` 增加内存级直读缓存,避免重复重建时产生多余的磁盘读取。 * 在 `AskUserQuestion` 对话框中对过长的问题、正文和选项文本进行换行显示,而不是用省略号截断。问题提示、正文描述、选项标签、选项描述以及提交标签页的复核条目现在会以悬挂缩进的方式分多行显示。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-20) * 重构终端界面的代码结构。 0.4.0(2026-05-27) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-4-0-2026-05-27) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-50) * 新增用户全局的 plugin 安装能力,包括交互式 plugin 管理、plugin 提供的 Skill,以及 plugin 自带的 MCP server。 * 在第二次粘贴时展开折叠的粘贴标记。 * 重做工具权限:cwd 之外的读取不再触发提示,会话级授权按完整调用精确匹配,基于路径的规则改为大小写不敏感。 * 新增 `/export-debug-zip` 斜杠命令,可直接在终端界面将当前会话导出为调试用 ZIP 归档。 * 新增 `/export-md` 斜杠命令,可将当前会话导出为 Markdown 文件。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-75) * 在启动时若 pull request 查询失败,避免终端界面崩溃。 * 修复在空 Thinking 增量产生孤立 Thinking 组件时,Thinking 旋转图标残留到轮次结束之后的问题。 * 派生会话后显示原始的会话恢复命令。 * 限制 plugin zip 安装:仅接受 manifest 位于归档根目录或单层包装目录的情况。 * 将带会话标签的日志条目独占地路由到会话 sink,不再同时写入全局 sink;并对所有携带 `agentId=main` 的会话日志行,统一省略主 Agent 中稳定不变的上下文键。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-21) * 重构终端界面中的会话恢复回放逻辑。 * 在常规轮次与压缩中,对瞬时 LLM 失败采用统一的重试分类。 ### 其他 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E5%85%B6%E4%BB%96-1) * 增强 `kimi export`,在 manifest 中记录更多诊断信息。 0.3.0(2026-05-26) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-3-0-2026-05-26) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-51) * `/logout` 现在会打开一个选择器,让你选择要登出的供应商,而不再总是登出当前模型所对应的供应商。当前供应商默认高亮,因此按 Enter 即可保持与此前一致的行为。该命令同时以 `/disconnect` 别名提供。 * `openai` 供应商现在开箱即用地支持 OpenAI 兼容的 reasoner 模型:自动识别响应中的 Thinking 字段(`reasoning_content` / `reasoning_details` / `reasoning`),并在历史包含 Thinking 时自动注入 `reasoning_effort`。DeepSeek、Qwen、One API 等网关服务无需再手工设置 `reasoning_key`,该字段仍可作为非标准网关的显式覆盖项。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-76) * 在流式输出或压缩上下文期间,阻止运行 `/model` 和 `/sessions` 斜杠命令。 * 在通过 `/connect` 配置 OpenAI 兼容模型时,保留模型目录中声明的 interleaved reasoning 字段。 * 修复 API 密钥输入对话框在空白状态下显示掩码点的问题。 * 修复 `~/.agents/` 下的用户 Skill 未被加载的问题。 * 恢复终端界面中运行中的子 Agent 的实时 token 显示。 * 在会话恢复时,若所有待办均已完成则隐藏待办面板。 * 在工具返回结果格式错误或缺失时,始终发出配对的工具结果,避免下一次请求因缺少 `tool_call_id` 而失败。 * 修复 Plan 模式下的会话重置:新会话在 Plan 评审被拒后不再失败,并能在初始化错误后继续接收事件。 * 在控制终端消失时及时退出。终端界面现在会处理 `SIGHUP` / `SIGTERM` 信号以及 stdout/stderr 的 `EIO` / `EPIPE` / `ENOTCONN` 错误,避免父 shell 或终端复用器异常退出后残留占用 CPU 核心的 `kimi` 进程。 * 避免本地补全上限过小,导致摘要生成前推理被截断。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-22) * 让 `AgentRecords` 直接持有 `Agent` 实例,并将恢复时的派发逻辑内联。 ### 其他 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E5%85%B6%E4%BB%96-2) * 改进 `Write` 工具的交互体验。 0.2.0(2026-05-26) [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#_0-2-0-2026-05-26) ----------------------------------------------------------------------------------------------------- ### 新功能 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E6%96%B0%E5%8A%9F%E8%83%BD-52) * 新增 `/connect` 命令,可从模型目录中配置供应商和模型。 * `/connect` 的供应商和模型选择器现支持键入即搜索过滤,长列表会自动分页;配置了较多模型时,`/model` 选择器同样支持分页。 * 在终端界面输入框中新增 `Ctrl-J` 作为插入换行的额外快捷键。 * 在会话回放过程中新增 wire 记录迁移处理。 * 在首次启动迁移期间,将用户 Skill 从 `~/.kimi/skills/` 迁移到 `~/.kimi-code/skills/`;已存在的目标 Skill 会被保留。 * 在 stream-json 输出格式中以结构化 meta 消息形式发出会话恢复提示。 ### 修复 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E4%BF%AE%E5%A4%8D-77) * 在 OAuth 设备信息中改为上报 macOS 产品版本,而不是 Darwin 内核版本。 * 将 `X-Msh-Platform` 请求头的取值修正为 `kimi_code_cli`。 * 在未配置模型时,澄清提示词模式下的错误提示,引导用户走登录流程。 * 在会话选择器中隐藏空的当前会话,同时保留其他空会话可见。 * 不再在迁移界面中提及 OAuth 凭据 —— 它们从不会被迁移,此前的 "needs /login" 提示会被误读为失败。仅使用 OAuth 的安装不再触发迁移界面。 * 在反馈、用量、登录和模型设置失败时,展示 API 返回的错误信息。 * 将终端界面中的模型选择持久化到默认配置,并在新会话中遵循已配置的默认 Thinking 状态。 * 在更新对话历史之前,对不包含摘要的压缩响应进行重试。 * 避免大体量流式工具参数导致的 CPU 峰值,并合并高频的流式 UI 更新。 * 在 wire 协议版本较新时改为继续恢复会话而不是失败。终端界面会显示一条警告,并在不进行迁移的情况下回放记录。 * 当 tmux 的扩展按键设置可能导致带修饰键的 Enter 快捷键无法工作时,向 tmux 用户发出提示。 * 默认让 Kimi 请求使用剩余的上下文窗口作为补全 token 的额度,同时将显式设置的环境变量上限作为硬上限保留。 ### 重构 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E9%87%8D%E6%9E%84-23) * 将工具调用数据扁平化,把工具名和参数内联到顶层,并限制旧版记录迁移仅重写匹配的工具调用数据。 * 将 wire 元数据处理移动到记录层,并将持久化后端的职责限制在存储操作上。 ### 其他 [​](https://www.kimi.com/code/docs/kimi-code-cli/changelog.html#%E5%85%B6%E4%BB%96-3) * 当未配置模型时,`/model` 和欢迎面板现在会引导用户使用 `/login`(针对 Kimi)和 `/connect`(针对其他供应商)。 --- # Agent 与 subagent | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#VPContent) Return to top Agent 与 subagent [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#agent-%E4%B8%8E-subagent) ====================================================================================================================== Kimi Code CLI 中的每次会话都由一个 **main agent** 驱动。main agent 理解用户意图、规划步骤、调用工具,并在需要时向外派发 **subagent** 处理更聚焦的子任务:探索一个陌生代码库、并行审阅多处实现、或在不触碰主上下文的情况下规划一次大型重构。 subagent 接受 main agent 给出的任务描述,在自己的独立上下文里工作,最后把结论返回。它不会与用户直接对话,中间的思考和工具调用记录也不会混入 main agent 的历史。 内置 subagent [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E5%86%85%E7%BD%AE-subagent) -------------------------------------------------------------------------------------------------------------------- Kimi Code CLI 内置三种 subagent,开箱即用,分别面向不同任务形态: * **`coder`**:默认 subagent,通用软件工程助手,可以读写文件、执行命令、搜索代码并落地具体改动。 * **`explore`**:代码库探索专用,只做只读操作,不修改任何文件。适合在不改动文件的前提下快速搜索、阅读和总结仓库。 * **`plan`**:实现规划与架构设计专用,连 Shell 命令都不提供,专注于"想清楚怎么做"而不是"动手做"。 三种类型之外,使用 subagent 还有三条约定,分别关于工具边界、委派深度和完成时机: `coder` subagent 与 main agent 共享大部分工具集:可以在后台执行 Shell 命令、维护待办列表、进入 Plan 模式、调用 Agent Skills。三种内置 subagent 都不能继续派发新的 subagent。 自定义 Agent 缺省时继承内置委派列表(`coder`、`explore`、`plan`),这些内置类型自身不能再派发,因此委派链默认必然终止,不存在不受限的递归派发。如需更深的委派链,可以在 Agent 文件中显式声明 [`subagents`](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#agent-%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F) 列表。 如果 subagent 结束自己的轮次时仍有后台任务在运行,这次运行会等这些后台任务全部落定后才回报完成。main agent 拿到结果时,背后的工作也已经真正完成。 调用方式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%B0%83%E7%94%A8%E6%96%B9%E5%BC%8F) ---------------------------------------------------------------------------------------------------------------------- 调度的完整链路只有三个环节:派发、审批、回收,都不需要手动管理。 subagent 由 main agent 自动调度:根据任务复杂度、上下文消耗和子任务的独立性,在适当时机派发,无需用户手动指定。 每次派发都会在终端以审批请求的形式呈现,方便你审视任务描述,除非你已用 allow 规则放行或处于 YOLO 模式。你也可以在对话中直接指示 main agent 使用特定 subagent,例如"先用 explore 把相关文件梳理一遍再动手"。 subagent 支持在后台运行:完成后结果自动回到 main agent,无需手动轮询。也可以唤回已有的 subagent 实例继续推进同一任务。 上下文隔离与资源开销 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E4%B8%8A%E4%B8%8B%E6%96%87%E9%9A%94%E7%A6%BB%E4%B8%8E%E8%B5%84%E6%BA%90%E5%BC%80%E9%94%80) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 每个 subagent 拥有完全独立的上下文窗口,只能看到 main agent 显式传入的任务描述,看不到 main agent 的对话历史。subagent 自己的中间思考和工具调用记录不会回流,只有最终结果会出现在 main agent 的上下文里。 这种隔离带来两个好处: * **main agent 上下文保持精炼**,长会话中不会被大量探索性日志撑满。 * **多个 subagent 可以并行运行**,互不干扰。 每个 subagent 都会独立消耗模型 token。简单任务没有必要派发 subagent,由 main agent 直接处理更经济。 权限继承 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E6%9D%83%E9%99%90%E7%BB%A7%E6%89%BF) ---------------------------------------------------------------------------------------------------------------------- subagent 的权限规则继承自 main agent:main agent 通过 `/permission` 或在审批中接受的"始终允许"规则,会自动覆盖到它派发出的所有 subagent,subagent 不需要重新审批同类工具调用。`Agent` 工具本身默认放行,因此 main agent 可以在不打断用户的前提下完成多次委派。 如果需要某类工具在 subagent 中始终不可用,应收紧 main agent 的权限规则。 自定义 Agent [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) ------------------------------------------------------------------------------------------------------------------------ 除了三个内置 subagent,你还可以用 Markdown 文件定义自己的 Agent。每个文件描述一个 Agent:文件顶部的 Frontmatter 声明名称、描述和工具权限,文件正文是它的系统提示词。 自定义 Agent 可以作为 subagent 被委派:main agent 会自动发现它们,与内置 subagent 并列。自定义 Agent 也可以在启动时选为 main agent。 ### Agent 目录 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#agent-%E7%9B%AE%E5%BD%95) Kimi Code CLI 按作用域发现 Agent 文件,作用域越具体,优先级越高:**显式(`--agent-file`)> 项目 > 额外 > 用户 > Plugin > 内置**。两个文件定义了相同的 `name` 时,高优先级作用域胜出。每个目录都会递归扫描 `.md` 文件。 **用户级**(对所有项目生效): * `$KIMI_CODE_HOME/agents/`(默认:`~/.kimi-code/agents/`) * `~/.agents/agents/` Kimi 专属的用户 Agent 目录随 `KIMI_CODE_HOME` 移动,通用的 `~/.agents/agents/` 目录留在真实用户目录下,便于跨工具共享。 **项目级**:项目根目录指从工作目录向上查找、最近的包含 `.git` 的目录。可用位置: * `.kimi-code/agents/` * `.agents/agents/` **额外目录**:在 `config.toml` 顶层通过 `extra_agent_dirs` 声明: toml extra_agent_dirs = ["~/team-agents", ".agents/team-agents"] **Plugin 级**:已启用 plugin 在其 manifest 的 `agents` 字段中声明的目录,省略时自动采用 plugin 根下的 `agents/` 目录,见 [插件 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6-agent) 。Plugin Agent 优先级仅高于内置 Agent。 **内置 Agent** 随 CLI 分发,优先级最低。目录中发现的文件不会仅凭同名覆盖内置 Agent;如确需替换,必须在 Frontmatter 中声明 `override: true`。通过 `--agent-file` 加载的文件视为显式启动意图,可以覆盖同名内置 Agent,优先级高于所有目录作用域,且仅对本次启动生效。 另外,`$KIMI_CODE_HOME/SYSTEM.md` 可永久覆盖默认 main agent 的系统提示词,它不参与 Agent 文件发现,优先级交互见 [SYSTEM.md 小节](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E7%94%A8-systemmd-%E8%A6%86%E7%9B%96-main-agent-%E7%9A%84%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) 。 信任模型 Agent 文件属于提示词配置,而项目级文件来自仓库本身,包括你刚刚 clone、尚不可信的仓库。项目作用域的文件可以完全接管内置 Agent:命名为 `agent.md` 并声明 `override: true` 会替换**默认 main agent 的整个系统提示词**,`coder.md` 加 `override: true` 则会替换默认 subagent 类型。不同于把 `AGENTS.md` 内容作为参考资料注入提示词,override 文件本身就是系统提示词,且不写 `tools` 的文件保留全部工具。在不熟悉的仓库中运行 Kimi Code 之前,请以对待脚本同样的谨慎检查其中的 `.kimi-code/agents/` 与 `.agents/agents/` 目录。 ### Agent 文件格式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#agent-%E6%96%87%E4%BB%B6%E6%A0%BC%E5%BC%8F) Agent 文件是带 Frontmatter 的普通 Markdown: markdown --- name: reviewer description: 严格的代码审查 Agent,按严重度分级报告问题 whenToUse: 代码评审与 PR 检查 override: false tools: - Read - Grep - Glob - mcp__github__* disallowedTools: - Bash --- 你是严格的代码审查者。阅读 diff 后,按严重度分级报告问题…… 各字段的含义如下: | 字段 | 必填 | 说明 | | --- | --- | --- | | `name` | 否 | kebab-case 唯一标识。缺省时取文件名去掉扩展名后的部分;名字缺失或不是 kebab-case 的文件会被跳过并告警 | | `description` | 是 | Agent 的用途。main agent 挑选 subagent 时会看到,请围绕委派决策来写 | | `whenToUse` | 否 | 补充说明何时应使用该 Agent | | `override` | 否 | 是否允许覆盖同名内置 Agent,默认 `false`。`--agent-file` 属于显式启动意图,无需设置此字段 | | `tools` | 否 | 工具允许列表。MCP 工具用 glob 匹配(如 `mcp__github__*`);支持 YAML 列表或逗号分隔字符串。缺省或单独的 `*` 表示允许全部工具,空列表表示禁用全部工具 | | `disallowedTools` | 否 | 工具禁止列表,写法与匹配规则和 `tools` 相同,在 `tools` 之后应用 | | `subagents` | 否 | 允许委派的 subagent 名称列表,写法与 `tools` 相同。缺省继承内置默认委派列表,单独的 `*` 表示可委派所有类型。main agent 的有效委派列表会自动并入所有发现的自定义 Agent | 内置工具与用户工具按名称精确匹配(区分大小写);以 `mcp__` 开头的条目按 glob 匹配 MCP 工具。以下三种写法永远匹配不到任何工具,在 profile 生效时会给出警告: * 在 `mcp__` 模式之外使用通配符:`disallowedTools` 里单独的 `*` 什么也禁不掉。 * 写不全的 `mcp__` 字面量:`mcp__github` 匹配不到任何工具;匹配整个服务器要用 `mcp__github__*`。 * 任何已注册或内置工具都没有的名字:通常是笔误,如把 `Read` 写成 `read`。 正文即 Agent 的系统提示词,每次构建提示词时都会作为模板渲染。`${var}` 占位符替换为实时上下文值:未知变量保持原样,单独的 `$` 没有特殊含义,上下文中缺失的变量渲染为空字符串。`${base_prompt}` 会在放置它的位置嵌入有效默认系统提示词(内置默认,或存在时为你的 `SYSTEM.md` 覆盖),因此文件可以包裹默认行为而不是替换它。如果文件替换默认提示词后仍要保留已启用 plugin 提供的指令,把 `${plugin_sections}` 放在希望出现这些指令的位置即可。可用变量见 [SYSTEM.md 变量表](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E7%94%A8-systemmd-%E8%A6%86%E7%9B%96-main-agent-%E7%9A%84%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) 。 未知字段会被忽略,新版本写的文件在旧版本上仍可读取。其他 Agent 工具的字段(如 Claude Code 的 `model`、OpenCode 的 `mode`)同样会被忽略。加上 `tools` 的逗号分隔写法和 `name` 缺省回退到文件名,Claude Code 与 OpenCode 风格的 Agent 文件一般可直接加载,只含 `description` 和正文的最小文件可跨工具通用。 目录中发现的非法文件会被跳过并告警,不影响其他文件。通过 `--agent-file` 显式传入的文件必须合法,否则 CLI 会报错并退出。 注意 `tools` 与 `disallowedTools` 不仅决定模型能"看到"哪些工具,还会在执行前再次强制检查。`subagents` 同样双重生效:`Agent` 工具的类型列表只包含允许委派的 subagent,`Agent` 与 `AgentSwarm` 在实际派发前都会强制校验;唤回已有 subagent 不受此限制。权限规则仍是独立的控制层,用于决定哪些操作需要审批。 作为 subagent 委派的自定义 Agent 不会携带内置 subagent 的角色框架("你的最后一条消息就是完整交付")。如果编写的 Agent 用于委派,请在正文中说明:其最后一条消息应当是交付给调用方的完整、自包含的结果。 ### 选择 main agent [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E9%80%89%E6%8B%A9-main-agent) 两个 CLI flag 用于选择驱动新会话的 Agent,在 print 模式(`kimi -p`)和交互式 TUI 中均可使用: * **`--agent <name>`**:以指定 Agent 作为 main agent 启动会话。名称可以指向内置 Agent 或任何已发现的文件;名称不存在时会报错,并列出可用的 Agent。 * **`--agent-file <path>`**:以最高优先级加载一个 Agent 文件(仅本次启动)并以其启动。该 flag 只接受一个文件:不可重复传入,也不能与 `--agent` 同时使用。 两个 flag 都仅在新建会话时有效,不能与 `--session`/`--continue` 组合。Agent 在会话创建时绑定,恢复会话时会自动还原已绑定的 Agent,因此恢复时不需要(也不允许)携带这些 flag。 例如: sh kimi --agent reviewer kimi -p --agent reviewer "审查这个分支上的改动" 绑定的 Agent 即会话的身份,在会话首次绑定后即固定,之后不可切换。在 TUI 中,这些 flag 只绑定启动时的会话;之后在同一进程内新建的会话(例如通过 `/new`)使用默认 Agent。 定制 main agent 时,在正文中引用 `${base_prompt}` 可保留有效默认提示词中已有的环境、工作区指令、Skill 和 plugin 注入。要替换默认提示词、但只保留 plugin 提供的指令,改用 `${plugin_sections}`。正文同时不引用这两个变量时,Agent 拥有完全独立的提示词,plugin 指令不会注入,适合自包含的场景。 ### 用 SYSTEM.md 覆盖 main agent 的系统提示词 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E7%94%A8-system-md-%E8%A6%86%E7%9B%96-main-agent-%E7%9A%84%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) 希望永久覆盖 main agent 的系统提示词、而不必每次启动都传入 `--agent` 或 `--agent-file` 时,可以写一份 `$KIMI_CODE_HOME/SYSTEM.md`,默认位置为 `~/.kimi-code/SYSTEM.md`,随 `KIMI_CODE_HOME` 移动。文件存在且非空期间,它整体替换内置默认 main agent 的系统提示词;但只替换提示词,描述、工具集与允许委派的 subagent 列表仍沿用内置默认值。SYSTEM.md 在包括交互式 TUI 会话在内的所有启动方式下生效。 SYSTEM.md 是纯 Markdown 正文,不需要也不读取 Frontmatter。文件缺失或为空时不生效;读取失败时会告警并回退到内置提示词。 优先级上,显式意图仍然胜出: * 项目作用域中声明了 `override: true` 的同名 Agent 文件、通过 `--agent-file` 传入的文件都排在 SYSTEM.md 之前。 * 用 `--agent` 选择其他 Agent 时,SYSTEM.md 不生效。 * 在用户作用域内部,SYSTEM.md 优先于 `agents/` 目录中扫描到的同名文件。 与普通 Agent 文件的正文一样,SYSTEM.md 在每次构建提示词时作为模板渲染,正文中的 `${var}` 占位符会被替换为实时上下文: | 变量 | 内容 | | --- | --- | | `${skills}` | 合并后的 Agent Skills 注入内容;`Skill` 工具不可用时为空 | | `${agents_md}` | 工作区指令文件(如 `AGENTS.md`)的内容 | | `${cwd}` | 当前工作目录 | | `${cwd_listing}` | 工作目录的文件列表 | | `${os}` | 操作系统类型 | | `${shell}` | Shell 名称与路径,例如 `bash (\`/bin/bash\`)\` | | `${now}` | 当前时间(ISO 格式) | | `${additional_dirs_info}` | 加入工作区的额外目录信息;没有时为空 | | `${base_prompt}` | 默认系统提示词。在 `SYSTEM.md` 中指内置默认提示词;在 Agent 文件中指有效默认提示词(内置默认,或存在时的 `SYSTEM.md` 覆盖) | | `${plugin_sections}` | 已启用 plugin 提供的完整 Plugin Instructions 块;没有已启用 plugin 提供指令时为空 | 未知变量原样保留,单独的 `$` 没有特殊含义;上下文中缺失的变量渲染为空字符串。另有四个预组合块 `${windows_notes}`、`${additional_dirs_section}`、`${skills_section}`、`${plugin_sections}`,渲染对应的内置提示词段落,不适用时为空字符串。 内置默认提示词已经包含 `${plugin_sections}`;当 `${base_prompt}` 已展开为该提示词时,不要再重复加入此变量。利用这些变量可以重建内置提示词的骨架,例如: markdown You are Kimi, running at ${cwd} on ${os}. ${agents_md} ${skills} ${plugin_sections} 指令文件 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E6%8C%87%E4%BB%A4%E6%96%87%E4%BB%B6) ---------------------------------------------------------------------------------------------------------------------- 全局 Kimi 专属指令可放在 `$KIMI_CODE_HOME/AGENTS.md`(默认:`~/.kimi-code/AGENTS.md`)。当你用 `KIMI_CODE_HOME` 移动数据根时,这份全局指令文件也会一起移动。跨工具通用指令仍可放在真实 OS home 下的 `~/.agents/AGENTS.md`,项目级指令仍放在项目目录中,例如 `.kimi-code/AGENTS.md` 或 `AGENTS.md`。 会话目录中的存储位置 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E4%BC%9A%E8%AF%9D%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E5%AD%98%E5%82%A8%E4%BD%8D%E7%BD%AE) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- subagent 的运行状态持久化到当前会话目录的 `agents/` 子目录下,每个 subagent 实例对应一个独立目录,其中包含按时间顺序记录提示词、消息历史与最终状态的 `wire.jsonl` 文件。后台 subagent 还会通过 `tasks/` 子目录暴露生命周期状态。 注意 会话目录、wire 文件和任务记录都属于本地调试材料,可能包含用户 prompt、命令输出、仓库路径、工具返回内容或凭证痕迹。不要把这些文件直接提交到公开仓库、issue 或聊天记录里;如确需分享,请先脱敏。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------ * [Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) — 在 subagent 完成等关键节点触发本地脚本通知或拦截 * [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) — 给 subagent 注入专业知识和工作流程 --- # Hooks | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#VPContent) Return to top Hooks [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#hooks) ======================================================================================= Hooks(钩子)是一种自动触发机制:你预先告诉 Kimi Code CLI"每当发生 X,运行这个脚本"。脚本在你的本机执行,你可以在里面写任何逻辑。典型的使用场景: * **安全拦截**:Agent 要执行 Shell 命令前,检查是否包含危险操作(如 `rm -rf`),包含则阻断执行 * **桌面通知**:后台任务完成时,弹出系统通知提醒你回来查看结果 * **自动检查**:每次用户提交消息时,自动在上下文里附加一些背景信息(如当前 Git 分支) Hooks 是怎么工作的 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#hooks-%E6%98%AF%E6%80%8E%E4%B9%88%E5%B7%A5%E4%BD%9C%E7%9A%84) ----------------------------------------------------------------------------------------------------------------------------------------------------- 配置一条 hook 规则,需要指定三件事:**在什么事件上触发**、**匹配哪些目标**、**运行哪个脚本**。 触发时,CLI 会把事件的详细信息(触发原因、工具名称、命令内容等)打包成 JSON,通过**标准输入**(stdin,程序运行时用来接收外部数据的通道)传给脚本。脚本读取这些信息后,决定怎么响应。 脚本的响应结果由两样东西决定: * **退出码**(exit code,程序结束时向操作系统报告的状态数字):`0` 表示放行,`2` 表示阻断,其他数字默认放行 * **标准输出**(stdout,脚本打印到终端的内容):可以附带说明文字 即使脚本报错或超时,CLI 也**不会因此中断你的工作**。这种"出错就放行"的设计称为 fail-open(失败开放),避免 hook 异常阻塞主流程。 注意 正因为 fail-open,Hooks 适合做提醒和轻量拦截,但**不应作为唯一的安全防线**。对真正高风险的操作,仍需依赖权限审批和人工确认。 快速上手:一个最简单的 hook [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B-%E4%B8%80%E4%B8%AA%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84-hook) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 下面这条 hook 会在每次后台任务完成时,在终端标题栏闪一下通知(macOS 需要安装 `terminal-notifier`): toml # 写在 ~/.kimi-code/config.toml 里 [[hooks]] event = "Notification" # 触发时机:后台任务状态变化时 matcher = "task\\.completed" # 只关心"已完成"的通知 command = "terminal-notifier -title Kimi -message 'Task done'" 保存配置、重开会话,下次后台任务完成时就会弹出通知。 配置 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E9%85%8D%E7%BD%AE) ------------------------------------------------------------------------------------------------- 所有 hook 规则写在 `~/.kimi-code/config.toml` 的 `[[hooks]]` 数组里: | 字段 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | `event` | `string` | 是 | 触发事件名,取值见 [事件一览](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E4%B8%80%E8%A7%88) | | `matcher` | `string` | 否 | 用正则表达式(一种字符串匹配语法)过滤事件目标;不填则匹配全部 | | `command` | `string` | 是 | 触发时要运行的 Shell 命令 | | `timeout` | `integer` | 否 | 超时秒数,范围 1–600;默认 30 秒 | `[[hooks]]` 只允许这四个字段,多写会导致配置文件加载失败。 **同一事件匹配多条规则时**,所有命中的 hook 并行运行;`command` 完全相同的多条规则只运行一次。 Hook 命令的工作目录是当前会话的项目目录。 进程组与超时处理 非 Windows 平台上,hook 进程运行在独立进程组中;超时后 CLI 先发送信号让脚本有机会善后,再强制终止。 ### 事件数据格式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F) 每次触发时,CLI 都会把以下基础信息通过 stdin 传给脚本: json { "hook_event_name": "PreToolUse", "session_id": "session_abc", "session_title": "修复登录页", "client_type": "kimi_code_cli", "cwd": "/path/to/project" } 具体事件还会附带额外字段(如工具名称、命令内容),见 [事件一览](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E4%B8%80%E8%A7%88) 。所有字段名使用下划线命名(snake\_case)。 返回值 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E8%BF%94%E5%9B%9E%E5%80%BC) ----------------------------------------------------------------------------------------------------------- 脚本结束后,CLI 根据退出码判断 hook 的意图: | 退出码 | 含义 | CLI 怎么处理 | | --- | --- | --- | | `0` | 正常结束,放行 | 继续执行,若标准输出(stdout)有内容可附加到上下文 | | `2` | 主动阻断 | 停止当前操作;错误输出(stderr,`console.error` 打印的内容)作为阻断原因 | | 其他非零值 | 脚本出错 | 默认放行(fail-open) | | 超时或崩溃 | 脚本异常 | 默认放行(fail-open) | 也可以通过标准输出返回一段 JSON 来阻断: json { "hookSpecificOutput": { "permissionDecision": "deny", "permissionDecisionReason": "请用 rg 代替 grep" } } 说明 只有**可阻断事件**(`PreToolUse`、`Stop`、`UserPromptSubmit`)的返回值会影响主流程。其余事件属于**观察型事件**:触发后即发即忘,不管脚本返回什么,主流程都不会改变。 事件一览 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%BA%8B%E4%BB%B6%E4%B8%80%E8%A7%88) --------------------------------------------------------------------------------------------------------------------- | 事件 | Matcher 匹配的是 | 会触发阻断? | 说明 | | --- | --- | --- | --- | | `UserPromptSubmit` | 用户提交的文本内容 | ✓ | 用户发送消息时触发;返回文本会附加到上下文,阻断则本轮不调用模型 | | `UserPromptQueued` | 排队消息的文本内容 | — | 上一回合仍在运行、新消息进入队列时触发;payload 含 `prompt_id`、`prompt`、`queue_length` | | `PreToolUse` | 工具名 | ✓ | 工具调用前、权限检查前触发;阻断后工具不会执行 | | `Stop` | 空字符串 | ✓ | 模型准备结束本轮时触发;阻断后可追加一条消息让模型继续 | | `TurnStarted` | 回合来源类型(如 `user`、`task`、`system_trigger`) | — | 新回合开始时触发;payload 含 `turn_id`、`origin_kind`、`origin_name`、`prompt` | | `PostToolUse` | 工具名 | — | 工具成功执行后触发 | | `PostToolUseFailure` | 工具名 | — | 工具失败或被阻断后触发 | | `PermissionRequest` | 工具名 | — | 即将等待用户审批前触发 | | `PermissionResult` | 工具名 | — | 审批结束后触发 | | `SessionStart` | `startup` 或 `resume` | — | 新会话启动或历史会话恢复后触发;payload 含 `source`、`model`、`profile` | | `SessionEnd` | `exit` 或 `archive` | — | 会话关闭后触发;`archive` 表示会话被归档而非退出 | | `SessionHeartbeat` | 空字符串 | — | 会话存活期间每 60 秒触发一次,仅配置本事件时计时器才运行;payload 含 `uptime_ms` | | `SubagentStart` | subagent 名称 | — | subagent 开始运行前触发 | | `SubagentStop` | subagent 名称 | — | subagent 成功完成后触发 | | `TaskStarted` | 任务类型(`agent`、`process` 或 `question`) | — | 后台任务启动时触发;payload 含 `task_id`、`description`、`detached` | | `StopFailure` | 错误类型 | — | 本轮因错误失败后触发 | | `Interrupt` | 空字符串 | — | 用户中断本轮时触发(如按 Esc);超时等程序性中断不触发,此时 `Stop` 由本事件替代;payload 含 `reason` | | `PreCompact` | `manual` 或 `auto` | — | 上下文压缩开始前触发;返回值被完全忽略 | | `PostCompact` | `manual` 或 `auto` | — | 上下文压缩完成后触发 | | `Notification` | 通知类型(如 `task.completed`) | — | 后台任务状态变化时触发 | 示例:阻断危险 Shell 命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E7%A4%BA%E4%BE%8B-%E9%98%BB%E6%96%AD%E5%8D%B1%E9%99%A9-shell-%E5%91%BD%E4%BB%A4) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 下面的 hook 在 Agent 调用 `Bash` 工具前检查命令内容,命中 `rm -rf` 时阻断: toml [[hooks]] event = "PreToolUse" matcher = "Bash" command = "node ~/.kimi-code/hooks/block-dangerous-bash.mjs" timeout = 5 js // block-dangerous-bash.mjs // 从 stdin 读取 CLI 传来的事件数据 let input = ''; process.stdin.on('data', (chunk) => { input += chunk; }); process.stdin.on('end', () => { const payload = JSON.parse(input); // 解析事件数据 const command = payload.tool_input?.command ?? ''; if (command.includes('rm -rf')) { // 通过 stderr 说明阻断原因,退出码 2 表示阻断 console.error('检测到危险命令,已阻断'); process.exit(2); } // 正常退出(退出码 0)表示放行 }); 阻断后,Kimi Code CLI 会把阻断原因写回上下文,模型可以据此选择更安全的替代方案。 注意 此示例仅演示阻断机制,不是生产级的安全解析器。真实场景更适合用白名单,或用专门的 Shell 解析器处理引号、变量展开和多段命令。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ----------------------------------------------------------------------------------------------------------- * [配置](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E9%85%8D%E7%BD%AE) — `[[hooks]]` 在 `config.toml` 中的完整字段声明 * [Agent 与 subagent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — 利用 `SubagentStop` 事件在 subagent 完成后触发通知 --- # 自定义主题 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#VPContent) Return to top 自定义主题 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%BB%E9%A2%98) ================================================================================================================================ Kimi Code CLI 可以使用内置配色,也可以使用自定义 JSON 主题文件。自定义文件放在主题目录下,会和内置选项一起出现在 `/theme` 里。 内置颜色 token [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E5%86%85%E7%BD%AE%E9%A2%9C%E8%89%B2-token) ---------------------------------------------------------------------------------------------------------------------------------- 自定义主题可以覆盖下面这些 token。`dark` 和 `light` 两列展示内置值;`auto` 会在启动时解析为其中一个调色板,如果无法检测终端背景,则回退到 `dark`。 | Token | `dark` | `light` | 控制什么 | | --- | --- | --- | --- | | `primary` | `#4FA8FF` | `#1565C0` | 最常用色。链接、行内代码、对话框选中项、聚焦边框、徽章、spinner | | `accent` | `#5BC0BE` | `#00838F` | 次级强调。审批 `▶` 前缀、设备码框、图片占位、面板、注册表导入 | | `text` | `#E0E0E0` | `#1A1A1A` | 正文。对话框正文、todo 标题、footer 模型名、Markdown 标题、列表符号 | | `textStrong` | `#F5F5F5` | `#1A1A1A` | 加粗强调文字。输入类对话框、状态消息 | | `textDim` | `#888888` | `#454545` | 次级、变暗文字。思考、提示、已完成 todo、Markdown 引用、footer 状态栏 | | `textMuted` | `#6B6B6B` | `#5F5F5F` | 最浅文字。计数、滚动信息、Markdown 链接 URL、代码块边框 | | `border` | `#5A5A5A` | `#737373` | 面板与编辑器的普通边框、Markdown 分隔线 | | `borderFocus` | `#E8A838` | `#92660A` | 聚焦/注意边框,目前仅审批面板使用 | | `success` | `#4EC87E` | `#0E7A38` | 成功态。`✓`、已启用、完成 | | `warning` | `#E8A838` | `#92660A` | 警告态。auto/yolo 徽章、过期标记、Plan 模式提示 | | `error` | `#E85454` | `#B91C1C` | 错误态。错误信息、失败的工具输出 | | `diffAdded` | `#4EC87E` | `#0E7A38` | diff 新增行 | | `diffRemoved` | `#E85454` | `#B91C1C` | diff 删除行 | | `diffAddedStrong` | `#7AD99B` | `#0E7A38` | diff 行内改动的新增词(加粗高亮) | | `diffRemovedStrong` | `#F08585` | `#B91C1C` | diff 行内改动的删除词(加粗高亮) | | `diffGutter` | `#6B6B6B` | `#737373` | diff 行号槽 | | `diffMeta` | `#888888` | `#5F5F5F` | diff 元信息 / hunk 头 | | `roleUser` | `#FFCB6B` | `#9A4A00` | 用户消息的子弹头与文字、技能激活名 | | `shellMode` | `#BD93F9` | `#7C3AED` | Shell 模式(`!`)的提示符、编辑器边框、回显的命令行 | 使用 custom-theme skill [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E4%BD%BF%E7%94%A8-custom-theme-skill) ---------------------------------------------------------------------------------------------------------------------------------------- 你不需要手写 JSON。运行内置的 `/custom-theme [附加文本]` skill 进入自定义主题流程:它会帮你选颜色,把文件写到 `~/.kimi-code/themes/`,校验十六进制色值,并告诉你如何应用。 调用示例: * `/custom-theme Create a warm dark theme with amber accents.` * `/custom-theme Make a light theme based on Solarized, but keep errors easy to see.` * `/custom-theme Tweak my ember theme so diffs have higher contrast.` 激活后,skill 通常会先问你想用浅色还是深色基准、偏好的风格或调色板,以及是否有必须包含的精确颜色。如果用它编辑已有主题,确保它先读取并备份文件,再覆盖写入。 创建一个主题 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E4%B8%BB%E9%A2%98) ------------------------------------------------------------------------------------------------------------------------------------------ 在主题目录下新建一个 `.json` 文件即可。主题目录是: * `~/.kimi-code/themes/` * 如果设置了 `KIMI_CODE_HOME` 环境变量,则是 `$KIMI_CODE_HOME/themes/` 目录不存在就自己建一个。文件名就是主题名:`ember.json` 会在 `/theme` 里显示为 `Custom: ember`。 一个最小的主题只需要写你想改的颜色,其余自动沿用基准调色板(默认是 `dark`): json { "name": "ember", "colors": { "primary": "#83A598", "accent": "#FE8019" } } 字段说明: * `name`(必填):主题的标识名。 * `displayName`(可选):人类可读的名字。 * `base`(可选):未指定的 token 沿用哪个内置调色板,`"dark"`(默认)或 `"light"`。做浅色主题时设为 `"light"`,否则未写的 token 会沿用 dark 调色板,在浅色背景上可能不可读。 * `colors`(可选):要覆盖的颜色 token,值是 6 位十六进制色值(如 `#FE8019`)。 使用 [内置颜色 token](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E5%86%85%E7%BD%AE%E9%A2%9C%E8%89%B2-token) 里的 token 名。没有写到的 token 会自动回退到所选基准调色板的对应值,所以你完全可以只覆盖一部分: json { "name": "just-blue", "colors": { "primary": "#3B82F6", "roleUser": "#3B82F6" } } 选用主题 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E9%80%89%E7%94%A8%E4%B8%BB%E9%A2%98) ---------------------------------------------------------------------------------------------------------------------- 两种方式: 1. **`/theme` 命令**(推荐):打开主题选择器,自定义主题会以 `Custom: <文件名>` 出现。选择器每次打开都会重新扫描主题目录,新加的主题文件无需重启就能看到。 2. **[`tui.toml`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tuitoml) **:把 `theme` 设成你的主题名: toml # ~/.kimi-code/tui.toml theme = "ember" 出错时会怎样 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E5%87%BA%E9%94%99%E6%97%B6%E4%BC%9A%E6%80%8E%E6%A0%B7) ------------------------------------------------------------------------------------------------------------------------------------------ 自定义主题的设计原则是"尽量别打断你": * **某个色值不合法**(不是 `#` 加 6 位十六进制):静默跳过这一项,并回退到所选基准调色板,其余颜色照常生效。 * **写了无法识别的 token**:忽略,不影响其它颜色。 * **自定义主题文件不存在或 JSON 损坏**:静默回退到内置 `dark` 调色板,不会再尝试 `auto`。 编辑正在使用的主题 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E7%BC%96%E8%BE%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%E7%9A%84%E4%B8%BB%E9%A2%98) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 如果你修改的是当前正在生效的主题文件,改动不会自动重新加载。让新颜色生效有两种办法: * 运行 `/reload-tui`,它会重新读取 `tui.toml` 并重新应用当前主题(包括重新读取主题文件); * 或者在 `/theme` 里先切到另一个主题,再切回来。 注意 在 `/theme` 里重新选中同一个主题不会触发重载,只会提示 "Theme unchanged"。要重载已激活主题的改动,用上面两种办法之一。 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/themes.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------ * [配置文件](https://www.kimi.com/code/docs/kimi-code-cli/configuration/config-files.html#tuitoml) — `tui.toml` 的完整字段说明,包括 `theme` 配置项 --- # kimi acp 子命令 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#VPContent) Return to top `kimi acp` 子命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#kimi-acp-%E5%AD%90%E5%91%BD%E4%BB%A4) ============================================================================================================================== `kimi acp` 把 Kimi Code CLI 切换到 **ACP (Agent Client Protocol)** 模式:在标准输入/输出上以 JSON-RPC 形式与 ACP 客户端(如 Zed、JetBrains AI Chat 等)对话,让 IDE 直接驱动 kimi 的会话、prompt 与工具调用。 sh kimi acp 启动后命令不会打印任何 banner,立刻等待 ACP 客户端在 stdin 上发出 `initialize` 请求。日志会写到标准错误(以及 `~/.kimi-code/logs/` 下的诊断日志),所以 ACP 通道本身保持干净。 谁会调用它? 你通常不需要手动跑 `kimi acp`——这个命令是给 IDE 的子进程入口准备的。IDE 端的配置见[在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) 。 能力矩阵 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#%E8%83%BD%E5%8A%9B%E7%9F%A9%E9%98%B5) -------------------------------------------------------------------------------------------------------------------- 下表列出 ACP server 声明的能力。`agentCapabilities` 字段在 `initialize` 响应里完整返回,IDE 端可据此调整 UI。 | 能力 | 取值 | 说明 | | --- | --- | --- | | `loadSession` | `true` | 支持 `session/load` 续接已有会话,加载时会同步回放历史 | | `promptCapabilities.image` | `true` | 支持 ACP `image` 内容块(base64 + mimeType) | | `promptCapabilities.audio` | `false` | 暂不支持音频 prompt | | `promptCapabilities.embeddedContext` | `true` | 客户端可发送 `resource`/`resource_link` 嵌入式资源块,文本内容会以 `<resource uri="...">...</resource>` 形式注入 prompt;blob 资源被丢弃并写 warn | | `sessionCapabilities.list` | `{}` | 支持 `session/list` 枚举当前用户的会话 | | `sessionCapabilities.resume` | `{}` | 支持 `session/resume` 重新挂接会话,不回放历史 | | `sessionCapabilities.close` | `{}` | 支持 `session/close` 拆除存活中的会话 | | `sessionCapabilities.delete` | `{}` | 支持 `session/delete` 永久删除会话 | | `sessionCapabilities.fork` | `{}` | 支持 `session/fork` 从已有会话分叉 | | `sessionCapabilities.additionalDirectories` | `{}` | 额外工作目录,仅在 `session/new` 时生效 | | `mcpCapabilities.http` | `true` | 转发 IDE 配置的 HTTP MCP 服务 | | `mcpCapabilities.sse` | `true` | 转发 IDE 配置的旧式 SSE MCP 服务 | | `auth.logout` | `{}` | 支持 ACP `logout`,丢弃托管供应商的 token | ACP 方法覆盖 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#acp-%E6%96%B9%E6%B3%95%E8%A6%86%E7%9B%96) ---------------------------------------------------------------------------------------------------------------------------- 在 `@agentclientprotocol/sdk@1.x` 中,ACP 方法按命名空间组织:`core` 与 `session` 覆盖主 agent 流程,`providers`、`nes`(inline-edit 预测)与 `document`(缓冲区同步)是可选扩展面;客户端侧的 reverse-RPC 方法则分组在 `session`、`fs`、`terminal` 与 `elicitation` 下。 **概览:ACP server 实现了全部 core(3/3)与 session(11/11)agent 侧方法、10/11 客户端 reverse-RPC 方法,以及 `session/set_model` 扩展方法。未实现:`providers/*`、`nes/*`、`document/*` 与 `elicitation/complete`——对这些方法的请求一律返回 `methodNotFound`。** ### core agent 侧 — IDE → agent(3 / 3) [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#core-agent-%E4%BE%A7-%E2%80%94-ide-%E2%86%92-agent-3-3) | 方法 | 状态 | 说明 | | --- | --- | --- | | `initialize` | 是 | 版本协商;返回 `agentInfo: { name: 'Kimi Code CLI', version }`、能力矩阵、`authMethods`(一等 `type:'terminal'` 加旧式 `_meta['terminal-auth']` 回退) | | `authenticate` | 是 | 校验 `method_id='login'`;token 缺失返回 `authRequired (-32000)`,未知 id 返回 `invalidParams (-32602)` | | `logout` | 是 | 丢弃托管供应商的 token;后续受限调用会再次返回 `auth_required` | ### session agent 侧 — IDE → agent(11 / 11) [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#session-agent-%E4%BE%A7-%E2%80%94-ide-%E2%86%92-agent-11-11) | 方法 | 状态 | 说明 | | --- | --- | --- | | `session/new` | 是 | 接受 `cwd` / `mcpServers` / `additionalDirectories`,返回 `sessionId` + `configOptions[]` + `modes` | | `session/load` | 是 | 恢复磁盘会话,在响应返回前把历史以 `session/update` 同步回放 | | `session/resume` | 是 | `session/load` 的轻量兄弟方法,跳过历史回放 | | `session/list` | 是 | 枚举磁盘会话,可按 `cwd` 过滤 | | `session/fork` | 是 | 从源会话分叉;请求上的 `cwd` / `additionalDirectories` / `mcpServers` 会被忽略并写 warn | | `session/close` | 是 | 尽力拆除:中断进行中的 turn、释放会话级资源并关闭存活会话;未知 id 不算错误 | | `session/delete` | 是 | 永久删除会话及其持久化数据;未知 id 返回 `invalidParams (-32602)` | | `session/prompt` | 是 | 接受 `text` / `image` / `resource` / `resource_link` 内容块,流式输出 `agent_message_chunk` | | `session/cancel` | 是 | 中断当前 turn(针对 prompt 的 JSON-RPC `$/cancel_request` 走同一条取消路径) | | `session/set_mode` | 是 | 校验 `modeId`,与 `set_config_option({configId:'mode'})` 走同一个模式切换 | | `session/set_config_option` | 是 | 统一的 model / thinking / mode picker 分发 | ### 客户端 reverse-RPC — agent → IDE(10 / 11) [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#%E5%AE%A2%E6%88%B7%E7%AB%AF-reverse-rpc-%E2%80%94-agent-%E2%86%92-ide-10-11) | 方法 | 状态 | 说明 | | --- | --- | --- | | `session/update` | 是 | 流式推送 `agent_message_chunk` / `tool_call*` / `plan` / `config_option_update` / `available_commands_update` | | `session/request_permission` | 是 | 工具审批和问题提问共用此通道 | | `fs/read_text_file` | 是 | 客户端声明 `fsCapabilities` 时,引擎的文件读取路由到客户端 | | `fs/write_text_file` | 是 | 引擎的文件写入路由到客户端 | | `terminal/create` · `output` · `release` · `kill` · `wait_for_exit` | 是 | 客户端声明 `clientCapabilities.terminal` 时,shell 执行通过 reverse-RPC 交给客户端 | | `elicitation/create` | 是 | 客户端声明 `elicitation.form` 时,ask-user 问题走原生表单;RPC 失败回退 `session/request_permission` | | `elicitation/complete` | 否 | | ### 扩展方法 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#%E6%89%A9%E5%B1%95%E6%96%B9%E6%B3%95) | 方法 | 状态 | 说明 | | --- | --- | --- | | `session/set_model` | 是 | 从 ACP 0.23 不稳定面保留下来的扩展方法,等价于 `set_config_option({configId:'model'})` | 上述未列出的方法一律返回 `methodNotFound`。 MCP 转发 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#mcp-%E8%BD%AC%E5%8F%91) -------------------------------------------------------------------------------------------------------- ACP 客户端在 `session/new` 或 `session/load` 中提供 `mcpServers` 时,ACP server 做如下转换: * `http` → kimi 的 `transport: 'http'` 配置 * `stdio` → kimi 的 `transport: 'stdio'` 配置 * `sse` → kimi 的 `transport: 'sse'` 配置 * `acp` → 丢弃并写一条 warn 日志 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-acp.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ---------------------------------------------------------------------------------------------------------- * [在 IDE 中使用](https://www.kimi.com/code/docs/kimi-code-cli/guides/ides.html) — Zed / JetBrains 配置步骤和故障排查 * [kimi 命令参考](https://www.kimi.com/code/docs/kimi-code-cli/reference/kimi-command.html) — 完整子命令列表 --- # Plugins | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#VPContent) Return to top Plugins [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#plugins) ============================================================================================= Plugins 把可复用的 Kimi Code CLI 能力打包成可安装单元:可以添加 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 、自定义 [Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) ,可以指定会话启动时自动加载的 Skill、提供系统提示词指令,也可以声明 MCP servers 提供真实工具能力。适合把工作流共享给团队、连接外部服务,或从 [官方插件](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%98%E6%96%B9%E6%8F%92%E4%BB%B6) 安装扩展。 安装与管理 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E7%AE%A1%E7%90%86) --------------------------------------------------------------------------------------------------------------------------------- 在 TUI 中运行 `/plugins` 打开 plugin 管理器,面板内有四个 tab: * **Installed**:管理已安装的 plugin * **Official**:Kimi 官方 marketplace plugin * **Curated**:默认 marketplace 中来自 Kimi 合作伙伴的第三方 plugin * **Custom**:从 URL 安装 面板内按键: | 按键 | 操作 | | --- | --- | | `Tab` / `Shift-Tab` | 在 Installed / Official / Curated / Custom 四个 tab 间切换 | | `Space` | 启用或禁用选中的已安装 plugin(Installed tab) | | `D` | 移除选中的已安装 plugin(Installed tab) | | `M` | 管理选中 plugin 的 MCP servers(Installed tab) | | `R` | 重新加载 `installed.json` 和所有 manifest(Installed tab) | | `Enter` | Installed:有更新时安装更新,否则查看 plugin 详情;Official/Curated:安装或更新;Custom:安装 | | `I` | 查看 plugin 详情(Installed tab) | | `Esc` | 返回或取消 | 也可以使用斜杠命令: | 命令 | 说明 | | --- | --- | | `/plugins` | 打开交互式 plugin 管理器 | | `/plugins list` | 列出已安装 plugins | | `/plugins install <path-or-url>` | 从本地目录、zip URL 或 GitHub 仓库 URL 安装 | | `/plugins marketplace [source]` | 浏览官方 marketplace,或传入自定义 marketplace JSON 的路径或 URL | | `/plugins info <id>` | 查看 plugin 详情和 diagnostics | | `/plugins enable <id>` | 启用 plugin | | `/plugins disable <id>` | 禁用 plugin | | `/plugins remove <id>` | 移除 plugin(需二次确认) | | `/plugins reload` | 重载 `installed.json` 和各 plugin manifest | | `/plugins mcp enable <id> <server>` | 启用 plugin 声明的 MCP server | | `/plugins mcp disable <id> <server>` | 禁用 plugin 声明的 MCP server | ### 从 GitHub 安装 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E4%BB%8E-github-%E5%AE%89%E8%A3%85) 通过 `/plugins install <url>` 可以直接从 GitHub 仓库安装,支持四种 URL 形式: * `https://github.com/<owner>/<repo>`:安装最新 release;无 release 时回落到默认分支 * `https://github.com/<owner>/<repo>/tree/<ref>`:安装指定分支、tag 或短 commit SHA * `https://github.com/<owner>/<repo>/releases/tag/<tag>`:钉死具体 tag * `https://github.com/<owner>/<repo>/commit/<sha>`:钉死具体 commit 网络请求只走 `github.com` 重定向和 `codeload.github.com` 下载,不调用 `api.github.com`。 ### 注意事项 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9) * 安装、启用/禁用、移除 plugin 后,当前会话不会更新,运行 `/reload` 或 `/new` 后生效。 * 本地安装会被拷贝到 `$KIMI_CODE_HOME/plugins/managed/<id>/`,CLI 始终从这份托管副本运行。安装后编辑原始源目录不会生效,需重新安装。 * 移除 plugin 只会删除安装记录,托管副本和原始源文件仍保留在磁盘上。 * Plugin 目前按用户安装,对所有项目生效,暂不支持项目级安装范围。 ### 自定义 marketplace JSON [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%87%AA%E5%AE%9A%E4%B9%89-marketplace-json) 浏览自定义目录时,把 JSON 路径或 URL 传给 `/plugins marketplace <source>`,或通过 [`KIMI_CODE_PLUGIN_MARKETPLACE_URL`](https://www.kimi.com/code/docs/kimi-code-cli/configuration/env-vars.html) 覆盖默认 marketplace。`plugins` 数组中每个条目需要 `id` 和 `source` 两个字段,`source` 支持本地路径、zip URL 和 GitHub URL: json { "version": "2", "plugins": [\ {\ "id": "my-plugin",\ "displayName": "My Plugin",\ "source": "./my-plugin"\ }\ ] } 官方插件 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%98%E6%96%B9%E6%8F%92%E4%BB%B6) ----------------------------------------------------------------------------------------------------------------------- 官方插件是 Kimi 官方维护的 plugin 和内置产品能力,目前有以下三种: * **[Kimi Datasource](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-datasource) **:用自然语言查询金融行情、财经资讯、宏观经济、企业工商、学术文献、法律法规和国际组织官方数据 * **[Kimi Browser Extension](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-browser-extension) **:让 AI 直接操控你自己的浏览器,完成各类网页操作 * **[Kimi Computer Use](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-computer-use) **:让 AI 操作你的桌面应用(macOS 和 Windows) ### 安装与升级 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E4%B8%8E%E5%8D%87%E7%BA%A7) 官方插件的安装与升级流程一致: 1. 运行 `/plugins`,按 `Tab` 键选中 **Official** tab 2. 找到要安装的插件,按 `Enter` 安装 3. 安装完成后运行 `/reload` 或 `/new` 激活 说明 Kimi Browser Extension 分两步安装:完成上述步骤后,还需要[安装浏览器扩展](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#install-the-browser-extension) 才能使用。 官方插件不会自动更新,使用旧版时会提示更新。升级到新版本只需重复上述安装步骤。 ### Kimi Datasource v3.4.0 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-datasource) Kimi Datasource 是 Kimi Code 官方数据插件。用自然语言直接查询金融行情、财经资讯、宏观经济、企业工商、学术文献、中国法律法规和国际组织官方数据,无需手动调用接口或申请数据账号。 数据来源包括世界银行、IMF、OECD、FRED、WHO、FAO、国家统计局、Wind、S&P Capital IQ、SEC EDGAR、财新、新华财经、恒生聚源等权威机构与知名数据库,信源可溯源。 > 使用前需先通过 `/login` 完成 Kimi Code 账号 OAuth 登录。数据查询会消耗 Kimi Code 套餐额度。 #### 使用方式 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F) 1. 直接用自然语言描述需求,Kimi Code 会自动调用数据能力 2. 通过 `/skill:kimi-datasource` 明确触发数据查询 Skill #### 能做什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88) **实时量化研究** — 想盯着茅台做个量化分析? 一句话拉取近三年的每日收盘价、MACD 和 KDJ 信号,直接出结论,不用找第三方数据平台。 **跨国宏观对比** — 研究中印越产业转移? 基于世界银行 50 年历史数据,一次查询拿到三国 GDP 增速、贸易额、人口结构的完整时间序列对比。 **合同前风险排查** — 签合同前五分钟才想起来查对方背景? 输入公司名,立刻拿到工商注册信息、股权穿透、司法纠纷和失信记录,当场决策。 **文献综述加速** — 写论文要梳理 RLHF 领域的研究脉络? 直接列出高引论文、主要作者和核心结论,综述提纲半小时内成型。 **法律条文速查** — 碰上居住权合同纠纷想确认法条? 一句话定位《民法典》相关条文原文、效力级别和时效性,再顺手拉几个相近判例佐证,不用翻法规库。 **机构级美股研究** — 要写一份美股深度报告? 一句话拉出年报原文、标准化财务指标、前 50 大股东和分析师一致预期,不用在多个数据终端之间来回切。 **财经资讯与行业数据** — 想追市场热点或政策动向? 直接查询财新的市场资讯、债券基金期货数据与上市公司产业链关系,以及新华财经国家金融信息平台的资讯、政策、公告与市场快讯,信源权威可溯源。 **标准查询** — 查合规要对照国标? 按标准号或主题查询国标、行标、地标和团标的编号、状态与全文入口。 #### 数据覆盖 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%95%B0%E6%8D%AE%E8%A6%86%E7%9B%96) | 类别 | 覆盖范围 | | --- | --- | | 股票与金融市场 | Wind、S&P Capital IQ、SEC EDGAR 等;A 股、港股、美股行情、技术指标、财报估值、分析师预期,8,000+ 美股上市公司官方披露文件 | | 财经资讯与行业数据 | 财新、新华财经等;市场资讯与快讯、上市公司公告、监管政策、债券基金期货数据、企业失信记录、产业链关系 | | 宏观经济 | 世界银行、IMF、OECD、FRED、国家统计局及 WHO、FAO 等;全球 189 个国家 50 年以上时间序列,中国全国/省/市指标(GDP、贸易、人口、汇率、CPI、国际收支) | | 中国标准 | 国家标准(GB)、行业标准、地方标准、团体标准的编号、名称、发布状态与详情;部分国标和公开团标提供官方全文入口 | | 企业数据 | 中国大陆企业工商信息、股权穿透、司法风险、关联图谱 | | 学术文献 | 物理、数学、计算机、金融、经济等领域百万量级论文,支持预印本查询 | | 法律法规 | 元典智库等;中国法律法规与司法案例,含各效力层次法规检索与详情、权威判例检索 | | 智能筛选 | 恒生聚源等;自然语言选股、选基金、选基金经理,及宏观行业数据、研报、公告与新闻 | #### 计费与限制 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%AE%A1%E8%B4%B9%E4%B8%8E%E9%99%90%E5%88%B6) * 数据查询按次计费,消耗 Kimi Code 账号额度 * 插件为只读查询,不提供任何写入或交易功能 * 技术指标(MACD、KDJ 等)及实时行情仅在交易时段内可用 * AI 输出内容仅供参考,不构成任何投资或商业决策建议 ### Kimi Browser Extension v2.0.11 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-browser-extension) Kimi Browser Extension 让 AI 直接操控你的浏览器,带着你的登录状态和 Cookie 打开网页、阅读内容、点击按钮、填写表单、截图保存,把重复的网页操作交给它完成。产品介绍见 [Kimi Browser Extension 官网](https://www.kimi.com/products/kimi-browser-extension) 。 #### 安装浏览器扩展 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E8%A3%85%E6%B5%8F%E8%A7%88%E5%99%A8%E6%89%A9%E5%B1%95) 通过 `/plugins` 安装后,还需要在浏览器中安装 Kimi Browser Extension 扩展才能使用。有两种安装方式: **方式一:应用商店安装(推荐)** 打开 [Chrome 应用商店](https://chromewebstore.google.com/detail/kimi-webbridge/fldmhceldgbpfpkbgopacenieobmligc) 或 [Edge 应用商店](https://microsoftedge.microsoft.com/addons/detail/kimi-webbridge/bnlffdbcfnanfbknnlaflhlhkocccckg) ,点击添加即可。 **方式二:手动安装** 无法访问应用商店时使用这种方式,按以下步骤操作: 1. [下载扩展安装包](https://kimi-web-img.moonshot.cn/webbridge/latest/extension/kimi-webbridge-extension.zip) 并解压 2. 在浏览器地址栏输入 `chrome://extensions/` 打开扩展管理页,开启右上角的**开发者模式** ![开启开发者模式](https://www.kimi.com/code/docs/images/kimi-code-cli/webbridge-dev-mode.jpeg) 3. 点击左上角的**加载未打包的扩展程序**,选择解压后的 `kimi-webbridge-extension` 文件夹 ![加载未打包的扩展程序](https://www.kimi.com/code/docs/images/kimi-code-cli/webbridge-load-unpacked.jpeg) 4. 安装完成后,浏览器工具栏会出现 Kimi Browser Extension 图标,即表示安装成功 ![工具栏出现 Kimi Browser Extension 图标](https://www.kimi.com/code/docs/images/kimi-code-cli/webbridge-install-success.jpeg) #### 能做什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88-1) * **网页操作自动化**:你说话,AI 帮你点网页、填表单、读内容、截图,把重复性的网页操作交给它 * **社媒热点选题**:自动浏览 X(Twitter)、微博、小红书的热门话题,筛选你感兴趣的方向,逐个打开高赞内容截图、提取核心观点,整理成素材库并给出选题建议 * **求职信息搜集**:在招聘网站按条件筛选岗位(关键词、城市、岗位类型),把岗位名称、链接、公司、薪资、投递方式整理成表格 * **竞品分析**:自动在多个 AI 产品间批量发问并采集回答,生成横向对比报告 * **机票比价**:在多个旅行平台查询同一行程,按价格排序记录航司、起降时间和原始链接,给出推荐方案 ### Kimi Computer Use v0.5.4 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#kimi-computer-use) Kimi Computer Use 让 AI 直接操作你的桌面应用,可以完成点击、拖拽、滚动、输入等操作。macOS 版全程在后台静默运行,不抢占你的鼠标;少量弹窗操作仍会唤起前台 App。Windows 版的差异见 [Windows 版注意事项](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#windows-%E7%89%88%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9) 。 #### 授权(macOS) [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8E%88%E6%9D%83-macos) 安装后首次使用时,Kimi Computer Use 会弹出授权窗口,按照提示操作即可: 1. 点击**辅助功能**和**屏幕录制**右侧的**去授权**,在系统设置中开启这两项权限。前者用于执行点击、输入与滚动,后者用于读取屏幕内容、识别需要操作的位置。 2. 在**接入本地 Agent**中打开 **Kimi Code** 开关,重启 Kimi Code 后生效。 ![Kimi Computer Use 授权窗口](https://www.kimi.com/code/docs/images/kimi-code-cli/kimi-computer-use-auth.jpeg) #### Windows 版注意事项 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#windows-%E7%89%88%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9) * **会短暂占用键鼠**:Windows 版无法像 macOS 版那样稳定地全程后台输入,执行操作时可能短暂激活目标窗口并使用你的鼠标键盘 * **系统要求**:Windows 10 version 1903(Build 18362)或更新版本 / Windows 11,x64;需要真实交互式桌面会话,Windows Server 需要 Desktop Experience * **无需额外授权**:Windows 不需要 macOS 那样的**辅助功能**和**屏幕录制**权限 * **权限对等**:目标应用以管理员权限运行时,KimiCU 也需要以同等权限运行 #### 能做什么 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88-2) * **在桌面软件整理和录入信息**:让 AI 把散落在各处的信息整理进备忘录、表格或笔记软件,不用手动逐条输入 * **测试网站和应用流程**:将重复的测试步骤交给 AI,截图确认渲染和跳转是否正常 * **处理重复操作**:反复打开、复制、粘贴、检查类型的工作,让 AI 在后台静默完成,不抢占鼠标 * **操作无接口的软件**:操作没有 CLI 或 API 的桌面端应用,例如把剪映里这段视频的片头剪掉三秒再导出 注意 涉及资金、账号和对外发布的操作不建议使用此能力。 Plugin manifest [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#plugin-manifest) ------------------------------------------------------------------------------------------------------------- Plugin 是一个带 manifest 的目录或 zip 文件。Manifest 可以放在以下任一位置: text <plugin_root>/kimi.plugin.json <plugin_root>/.kimi-plugin/plugin.json 两个文件同时存在时,以 `kimi.plugin.json` 为准。 示例: json { "name": "kimi-finance", "version": "1.0.0", "description": "Finance data and analysis workflows for Kimi Code CLI", "skills": "./skills/", "systemPromptPath": "./SYSTEM.md", "sessionStart": { "skill": "using-finance" }, "interface": { "displayName": "Kimi Finance", "shortDescription": "Market data and financial analysis workflows" } } 支持的字段: | 字段 | 说明 | | --- | --- | | `name` | 必填,作为 plugin id,必须匹配 `[a-z0-9][a-z0-9_-]{0,63}` | | `version`、`description`、`keywords`、`author`、`homepage`、`license` | 展示元数据 | | `interface` | 在 `/plugins` 中展示的字段:`displayName`、`shortDescription`、`longDescription`、`developerName`、`websiteURL` | | `skills` | 一个或多个 `./` 路径,必须位于 plugin 根目录内。省略时根目录的 `SKILL.md` 被当作单个 Skill root | | `agents` | 一个或多个 `./` 路径,必须位于 plugin 根目录内,指向含有 [Agent 文件](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent)<br> 的目录。省略时若根目录存在 `agents/` 目录则自动采用 | | `sessionStart.skill` | 在新会话或恢复会话开始时,把指定 plugin Skill 加载到 main agent | | `skillInstructions` | 每次加载此 plugin 的 Skill 时一并附带的额外说明 | | `systemPrompt` | plugin 启用期间提供给 Agent 系统提示词的内联指令 | | `systemPromptPath` | 指向 UTF-8 文本文件的 `./` 路径;同时设置 `systemPrompt` 时,文件内容拼接在内联指令之后 | | `mcpServers` | MCP server 声明,默认启用,可从 `/plugins` 中禁用 | | `hooks` | 在 plugin 启用期间于生命周期事件上运行的 hook 规则,见 [插件中的 Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E4%B8%AD%E7%9A%84-hooks) | | `commands` | 一个或多个 `./` 路径,指向目录或 `.md` 文件,把其中的 Markdown 文件注册为斜杠命令,见 [插件斜杠命令](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) | `tools`、`apps`、`inject`、`configFile` 等不支持的运行时字段会显示为 diagnostics 并被忽略。 ### 系统提示词指令 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%8C%87%E4%BB%A4) Plugin 通过 `systemPrompt` 和 `systemPromptPath` 两个字段向 Agent 的系统提示词注入指令。本节按三块说明:写法与读取时机、大小限制、两个引擎的差异。 ### 写法与读取时机 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%86%99%E6%B3%95%E4%B8%8E%E8%AF%BB%E5%8F%96%E6%97%B6%E6%9C%BA) 短指令可以直接写在 `systemPrompt`,较长内容则用 `systemPromptPath` 指向 plugin 根目录内的文件。两个字段同时存在时,内联文本在前,文件内容在后。文件内容在安装或重载 plugin 时读取,修改文件后需要 `/plugins reload` 才会生效。例如: json { "name": "code-review", "systemPromptPath": "./SYSTEM.md" } 内置 Agent 提示词会自动包含已启用 plugin 的指令。自定义 `SYSTEM.md` 或 Agent 文件完全拥有自己的模板,应在希望出现 plugin 指令的位置加入 `${plugin_sections}`。如果自定义模板包含 `${base_prompt}`,且该有效默认提示词已经包含 plugin 块,则不要再重复加入 `${plugin_sections}`。变量完整列表见 [自定义 Agent 与 SYSTEM.md](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E7%94%A8-systemmd-%E8%A6%86%E7%9B%96-main-agent-%E7%9A%84%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D) 。 ### 大小限制 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%A4%A7%E5%B0%8F%E9%99%90%E5%88%B6) `systemPrompt` 字段与 `systemPromptPath` 文件各限制为 32 KB(UTF-8 字节),超限内容会被忽略并显示在 plugin 的 diagnostics 中。一次提示词构建最多注入所有已启用 plugin 合计 64 KB 的指令,超出预算的贡献会被跳过并给出警告;单个 plugin 的内联文本与文件合计超过该预算时同样整体跳过。 ### 两个引擎的差异 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E4%B8%A4%E4%B8%AA%E5%BC%95%E6%93%8E%E7%9A%84%E5%B7%AE%E5%BC%82) 系统提示词贡献在 Kimi Code 的所有界面上都生效:交互式 TUI、`kimi -p` 和 `kimi web` 都运行在 v2 引擎上。 新会话和新建 Agent 会读取当前已启用 plugin 的指令,正在进行的请求继续使用已有的系统提示词。`/plugins reload` 会刷新 plugin Skill 列表,并请求重建活跃 Agent 的提示词;需要让变更在下一轮前明确收敛时使用该命令。切换 plugin 的 MCP server 不会改变系统提示词指令。 两个引擎下的指令刷新行为 在 v2 引擎中,安装、启用、禁用或移除 plugin 会立即更新 catalog,后续的提示词重建可能会读取新的指令。legacy 引擎中每个活跃 session 保留自己的 plugin 快照,直到 `/plugins reload` 或创建新 session。从磁盘恢复的 session 先使用持久化的提示词,后续重建再遵循对应引擎的行为。 插件斜杠命令 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E6%96%9C%E6%9D%A0%E5%91%BD%E4%BB%A4) ------------------------------------------------------------------------------------------------------------------------------------------- 斜杠命令把一段常用提示词存成 `/命令`,输入即可触发。 下面是一个最小完整例子,插件目录结构: text kimi-finance/ kimi.plugin.json commands/ report.md manifest(`kimi.plugin.json`)用 `commands` 字段指出命令文件的位置: json { "name": "kimi-finance", "version": "1.0.0", "commands": "./commands/" } 命令文件 `commands/report.md` 中,顶部两行 `---` 之间是 frontmatter,其下正文是触发时发给 Agent 的提示词: markdown --- description: 拉取指定股票的财报并总结 --- 拉取 $ARGUMENTS 的最新财报数据,总结营收、利润和关键风险。 安装并启用后,在对话里输入: text /kimi-finance:report TSLA Kimi 会把正文里的 `$ARGUMENTS` 替换成 `TSLA`,再执行这段提示词。三处细节分述如下。 ### 声明命令(`commands` 字段) [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%A3%B0%E6%98%8E%E5%91%BD%E4%BB%A4-commands-%E5%AD%97%E6%AE%B5) `commands` 填一个 `./` 路径或路径数组,指向 plugin 根目录内的目录或 `.md` 文件: * 指向**目录**:递归收集其中所有 `.md` 文件,每个文件各成为一个命令。 * 指向**单个 `.md` 文件**:只注册这一个。 * 指向非 `.md` 或不存在的路径:显示为 diagnostics 并被忽略。 ### 编写命令文件 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E7%BC%96%E5%86%99%E5%91%BD%E4%BB%A4%E6%96%87%E4%BB%B6) 命令文件分两部分:可选的 **frontmatter**(顶部两行 `---` 之间,可写 `name`、`description`)和**正文**(`---` 之后的提示词)。两个字段省略时的回退规则: * `name`(命令名):省略时按文件相对 `commands` 的路径命名,去掉 `.md`、以 `/` 分隔,如 `commands/frontend/component.md` 注册为 `frontend/component`;frontmatter 里显式写的优先 * `description`(命令列表里的说明):省略时取正文首行非空文字,超 240 字符截断;正文也为空则显示 `No description provided.` ### 调用命令与传参 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E8%B0%83%E7%94%A8%E5%91%BD%E4%BB%A4%E4%B8%8E%E4%BC%A0%E5%8F%82) 命令自动以插件 id 作前缀注册成 `<插件名>:<命令名>`,所以上面的命令实际叫 `/kimi-finance:report`,不同插件的同名命令因此不会冲突。 命令后输入的文字会替换正文里的 `$ARGUMENTS`。若正文没写 `$ARGUMENTS` 却传了参数,参数不会丢弃,而是以 `ARGUMENTS: <你输入的内容>` 追加到正文末尾。 Skills 与会话启动 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#skills-%E4%B8%8E%E4%BC%9A%E8%AF%9D%E5%90%AF%E5%8A%A8) ----------------------------------------------------------------------------------------------------------------------------------------------- Plugin Skills 使用与普通 [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) 相同的 `SKILL.md` 格式,典型目录结构如下: text my-plugin/ kimi.plugin.json skills/ using-my-plugin/ SKILL.md another-workflow/ SKILL.md `sessionStart.skill` 在会话启动时把一个 plugin Skill 加载到 main agent,适合放置初始化说明、工作流规则,或把其他工具中的术语映射到 Kimi Code CLI。它只注入文本,不执行代码。 无论 Skill 通过哪种方式加载(`sessionStart.skill`、`/skill:<name>` 或模型自动调用),`skillInstructions` 都会随该 plugin 的 Skill 一起出现。 插件 Agent [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6-agent) --------------------------------------------------------------------------------------------------------------- Plugin 可以携带自定义 Agent:在 manifest 的 `agents` 字段里声明一个或多个 `./` 目录,或直接在 plugin 根下放置 `agents/` 目录。其中的 Agent 文件与 [自定义 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html#%E8%87%AA%E5%AE%9A%E4%B9%89-agent) 格式相同,会在 plugin 启用期间作为 subagent 被 main agent 自动发现和委派。 text my-plugin/ kimi.plugin.json agents/ reviewer.md Plugin Agent 的优先级低于其他文件来源:同名时用户级、额外目录、项目级和 `--agent-file` 的 Agent 都会覆盖 plugin 提供的版本;替换内置 Agent 同样需要在 frontmatter 里显式写 `override: true`。安装、启用、禁用或移除 plugin 后,Agent 列表在新会话或 `/reload` 时刷新;v2 引擎的当前会话还会在 `/plugins reload` 后刷新。 Plugin 中的 MCP servers [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#plugin-%E4%B8%AD%E7%9A%84-mcp-servers) ----------------------------------------------------------------------------------------------------------------------------------------- 当 plugin 需要真实工具能力时,可以在 manifest 中声明 `mcpServers`,复用 [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) 的 schema。 Stdio server(本地命令): json { "mcpServers": { "finance": { "command": "uvx", "args": ["kimi-finance-mcp"] } } } HTTP server(远程服务): json { "mcpServers": { "docs": { "url": "https://example.com/mcp" } } } 对于 stdio servers,`command` 可以是 `PATH` 上的命令,也可以是 plugin 根目录内以 `./` 开头的路径。`cwd` 同理,必须以 `./` 开头并位于 plugin 根目录内,否则该 server 会被忽略。 Plugin MCP servers 会在 `/reload` 后或新会话中启动。启用或禁用某个 server: sh /plugins mcp disable kimi-finance finance /reload /plugins mcp enable kimi-finance finance /reload 插件中的 Hooks [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E6%8F%92%E4%BB%B6%E4%B8%AD%E7%9A%84-hooks) ----------------------------------------------------------------------------------------------------------------------------------- plugin 可以在其 manifest 中声明 hook 规则,在 plugin 启用期间于生命周期事件上运行。每一项的字段与 [`config.toml` 中的 `[[hooks]]` 规则](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html#%E9%85%8D%E7%BD%AE) 相同(`event`、`matcher`、`command`、`timeout`): json { "hooks": [\ {\ "event": "PreToolUse",\ "matcher": "Bash",\ "command": "node ./hooks/check-bash.mjs",\ "timeout": 5\ }\ ] } plugin hooks 复用与全局 hooks 相同的机制。事件列表、stdin JSON 载荷、退出码与返回值对主流程的影响,详见 [Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) 。两者区别: * plugin 的 hooks 仅在 plugin **启用**期间生效;禁用 plugin 后其 hooks 停止运行。 * 每条 hook 的工作目录为 plugin 根目录,`command` 可以使用 plugin 内的 `./` 路径。 * hook 进程会额外收到两个环境变量:`KIMI_CODE_HOME` 和 `KIMI_PLUGIN_ROOT`(plugin 根目录)。 仅安装 plugin 本身不会运行其 hooks;它们只在 plugin 启用期间、匹配的事件触发时运行。 安全模型 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E5%AE%89%E5%85%A8%E6%A8%A1%E5%9E%8B) ----------------------------------------------------------------------------------------------------------------------- Plugin 的加载范围有限,安装和运行时的安全边界如下: * 不会执行命令型 plugin tools 或旧式工具运行时 * 所有路径在解析符号链接后仍必须位于 plugin 根目录内 * 已启用 plugin 的 MCP servers 在 `/reload` 后或新会话中启动,可随时从 `/plugins` 禁用 * 损坏的 manifest 或不安全路径显示在 `/plugins info <id>` 的 diagnostics 中,不影响其他会话 下一步 [​](https://www.kimi.com/code/docs/kimi-code-cli/customization/plugins.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) ------------------------------------------------------------------------------------------------------------- * [Agent Skills](https://www.kimi.com/code/docs/kimi-code-cli/customization/skills.html) — 了解 SKILL.md 格式,编写 plugin 携带的 Skill * [自定义 Agent](https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html) — 了解 Agent 文件格式与目录作用域优先级 * [MCP](https://www.kimi.com/code/docs/kimi-code-cli/customization/mcp.html) — 了解 plugin 中 MCP server 声明复用的 schema * [Hooks](https://www.kimi.com/code/docs/kimi-code-cli/customization/hooks.html) — 了解 plugin hooks 复用的全局 hook 机制 --- # Claude Code | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/claude-code#VPContent) Return to top Claude Code [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#claude-code) ========================================================================================== > [Claude Code](https://docs.anthropic.com/en/docs/claude-code) > 是 Anthropic 提供的编程 Agent 产品,界面、配置项和支持能力可能随版本变化。本文说明一种通用接入方案:通过环境变量将 Claude Code 的模型请求转发到 Kimi Code API。 开始之前 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%BC%80%E5%A7%8B%E4%B9%8B%E5%89%8D) ------------------------------------------------------------------------------------------------------------ * 确保你已经订阅 [Kimi 会员](https://www.kimi.com/membership/pricing?from=) 并开通 Kimi Code 权益。 * 获取 API Key: 1. 进入 [Kimi Code 控制台](https://www.kimi.com/code/console) ; 2. 点击「新建 API Key」,输入名称后确认; 3. 复制生成的 Key 并妥善保存(关闭弹窗后无法再次查看完整 Key)。 ![Kimi Code 控制台](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/kimi-code-console.png) 配置流程 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B) ------------------------------------------------------------------------------------------------------------ [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 是 Anthropic 推出的命令行编程助手。通过配置环境变量将其接入 Kimi 的 API 端点,你就能在 Claude Code 中直接调用 Kimi Code 的 AI 能力,在熟悉的终端交互里获得 Kimi Code 的编程体验。 ① **安装 Claude Code** 安装方式请参考 [Claude Code 官方文档](https://docs.anthropic.com/en/docs/claude-code/getting-started) 。 │ ② **执行脚本,跳过登录流程** 安装完成后,不要直接启动 Claude。先在终端执行以下脚本,跳过 Anthropic 默认的登录流程并清理历史配置: sh node --eval " // enable third party model support and fast mode const claudeJsonFilePath = path.join(os.homedir(), '.claude.json'); if (fs.existsSync(claudeJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeJsonFilePath, 'utf-8')); fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ ...content, penguinModeOrgEnabled: true, hasCompletedOnboarding: true }, null, 2), 'utf-8'); } else { fs.writeFileSync(claudeJsonFilePath, JSON.stringify({ penguinModeOrgEnabled: true, hasCompletedOnboarding: true }), 'utf-8'); } // delete old endpoint, credential and model id const claudeSettingsJsonFilePath = path.join(os.homedir(), '.claude', 'settings.json'); if (fs.existsSync(claudeSettingsJsonFilePath)) { const content = JSON.parse(fs.readFileSync(claudeSettingsJsonFilePath, 'utf-8')); if (typeof content === 'object' && typeof content.env === 'object') { for (const element of [\ 'ANTHROPIC_BASE_URL',\ 'ANTHROPIC_API_KEY',\ 'ANTHROPIC_AUTH_TOKEN',\ 'ANTHROPIC_MODEL',\ 'ANTHROPIC_SMALL_FAST_MODEL',\ 'CLAUDE_CODE_SUBAGENT_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL',\ 'ANTHROPIC_DEFAULT_FABLE_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL',\ 'ANTHROPIC_DEFAULT_OPUS_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL',\ 'ANTHROPIC_DEFAULT_SONNET_MODEL_NAME',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL',\ 'ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME',\ 'ENABLE_TOOL_SEARCH',\ 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',\ 'CLAUDE_CODE_EFFORT_LEVEL',\ ]) { delete content.env[element]; } fs.writeFileSync(claudeSettingsJsonFilePath, JSON.stringify(content, null, 2), 'utf-8'); } } " 其中 settings.json 清理部分仅删除 `env` 中的端点、密钥与模型相关变量(这些残留会**覆盖**终端里 export 的同名环境变量),不影响其他配置。另外请检查 `~/.zshrc`、`~/.bashrc` 等 shell 配置文件中是否残留旧的 `ANTHROPIC_*` export(Windows 用户请检查用户环境变量),如有请一并删除。 │ ③ **配置 API 接入** 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 请先根据自己的会员档位确认可用的模型与上下文窗口(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ): | 会员档位 | 可配置模型 | 可用上下文上限 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3` <br>`k3-256k` <br>`kimi-for-coding` | `k3`:`262144` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` | | Pro 及以上 / Allegretto 及以上 | `k3` <br>`k3-256k` <br>`kimi-for-coding` <br>`kimi-for-coding-highspeed` | `k3`:`1048576` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` <br>`kimi-for-coding-highspeed`:`262144` | 提供两种配置方式,**任选其一,不要混用**:方式一写入 settings.json 配置文件,长期生效、任何方式启动都生效;方式二在当前终端临时 export,仅对当前会话有效。 **方式一:写入 settings.json(推荐,长期生效)** settings.json 的路径: macOS / LinuxWindows text ~/.claude/settings.json text C:\Users\<用户名>\.claude\settings.json 将以下配置写入该文件的 `env` 字段(文件不存在则新建): K3-256KK3 1M 上下文 json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", "ANTHROPIC_API_KEY": "你的API Key", "ANTHROPIC_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3-256k", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3-256k", "CLAUDE_CODE_SUBAGENT_MODEL": "k3-256k", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "262144", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "262144" } } json { "env": { "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", "ANTHROPIC_API_KEY": "你的API Key", "ANTHROPIC_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_FABLE_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_OPUS_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_SONNET_MODEL": "k3[1m]", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3[1m]", "CLAUDE_CODE_SUBAGENT_MODEL": "k3[1m]", "CLAUDE_CODE_EFFORT_LEVEL": "high", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576" } } 保存后重启 Claude Code 生效。 明文密钥风险 `settings.json` 中的 API Key 以明文存储,请勿将该文件提交到版本仓库或随 dotfiles 公开分享;该文件的 `env` 会**覆盖**终端里 export 的同名变量。 **方式二:终端环境变量(仅当前会话)** **K3-256K 配置如下:** macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/ export ANTHROPIC_API_KEY=你的API Key export ANTHROPIC_MODEL="k3-256k" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.com/coding/" $env:ANTHROPIC_API_KEY="你的API Key" $env:ANTHROPIC_MODEL="k3-256k" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="262144" claude **K3 1M 上下文**配置如下: 注意 `k3[1m]` 写法仅在 Claude Code 环境变量场景需要 `k3[1m]`(以及外层的引号)用来明确告诉 Claude Code 把上下文窗口设为 1M;其它场景(例如 API 请求、其它第三方工具的 Model ID 字段)只需填 `k3` 即可。 macOS / LinuxWindows sh export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/ export ANTHROPIC_API_KEY=你的API Key export ANTHROPIC_MODEL="k3[1m]" export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL export CLAUDE_CODE_EFFORT_LEVEL=high export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576 claude powershell $env:ANTHROPIC_BASE_URL="https://api.kimi.com/coding/" $env:ANTHROPIC_API_KEY="你的API Key" $env:ANTHROPIC_MODEL="k3[1m]" $env:ANTHROPIC_DEFAULT_FABLE_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_OPUS_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_SONNET_MODEL=$env:ANTHROPIC_MODEL $env:ANTHROPIC_DEFAULT_HAIKU_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_SUBAGENT_MODEL=$env:ANTHROPIC_MODEL $env:CLAUDE_CODE_EFFORT_LEVEL="high" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="1048576" $env:CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576" claude ### 配置项说明 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E9%85%8D%E7%BD%AE%E9%A1%B9%E8%AF%B4%E6%98%8E) Claude Code 内部会按场景使用不同档位的模型(主对话、后台摘要、子 Agent 等),只配置部分变量会让对应场景静默失败: | 变量 | 作用 | 不配置或配置错误的影响 | | --- | --- | --- | | `ANTHROPIC_BASE_URL` | 将模型请求转发到 Kimi Code 端点 | 请求被发往 Anthropic 官方端点,鉴权失败 | | `ANTHROPIC_API_KEY` | 使用 Kimi Code API Key 鉴权 | 返回 401 鉴权错误 | | `ANTHROPIC_MODEL` | 主对话使用的模型 | 使用 Claude 默认模型名,Kimi Code 端点无法识别,报模型不存在错误 | | `ANTHROPIC_DEFAULT_OPUS_MODEL` / `ANTHROPIC_DEFAULT_SONNET_MODEL` / `ANTHROPIC_DEFAULT_HAIKU_MODEL` / `ANTHROPIC_DEFAULT_FABLE_MODEL` | Claude Code 按任务档位选择模型时使用的模型名 | 对应档位的任务(如 haiku 档的后台标题生成、摘要)请求失败 | | `CLAUDE_CODE_SUBAGENT_MODEL` | 子 Agent 使用的模型 | 子任务请求失败或效果明显变差 | | `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | 触发自动压缩上下文的窗口大小 | 需与模型上下文一致:`k3[1m]` 为 `1048576`,其余模型为 `262144`;设置过小会过早压缩丢失上下文,过大则报上下文超限错误 | | `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | 最大上下文 token 数 | 同上,需与所选模型的上下文窗口一致 | | `CLAUDE_CODE_EFFORT_LEVEL` | 默认思考档位,K3 推荐设为 `high` | 较低值可能在复杂任务上降低质量 | 切换模型时,请把配置中所有模型变量的值一并替换为新模型名。 ### 切换思考档位 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%88%87%E6%8D%A2%E6%80%9D%E8%80%83%E6%A1%A3%E4%BD%8D) 启动后在会话中输入 `/effort` 即可切换思考档位,无需配置环境变量。K3 与 K2.8 Preview 均支持 `low` / `high` / `max` 三档且档位一致,Claude Code 的档位与实际档位的映射关系如下: | Claude Code 档位 | 实际档位 | | --- | --- | | `low` | `low` | | `medium` | `high`(推荐) | | `high` | `high`(推荐) | | `xhigh` | `max` | | `max` | `max` | | 未设置(默认) | `high`(K3)/ `max`(K2.8 Preview) | 注意 关闭 thinking 后路由到 K2.8 Preview 无思考版:K3 系列与 K2.8 Preview 关闭 thinking 后,请求均由 K2.8 Preview(无思考)处理;thinking 快捷键 macOS 为 `Option+T`,Windows / Linux 为 `Alt+T`。 > 启动后若提示是否使用该 API key,确认使用即可。随后按照指引选择你信任的项目文件夹,完成授权即可。 > > ![Claude Code 授权访问项目文件](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-trust-folder.jpg) │ ④ **启动后验证** 启动后输入 `/status`,如果返回信息中显示 Base URL 为 `https://api.kimi.com/coding/`,则配置成功。此时即使模型名称仍显示为 Claude 模型,实际调用的仍是 Kimi Code 的 API。 ![Claude Code 状态检查](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-status-check.png) │ 在 VS Code 插件中使用 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%9C%A8-vs-code-%E6%8F%92%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8) -------------------------------------------------------------------------------------------------------------------------------------------------- 插件自带 Claude Code 程序,与命令行共用 `~/.claude` 下的配置。按以下步骤接入: 1. 按方式一的「[配置流程](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E9%85%8D%E7%BD%AE%E6%B5%81%E7%A8%8B) 」完成 API 接入配置。 2. 打开插件新建会话,出现登录页面时点击底部的 **Run `claude` in terminal**: ![登录页面点击 Run claude in terminal](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-run-in-terminal.png) 3. 在弹出的终端中依次完成两个确认:信任目录选择 **Yes, I trust this folder**;API Key 确认选择 **1\. Yes**: ![Claude Code API key 确认提示](https://www.kimi.com/code/docs/images/zh/third-party-tools/claude-code/claude-api-key-confirm.jpg) 4. **完全退出 VS Code** 后重新打开,即可在插件中直接对话。 如果不经过终端确认就使用插件,插件会缺少 API Key 的确认登记,发送消息时会反复弹出登录页面。 常见问题 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------------ ### 修改配置后不生效 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E4%BF%AE%E6%94%B9%E9%85%8D%E7%BD%AE%E5%90%8E%E4%B8%8D%E7%94%9F%E6%95%88) 检查 `~/.claude/settings.json` 的 `env` 中是否有残留旧配置(会覆盖终端环境变量),可执行第 ② 步中的清理脚本;另外终端中 export 的变量只对当前会话有效,重开终端后需要重新设置;如果写入了 `settings.json`,请确认修改后重启了 Claude Code。 ### 返回 401 鉴权错误 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E8%BF%94%E5%9B%9E-401-%E9%89%B4%E6%9D%83%E9%94%99%E8%AF%AF) 检查 `ANTHROPIC_API_KEY` 是否为有效的 Kimi Code API Key,注意 Key 只在创建时完整展示一次。 ### 提示模型不存在(model not found) [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E6%8F%90%E7%A4%BA%E6%A8%A1%E5%9E%8B%E4%B8%8D%E5%AD%98%E5%9C%A8-model-not-found) 检查各模型变量的值是否拼写正确(如 `k3-256k`、`k3[1m]`),注意不要携带多余空格或引号。 ### 后台任务或子 Agent 报错 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%90%8E%E5%8F%B0%E4%BB%BB%E5%8A%A1%E6%88%96%E5%AD%90-agent-%E6%8A%A5%E9%94%99) 通常是 `ANTHROPIC_DEFAULT_HAIKU_MODEL`、`ANTHROPIC_DEFAULT_FABLE_MODEL` 或 `CLAUDE_CODE_SUBAGENT_MODEL` 未配置,对应场景请求了 Kimi Code 端点无法识别的模型名,请对照「配置项说明」补齐。 ### VS Code 插件一直弹出登录页面 [​](https://www.kimi.com/code/docs/third-party-tools/claude-code#vs-code-%E6%8F%92%E4%BB%B6%E4%B8%80%E7%9B%B4%E5%BC%B9%E5%87%BA%E7%99%BB%E5%BD%95%E9%A1%B5%E9%9D%A2) 插件缺少 API Key 的确认登记。详细操作见「[在 VS Code 插件中使用](https://www.kimi.com/code/docs/third-party-tools/claude-code#%E5%9C%A8-vs-code-%E6%8F%92%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8) 」。 --- # 模型配置 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/models.html#VPContent) Return to top 模型配置 [​](https://www.kimi.com/code/docs/kimi-code/models.html#%E6%A8%A1%E5%9E%8B%E9%85%8D%E7%BD%AE) ==================================================================================================== 本页介绍 Kimi Code 提供的模型,以及如何在各客户端之间切换。 模型总览 [​](https://www.kimi.com/code/docs/kimi-code/models.html#%E6%A8%A1%E5%9E%8B%E6%80%BB%E8%A7%88) ---------------------------------------------------------------------------------------------------- Kimi Code 目前提供 K3、K2.8 Preview 与 K2.7 Code HighSpeed 三类模型、共 4 个模型 ID,可在客户端或第三方工具中按模型 ID 选择。各模型规格对比如下: 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 | Model ID | `k3` | `k3-256k` | `kimi-for-coding` | `kimi-for-coding-highspeed` | | --- | --- | --- | --- | --- | | 模型版本 | K3 | K3 | K2.8 Preview | K2.7 Code HighSpeed | | 说明 | 最强旗舰编程模型,2.8T 参数规模,1M 上下文窗口 | K3 的 256K 上下文版本,`k3`(1M)消耗约为 `k3-256k` 两倍 | 综合性能接近 K3,思考效率更高,擅长代码补全与常规开发任务 | K2.7 Code 的高速版,编码能力一致,输出速度约为普通版 5–6 倍 | | 速度 | 常规速度 | 常规速度 | 常规速度 | 高速版(6 倍速 3 倍消耗) | | 上下文窗口 | `1048576`(面向高档位会员) | 仅 `262144` | `1048576` | `262144` | | 思考程度 | `reasoning_effort:low` / `high` / `max` <br>(默认 `high`) | `reasoning_effort:low` / `high` / `max`(默认 `high`) | `reasoning_effort:low` / `high` / `max` <br>(默认 `max`) | `Thinking:ON` | | 调用限制(新套餐) | Plus 及以上可用 <br>Pro 及以上支持 1M 上下文 | Plus 及以上可用 | Plus 及以上可用 | Pro 及以上 | | 调用限制(老套餐) | Moderato 及以上可用 <br>Allegretto 及以上支持 1M 上下文 | Moderato 及以上可用 | Andante 及以上可用 | Allegretto 及以上 | | 多模态输入支持 | 图片、视频 | 仅图片 | 图片、视频 | 图片、视频 | 需要更高档位的会员套餐? 不同会员套餐解锁不同的模型、上下文与速度能力,可 [**前往升级订阅 →**](https://www.kimi.com/code/#pricing) 。 为什么新模型上线后消耗变多了? 切换模型后,之前建立的上下文缓存 (cache) 在新模型上不再命中,这部分上下文需要重新预填充 (prefill)。因此刚切到新模型时消耗会偏高。建议操作: * **新开 session 再使用新模型**:能让效果更好、消耗更少。 为什么模型 ID 写对了还是报 401? 当请求的能力超出当前套餐权限时,服务端会返回 `401`,常见三种情况: * **无 K3 调用权限**:套餐低于 Moderato / Plus 时无法调用 `k3`、`k3-256k`(新套餐 Go 档无 coding 额度),需升级至 Moderato / Plus 及以上。 * **无 1M 权限**:Moderato / Plus 套餐用户调用 `k3` 时支持最高 256K 上下文;Allegretto / Pro 及更高档位支持最高 1M 上下文。调用 `k3-256k` 时上下文上限固定为 256K。 * **无高速版权限**:部分套餐不含高速版,升级至 Allegretto / Pro 及更高档位套餐即可调用 `kimi-for-coding-highspeed`。 完整报错文案与处理方式详见 [错误参考](https://www.kimi.com/code/docs/kimi-code/error-reference.html) 。 为什么高速版提速不明显? 两个常见原因: * **模型 ID 填错**:高速版 ID 必须是 `kimi-for-coding-highspeed`,填错会兜底到标准版 `kimi-for-coding`,不报错也不加速。 * **工具与脚本占了大头**:高速版只加快**模型输出**;一次任务里工具调用(读写文件、执行命令等)与脚本执行的耗时不受影响,这部分占比大时整体提速就不明显。 如何减少因思考程度切换带来的消耗? 切换思考程度(effort)会让已建立的上下文缓存(cache)失效,原本能命中缓存的上下文需要重新预填充(prefill)。为避免频繁触发重新预填充: * 根据任务复杂度选定思考程度后,在同一会话内尽量保持一致; * 确需改用不同思考程度时,新建会话再切换,而不是在长会话里反复切换。 K3(1M)与 K3-256k 切换注意事项 **K3(1M)切换至 K3-256k**:如果当前会话的上下文已超过 256k,部分 coding 工具(如 Kimi Code CLI、Claude Code)会在工具侧直接执行 compact。建议: 1. 切换前先手动执行一次 compact,将上下文压缩至 256k 以内,既能保留任务要点、会话不断档,切换后额度也更耐用。 2. 若历史上下文中包含视频文件,由于 K3-256k 不支持视频输入,直接切换会报错,请先 compact 再切换。 **K3-256k 切换至 K3(1M)**:如果 K3-256k 已接近 256k 上限且不希望 compact 丢失信息,可以直接切换到 1M;当前版本从 256k 切换到 1M 不会影响缓存。 如何切换模型 [​](https://www.kimi.com/code/docs/kimi-code/models.html#switch-model) ------------------------------------------------------------------------------ 使用注意 * **切换 model id 时建议开启新对话**:切换模型会使已建立的缓存失效。建议开启新会话,避免产生额外 token 消耗的同时获得更好体验。 * **填写 Model ID,不是模型版本名**:调用模型时需要填写上表中的 Model ID(如 `k3`、`k3-256k`、`kimi-for-coding`、`kimi-for-coding-highspeed`),如果填写成模型版本名(如 `K3`、`K2.8 Preview`),会调用失败。 * **关闭 thinking 后路由到 K2.8 Preview 无思考版**:K3 系列与 K2.8 Preview 关闭 thinking 后,请求均由 K2.8 Preview(无思考)处理。 切换到目标模型的方式: ### 官方客户端 [​](https://www.kimi.com/code/docs/kimi-code/models.html#%E5%AE%98%E6%96%B9%E5%AE%A2%E6%88%B7%E7%AB%AF) * **Kimi Code 桌面端**:在输入框内的模型选择器切换目标模型;若目标模型还没出现,重启桌面端或重新登录即可。 * **官方 Kimi Code CLI**:输入 `/model` 即可切换模型,无需修改配置;列表里暂未出现最新模型时,`/logout` 后重新 `/login` 即可。 * **Kimi Code for VS Code**:在输入栏下拉菜单中选择目标模型;若目标模型还没出现,重启 VS Code 或重新安装插件即可。 ### 第三方工具 [​](https://www.kimi.com/code/docs/kimi-code/models.html#%E7%AC%AC%E4%B8%89%E6%96%B9%E5%B7%A5%E5%85%B7) 把工具里的 Model ID 配置为目标模型即可。详细步骤如下: 1. 在 [Kimi Code 控制台](https://www.kimi.com/code/console) 创建 API Key。 2. 在工具中填入 Base URL 和相应模型 ID。 Kimi Code API 同时兼容 OpenAI 和 Anthropic 两种协议,Base URL 如下: | 协议 | Base URL | | --- | --- | | OpenAI 兼容 | 国内 `https://api.kimi.com/coding/v1` <br>海外 `https://api.kimi.ai/coding/v1` | | Anthropic 兼容 | 国内 `https://api.kimi.com/coding/` <br>海外 `https://api.kimi.ai/coding/` | 详细配置步骤请参考对应工具的接入文档: [Claude CodeAnthropic 的命令行编程助手](https://www.kimi.com/code/docs/third-party-tools/claude-code) [OpenCode终端编程 Agent](https://www.kimi.com/code/docs/third-party-tools/opencode) [CodexOpenAI 的编程 Agent](https://www.kimi.com/code/docs/third-party-tools/codex) 第三方工具中的 effort 映射 K3 与 K2.8 Preview 均支持 `low` / `high` / `max` 三档思考程度(effort);工具传入的 effort 会按下表映射: # 默认 null / undefined → 模型默认值(K3 为 high,K2.8 Preview 为 max) 其它未知取值 → HTTP 400 请求报错 # → max ultra / max / xhigh → max # → high(推荐) high / medium → high # → low low / minimum / light → low # → 关闭思考 none → thinking.type disabled --- # 在 Codex 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/codex#VPContent) Return to top 在 Codex 中使用 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%9C%A8-codex-%E4%B8%AD%E4%BD%BF%E7%94%A8) ==================================================================================================================== [Codex](https://openai.com/zh-Hans-CN/codex/) 是 OpenAI 提供的编程 Agent。Kimi Code 服务端原生支持 OpenAI Responses API(流式/非流式、reasoning、function calling 均可用),Codex CLI、桌面端可以通过自定义 model provider 直连,无需任何本地路由或协议转换工具——本文介绍具体配置方法。 > OpenAI Responses API 支持文本和图片输入,暂不支持视频输入。如需分析视频,可先用 ffmpeg 提取关键帧后交给模型。 会员权限 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E4%BC%9A%E5%91%98%E6%9D%83%E9%99%90) ------------------------------------------------------------------------------------------------------ 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 配置前先了解自己的会员档位(新老套餐规则对比见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) ),再根据下表选择合适的模型: | 会员档位 | 可用模型 | 上下文窗口 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3` <br>`k3-256k` <br>`kimi-for-coding` | `k3`:`262144` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` | | Pro 及以上 / Allegretto 及以上 | `k3` <br>`k3-256k` <br>`kimi-for-coding` <br>`kimi-for-coding-highspeed` | `k3`:`1048576` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` <br>`kimi-for-coding-highspeed`:`262144` | 准备工作 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C) ------------------------------------------------------------------------------------------------------ 1. 在 [Kimi Code 控制台](https://www.kimi.com/code/console) 创建并保存 API Key。 2. 安装 Codex CLI: bash npm install -g @openai/codex 第一步:创建模型目录 models.json [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E7%AC%AC%E4%B8%80%E6%AD%A5-%E5%88%9B%E5%BB%BA%E6%A8%A1%E5%9E%8B%E7%9B%AE%E5%BD%95-models-json) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 在 Codex 配置目录下创建 `models.json`: macOS / LinuxWindows text ~/.codex/models.json text C:\Users\<用户名>\.codex\models.json 写入以下内容(此处以 K3 系列模型为例): json { "models": [\ {\ "slug": "k3",\ "display_name": "K3",\ "description": "K3,1M 上下文",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 0,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 1048576,\ "max_context_window": 1048576,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ },\ {\ "slug": "k3-256k",\ "display_name": "K3 256K",\ "description": "K3 256K 上下文",\ "default_reasoning_level": "high",\ "supported_reasoning_levels": [\ { "effort": "low", "description": "Light reasoning" },\ { "effort": "high", "description": "Enhanced reasoning" },\ { "effort": "max", "description": "Deep reasoning" }\ ],\ "shell_type": "shell_command",\ "visibility": "list",\ "supported_in_api": true,\ "priority": 1,\ "base_instructions": "",\ "supports_reasoning_summaries": true,\ "default_reasoning_summary": "none",\ "support_verbosity": false,\ "truncation_policy": { "mode": "bytes", "limit": 10000 },\ "context_window": 262144,\ "max_context_window": 262144,\ "effective_context_window_percent": 95,\ "supports_parallel_tool_calls": true,\ "experimental_supported_tools": [],\ "input_modalities": ["text", "image"]\ }\ ] } 第二步:编写 config.toml [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E7%AC%AC%E4%BA%8C%E6%AD%A5-%E7%BC%96%E5%86%99-config-toml) ------------------------------------------------------------------------------------------------------------------------------------------ Codex CLI 的配置文件路径: macOS / LinuxWindows text ~/.codex/config.toml text C:\Users\<用户名>\.codex\config.toml 写入以下内容(文件不存在则新建): toml model = "k3-256k" model_provider = "kimi" web_search = "live" model_catalog_json = "~/.codex/models.json" [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.com/coding/v1" env_key = "KIMI_API_KEY" wire_api = "responses" [desktop] enabled-reasoning-efforts = ["low", "high", "max"] 各字段含义: | 配置项 | 说明 | | --- | --- | | `model` | 默认使用的模型。推荐 `k3-256k`(更省配额),有 1M 上下文需求时用 `k3` | | `model_provider` | 默认使用的 provider,对应下方 `[model_providers.kimi]` 的表名 | | `web_search` | 联网搜索开关。Kimi Code 端点已支持联网搜索,设为 `"live"` 启用实时搜索 | | `model_catalog_json` | 上一步创建的模型目录文件路径,声明模型的上下文窗口与图片输入能力 | | `base_url` | Kimi Code 的 API 地址,国内 `https://api.kimi.com/coding/v1`,海外 `https://api.kimi.ai/coding/v1` | | `env_key` | 存放 API Key 的环境变量**名称**(这里填 `KIMI_API_KEY`,不是填 Key 本身)。Codex 启动时从同名环境变量读取密钥,变量的值在下一步设置 | | `wire_api` | 请求使用的协议,必须填 `"responses"` 以走 Responses API | | `enabled-reasoning-efforts` | 桌面端模型选择器中显示的思考档位,仅影响桌面端,CLI 无需此配置 | 第三步:设置 API Key [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E7%AC%AC%E4%B8%89%E6%AD%A5-%E8%AE%BE%E7%BD%AE-api-key) ---------------------------------------------------------------------------------------------------------------------------------- 推荐通过环境变量提供 Key(即上面的 `env_key` 方式):配置文件中不含明文密钥,可以安全分享、备份,也是 Codex 官方推荐的方式。 按操作系统选择对应命令: macOSLinuxWindows sh echo 'export KIMI_API_KEY="sk-kimi-你的key"' >> ~/.zshrc source ~/.zshrc sh echo 'export KIMI_API_KEY="sk-kimi-你的key"' >> ~/.bashrc source ~/.bashrc powershell setx KIMI_API_KEY "sk-kimi-你的key" 使用 Codex 桌面 App 时还需要一步:从 Dock 或访达启动的 App 读不到终端里的环境变量,需要把 Key 注入当前用户会话。在终端执行: sh launchctl setenv KIMI_API_KEY "sk-kimi-你的key" 执行后**完全退出**桌面 App(Cmd+Q)再重新打开,才会生效。注意:该变量在重启电脑后失效,需要重新执行。Windows 没有这一步——`setx` 写入的是系统环境变量,重启 App 即可。 ### 备选:写入配置文件(experimental\_bearer\_token) [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%A4%87%E9%80%89-%E5%86%99%E5%85%A5%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-experimental-bearer-token) 如果遇到环境变量不生效的问题(例如 GUI 应用读不到环境变量、CI 环境不便注入等),可以改用 `experimental_bearer_token`,把 Key 直接写在 provider 配置里代替 `env_key`: toml [model_providers.kimi] name = "Kimi" base_url = "https://api.kimi.com/coding/v1" wire_api = "responses" experimental_bearer_token = "sk-kimi-你的key" 明文密钥风险 此方式下 Key 以**明文**存储在配置文件中,请勿将该文件提交到版本仓库或随 dotfiles 公开分享,是否使用请自行权衡。`env_key` 与 `experimental_bearer_token` 两种方式不要同时配置。 第四步:启动并验证 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E7%AC%AC%E5%9B%9B%E6%AD%A5-%E5%90%AF%E5%8A%A8%E5%B9%B6%E9%AA%8C%E8%AF%81) ------------------------------------------------------------------------------------------------------------------------------------------------ 新开一个终端,进入需要使用的项目目录,直接启动 Codex: bash cd /path/to/your/project codex 在会话里发一句 `hello`,能正常返回结果就说明配置已生效。 配置成功的标志: * 启动信息中显示 `model: k3-256k`(或你选用的模型)、`provider: kimi`; * 不再出现 `Model metadata not found` 警告(models.json 已生效)。 在 Codex 桌面端中使用 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%9C%A8-codex-%E6%A1%8C%E9%9D%A2%E7%AB%AF%E4%B8%AD%E4%BD%BF%E7%94%A8) -------------------------------------------------------------------------------------------------------------------------------------------------- 桌面端与 CLI 读取同一份 `~/.codex/models.json` 和 `~/.codex/config.toml`,可按照 CLI 的配置过程完成前三步,随后操作下列步骤: 1. **(仅 macOS)注入环境变量**:GUI 应用读不到在终端里配置的变量,先执行下面的命令,把 `KIMI_API_KEY` 注入用户会话。Windows 的 `setx` 写入的是系统环境变量,无需这一步。 sh launchctl setenv KIMI_API_KEY "sk-kimi-你的key" 2. **重启桌面 App**:完全退出(macOS 为 Cmd+Q)再重新打开,新的配置才会被加载。 3. **选择模型开始对话**:在模型选择器里选择 Kimi 的模型,打开新线程即可开始使用。 TIP 桌面端运行时会自动向 `config.toml` 追加插件、MCP 等管理字段,属正常现象;手动添加的 Kimi Code 配置会被完整保留,请勿删除这些自动生成的区块。 切换思考程度(effort) [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%88%87%E6%8D%A2%E6%80%9D%E8%80%83%E7%A8%8B%E5%BA%A6-effort) ----------------------------------------------------------------------------------------------------------------------------------------- K3 支持 `low` / `high` / `max` 三档思考程度。在 Codex CLI 会话中,输入 `/model` 重新选中当前模型,然后在 **Select Reasoning Level** 菜单中选择档位。 切换档位后建议新建会话,避免旧上下文缓存失效带来的额外消耗。 常见问题 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------ ### 报错 Missing environment variable: KIMI\_API\_KEY [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E6%8A%A5%E9%94%99-missing-environment-variable-kimi-api-key) 当前进程读不到环境变量。确认已写入正确的 shell 配置文件并新开终端;macOS 桌面 App 参考第三步的 `launchctl` 方法;仍有问题可改用 `experimental_bearer_token`。 ### codex exec 无法执行工具命令 [​](https://www.kimi.com/code/docs/third-party-tools/codex#codex-exec-%E6%97%A0%E6%B3%95%E6%89%A7%E8%A1%8C%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4) 在 user namespace 受限的环境(例如 bwrap 报 ENOSPC)下,Codex 的默认沙箱无法工作,`codex exec` 需要加上 `--sandbox danger-full-access` 才能执行工具命令,即 `codex exec --sandbox danger-full-access "你的任务"`。注意该参数会关闭沙箱隔离,命令将直接在你的真实环境中执行,请确认任务来源可信后再使用。 下一步 [​](https://www.kimi.com/code/docs/third-party-tools/codex#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 查看模型的能力对比和完整 effort 映射表 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) — 确认可用模型与档位要求 --- # 在 Hermes Agent 中使用 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/third-party-tools/hermes.html#VPContent) Return to top 在 Hermes Agent 中使用 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E5%9C%A8-hermes-agent-%E4%B8%AD%E4%BD%BF%E7%94%A8) ======================================================================================================================================== [Hermes Agent](https://github.com/NousResearch/hermes-agent) 是 Nous Research 开源的自我改进型 AI Agent,内置学习闭环,支持终端、Telegram、Discord 等多种入口。本文介绍如何在 Hermes Agent 中接入 Kimi Code 会员,使用 Kimi 提供的模型推理能力。 准备工作 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C) ------------------------------------------------------------------------------------------------------------ 开始前,请完成以下准备工作。安装和账号相关操作请按照对应的官方指引完成,本文不再展开。 [安装 Hermes Agent按照 Hermes Agent 官方安装文档完成安装或更新。](https://hermes-agent.nousresearch.com/docs/getting-started/installation) [创建 API Key在 Kimi Code 控制台创建并妥善保存会员 API Key。](https://www.kimi.com/code/console) [确认会员档位在会员权益页查看当前档位的可用模型与权益。](https://www.kimi.com/code/docs/kimi-code/membership) 第一步:选择 Kimi Coding Plan 和模型 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E4%B8%80%E6%AD%A5-%E9%80%89%E6%8B%A9-kimi-coding-plan-%E5%92%8C%E6%A8%A1%E5%9E%8B) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 在终端输入下列指令,运行模型配置向导: sh hermes model 在一级菜单选择 **Kimi / Moonshot**。 ![在一级菜单选择 Kimi / Moonshot](https://www.kimi.com/code/docs/images/zh/third-party-tools/hermes/provider-menu.png) 在二级菜单选择 **Kimi / Kimi Coding Plan**,然后在掩码输入框中粘贴会员 API Key,无需手动填写 Base URL。 ![在二级菜单选择 Kimi / Kimi Coding Plan](https://www.kimi.com/code/docs/images/zh/third-party-tools/hermes/provider-region.png) 选择默认模型时,向导会列出当前 Key 可用的模型: ![向导列出当前 Key 可用的模型](https://www.kimi.com/code/docs/images/zh/third-party-tools/hermes/model-list.png) 注意:列表中的 `kimi-k3` 和配置中使用的 `k3` 是同一个模型 模型上新推荐 **K2.8 Preview** 现已全量上线 Kimi Code,`kimi-for-coding` 直接升级、无需修改配置:综合性能接近 K3,支持 `low` / `high` / `max` 三档思考程度与最高 1M 上下文。详见 [最新动态](https://www.kimi.com/code/docs/kimi-code/whats-new.html) 。 先了解自己的会员档位,再根据下表选择合适的模型,详见 [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html#plan-comparison) : | 会员档位 | 可用模型 | 上下文窗口 | | --- | --- | --- | | Go(新套餐) | 无 coding 额度 | — | | Andante(老套餐) | `kimi-for-coding` | `1048576` | | Plus / Moderato | `k3` <br>`k3-256k` <br>`kimi-for-coding` | `k3`:`262144` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` | | Pro 及以上 / Allegretto 及以上 | `k3` <br>`k3-256k` <br>`kimi-for-coding` <br>`kimi-for-coding-highspeed` | `k3`:`1048576` <br>`k3-256k`:`262144` <br>`kimi-for-coding`:`1048576` <br>`kimi-for-coding-highspeed`:`262144` | 注意:列表中的 `kimi-k3` 和配置中使用的 `k3` 是同一个模型,同时列表里没有 `k3-256k`,如需使用,选择 **Enter custom model name** 手动输入 `k3-256k`,不要加任何前缀。使用超出权限的模型和上下文会触发报错。 ![选择 Enter custom model name 手动输入模型名](https://www.kimi.com/code/docs/images/zh/third-party-tools/hermes/custom-model.png) 第二步:写入 K3 完整配置 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E4%BA%8C%E6%AD%A5-%E5%86%99%E5%85%A5-k3-%E5%AE%8C%E6%95%B4%E9%85%8D%E7%BD%AE) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 运行: sh hermes config edit > `hermes config edit` 只是用默认终端编辑器打开 `~/.hermes/config.yaml`。不习惯 nano/vim 的话,也可以直接用 VS Code 等任意编辑器打开这个文件修改,效果相同。 yaml custom_providers: - name: kimi-coding-plan base_url: https://api.kimi.com/coding/v1 key_env: KIMI_API_KEY api_mode: chat_completions model: k3-256k extra_body: reasoning_effort: high models: k3-256k: context_length: 262144 supports_vision: true model: provider: custom:kimi-coding-plan default: k3-256k context_length: 262144 supports_vision: true agent: reasoning_effort: high auxiliary: vision: provider: main model: k3-256k extra_body: reasoning_effort: high 编辑完成后保存退出(nano 按 `Ctrl+O` 回车保存、`Ctrl+X` 退出;vim 输入 `:wq`;VS Code 直接保存即可)。 代码块中几个关键字段的说明: * `reasoning_effort`:推理强度,这里显式设为 `high`。支持 `low` / `high` / `max`,默认 `high`,映射规则见 [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) * `context_length` 和 `supports_vision`:启用 256K 上下文和原生图片理解;`auxiliary` 区域让图片分析复用同一个主 Provider * `key_env`:对应的 `KIMI_API_KEY` 就是第一步在向导中粘贴的会员 Key,无需重复配置 * `base_url`:只填到 `/coding/v1`,Hermes 会自动追加 `/chat/completions`,不要把完整请求地址写进去 说明 如需 1M 上下文的 `k3`(Allegretto / Pro 及以上档位可用),把上面配置中的 `k3-256k` 全部替换为 `k3`,并将两处 `context_length` 改为 `1048576` 即可。Moderato / Plus 档位调用 `k3` 时上下文上限同样为 256K,无需修改。 第三步:启用视频分析 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E4%B8%89%E6%AD%A5-%E5%90%AF%E7%94%A8%E8%A7%86%E9%A2%91%E5%88%86%E6%9E%90) ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Hermes Agent 内置官方视频分析工具,启用一次即可: sh hermes tools enable video 启用后,Hermes 可以调用官方 `video_analyze` 工具。对于本地视频,该工具会读取完整文件,编码为 `data:video/...;base64,...`,再以 `video_url` 内容块发送给模型,不会先在本地使用 FFmpeg 抽帧。 之后在对话中提供视频的绝对路径,并明确要求调用 `video_analyze`,无需使用 `/video` 命令: text 调用 video_analyze 分析 /绝对路径/demo.mp4,概括视频内容,并列出三个能从画面确认的细节。 支持 MP4、WebM、MOV、AVI、MKV、MPEG 等常见格式,Base64 编码后的视频载荷上限约 50 MB——这是 Hermes 客户端视频工具的硬编码上限,不是 Kimi API 的限制,较大的视频请先裁剪或压缩。也可以直接提供可公开访问的 HTTP/HTTPS 视频 URL。 > 视频分析依赖模型的多模态能力,`k3-256k` 不支持视频输入。如果第二步配置的是 `k3-256k`,分析视频前请先把默认模型切换为 `k3`。 第四步:使用图片 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E5%9B%9B%E6%AD%A5-%E4%BD%BF%E7%94%A8%E5%9B%BE%E7%89%87) -------------------------------------------------------------------------------------------------------------------------------------------- 在对话中使用本地图片的绝对路径: text /image /图片的绝对路径/example.png 也可以把图片复制到剪贴板后输入 `/paste`,再输入问题。图片会作为原生视觉内容发送给第二步配置的模型。 第五步:启动并验证 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E4%BA%94%E6%AD%A5-%E5%90%AF%E5%8A%A8%E5%B9%B6%E9%AA%8C%E8%AF%81) ------------------------------------------------------------------------------------------------------------------------------------------------------ 配置完成后启动新会话,让供应商和模型配置生效: sh hermes 启动后确认底部状态栏显示的模型名和上下文窗口符合预期(例如 `k3-256k` + `256K`),然后发送一个简单请求验证连通性。 ![启动后状态栏显示模型名与上下文窗口](https://www.kimi.com/code/docs/images/zh/third-party-tools/hermes/chat.png) 常见问题 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) ------------------------------------------------------------------------------------------------------------ ### 模型列表里没有 `k3-256k` [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8%E9%87%8C%E6%B2%A1%E6%9C%89-k3-256k) `k3-256k` 不在向导的默认模型列表里。重新运行 `hermes model`,选择 **Kimi / Moonshot > Kimi / Kimi Coding Plan**,然后选择 **Enter custom model name** 手动输入 `k3-256k`。 ### 返回 401 或 Key 被拒绝 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E8%BF%94%E5%9B%9E-401-%E6%88%96-key-%E8%A2%AB%E6%8B%92%E7%BB%9D) 确认使用的是在 [Kimi Code 控制台](https://www.kimi.com/code/console) 创建的 `sk-kimi-` 会员 Key,并确认会员档位支持所选模型(见[第一步](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E7%AC%AC%E4%B8%80%E6%AD%A5%E9%80%89%E6%8B%A9-kimi-coding-plan-%E5%92%8C%E6%A8%A1%E5%9E%8B) 的档位表)。如确认无误仍报错,重新生成 Key 后再运行 `hermes model` 输入。 ### 返回 403 错误 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E8%BF%94%E5%9B%9E-403-%E9%94%99%E8%AF%AF) 触发了额度或频率限制。请留意每 5 小时的滚动频率窗口;老会员的订阅额度每 7 天刷新(新会员已取消每周额度限制),等窗口重置后自动恢复;额度使用情况可在 [Kimi Code 控制台](https://www.kimi.com/code/console) 查看。具体报错文案与处理方式见[错误参考](https://www.kimi.com/code/docs/kimi-code/error-reference.html#%E9%85%8D%E9%A2%9D%E4%B8%8E%E8%B4%A6%E6%88%B7%E9%99%90%E5%88%B6) 。 ### 视频工具没有被调用 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E8%A7%86%E9%A2%91%E5%B7%A5%E5%85%B7%E6%B2%A1%E6%9C%89%E8%A2%AB%E8%B0%83%E7%94%A8) 确认已执行 `hermes tools enable video`,并在提问中明确要求调用 `video_analyze`,且本地视频使用绝对路径。编码后的负载需小于约 50 MB。 下一步 [​](https://www.kimi.com/code/docs/third-party-tools/hermes.html#%E4%B8%8B%E4%B8%80%E6%AD%A5) -------------------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 查看模型的能力对比和完整 effort 映射表 * [会员权益](https://www.kimi.com/code/docs/kimi-code/membership.html) — 确认可用模型、额度刷新规则与档位要求 --- # 会员权益 | Kimi Code 文档 [Skip to content](https://www.kimi.com/code/docs/kimi-code/membership#VPContent) Return to top 会员权益 [​](https://www.kimi.com/code/docs/kimi-code/membership#%E4%BC%9A%E5%91%98%E6%9D%83%E7%9B%8A) =================================================================================================== 📢 新套餐发布 Kimi 会员新套餐正式发布,定价不变。新套餐详情见 [Kimi Code 套餐购买页](https://www.kimi.com/code/#pricing) 。新会员**取消每周额度限制**,仅保留每 5 小时的滚动频率窗口;Go 档无 coding 额度,Plus 及以上档位可使用 Kimi Code。老套餐会员不受影响,档位名称、额度规则与自动续费均维持原样。新老套餐的规则差异见下方 [套餐档位](https://www.kimi.com/code/docs/kimi-code/membership#plan-comparison) 对比。 概述 [​](https://www.kimi.com/code/docs/kimi-code/membership#%E6%A6%82%E8%BF%B0) ------------------------------------------------------------------------------- Kimi Code 是 [Kimi 会员权益](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) 中面向开发者的智能编程服务,随 Kimi 会员订阅一同提供,与 Kimi 会员共享同一套额度。CLI、VS Code、桌面端及第三方工具发起的请求,均计入该额度。 订阅档位与价格详见 [Kimi 会员权益页](https://www.kimi.com/membership/pricing?from=kfc_docs_membership) 。 套餐档位 [​](https://www.kimi.com/code/docs/kimi-code/membership#plan-comparison) ------------------------------------------------------------------------------ Kimi 会员已启用新的档位名称,定价不变。新老套餐的规则对比如下: | 对比项 | 老套餐 | 新套餐 | | --- | --- | --- | | Kimi Code 使用门槛 | Andante 及以上 | Plus 及以上 | | 5 小时频率窗口 | 有 | 有 | | 周频率窗口 | 有 | 无 | | 月总额度 | 有 | 有 | | K3 调用门槛 | Moderato 及以上 | Plus 及以上 | | K3 1M 上下文门槛 | Allegretto 及以上 | Pro 及以上 | | 高速版门槛 | Allegretto 及以上 | Pro 及以上 | **常见问题** 老套餐还能继续使用吗? 可以。在新版套餐上线前购买的旧版套餐仍可继续使用,到期后可选择续订或升级到新版套餐。 我一定要升级新套餐吗? 不是强制迁移。老套餐可以继续维持订阅,是否升级取决于你的使用需求。 如何升级会员计划? 在 [Kimi Code 套餐购买页](https://www.kimi.com/code/#pricing) 选择想要升级的新套餐,点击「订阅」后按提示完成支付即可。升级时系统会根据当前套餐的剩余天数折算,新套餐权益立即生效。 额度与限制 [​](https://www.kimi.com/code/docs/kimi-code/membership#%E9%A2%9D%E5%BA%A6%E4%B8%8E%E9%99%90%E5%88%B6) ------------------------------------------------------------------------------------------------------------- 新会员与老会员的额度规则不同: * **新会员**:取消每周额度限制,不再每 7 天刷新;保留**每 5 小时的滚动频率窗口**——短时间请求过多会触发限流,等窗口滚动后自动恢复。 * **老会员**:规则不变,额度以订阅日为起点**每 7 天自动刷新**,未用完不累积;同样有每 5 小时的滚动频率窗口。 两类会员都与 Kimi 会员计划共享月总额度:如月总额度达到上限,Kimi Code 额度会冻结,需等待月额度重置或升级订阅。月额度消耗可在 [订阅](https://www.kimi.com/membership/subscription) 页查看。 所有登录设备和 API Key 共享同一套配额;超过 30 天未活跃的设备会自动解绑,重新 `/login` 即可恢复。登录 [Kimi Code 控制台](https://www.kimi.com/code/console) 可随时查看剩余额度与频限状态、管理 API Key 和登录设备。 加油包 [​](https://www.kimi.com/code/docs/kimi-code/membership#extra-usage) ------------------------------------------------------------------------- 订阅额度用尽后,可用加油包(Extra Usage)余额继续发起请求,不必等待刷新。仅订阅会员可开启,且**网页端 Kimi 与 Kimi Code 共享同一份加油包额度**。完整条款见 [加油包充值协议](https://www.kimi.com/user/agreement/extra-usage-rules-cn) 。 ![额度加油包](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-module.png) **充值入口** * **从主站充值**:进入 Kimi [订阅页面](https://www.kimi.com/membership/subscription?tab=quota) ,滚动至页面底部的「额度加油包」模块 → 选择充值金额 → 完成支付即可。 * **从 Kimi Code 控制台充值**:当你的**周额度(老会员)或 5 小时额度任意一项消耗超过 80%** 时,进度条卡片会出现【加油包购买】按钮,点击即可跳转到 Kimi 订阅页完成购买。 ![Kimi Code 控制台的额度加油包入口](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-console.png) **开启与管理** 打开「额度加油包」开关后,当订阅额度用尽时,系统会自动从加油包余额中扣减。点击模块的「设置」可开启**每月消费上限**、设定本月最多可花费的金额;进度条则实时显示本月加油包的消耗情况。 **计费与规则** * **计费**:按实际用量扣费——读取与生成的内容越多、任务越复杂,花费越高;余额以人民币显示,费率以平台展示为准。加油包价格近似于 [Kimi 开放平台](https://platform.kimi.com/) 的官方 API 价格;用量较大时,升级订阅通常更划算。 * **消耗优先级**:先扣订阅等限时额度,**加油包最后扣**,作为兜底补充。开启后即使订阅额度被打满,也能无缝消耗加油包余额,任务不中断、不报错。 * **限额控制**:可在设置中开启「每月消费上限」,为加油包设定本月最多可花费的金额;不开启则不限额。 * **有效期与叠加**:余额不过期、可叠加;订阅失效后余额仍可继续消费,但失效期间无法再充值,需重新开通订阅后才能充值。 * **退款**:一般不可退款、转让或兑现。 > 计费示例(引自官方示例,仅供感受量级,实际以平台为准):一次简单请求(如「推荐一首摇滚歌曲」)约 **0.03 元**;一次复杂的多步任务(如「规划一周成都到川西的自驾行程」)约 **1.6 元**。 > 充值限制:单次最低 25 RMB,每日最多 10 次、累计 3,000 RMB,余额上限 10,000 RMB。 **查询用量** * **Kimi 网页 / App**:设置 → 订阅和发票 → [我的额度](https://www.kimi.com/membership/subscription?tab=quota) 。 * **Kimi Code 控制台**:**开启加油包后**,登录 [控制台](https://www.kimi.com/code/console) 即可查看余额与用量。 * **Kimi Code CLI**:在命令行中输入 `/usage` 直接查询。 ![CLI 中 /usage 查看加油包(Extra Usage)用量](https://www.kimi.com/code/docs/images/zh/kimi-code/membership/extra-usage-cli.png) **常见问题** 网页端 Kimi 和 Kimi Code 的加油包是同一个钱包吗? 是的。加油包额度在 Kimi 与 Kimi Code 之间共享——充值一次,两端通用;「我的额度」里充值的加油包与 Kimi Code 控制台的加油包也是同一个。 加油包和订阅额度谁先扣? 先扣订阅等限时额度,加油包在所有限时额度耗尽后才作为兜底扣除。 达到月 / 周(老会员)/ 小时额度上限,或会话中被限流时,还能继续吗? 能。开启加油包后不受订阅限额影响,任意额度触顶都会无缝切到加油包余额,任务不中断、不报错,且只扣加油包余额、不影响会员额度刷新。 加油包怎么计费?和同价位的订阅、开放平台 API 相比如何? 计费取决于请求的输入 / 输出量与 cache 命中率;加油包单价近似 [Kimi 开放平台](https://platform.kimi.com/) 的官方 API,用量较大时升级订阅通常更划算。 没用完的余额能留到下个月、能叠加吗? 能。余额制、不过期、可叠加;订阅失效后余额仍可消费,但失效期间无法充值,需重新开通订阅后再充。 余额快用尽时(如充了 25 元),会保证当前请求跑完吗? 会保证「最后一次模型调用」即使计费超限也完成,但不保证整个任务一定跑完。 加油包支持企业版吗? 暂不支持。 注销账户后余额会退回吗? 请前往 [Kimi 网页端](https://www.kimi.com/) ,点击左下角头像 → **帮助** → **用户反馈**,接入在线客服申请退款。 下一步 [​](https://www.kimi.com/code/docs/kimi-code/membership#%E4%B8%8B%E4%B8%80%E6%AD%A5) ----------------------------------------------------------------------------------------- * [模型配置](https://www.kimi.com/code/docs/kimi-code/models.html) — 各档位可用的模型、上下文窗口与切换方式 * [错误参考](https://www.kimi.com/code/docs/kimi-code/error-reference.html) — 额度用尽、权限不足等报错的处理方式 ---