An error occurred during credentials validation when Add OpenAI-API-compatible #8411

Closed
opened 2026-02-21 18:25:34 -05:00 by yindo · 4 comments
Owner

Originally created by @AInseven on GitHub (Feb 19, 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

Version 0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

An error occurred during credentials validation: HTTPConnectionPool(host='127.0.0.1', port=10000): 
Max retries exceeded with url: /v1/chat/completions 
(Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76e61f5591c0>: 
Failed to establish a new connection: 
[Errno 111] Connection refused'))

Can't Add OpenAI-API-compatible,but curl this url works well.

curl http://localhost:10000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ]
    }'

response with:

{"id":"chatcmpl-e0bfa5fd061042dcadbbb93596f15c8f",
"object":"chat.completion",
"created":1739947152,
"model":"Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8",
"choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null,
"content":"Hello there! How can I assist you today? Feel free to ask me any questions or let me know if you need help with something.",
"tool_calls":[]},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":31,"total_tokens":60,"completion_tokens":29,"prompt_tokens_details":null},"prompt_logprobs":null}

Image

✔️ Expected Behavior

Add model provider of OpenAI-API-compatible

Actual Behavior

An error occurred

Originally created by @AInseven on GitHub (Feb 19, 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 Version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ``` An error occurred during credentials validation: HTTPConnectionPool(host='127.0.0.1', port=10000): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76e61f5591c0>: Failed to establish a new connection: [Errno 111] Connection refused')) ``` Can't Add OpenAI-API-compatible,but **curl this url works well**. ```bash curl http://localhost:10000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8", "messages": [ { "role": "user", "content": "Hello!" } ] }' ``` response with: ``` json {"id":"chatcmpl-e0bfa5fd061042dcadbbb93596f15c8f", "object":"chat.completion", "created":1739947152, "model":"Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8", "choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null, "content":"Hello there! How can I assist you today? Feel free to ask me any questions or let me know if you need help with something.", "tool_calls":[]},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":31,"total_tokens":60,"completion_tokens":29,"prompt_tokens_details":null},"prompt_logprobs":null} ``` ![Image](https://github.com/user-attachments/assets/e4c9ca4c-905e-495c-ad0d-7f9162c02cd8) ### ✔️ Expected Behavior Add model provider of OpenAI-API-compatible ### ❌ Actual Behavior An error occurred
yindo added the 🐞 bug label 2026-02-21 18:25:34 -05:00
yindo closed this issue 2026-02-21 18:25:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 19, 2025):

Hey @AInseven! I'm here to help you with any bugs you encounter, answer your questions, and guide you on contributing. Let's work together to resolve this issue!

To resolve the "connection refused" error when trying to add an OpenAI-API-compatible model using the endpoint http://127.0.0.1:10000/v1/chat/completions, consider the following steps:

  1. Unset System Proxy Environment Variables: If your system has HTTP_PROXY and HTTPS_PROXY environment variables set, unset them before running Docker Compose. This can be done with the following commands:

    unset HTTP_PROXY
    unset HTTPS_PROXY
    
  2. Use 'host.docker.internal': In a self-hosted Docker setup, replace 127.0.0.1 with host.docker.internal in your configuration. Use http://host.docker.internal:10000/v1/chat/completions to allow the Docker container to connect to the host machine's services [1].

These steps should help resolve the connection issue you're experiencing.

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 (Feb 19, 2025): <!-- Greeting --> Hey @AInseven! I'm here to help you with any bugs you encounter, answer your questions, and guide you on contributing. Let's work together to resolve this issue! <!-- Answer --> To resolve the "connection refused" error when trying to add an OpenAI-API-compatible model using the endpoint `http://127.0.0.1:10000/v1/chat/completions`, consider the following steps: 1. **Unset System Proxy Environment Variables**: If your system has `HTTP_PROXY` and `HTTPS_PROXY` environment variables set, unset them before running Docker Compose. This can be done with the following commands: ```bash unset HTTP_PROXY unset HTTPS_PROXY ``` 2. **Use 'host.docker.internal'**: In a self-hosted Docker setup, replace `127.0.0.1` with `host.docker.internal` in your configuration. Use `http://host.docker.internal:10000/v1/chat/completions` to allow the Docker container to connect to the host machine's services <sup>[[1]](https://github.com/langgenius/dify/issues/11739)</sup>. These steps should help resolve the connection issue you're experiencing. <!-- 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/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c6cb79e3-e7b9-4e7d-9b63-97847350a40b?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 19, 2025):

See the bot's reply.

replace 127.0.0.1 with host.docker.internal in your configuration
@crazywoola commented on GitHub (Feb 19, 2025): See the bot's reply. ``` replace 127.0.0.1 with host.docker.internal in your configuration ```
Author
Owner

@AInseven commented on GitHub (Feb 19, 2025):

I have replaced,but still error occurred.

An error occurred during credentials validation: 
HTTPConnectionPool(host='host.docker.internal', port=10000): 
Max retries exceeded with url: /v1/chat/completions 
(Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x76e61f5be0f0>:
 Failed to resolve 'host.docker.internal' ([Errno -2] Name or service not known)"))

And I don't have any proxy. All the following commands got nothing.

echo $HTTP_PROXY
echo $HTTPS_PROXY
env | grep -i proxy
@AInseven commented on GitHub (Feb 19, 2025): I have replaced,but still error occurred. ``` An error occurred during credentials validation: HTTPConnectionPool(host='host.docker.internal', port=10000): Max retries exceeded with url: /v1/chat/completions (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x76e61f5be0f0>: Failed to resolve 'host.docker.internal' ([Errno -2] Name or service not known)")) ``` And I don't have any proxy. All the following commands got nothing. ```bash echo $HTTP_PROXY echo $HTTPS_PROXY env | grep -i proxy ```
Author
Owner

@crazywoola commented on GitHub (Feb 19, 2025):

This could happen due to you have turned on the VPN, which might mess up the network between each network. You can turn it off to see if this works.

Also you can use your real IP address of your machine.

@crazywoola commented on GitHub (Feb 19, 2025): This could happen due to you have turned on the VPN, which might mess up the network between each network. You can turn it off to see if this works. Also you can use your real IP address of your machine.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8411