# Continue (/zh-Hant/docs/guides/continue)

在 VS Code 與 JetBrains 的 Continue 擴充功能中，以 cheapaimodel 的模型進行對話、編輯與套用。



Continue 透過 `openai` 供應商加上自訂的 `apiBase` 連接 OpenAI 相容服務，設定寫在你的 `config.yaml`。

|          | Continue 設定 | 值                                                               |
| -------- | ----------- | --------------------------------------------------------------- |
| Base URL | `apiBase`   | `https://api.cheapaimodel.ai/v1`                                |
| API Key  | `apiKey`    | 你在控制台 [API Key](https://console.cheapaimodel.ai/keys) 頁面建立的 Key |
| 模型 ID    | `model`     | `glm-5.3`，或[目錄](/zh-Hant/models)中的任何模型 ID                       |

## 設定 [#設定]

把 Key 存進 Continue 的密鑰檔案。Continue 從 `.env` 檔案讀取 `${{ secrets.NAME }}` 的值；IDE 擴充功能看不到你在 shell 中匯出的環境變數。

```bash title="~/.continue/.env"
CHEAPAIMODEL_API_KEY=sk-...
```

接著在 `~/.continue/config.yaml`（Windows 為 `%USERPROFILE%\.continue\config.yaml`）加入一個模型：

```yaml title="~/.continue/config.yaml"
name: Main Config
version: 1.0.0
schema: v1

models:
  - name: GLM-5.3 (cheapaimodel)
    provider: openai
    model: glm-5.3
    apiBase: https://api.cheapaimodel.ai/v1
    apiKey: ${{ secrets.CHEAPAIMODEL_API_KEY }}
    roles:
      - chat
      - edit
      - apply
```

儲存檔案，然後在 Continue 側邊欄把 &#x2A;*GLM-5.3 (cheapaimodel)** 選為對話模型。要使用更多模型，就為[目錄](/zh-Hant/models)中的每個模型 ID 各加一筆。

## 自動完成、嵌入與重新排序 [#自動完成嵌入與重新排序]

以下角色請留給其他供應商：

* **`autocomplete`**：Continue 的 Tab 自動完成需要以中間填充（FIM）格式訓練的模型，對話模型做這件事效果不佳。目錄中的模型都是對話模型。
* **`embed`*&#x2A; 與 &#x2A;*`rerank`**：cheapaimodel 沒有嵌入或重新排序模型。程式碼庫索引請繼續使用 Continue 內建的嵌入模型（VS Code）或其他供應商。

## 常見錯誤 [#常見錯誤]

* **Key 已在 shell 中設定，但 Continue 沒有使用。** VS Code 與 JetBrains 擴充功能讀不到 shell 的環境變數。請把 Key 寫進 `~/.continue/.env`（值不加引號），然後重新啟動 IDE。
* **`config.yaml` 的修改沒有生效。** 在 VS Code 命令選擇區執行 **Developer: Reload Window**。
* **`404`，正文為純文字 `fault filter abort`。** `apiBase` 漏了 `/v1`，請求被送往 `/chat/completions`，這不是 API 路徑。請設定 `https://api.cheapaimodel.ai/v1`。
* **`404` 與 `Invalid URL (POST /v1/chat/completions/chat/completions)`。** `apiBase` 中包含了端點路徑。Continue 會自行加上 `/chat/completions`，只要設定 `https://api.cheapaimodel.ai/v1`。
* **`503` 且帶有 `model_not_found`。** `model` 的值不是我們提供的模型 ID。請從[目錄](/zh-Hant/models)完整複製 ID；`name` 只是顯示名稱。
