lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.65k stars 10.02k forks source link

[Bug] The third-party API KEY I use reports an error 404 #4222

Closed zhouxiangbin closed 1 month ago

zhouxiangbin commented 1 month ago

📦 Environment

Docker

📌 Version

26.0.0

💻 Operating System

Other Linux

🌐 Browser

Chrome

🐛 Bug Description

Error requesting OpenAI service, please troubleshoot or retry based on the following information

📷 Recurrence Steps

The third-party API I use works fine when running with the chatgpt-web-midjourney-proxy container; But the LobeChat program reports a 404 error The docker run command is as follows

docker run -d -p 3210:3210 \ -e OPENAI_API_KEY=hk-dri6666666666666666666666666666666666cf1e712 \ -e OPENAI_PROXY_URL=https://api.openai-hk.com \ -e ACCESS_CODE=lobe66 \ --name lobe-chat \ lobehub/lobe-chat

image

🚦 Expected Behavior

No response

📝 Additional Information

No response

lobehubbot commented 1 month ago

👀 @zhouxiangbin

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 1 month ago

Hello, @zhouxiangbin! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

I found some similar issues and discussions that might help you troubleshoot the 404 error you're encountering:

  1. OpenAI is not accessible with getaddrinfo: This discussion suggests ensuring the DNS configuration is correct and not overridden by Docker settings. It also recommends setting the DNS configuration file to read-only to prevent modifications [1].
  2. [Bug] OpenAI is not accessible: This issue was resolved by adding DNS settings in the docker-compose file. The user added the following lines:
    dns:
      - 8.8.4.4
      - 8.8.8.8

    This change made the solution permanent [2].

To troubleshoot your specific 404 error, follow these steps:

  1. Verify OPENAI_PROXY_URL Configuration:

    • Ensure that the OPENAI_PROXY_URL is correctly set in your environment variables.
    • Confirm that the URL includes the /v1 suffix if it is required by the OpenAI service endpoint.
  2. Check for Common Issues:

    • Double-check the URL for any typos or incorrect paths.
    • Make sure the URL is accessible and correctly points to the OpenAI service.
  3. Consult Related Discussions:

  4. Review Error Handling in Code:

    • Check the error handling in your code to ensure that it properly captures and logs the error details. For example, the LobeAi360AI class in the LobeChat program has specific error handling for different types of errors, such as ProviderBizError and InvalidProviderAPIKey. Ensure that similar error handling is in place for your OpenAI integration [3][4][5].

By following these steps, you should be able to identify and resolve the 404 error with the OpenAI service.

To continue talking to Dosu, mention @dosu.

arvinxx commented 1 month ago

-e OPENAI_PROXY_URL=https://api.openai-hk.com/v1

lobehubbot commented 1 month ago

✅ @zhouxiangbin

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。