关于Cline免费模型在OpenCode的一些坑

关于Cline免费模型在OpenCode的一些坑
关于Cline免费模型在OpenCode的一些坑

[!NOTE]
TL;DR:

  1. OpenAI Compatible
  2. https://api.cline.bot/api/v1
  3. "variants": { "xhigh": {"reasoningEffort": "xhigh"}}

image

https://linux.do/t/topic/2321520 继续讨论。

接入 OpenCode 后,相比于官方 API,还是有一些坑点的。

  1. 三个免费模型(v4/2.5/3)端点都不支持 Anthropic 和 OpenAI Responses 格式,只支持 OpenAI Compatible 格式(@ai-sdk/openai-compatible),否则返回
{"error":"Unauthorized: Please make sure you're using the latest version of Cline and re-authenticate your Cline account."}
  1. 三个免费模型只支持最高 xhigh 推理强度("reasoning_effort": "xhigh"),否则返回
{
  "error": {
    "code": "stream_initialization_failed",
    "message": "Failed to create stream: inference request failed: failed to generate stream from Vercel: failed to invoke model 'xiaomi/mimo-v2.5' with streaming: request failed with status 400: {\"error\":{\"message\":\"Invalid option: expected one of \\\"none\\\"|\\\"minimal\\\"|\\\"low\\\"|\\\"medium\\\"|\\\"high\\\"|\\\"xhigh\\\"\",\"type\":\"invalid_request_error\",\"param\":\"reasoning.effort\",\"code\":\"invalid_request_error\"}}",
    "request_id": "LcHaHtEeyQTvjxUZUakxwUfncoDlfsmV",
    "type": "stream_error"
  }
}

比如在 CC-Switch/opencode.json 时应该这么配置:

CC-Switch 内模型配置片段:

{
  "npm": "@ai-sdk/openai-compatible",
  "options": {
    "baseURL": "https://api.cline.bot/api/v1",
    "apiKey": "sk_vme50thursdaykfcgogogoplease",
    "setCacheKey": true
  },
  "models": {
    "deepseek/deepseek-v4-flash": {
      "name": "DeepSeek V4 Flash",
      "variants": {
        "xhigh": {
          "reasoningEffort": "xhigh"
        }
      }
    },
    "xiaomi/mimo-v2.5": {
      "name": "MiMo V2.5",
      "variants": {
        "xhigh": {
          "reasoningEffort": "xhigh"
        }
      }
    },
    "minimax/minimax-m3": {
      "name": "MiniMax M3",
      "variants": {
        "xhigh": {
          "reasoningEffort": "xhigh"
        }
        }
      }
    }
  }
}

鬼知道除了 xhigh 以外的强度有什么副作用,所以就只配了 xhigh。既然模型都是免费的,那直接上最强的 xhigh 就好了呗。多一事不如少一事。

另外需要注意的是,OC 的会话标题生成器使用的是 high 强度。

设置这么一大长串(当然我改短了才发出来的,实际上你依然可以选择填写剩下的 low medium)就是方便选择推理强度。不手动选择推理强度(也就是不显示字段/Select variant 选 Default)就会默认不发送 reasoning_effort 字段:

image

切换推理强度可以通过按键盘上的 Ctrl+T 或在输入框内输入 /variants

image

1 个帖子 - 1 位参与者

阅读完整话题

来源: LinuxDo 最新话题查看原文