软件

Opencode 思考强度设置的一点小坑

Opencode 思考强度设置的一点小坑

记录一下在本地使用Qwen3.8-27B时接入opencode遇到的一些坑:

首先,opencode的jsonc文件中不能像GPT一样在一个模型中设置思考强度,必须分成多个模型,并额外添加options模块传入,当然,除了思考强度外,你也可以在这里设置其它参数,比如temperature和top_p。

其次,因为要共享同一个api地址,除了第一个,每一个模型都需要设置一个单独ID,完整示例设置如下所示:

    "local2": {
      "name": "qwen3.8",
      "npm": "@ai-sdk/openai-compatible",
      "models": {
        "qwen3.8-27b": {
          // 关闭思考模式(直出模式)
          "name": "Qwen 3.8 27B 直出",
          "limit": {
            "context": 200000,
            "output": 20000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "options": {
            "temperature": 0.7,
            "top_p": 0.8,
            "presence_penalty": 1.5,
            "top_k": 20,
            "chat_template_kwargs": {
              "enable_thinking": false
            }
          }
        },
        "qwen3.8-27b-int4-think": {
          // 开启思考模式(xhigh 默认,深度分析)
          "name": "Qwen 3.8 27B 思考 (xhigh)",
          "id": "qwen3.8-27b",
          "limit": {
            "context": 200000,
            "output": 20000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "options": {
            "temperature": 1.0,
            "top_p": 0.95,
            "presence_penalty": 0.1,
            "top_k": 20,
            "chat_template_kwargs": {
              "enable_thinking": true
            },
            "reasoningEffort": "xhigh"
          }
        },
        "qwen3.8-27b-int4-think-medium": {
          // 开启思考模式(medium,速度与准确性平衡)
          "name": "Qwen 3.8 27B 思考 (medium)",
          "id": "qwen3.8-27b-int4",
          "limit": {
            "context": 200000,
            "output": 20000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "options": {
            "temperature": 1.0,
            "top_p": 0.95,
            "presence_penalty": 0,
            "top_k": 20,
            "chat_template_kwargs": {
              "enable_thinking": true
            },
            "reasoningEffort": "medium"
          }
        },
        "qwen3.8-27b-int4-think-low": {
          // 开启思考模式(low,优先速度和成本)
          "name": "Qwen 3.8 27B 思考 (low)",
          "id": "qwen3.8-27b-int4",
          "limit": {
            "context": 200000,
            "output": 20000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "options": {
            "temperature": 1.0,
            "top_p": 0.95,
            "presence_penalty": 0,
            "top_k": 20,
            "chat_template_kwargs": {
              "enable_thinking": true
            },
            "reasoningEffort": "low"
          }
        }
      },
      "options": {
        "baseURL": "http://127.0.0.1:8000/v1",
        "apiKey": "12345",
        "timeout": false,
        "chunkTimeout": 120000
      }
    },

评论

10:24:00
8月27日, 2026, 周三
system_stats.sh
处理器 CPU82%
运行内存 RAM12.4G / 16G
网络吞吐 Network5.2 Mbps · 4g

精选图库

JacyLunatic

JacyLunatic

只争朝夕

91 篇创作

实时天气

24°
本地
28° / 24°
97% 12 km/h 体感 29°
逐小时
多日预报

创作活跃度

萌ICP备20241011号
本站已加入BLOGS·CN