Error occurs when adding model for OpenAI-API-compatible plugin #88

Closed
opened 2026-02-16 10:18:02 -05:00 by yindo · 5 comments
Owner

Originally created by @WorthStudy on GitHub (Mar 18, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Error occurred when adding models in OpenAI-API-compatible plugins, causing models to fail to be added. Sometimes the error is "Credentials validation failed with status code 401" or "Credentials validation failed with status code 503." Multiple OpenAI-API compatible model providers have been tested, but the above errors have been consistently reported, resulting in the inability to add models.

2025-03-18 15:05:27.039 ERROR [Dummy-53] [models.py:162] - Failed to save model credentials, tenant_id: bbaccec3-3c9f-43cd-a2cd-3987d0833e17, model: Internlm3-8B-Instruct, model_type: llm
Traceback (most recent call last):
File "/app/api/controllers/console/workspace/models.py", line 154, in post
model_provider_service.save_model_credentials(
File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
provider_configuration.add_or_update_custom_model_credentials(
File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials
provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate
credentials = model_provider_factory.model_credentials_validate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate
self.plugin_model_manager.validate_model_credentials(
File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
for resp in response:
^^^^^^^^
File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
self._handle_plugin_daemon_error(error.error_type, error.message)
File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
raise CredentialsValidateFailedError(error_object.get("message"))
core.model_runtime.errors.validate.CredentialsValidateFailedError: Credentials validation failed with status code 503

✔️ Expected Behavior

The normal situation should be that the model is added successfully, and there are no errors reported in the docker container.

Actual Behavior

Actually, it reported the error "Credentials validation failed with status code xxx."

Originally created by @WorthStudy on GitHub (Mar 18, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Error occurred when adding models in OpenAI-API-compatible plugins, causing models to fail to be added. Sometimes the error is "Credentials validation failed with status code 401" or "Credentials validation failed with status code 503." Multiple OpenAI-API compatible model providers have been tested, but the above errors have been consistently reported, resulting in the inability to add models. ``` 2025-03-18 15:05:27.039 ERROR [Dummy-53] [models.py:162] - Failed to save model credentials, tenant_id: bbaccec3-3c9f-43cd-a2cd-3987d0833e17, model: Internlm3-8B-Instruct, model_type: llm Traceback (most recent call last): File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error raise CredentialsValidateFailedError(error_object.get("message")) core.model_runtime.errors.validate.CredentialsValidateFailedError: Credentials validation failed with status code 503 ``` ### ✔️ Expected Behavior The normal situation should be that the model is added successfully, and there are no errors reported in the docker container. ### ❌ Actual Behavior Actually, it reported the error "Credentials validation failed with status code xxx."
yindo closed this issue 2026-02-16 10:18:02 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 18, 2025):

I found two similar unsolved discussions that might be relevant to your issue:

  1. Error when adding ollama model - This discussion was last updated on March 16, 2025, and it involves errors when adding models, similar to what you're experiencing [1].

  2. Help - Can't add OpenAi compatible Endpoints anymore (0.12.1) - This discussion was last updated on November 28, 2024, and it also deals with issues related to adding OpenAI-compatible endpoints [2].

Regarding the errors you're encountering, the "Credentials validation failed with status code 401" error can occur due to several reasons, such as Dify not being initialized, init validation not being completed, or incorrect credentials. The "Credentials validation failed with status code 503" error is typically due to service instability with specific providers like siliconflow and deepseek. As a workaround, you can try using alternative providers like Gemini or OpenRoute, which have been confirmed to work properly [3][4].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 18, 2025): <!-- Answer --> I found two similar unsolved discussions that might be relevant to your issue: 1. [Error when adding ollama model](https://github.com/langgenius/dify/discussions/14104) - This discussion was last updated on March 16, 2025, and it involves errors when adding models, similar to what you're experiencing <sup>[[1]](https://github.com/langgenius/dify/discussions/14104)</sup>. 2. [Help - Can't add OpenAi compatible Endpoints anymore (0.12.1)](https://github.com/langgenius/dify/discussions/11188) - This discussion was last updated on November 28, 2024, and it also deals with issues related to adding OpenAI-compatible endpoints <sup>[[2]](https://github.com/langgenius/dify/discussions/11188)</sup>. Regarding the errors you're encountering, the "Credentials validation failed with status code 401" error can occur due to several reasons, such as Dify not being initialized, init validation not being completed, or incorrect credentials. The "Credentials validation failed with status code 503" error is typically due to service instability with specific providers like siliconflow and deepseek. As a workaround, you can try using alternative providers like Gemini or OpenRoute, which have been confirmed to work properly <sup>[[3]](https://github.com/langgenius/dify/blob/fcd9fd8513c63ae22c24cfcaba4989a71f5406c5/api/controllers/console/error.py)</sup><sup>[[4]](https://github.com/langgenius/dify/issues/16050)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1d5834ad-abd8-43fd-9b93-cb1e46e18b28?feedback_type=other)</sup>
Author
Owner

@kevin-lucifer commented on GitHub (May 20, 2025):

Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url),
But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform.
Which means, I can't use third-party deepseek llm, cause I don't have a module ID option.

Aliyun url: https://dashscope.aliyuncs.com/compatible-mode/v1

Error from the front-end:
An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))

@kevin-lucifer commented on GitHub (May 20, 2025): Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url), But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform. Which means, I can't use third-party deepseek llm, cause I don't have a module ID option. Aliyun url: https://dashscope.aliyuncs.com/compatible-mode/v1 Error from the front-end: An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))
Author
Owner

@WorthStudy commented on GitHub (May 20, 2025):

Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url),我也遇到了同样的错误,在我的情况下,openAI 兼容的 URL 是正常的(我给它一个阿里云百莲 deepseek 的 URL), But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform.但 deepseek 兼容的 URL 无法使用。服务是稳定的,例如阿里云百莲平台。 Which means, I can't use third-party deepseek llm, cause I don't have a module ID option.这意味着,我无法使用第三方 deepseek LLM,因为我没有模块 ID 选项。

