Credentials validation failed with status code 400 in text embedding model adding #283

Closed
opened 2026-02-16 10:18:47 -05:00 by yindo · 1 comment
Owner

Originally created by @hc9701 on GitHub (May 15, 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.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I tried to add a text_embedding model (called bge-large-zh) from 百度千帆大模型平台 using openAI-API-compatible. When I try to save the model, it shows “Credentials validation failed with status code 400”.

In fact, I think I might find where the bug is.
The payload in "text_embedding.py" is {"input": "ping", "model": model}. However, the payload in the demo provided by Baidu is { "model": "embedding-v1", "input":["White T-shirt"] } (see demo)
notice that there is a pair of [] missing in the value of input.

✔️ Expected Behavior

status code 200

Actual Behavior

status code 400

Originally created by @hc9701 on GitHub (May 15, 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.3.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I tried to add a text_embedding model (called bge-large-zh) from 百度千帆大模型平台 using openAI-API-compatible. When I try to save the model, it shows “Credentials validation failed with status code 400”. In fact, I think I might find where the bug is. The payload in "text_embedding.py" is `{"input": "ping", "model": model}`. However, the payload in the demo provided by Baidu is `{ "model": "embedding-v1", "input":["White T-shirt"] }` (see [demo](https://cloud.baidu.com/doc/qianfan-api/s/Fm7u3ropn)) notice that there is a pair of `[]` missing in the value of input. ### ✔️ Expected Behavior status code 200 ### ❌ Actual Behavior status code 400
yindo closed this issue 2026-02-16 10:18:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 15, 2025):

To resolve the "Credentials validation failed with status code 400" error, ensure that the payload structure matches the expected format for the Baidu API. The correct payload should include the input as a list, even if it contains only one item. Based on the Baidu demo, the payload should look like this:

{
    "model": "embedding-v1",
    "input": ["ping"]
}

Make sure that the input field is a list, as the absence of brackets [] around the input value can lead to validation errors. Additionally, verify that you have provided valid api_key and secret_key in the credentials dictionary, as these are necessary for obtaining an access token from Baidu [1].

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 (May 15, 2025): <!-- Answer --> To resolve the "Credentials validation failed with status code 400" error, ensure that the payload structure matches the expected format for the Baidu API. The correct payload should include the `input` as a list, even if it contains only one item. Based on the Baidu demo, the payload should look like this: ```json { "model": "embedding-v1", "input": ["ping"] } ``` Make sure that the `input` field is a list, as the absence of brackets `[]` around the input value can lead to validation errors. Additionally, verify that you have provided valid `api_key` and `secret_key` in the `credentials` dictionary, as these are necessary for obtaining an access token from Baidu <sup>[[1]](https://github.com/langgenius/dify/issues/12767)</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/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7a17d63d-3391-4cef-8ce3-b3edd630d8ac?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#283