> For the complete documentation index, see [llms.txt](https://docs.cherryai.com.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cherryai.com.cn/docs/zhong-wen-fan-ti/pre-basic/providers/zi-ding-yi-fu-wu-shang.md).

# 自定義服務商

Cherry Studio 唔單止整合咗主流嘅 AI 模型服務，仲俾咗您強大嘅自訂能力。透過 **自訂 AI 服務商** 功能，您可以輕鬆接入任何您需要嘅 AI 模型。

## 點解需要自訂 AI 服務商？

* **靈活性：** 唔再受限於預設嘅服務商列表，自由選擇最適合您需求嘅 AI 模型。
* **多樣性：** 試吓各種唔同平台嘅 AI 模型，發掘佢哋嘅獨特優勢。
* **可控性：** 直接管理您嘅 API 密鑰同存取地址，確保安全同私隱。
* **自訂化：** 接入私有化部署嘅模型，滿足特定業務場景嘅需求。

## 點樣添加自訂 AI 服務商？

只需要簡單幾步，即可喺 Cherry Studio 入面添加您嘅自訂 AI 服務商：

<figure><img src="/files/7dd770b0b148035a42945ac895722bf509b1542d" alt=""><figcaption></figcaption></figure>

1. **打開設定：** 喺 Cherry Studio 界面左側導航欄中，撳「設定」（齒輪圖示）。
2. **進入模型服務：** 喺設定頁面中，選擇「模型服務」分頁。
3. **添加提供商：** 喺「模型服務」頁面入面，您會睇到已有嘅服務商列表。撳列表下方嘅「+ 添加」按鈕，打開「添加提供商」彈窗。
4. **填寫資訊：** 喺彈窗入面，您需要填寫以下資訊：
   * **提供商名稱：** 幫您嘅自訂服務商改個容易辨認嘅名稱（例如：MyCustomOpenAI）。
   * **提供商類型：** 喺下拉列表中揀選您嘅服務商類型。目前支援：
     * OpenAI
     * Gemini
     * Anthropic
     * Azure OpenAI
5. **儲存設定：** 填寫完成後，撳「添加」按鈕儲存您嘅設定。

## 設定自訂 AI 服務商

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

添加完成後，您需要喺列表中搵返您頭先添加嘅服務商，然後進行詳細設定：

1. **啟用狀態** 自訂服務商列表最右側有個啟用開關，撳開就代表啟用該自訂服務。
2. **API 金鑰：**
   * 填寫您嘅 AI 服務商提供嘅 API 密鑰（API Key）。
   * 撳右側嘅「檢查」按鈕，可以驗證密鑰嘅有效性。
3. **API 地址：**
   * 填寫 AI 服務嘅 API 存取地址（Base URL）。
   * 請務必參考您嘅 AI 服務商提供嘅官方文件，攞正確嘅 API 地址。
4. **模型管理：**

   * 撳「+ 添加」按鈕，手動添加呢個提供商底下您想用嘅模型 ID。例如 `gpt-3.5-turbo`、`gemini-pro` 等等。

   <figure><img src="/files/60b380d9d0605006ad5021e39c551d9f3a7f878a" alt=""><figcaption></figcaption></figure>

   * 如果您唔肯定具體嘅模型名稱，請參考您嘅 AI 服務商提供嘅官方文件。
   * 撳「管理」按鈕，可以對已經添加嘅模型進行編輯或者刪除。

## 開始使用

完成以上設定後，您就可以喺 Cherry Studio 嘅聊天介面入面，揀您自訂嘅 AI 服務商同模型，開始同 AI 對話喇！

## 用 vLLM 做自訂 AI 服務商

vLLM 係一個類似 Ollama 嘅快速又易用嘅 LLM 推理庫。以下係點樣將 vLLM 整合到 Cherry Studio 嘅步驟：

1. **安裝 vLLM：** 按照 vLLM 官方文件（<https://docs.vllm.ai/en/latest/getting_started/quickstart.html>）安裝 vLLM。

   ```sh
   pip install vllm # 如果你用 pip
   uv pip install vllm # 如果你用 uv
   ```
2. **啟動 vLLM 服務：** 用 vLLM 提供嘅 OpenAI 相容介面啟動服務。主要有兩種方式，分別如下：

   * 使用 `vllm.entrypoints.openai.api_server` 啟動

   ```sh
   python -m vllm.entrypoints.openai.api_server --model gpt2
   ```

   * 使用 `uvicorn` 啟動

   ```sh
   vllm --model gpt2 --served-model-name gpt2
   ```

確保服務成功啟動，並監聽 `8000` 上。 當然， 您亦可以透過參數 `--port` 指定 vLLM 服務嘅端口號。

3. **喺 Cherry Studio 入面添加 vLLM 服務商：**
   * 按照前面講嘅步驟，喺 Cherry Studio 入面添加一個新嘅自訂 AI 服務商。
   * **提供商名稱：** `vLLM`
   * **提供商類型：** 揀 `OpenAI`。
4. **設定 vLLM 服務商：**
   * **API 金鑰：** 因為 vLLM 唔需要 API 密鑰，可以將呢個欄位留空，或者填任何內容。
   * **API 地址：** 填寫 vLLM 服務嘅 API 地址。預設情況下，地址係： `http://localhost:8000/`（如果用咗唔同嘅端口，請相應修改）。
   * **模型管理：** 添加您喺 vLLM 入面載入嘅模型名稱。喺上面執行 `python -m vllm.entrypoints.openai.api_server --model gpt2` 嘅例子中，應該喺呢度填入 `gpt2`
5. **開始對話：** 而家，您可以喺 Cherry Studio 入面揀 vLLM 服務商同 `gpt2` 模型，開始同 vLLM 驅動嘅 LLM 對話喇！

## 提示同技巧

* **仔細閱讀文件：** 喺添加自訂服務商之前，請務必仔細閱讀您所用嘅 AI 服務商官方文件，了解 API 密鑰、存取地址、模型名稱等關鍵資訊。
* **檢查 API 密鑰：** 用「檢查」按鈕可以快速驗證 API 密鑰嘅有效性，避免因密鑰錯誤導致無法使用。
* **留意 API 地址：** 唔同嘅 AI 服務商同模型，API 地址可能會唔同，請務必填寫正確嘅地址。
* **模型按需要添加:** 請只添加您實際上會用到嘅模型，避免添加太多無用模型。

***

### 攞幫助同提交意見

如果您喺配置或使用過程中遇到任何疑問、Bug 或有功能改善建議，請參考 [反饋與建議](/docs/zhong-wen-fan-ti/question-contact/suggestions.md) 入面提供嘅官方渠道。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.cherryai.com.cn/docs/zhong-wen-fan-ti/pre-basic/providers/zi-ding-yi-fu-wu-shang.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