Aliyun url: https://dashscope.aliyuncs.com/compatible-mode/v1阿里云 URL:https://dashscope.aliyuncs.com/compatible-mode/v1

Error from the front-end:前端错误: An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))凭证验证期间发生错误:HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): 最大重试次数超过,网址为:/compatible-mode/v1/chat/completions (由于 SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF 在违反协议时发生 (_ssl.c:1000)')))

The OPENAI-compatible interface of Alibaba Cloud's Bailian does not support DeepSeek. For details, please visit the link: https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe

@WorthStudy commented on GitHub (May 20, 2025): > Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url),我也遇到了同样的错误,在我的情况下,openAI 兼容的 URL 是正常的(我给它一个阿里云百莲 deepseek 的 URL), But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform.但 deepseek 兼容的 URL 无法使用。服务是稳定的,例如阿里云百莲平台。 Which means, I can't use third-party deepseek llm, cause I don't have a module ID option.这意味着,我无法使用第三方 deepseek LLM,因为我没有模块 ID 选项。 > > Aliyun url: https://dashscope.aliyuncs.com/compatible-mode/v1阿里云 URL:https://dashscope.aliyuncs.com/compatible-mode/v1 > > Error from the front-end:前端错误: An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))凭证验证期间发生错误:HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): 最大重试次数超过,网址为:/compatible-mode/v1/chat/completions (由于 SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF 在违反协议时发生 (_ssl.c:1000)'))) The OPENAI-compatible interface of Alibaba Cloud's Bailian does not support DeepSeek. For details, please visit the link: https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe
Author
Owner

