Unquant

Opening your workspace…

Unquant

如何将 Unquant 添加至 OpenCode

OpenCode 支持将任意 OpenAI 兼容端点作为自定义 provider。将 Unquant 添加到配置文件后,即可从 OpenCode 的模型列表中选择使用。

配置指南阅读时间 2 分钟更新于 2026 年 10 月 1 日
  1. 1

    设置密钥

    export UNQUANT_API_KEY=your-unquant-key
  2. 2

    添加 provider

    在项目的 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 从未自动压缩,会话超出了上下文窗口。请按上方添加 limit 配置。网关现在会自动从 OpenCode 的压缩请求中裁剪最旧的轮次,重新运行压缩即可让会话继续。

继续阅读