Unquant

Opening your workspace…

Unquant

如何將 Unquant 加入 OpenCode

OpenCode 接受任何相容 OpenAI 的端點作為自訂提供者。在 opencode.json 中加入 Unquant,就能以 GLM-5.3-Flash 執行 262K 情境和無限制 token。

設定指南2 分鐘閱讀更新於 2026 年 10 月 1 日
  1. 1

    設定你的金鑰

    export UNQUANT_API_KEY=your-unquant-key
  2. 2

    新增提供者

    編輯 opencode.json(專案的或 ~/.config/opencode/opencode.json):

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "unquant": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Unquant",
          "options": {
            "baseURL": "https://api.unquant.io/v1",
            "apiKey": "{env:UNQUANT_API_KEY}"
          },
          "models": {
            "glm-5.3-flash": { "name": "GLM-5.3-Flash", "limit": { "context": 262144, "output": 32768 } },
            "qwen-3.8-flash-next": { "name": "Qwen 3.8 Flash Next", "limit": { "context": 262144, "output": 32768 } }
          }
        }
      }
    }
  3. 3

    選擇模型

    重新啟動 OpenCode,執行 /models,然後選擇 Unquant · GLM-5.3-Flash。

401
未授權

確認 UNQUANT_API_KEY 已在 OpenCode 執行的環境中設定。

403
不包含在你的訂閱中

請選擇你方案中的模型。

429
已達並行串流上限

你的帳號上還有另一個請求正在執行。

262K
對話過大無法壓縮

模型在 opencode.json 中沒有 limit,因此 OpenCode 從未壓縮,對話超出了視窗。加入上方的限制設定。閘道現在會修剪 OpenCode 壓縮請求中最舊的輪次,讓再次執行壓縮後對話可以繼續。

延伸閱讀