白嫖近 2000 万 tokens 免费额度,让 WorkBuddy 支持 20 个主流大模型,每月省下一大笔 AI 订阅费。
一、为什么要把百炼模型接入 WorkBuddy?
作为 AI 爱好者,你可能同时用着 ChatGPT、Claude、Gemini 等多个大模型产品。但如果你用的是WorkBuddy(一个强大的 AI 代码编辑器),就可以通过自定义模型配置,直接把阿里云百炼平台的免费大模型接入进来。
优势很明显:
- 免费额度充沛:每个模型 100 万 tokens,20 个模型总计近 2000 万 tokens,有效期到 2026 年 9 月
- 模型丰富:涵盖通义千问、DeepSeek、GLM、Kimi 等主流模型
- 一次配置,长期使用:配置完成后直接在 WorkBuddy 界面切换,无需频繁切换平台
二、准备工作
1. 获取百炼 API Key
- 打开 阿里云百炼控制台
- 左侧菜单 →API 服务→API-Key 管理
- 点击「创建 API-Key」或复制已有的 Key
- Key 格式为
sk-xxxxxxxx
注意:免费 Token 仅限中国内地节点使用,海外节点不享受免费额度。
2. 开启模型免费额度
在百炼控制台的「模型广场」中,找到你想用的模型,点击右侧开关将「未开启」变成「已开启」。免费额度开启不会扣费,只是激活使用权限。
以下是已验证可用的模型列表(截至 2026 年 7 月):
| 模型 | 额度 | 到期日 | 特点 |
|---|---|---|---|
| qwen3.7-plus | 97.5万 | 2026-09-01 | 日常对话首选 |
| glm-5.2 | 100万 | 2026-09-15 | 智谱最新模型 |
| kimi-k2.7-code | 100万 | 2026-09-14 | 代码生成专精 |
| kimi-k2.6 | 100万 | 2026-07-21 | 综合能力强 |
| qwen3.7-max-2026-06-08 | 100万 | 2026-09-08 | 复杂推理 |
| qwen3.6-max-preview | 100万 | - | 预览版,支持大上下文 |
| qwen3.7-max | 100万 | - | 正式版 |
| deepseek-v4-pro | 100万 | 2026-07-24 | DeepSeek 专业版 |
| qwen3.6-flash | 100万 | 2026-07-17 | 快速响应 |
| qwen3.5-ocr | 100万 | 2026-09-14 | 视觉识别 |
| 以及其他 10+ 个模型… | - | - | - |
三、配置 models.json(核心步骤)
3.1 配置文件位置
WorkBuddy 的自定义模型配置文件位于:
~/.workbuddy/models.json在 Windows 上,完整路径通常是:
C:\Users\你的用户名\.workbuddy\models.json3.2 配置格式
每个模型需要配置以下字段:
{ "id": "模型API名称", "name": "WorkBuddy界面显示名称", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "你的百炼API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }3.3 关键字段说明
| 字段 | 说明 | 注意事项 |
|---|---|---|
id | 必须与百炼 API 模型名完全一致 | 不能加前缀!例如glm-5.1而不是bailian-glm-5.1 |
name | WorkBuddy 界面显示的名称 | 可以自定义,如GLM 5.1 (百炼免费) |
url | 百炼 OpenAI 兼容端点 | 固定为https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions |
useCustomProtocol | 必须设为true | 否则请求会走 WorkBuddy 代理,导致「余额不足」错误 |
maxTokens | 模型最大输出 token 数 | 百炼部分模型上限 65536,超出会报错 |
四、踩坑记录(重要)
坑 1:useCustomProtocol: false→ 「余额不足」
现象:配置完成后提示「余额不足或无可用资源包,请充值」。
原因:useCustomProtocol默认为false,请求会经过 WorkBuddy 自己的代理服务器转发,扣除的是 WorkBuddy 的额度而非百炼额度。
解决:改为"useCustomProtocol": true,让 WorkBuddy 直连百炼 API。
坑 2:id加了前缀 → 「404 模型不存在」
现象:提示「404 The modelbailian-glm-5.1does not exist」。
原因:WorkBuddy 把id字段直接作为 API 请求的model参数发送。如果id写的是bailian-glm-5.1,百炼 API 不认识这个名称。
解决:id必须与百炼 API 的模型名完全一致,例如glm-5.1、deepseek-v4-flash。
坑 3:max_tokens超出限制 → 「Range of max_tokens should be [1, 65536]」
现象:提示「400 InternalError.Algo.InvalidParameter: Range of max_tokens should be [1, 65536]」。
原因:百炼部分模型的输出上限是 65536 tokens,WorkBuddy 默认可能发送更大的值。
解决:在模型配置中添加"maxTokens": 65536。经测试,以下模型需要设置此限制:
qwen3.7-plusdeepseek-v4-flashqwen3.6-flash-2026-04-16qwen3.5-ocrqwen3.6-35b-a3bqwen3.7-max-2026-05-17- 等其他 Qwen 系列模型
glm-5.1、glm-5.2、kimi-k2.7-code等模型无需限制。
五、完整配置示例
以下是一个包含 20 个百炼模型的完整models.json配置:
[ { "id": "qwen3.7-plus", "name": "Qwen 3.7 Plus (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "glm-5.2", "name": "GLM 5.2 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "kimi-k2.7-code", "name": "Kimi K2.7 Code (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } } ]完整配置(含全部 20 个模型)请参见文末附录或参考项目文件。
六、验证配置
6.1 重启 WorkBuddy
配置保存后,完全退出并重启 WorkBuddy(不是切换会话,是彻底关闭重新打开)。
6.2 选择模型
在对话区底部点击模型选择器,找到「阿里云百炼」分组,选择你想用的模型。
6.3 API 连通性测试
如果你想在命令行快速测试模型是否可用,可以使用以下 Python 脚本:
import requests API_KEY = 'sk-你的API-Key' url = 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions' headers = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'} models = ['qwen3.7-plus', 'glm-5.2', 'kimi-k2.7-code'] for model in models: response = requests.post(url, headers=headers, json={ 'model': model, 'messages': [{'role': 'user', 'content': 'hi'}], 'max_tokens': 5 }, timeout=20) if response.status_code == 200: print(f'[OK] {model}') else: print(f'[FAIL] {model}: {response.json().get("message", "未知错误")}')七、模型推荐指南
不同模型各有专长,按需选择效果最佳:
| 场景 | 推荐模型 | 理由 |
|---|---|---|
| 日常对话 | qwen3.7-plus | 剩余额度最多(97.5万),到期最晚 |
| 代码生成 | kimi-k2.7-code | 专为代码优化,支持 100 万 tokens |
| 快速问答 | qwen3.6-flash | 响应速度快,适合简单问题 |
| 复杂推理 | qwen3.7-max-2026-06-08 | 推理能力强,支持 reasoning 模式 |
| 视觉分析 | qwen3.5-ocr | 支持图片识别和 OCR |
| 中文理解 | glm-5.2 | 智谱模型,中文理解能力强 |
| 深度分析 | deepseek-v4-pro | DeepSeek 专业版,分析能力强 |
八、费用说明
免费额度规则
- 每个模型独立 100 万 tokens 免费额度
- 额度用完即停,不会自动扣费
- 有效期通常为 3-6 个月(具体以控制台显示为准)
- 仅限中国内地节点使用
如何避免超额扣费
- 在百炼控制台设置「免费额度用完即停」
- 定期检查各模型剩余额度
- 不要开启「自动续购」功能
九、常见问题 FAQ
Q: 配置后提示「余额不足」怎么办?
A: 检查useCustomProtocol是否为true。如果为false,请求会走 WorkBuddy 代理。
Q: 提示「404 模型不存在」?
A: 检查id字段是否与百炼 API 模型名完全一致,不能加前缀或后缀。
Q: 提示「max_tokens 超出范围」?
A: 在模型配置中添加"maxTokens": 65536。
Q: 模型列表中看不到百炼模型?
A: 完全重启 WorkBuddy(退出程序重新打开),不是切换会话。
Q: 免费额度用完后会自动扣费吗?
A: 不会。默认「用完即停」,不会自动购买付费额度。
Q: 可以在 LangChain 项目中同时使用这些模型吗?
A: 可以。使用 OpenAI 兼容接口:
from langchain_openai import ChatOpenAI llm = ChatOpenAI( model="qwen3.7-plus", base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", api_key="sk-你的API-Key", )十、总结
通过自定义模型配置,WorkBuddy 可以无缝接入阿里云百炼的 20+ 个免费大模型。配置过程中的三个关键要点:
useCustomProtocol: true— 直连百炼 API,不走 WorkBuddy 代理id与模型名一致— 不加前缀,百炼 API 认什么名字就写什么maxTokens: 65536— 部分 Qwen 系列模型需要限制输出长度
配置完成后,你就可以在 WorkBuddy 中自由切换各种大模型,享受近 2000 万 tokens 的免费额度。
附录:完整 models.json 配置
以下配置包含 20 个已验证的百炼模型,复制后替换apiKey为你的百炼 API Key 即可使用:
[ { "id": "qwen3.7-plus", "name": "Qwen 3.7 Plus (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "deepseek-v4-flash", "name": "DeepSeek V4 Flash (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": false, "supportsReasoning": false, "useCustomProtocol": true, "maxTokens": 65536 }, { "id": "qwen3.6-flash-2026-04-16", "name": "Qwen 3.6 Flash 0416 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": false, "useCustomProtocol": true, "maxTokens": 65536 }, { "id": "qwen3.5-ocr", "name": "Qwen 3.5 OCR (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": false, "useCustomProtocol": true, "maxTokens": 65536 }, { "id": "qwen3.6-35b-a3b", "name": "Qwen 3.6 35B-A3B (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high"] } }, { "id": "qwen3.7-max-2026-05-17", "name": "Qwen 3.7 Max 0517 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.7-max-2026-06-08", "name": "Qwen 3.7 Max 0608 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "glm-5.2", "name": "GLM 5.2 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "kimi-k2.7-code", "name": "Kimi K2.7 Code (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "kimi-k2.6", "name": "Kimi K2.6 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "qwen3.7-max-2026-05-20", "name": "Qwen 3.7 Max 0520 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.7-plus-2026-05-26", "name": "Qwen 3.7 Plus 0526 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.6-flash", "name": "Qwen 3.6 Flash (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": false, "useCustomProtocol": true, "maxTokens": 65536 }, { "id": "deepseek-v4-pro", "name": "DeepSeek V4 Pro (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": false, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.6-27b", "name": "Qwen 3.6 27B (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high"] } }, { "id": "glm-5.1", "name": "GLM 5.1 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "qwen3.7-max-preview", "name": "Qwen 3.7 Max Preview (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.5-plus-2026-04-20", "name": "Qwen 3.5 Plus 0420 (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh"] } }, { "id": "qwen3.6-max-preview", "name": "Qwen 3.6 Max Preview (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "maxTokens": 65536, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } }, { "id": "qwen3.7-max", "name": "Qwen 3.7 Max (百炼免费)", "vendor": "阿里云百炼", "url": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", "apiKey": "sk-你的API-Key", "supportsToolCall": true, "supportsImages": true, "supportsReasoning": true, "useCustomProtocol": true, "reasoning": { "supportedEfforts": ["minimal", "low", "medium", "high", "xhigh", "max"] } } ]更新时间:2026 年 7 月 6 日
测试环境:Windows 11 + WorkBuddy 5.1.7 + 阿里云百炼
测试结果:19/20 个模型可用(deepseek-v4-flash免费额度已耗尽)
本文档为技术分享,配置和使用过程中请遵守阿里云百炼的服务条款。