ruizhe
January 7, 2026, 3:21pm
1
Hello, I encountered the following error when using Dify workflow to call the Tongyi model :
Code
Run failed: [tongyi] Incorrect model credentials provided, please check and try again.
I have already entered the API Key in the model configuration, but it still shows an authentication error. I’d like to confirm a few questions:
Must the Base URL and API Key region be consistent? (For example, should the Beijing region use https://dashscope.aliyuncs.com/compatible-mode/v1?)
When configuring the Tongyi model in Dify, besides the API Key and Base URL, are there any additional parameters required?
Has anyone else encountered a similar error, and how was it resolved?
I hope experienced users can provide some guidance. Thank you very much!
ECR
January 8, 2026, 9:34am
2
Could you please provide a screenshot of the specific issue? Have you configured the Tongyi credentials in Avatar → Settings → Model Provider? To configure the credentials, you only need to enter the API key.
配置tongyi API KEY的时候出现报错 401
ECR
January 8, 2026, 10:00am
4
Reference: Dify Integration with Bailian Models to Build Large Model Applications - Large Model Service Platform Bailian - Alibaba Cloud
If using the mainland version of the model, select “No” for the international endpoint. If it still doesn’t work, you can try switching to an earlier version of the Tongyi plugin.
page
January 16, 2026, 8:23am
5
For domestic use of Alibaba Cloud’s Tongyi Qianwen model, select “No” for international endpoints.
I also encountered this problem. The API key itself can be pinged successfully, and in Dify, it was working yesterday without any changes. This morning, it showed this error all morning, but in the afternoon, it fixed itself. I don’t know what the problem is.
Rumour
January 20, 2026, 7:08am
7
You can try changing the Tongyi plugin version, lowering it by a few versions. I had this problem with the latest plugin I used last week, but after downgrading by two versions, I was able to add it.
@Dify_Forum_Helper Please summarize the Q&A, and also emphasize how to install new versions of plugins or revert to previous versions of plugins in the Dify Marketplace. Additionally, check GitHub for relevant discussions and link them.
这里帮大家把这个帖子的关键信息和操作步骤梳理一下,也顺便说明下在 Dify Marketplace 里如何升级/回退 Tongyi 插件版本。
1. 本帖问题总结(Q&A 总结)
错误现象:
Run failed: [tongyi] Incorrect model credentials provided, please check and try again.
或在配置 API Key 时直接报 401(Invalid API-key)。
从楼里的反馈来看,主要有几类原因和对应解法:
① 地域 / 端点设置不匹配
使用 阿里云内地版通义(百炼)模型 时:
在 Dify 里配置 Tongyi 时,“国际端点 ”选项需要设置为 “否” 。
如果误选为“是”,即走国际端点,而你的 API Key 是内地版的,就容易出现 401 或 “Incorrect model credentials”。
相关回复:
“用内地版模型的话,国际端点选否”
“国内的使用阿里云通义千问模型,使用国际端点选择‘否’”
结论:
你的 API Key 所在地域 必须和 Dify 插件里勾选的端点类型一致,否则会被当成凭证错误。
② Tongyi 插件版本本身有问题
多位同学反馈:
使用最新版本 Tongyi 插件时,明明 API Key 正确,在阿里云侧能用,但:
在 Dify 里保存凭证时直接 401;
或工作流里调用时报 “Incorrect model credentials provided”。
将 Tongyi 插件 回退几个版本(例如往前回退两个版本) 后,问题消失,可以正常添加和调用。
结论:
某些新版本的 Tongyi 插件中存在兼容性 / 校验问题。
如果你确认 Key 和端点都没问题,建议尝试 切换插件版本 (优先试回退到之前的稳定版本)。
③ 暂时性的服务端 / 网络问题
有同学的经历是:
昨天还能用;
今天早上完全不动配置就一直报错;
下午又“自己好了”。
结合这个情况,除了本地配置,也要考虑:
阿里云百炼侧的服务波动;
当前网络到阿里云的连通性抖动。
建议:
如果你已经确认配置正确、插件版本也正常,可以适当过一段时间再试,或换网络环境试一下。
④ Dify 里的配置位置错误 / Key 抄错
Tongyi 凭证需要在:
头像 → 设置 → 模型供应商 → Tongyi 里统一配置;
一般只需要:
填写 API Key ;
按实际情况选择是否使用国际端点;
注意 Key 复制时不要带空格或多余字符。
2. 在 Dify Marketplace 中安装/升级/回退 Tongyi 插件
下面是和本帖最相关的一部分:如何通过 Marketplace 管理 Tongyi 插件的版本,以便解决“凭证错误”问题。
注意:不同 Dify 版本,界面可能略有差异,但整体流程类似。
2.1 进入 Marketplace
使用管理员账号登录 Dify 控制台;
侧边栏中找到 “插件 / Marketplace / 扩展”(名字以实际界面为准) ;
点击进入插件市场。
2.2 查找 Tongyi 插件
在 Marketplace 搜索框中输入:Tongyi、DashScope 或 “通义”;
找到官方提供的 Tongyi / 阿里云百炼相关插件;
点击进入插件详情页。
2.3 安装或升级到最新版本
如果你 还没安装 :
在插件详情页点击 “安装 / Install” ;
安装完成后,回到 头像 → 设置 → 模型供应商 里配置 API Key。
如果你 已经安装但怀疑版本太旧 :
在插件详情页中通常会显示当前已安装版本;
若有新版本可用,界面一般会提供 “更新 / Update” 按钮;
点击后,等待更新完成即可。
提示:升级到最新版本有时能修复老版本的兼容问题,不过结合本帖反馈,Tongyi 也出现过“最新版本反而有 Bug”的情况,所以要根据实际情况选择版本。
2.4 回退到前几个版本
如果你遇到的是:
刚升级到最新 Tongyi 插件后,凭证突然一直报错;
或本帖中提到的那种:最新版本无论如何都 401 / Incorrect credentials;
可以尝试 回滚到之前的版本 ,大致步骤如下(以当前常见的插件管理方式为参考):
在 Marketplace / 插件管理界面里,打开 Tongyi 插件详情;
查找 “版本 / Versions / Release History” 或类似入口;
在版本列表中:
查看最近的几个版本号;
选择一个 早于当前版本的稳定版本 (例如当前是 vX.Y.Z,可以回退到 vX.Y.(Z-1) 或再早一两个小版本);
在该旧版本旁边点击 “安装此版本 / Install this version / Rollback” ;
等待安装/回退完成(一般会自动覆盖当前版本);
回到 模型供应商 页面,确认 Tongyi 仍然显示为“已安装”,重新运行一次工作流做验证。
如果你的界面暂时没有明显的“版本历史”入口,也可以:
在插件列表中 卸载当前 Tongyi 插件 ;
然后重新从 Marketplace 里选择指定版本安装(有些部署方式会通过配置文件或命令行指定版本,这种需要按你当前部署方式的文档来操作)。
3. 实际排查建议(给后来的同学)
如果你也遇到 “Incorrect model credentials provided / 401 Invalid API-key”:
先检查配置:
头像 → 设置 → 模型供应商 → Tongyi;
API Key 是否正确复制,无多余空格;
是否勾了“国际端点”,与你实际申请的 Key 地域是否一致;
如果你是内地版阿里云百炼:
勾选 “国际端点 = 否”;
按阿里云官方文档设置;
如果仍然报错:
打开 Dify Marketplace:
若当前是很旧版本 → 先尝试升级一次;
若你刚升级后开始报错 → 尝试 回退到前两个版本左右 的 Tongyi 插件;
最后再考虑外部因素:
确认服务器网络能正常访问阿里云百炼;
过一段时间再试,排除临时性服务波动。
4. 相关资料(建议在帖子中附带)
官方说明(阿里云)
GitHub / 社区讨论(建议版主在帖子里补充若存在的相关 issue)
可以在 GitHub 的 langgenius/dify-plugins、langgenius/dify 仓库中搜索关键字:tongyi, dashscope, 401, Invalid API-key,关注是否有已知的版本问题或已修复的 PR。
如果后面大家在特定插件版本上又遇到可复现的 401 / 凭证错误,建议在论坛或 GitHub issue 中注明:
Dify 版本号;
Tongyi 插件的具体版本号;
是否使用内地端点 / 国际端点;
这样有助于官方快速定位并修复版本问题。