Here’s a summary of the key information and operating steps from this post, along with an explanation of how to upgrade/downgrade Tongyi plugin versions in the Dify Marketplace.
1. Post Issue Summary (Q&A Summary)
Error Phenomenon:
Run failed: [tongyi] Incorrect model credentials provided, please check and try again.
Or a direct 401 error (Invalid API-key) when configuring the API Key.
Based on feedback in the thread, there are several main reasons and corresponding solutions:
① Region / Endpoint Settings Mismatch
- When using the Aliyun (Alibaba Cloud) Mainland China version of Tongyi (Bailian) model:
- When configuring Tongyi in Dify, the “International Endpoint” option needs to be set to “No”.
- If mistakenly selected as “Yes”, meaning using the international endpoint, and your API Key is for the mainland version, it’s prone to 401 or “Incorrect model credentials” errors.
- Related replies:
- “If using the mainland version model, select No for international endpoint”
- “For domestic use of Aliyun Tongyi Qianwen model, select ‘No’ for international endpoint”
Conclusion:
Your API Key region must be consistent with the endpoint type selected in the Dify plugin, otherwise it will be treated as an invalid credential.
② Tongyi Plugin Version Itself Has Issues
Several users reported:
- When using the latest Tongyi plugin version, even if the API Key is correct and works on the Aliyun side, but:
- A direct 401 error when saving credentials in Dify;
- Or “Incorrect model credentials provided” error when called in a workflow.
- After rolling back the Tongyi plugin by a few versions (e.g., two versions back), the issue disappeared, and it could be added and called normally.
Conclusion:
Some new versions of the Tongyi plugin have compatibility / validation issues.
If you confirm that the Key and endpoint are fine, it is recommended to try switching plugin versions (prioritize rolling back to a previous stable version).
③ Temporary Server / Network Issues
Some users experienced:
- It worked yesterday;
- This morning, it kept reporting errors without any configuration changes;
- And then “fixed itself” in the afternoon.
Considering this situation, in addition to local configuration, also consider:
- Service fluctuations on the Aliyun Bailian side;
- Current network connectivity instability to Aliyun.
Suggestion:
If you have confirmed that the configuration is correct and the plugin version is normal, you can try again after a while, or try with a different network environment.
④ Incorrect Configuration Location in Dify / Key Copied Incorrectly
- Tongyi credentials need to be configured in:
- Avatar → Settings → Model Providers → Tongyi;
- Generally, you only need to:
- Fill in the API Key;
- Select whether to use an international endpoint based on the actual situation;
- Be careful not to include spaces or extra characters when copying the Key.
2. Installing/Upgrading/Rolling Back Tongyi Plugin in Dify Marketplace
Below is the most relevant part of this post: how to manage Tongyi plugin versions through the Marketplace to resolve “credential error” issues.
Note: The interface may vary slightly across different Dify versions, but the overall process is similar.
2.1 Entering the Marketplace
- Log in to the Dify console with an administrator account;
- In the sidebar, find “Plugins / Marketplace / Extensions” (name subject to actual interface);
- Click to enter the plugin market.
2.2 Finding the Tongyi Plugin
- In the Marketplace search bar, enter:
Tongyi, DashScope, or “通义” (Tongyi);
- Find the official Tongyi / Aliyun Bailian related plugins;
- Click to enter the plugin details page.
2.3 Installing or Upgrading to the Latest Version
- If you haven’t installed yet:
- On the plugin details page, click “Install”;
- After installation, go back to Avatar → Settings → Model Providers to configure the API Key.
- If you have already installed but suspect the version is too old:
- The currently installed version is usually displayed on the plugin details page;
- If a new version is available, the interface will generally provide an “Update” button;
- After clicking, wait for the update to complete.
Tip: Upgrading to the latest version can sometimes fix compatibility issues in older versions, but based on feedback in this post, Tongyi has also had cases where “the latest version actually has bugs”, so choose the version according to the actual situation.
2.4 Rolling Back to Previous Versions
If you encounter:
- Credentials suddenly keep reporting errors after upgrading to the latest Tongyi plugin;
- Or the situation mentioned in this post: the latest version consistently gives 401 / Incorrect credentials;
You can try rolling back to a previous version, with the general steps as follows (referencing common plugin management methods):
- In the Marketplace / Plugin Management interface, open the Tongyi plugin details;
- Look for “Versions / Release History” or a similar entry point;
- In the version list:
- View the most recent version numbers;
- Select a stable version earlier than the current version (e.g., if the current is vX.Y.Z, you can roll back to vX.Y.(Z-1) or one or two minor versions earlier);
- Next to that older version, click “Install this version / Rollback”;
- Wait for the installation/rollback to complete (it usually automatically overwrites the current version);
- Go back to the Model Providers page, confirm that Tongyi still shows as “Installed”, and re-run a workflow for verification.
If your interface currently doesn’t have a clear “Version History” entry, you can also:
- Uninstall the current Tongyi plugin from the plugin list;
- Then re-install a specific version from the Marketplace (some deployment methods specify versions via configuration files or command line, in which case you need to follow your current deployment method’s documentation).
3. Practical Troubleshooting Advice (for future users)
If you also encounter “Incorrect model credentials provided / 401 Invalid API-key”:
- First check the configuration:
- Avatar → Settings → Model Providers → Tongyi;
- Is the API Key copied correctly, without extra spaces;
- Is “International Endpoint” checked, and does it match the region of your actual Key;
- If you are using the Aliyun Bailian mainland version:
- Check “International Endpoint = No”;
- Set according to Aliyun official documentation;
- If it still reports an error:
- Open Dify Marketplace:
- If it’s a very old version → first try upgrading once;
- If you just upgraded and it started reporting errors → try rolling back to about two previous versions of the Tongyi plugin;
- Finally, consider external factors:
- Confirm that the server network can access Aliyun Bailian normally;
- Try again after a while to rule out temporary service fluctuations.
4. Related Resources (Recommended to include in the post)
Official Documentation (Aliyun)
GitHub / Community Discussion (Moderators are encouraged to add relevant existing issues to the post)
- You can search for keywords like
tongyi, dashscope, 401, Invalid API-key in the langgenius/dify-plugins and langgenius/dify repositories on GitHub to check for known version issues or fixed PRs.
If users encounter reproducible 401 / credential errors again with a specific plugin version, it is recommended to specify in the forum or GitHub issue:
- Dify version number;
- Specific Tongyi plugin version number;
- Whether a mainland endpoint / international endpoint is used;
This will help the official team quickly locate and fix version issues.