news 2026/7/7 8:33:51

WorkBuddy 接入阿里云百炼

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
WorkBuddy 接入阿里云百炼

白嫖近 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

  1. 打开 阿里云百炼控制台
  2. 左侧菜单 →API 服务API-Key 管理
  3. 点击「创建 API-Key」或复制已有的 Key
  4. Key 格式为sk-xxxxxxxx

注意:免费 Token 仅限中国内地节点使用,海外节点不享受免费额度。

2. 开启模型免费额度

在百炼控制台的「模型广场」中,找到你想用的模型,点击右侧开关将「未开启」变成「已开启」。免费额度开启不会扣费,只是激活使用权限。

以下是已验证可用的模型列表(截至 2026 年 7 月):

模型额度到期日特点
qwen3.7-plus97.5万2026-09-01日常对话首选
glm-5.2100万2026-09-15智谱最新模型
kimi-k2.7-code100万2026-09-14代码生成专精
kimi-k2.6100万2026-07-21综合能力强
qwen3.7-max-2026-06-08100万2026-09-08复杂推理
qwen3.6-max-preview100万-预览版,支持大上下文
qwen3.7-max100万-正式版
deepseek-v4-pro100万2026-07-24DeepSeek 专业版
qwen3.6-flash100万2026-07-17快速响应
qwen3.5-ocr100万2026-09-14视觉识别
以及其他 10+ 个模型…---

三、配置 models.json(核心步骤)

3.1 配置文件位置

WorkBuddy 的自定义模型配置文件位于:

~/.workbuddy/models.json

在 Windows 上,完整路径通常是:

C:\Users\你的用户名\.workbuddy\models.json

3.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
nameWorkBuddy 界面显示的名称可以自定义,如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.1deepseek-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-plus
  • deepseek-v4-flash
  • qwen3.6-flash-2026-04-16
  • qwen3.5-ocr
  • qwen3.6-35b-a3b
  • qwen3.7-max-2026-05-17
  • 等其他 Qwen 系列模型

glm-5.1glm-5.2kimi-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-proDeepSeek 专业版,分析能力强

八、费用说明

免费额度规则

  • 每个模型独立 100 万 tokens 免费额度
  • 额度用完即停,不会自动扣费
  • 有效期通常为 3-6 个月(具体以控制台显示为准)
  • 仅限中国内地节点使用

如何避免超额扣费

  1. 在百炼控制台设置「免费额度用完即停」
  2. 定期检查各模型剩余额度
  3. 不要开启「自动续购」功能

九、常见问题 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+ 个免费大模型。配置过程中的三个关键要点:

  1. useCustomProtocol: true— 直连百炼 API,不走 WorkBuddy 代理
  2. id与模型名一致— 不加前缀,百炼 API 认什么名字就写什么
  3. 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免费额度已耗尽)


本文档为技术分享,配置和使用过程中请遵守阿里云百炼的服务条款。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/7 8:30:21

终极免费工具:快速解密QQ音乐qmc格式的完整指南

终极免费工具:快速解密QQ音乐qmc格式的完整指南 【免费下载链接】qmcdump 一个简单的QQ音乐解码(qmcflac/qmc0/qmc3 转 flac/mp3),仅为个人学习参考用。 项目地址: https://gitcode.com/gh_mirrors/qm/qmcdump 还在为QQ音乐…

作者头像 李华
网站建设 2026/7/7 8:25:36

弄懂 sk_buff 底层,才算真正入门 Linux 网络栈

大家好,前几天,收到有留言,说看 Linux 内核源码像是在读天书。特别是看到网络协议栈那一块,满屏幕的 sk_buff 绕得人头晕。 想真正搞懂 LInux 网络协议栈,先过了sk_buff这一关再说别的。 这还真不是我在危言耸听。sk…

作者头像 李华
网站建设 2026/7/7 8:23:03

TVA在具身智能的创新应用案例(10)

前沿技术介绍:AI智能体视觉(TVA,Transformer-based Vision Agent)是依托Transformer架构与“因式智能体”理论所构建的颠覆性工业视觉技术,属于“物理AI” 领域的一种全新技术形态,完成了从“虚拟世界”到“…

作者头像 李华