> 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.