@kevin-lucifer commented on GitHub (May 20, 2025):

Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url),我也遇到了同样的错误,在我的情况下,openAI 兼容的 URL 是正常的(我给它一个阿里云百莲 deepseek 的 URL), But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform.但 deepseek 兼容的 URL 无法使用。服务是稳定的,例如阿里云百莲平台。 Which means, I can't use third-party deepseek llm, cause I don't have a module ID option.这意味着,我无法使用第三方 deepseek LLM,因为我没有模块 ID 选项。
Aliyun url: https://dashscope.aliyuncs.com/compatible-mode/v1阿里云 URL:https://dashscope.aliyuncs.com/compatible-mode/v1
Error from the front-end:前端错误: An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))凭证验证期间发生错误:HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): 最大重试次数超过,网址为:/compatible-mode/v1/chat/completions (由于 SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF 在违反协议时发生 (_ssl.c:1000)')))

The OPENAI-compatible interface of Alibaba Cloud's Bailian does not support DeepSeek. For details, please visit the link: https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe

Both deepseek and OpenAI share the same base url, different modelId. (OpenAI SDK). I guess deepseek got it's own sdk too, but OpenAI SDK is more flexible for third-party llm cloud service vender. In my case, it's the only option.

Image

https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe

@kevin-lucifer commented on GitHub (May 20, 2025): > > Same error here, in my case, openAI compatible url is fine(I give it a aliyun bailian deepseek url),我也遇到了同样的错误,在我的情况下,openAI 兼容的 URL 是正常的(我给它一个阿里云百莲 deepseek 的 URL), But the deepseek compatible url not working. The service is stable, such as aliyun bailian platform.但 deepseek 兼容的 URL 无法使用。服务是稳定的,例如阿里云百莲平台。 Which means, I can't use third-party deepseek llm, cause I don't have a module ID option.这意味着,我无法使用第三方 deepseek LLM,因为我没有模块 ID 选项。 > > Aliyun url: [https://dashscope.aliyuncs.com/compatible-mode/v1阿里云](https://dashscope.aliyuncs.com/compatible-mode/v1%E9%98%BF%E9%87%8C%E4%BA%91) URL:https://dashscope.aliyuncs.com/compatible-mode/v1 > > Error from the front-end:前端错误: An error occurred during credentials validation: HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): Max retries exceeded with url: /compatible-mode/v1/chat/completions (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))凭证验证期间发生错误:HTTPSConnectionPool(host='dashscope.aliyuncs.com', port=443): 最大重试次数超过,网址为:/compatible-mode/v1/chat/completions (由于 SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF 在违反协议时发生 (_ssl.c:1000)'))) > > The OPENAI-compatible interface of Alibaba Cloud's Bailian does not support DeepSeek. For details, please visit the link: https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe Both deepseek and OpenAI share the same base url, different modelId. (OpenAI SDK). I guess deepseek got it's own sdk too, but OpenAI SDK is more flexible for third-party llm cloud service vender. In my case, it's the only option. ![Image](https://github.com/user-attachments/assets/88956541-a1dd-41a4-aab4-403daf92c716) https://bailian.console.aliyun.com/?tab=api#/api/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2833609.html&renderType=iframe
Author
Owner

@dosubot[bot] commented on GitHub (Aug 20, 2025):

Hi, @WorthStudy. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported credential validation errors (401 and 503) when adding OpenAI-API-compatible models in Dify v1.1.0 self-hosted via Docker.
  • Multiple providers, including Alibaba Cloud's Bailian DeepSeek, are affected with SSL and validation issues.
  • Bailian DeepSeek lacks module ID support and its OpenAI-compatible interface does not fully support DeepSeek features.
  • 401 errors may be due to initialization or credential problems; 503 errors often indicate provider instability.
  • Workarounds suggested include using alternative providers like Gemini or OpenRoute.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here.
  • If I don’t hear back within 5 days, I will automatically close this issue.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 20, 2025): Hi, @WorthStudy. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported credential validation errors (401 and 503) when adding OpenAI-API-compatible models in Dify v1.1.0 self-hosted via Docker. - Multiple providers, including Alibaba Cloud's Bailian DeepSeek, are affected with SSL and validation issues. - Bailian DeepSeek lacks module ID support and its OpenAI-compatible interface does not fully support DeepSeek features. - 401 errors may be due to initialization or credential problems; 503 errors often indicate provider instability. - Workarounds suggested include using alternative providers like Gemini or OpenRoute. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here. - If I don’t hear back within 5 days, I will automatically close this issue. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#88