# Code Tools 使用教學

Cherry Studio v1.5.7 版本引入咗操作簡單、功能強大嘅 Code Agent 功能，可以直接啟動同管理多種 AI 編程 agent。本教程會引導您完成設定同啟動嘅完整流程。

***

### 操作步驟

#### 1. 升級 Cherry Studio

首先，請確保您嘅 Cherry Studio 已經升級到 **v1.5.7** 或者更高版本。您可以去 [GitHub Releases](https://github.com/CherryHQ/cherry-studio/releases) 或者官方網站下載最新版本。

#### 2. 進入 Code Tool 工具界面

頂部導航模式：點擊界面頂部嘅「+」號圖標，新建一個空白標籤頁

<figure><img src="/files/08547c5253bf409a3dee3e78597f84c148f6f4b2" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1c1a84b1040e1112bdd0d9e6bae0f3304a5e90ce" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
喺左側導航模式下，點擊左側導航入面嘅 Code Tool 按鈕進入呢個頁面
{% endhint %}

#### 3. 選擇 CLI 工具

根據您嘅需求同手上持有嘅 API Key，揀一個要使用嘅 Code Agent 工具。目前支援以下幾種：

* **Claude Code**
* **Gemini CLI**
* **Qwen Code**
* **OpenAI Codex**

<figure><img src="/files/01147f1d2908fdca0925b920b5ce7ebaf09a0fae" alt=""><figcaption></figcaption></figure>

#### 4. 選擇 Agent 調用嘅模型

喺模型下拉列表中，選擇同您所揀 CLI 工具兼容嘅模型。 *（詳細嘅模型兼容性說明，請參考下方嘅「重要注意事項」）*

<figure><img src="/files/53b5dfdb43455c2813499cfb7c5831162c705d9b" alt=""><figcaption></figcaption></figure>

#### 5. 指定工作目錄

點擊「選擇目錄」按鈕，為 Agent 指定一個工作目錄。Agent 將會有權限存取此目錄下所有文件同子目錄，以便佢理解項目上下文、讀取文件同執行代碼。

<figure><img src="/files/e0f848fcd80e35ac730bf59bb8331d534ab4d30b" alt=""><figcaption></figcaption></figure>

#### 6 設置環境變量

* **自動配置**：您喺第 6 步（模型）同第 7 步（工作目錄）入面嘅選擇，會自動生成相應嘅環境變量。
* **自定義添加**：如果您嘅 Agent 或項目需要其他特定嘅環境變量（例如 `PROXY_URL` 等等），可以喺呢個區域自定義添加。

<figure><img src="/files/dca15b5ee7248385ff3fe9d64ea7d019afe0f014" alt=""><figcaption></figcaption></figure>

#### 7. 更新選項

* **內置可執行文件**：Cherry Studio 已經幫您整合咗上述所有 Code Agent 嘅可執行文件，喺大多數情況下，您唔使連線都可以直接使用。
* **自動更新**：如果您希望 Agent 一直保持最新版本，可以勾選 **`檢查更新並安裝最新版本`** 嘅選項。勾選之後，每次啟動時程式都會連線檢查並更新 Agent 工具。

<figure><img src="/files/cce1b04d827c7d646ec947d13d82fdaa106712fb" alt=""><figcaption></figcaption></figure>

#### 8. 啟動 Agent

所有配置完成後，點擊 **`啟動`** 按鈕。Cherry Studio 會自動調用您系統自帶嘅 Terminal（終端）工具，並喺入面載入好所有環境變量，然後運行您選擇嘅 Code Agent。依家您可以喺彈出嘅終端窗口入面同 AI Agent 互動喇。

<figure><img src="/files/db354b7b450dddf04ea1ca30e58010e007ca6917" alt=""><figcaption></figcaption></figure>

***

### 重要注意事項

1. **模型兼容性說明**：
   * **Claude Code**：需要選擇支援 Anthropic API Endpoint 格式嘅模型。目前官方支援嘅模型包括：
     * Claude 系列模型
     * DeepSeek V3.1（官方 API 平台）
     * Kimi K2（官方 API 平台）
     * 智譜 GLM 4.5（官方 API 平台）
     * **注意**：而家好多第三方服務商（例如 One API、New API 等）針對 DeepSeek、Kimi、GLM 嘅 API 接口，大多只支援 OpenAI Chat Completions 格式，可能未能同 Claude Code 直接兼容，需要等服務商逐步適配。
   * **Gemini CLI**：需要選擇 Google 嘅 Gemini 系列模型。
   * **Qwen Code**：支援 OpenAI Chat Completions API 格式嘅模型，強烈推薦使用 **`Qwen3 Coder`** 系列模型，以獲得最佳代碼生成效果。
   * **OpenAI Codex**：支援 GPT 系列模型（例如 `gpt-4o`, `gpt-5` 等等）。
2. **依賴同環境衝突**：
   * Cherry Studio 內部集成咗獨立嘅 Node.js 運行環境、Code Agent 可執行文件同環境變量配置，旨在提供一個開箱即用嘅純淨環境。
   * 如果您喺啟動 Agent 時遇到依賴衝突或者奇怪嘅錯誤，可以考慮暫時**卸載或禁用系統內已安裝嘅相關依賴**（例如全局安裝嘅 Node.js 或特定工具鏈），以排除衝突。
3. **API Token 消耗警告**：
   * **Code Agent 對 API Token 嘅消耗量非常大**。喺處理複雜任務時，Agent 為咗思考、規劃同生成代碼，可能會產生大量請求，導致 Token 快速消耗。
   * 請務必根據自己嘅 API 額度同預算，**量力而為**，密切留意 Token 使用情況，以防止預算超支。

希望本教程可以幫助您快速上手 Cherry Studio 強大嘅 Code Agent 功能！


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cherry-ai.com/docs/zhong-wen-fan-ti/advanced-basic/code-tools-shi-yong-jiao-cheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
