记录一下在本地使用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
}
},
评论