Since yesterday, I get this error when I use gpt-3.5-turbo, and I live in China

Same network, same api, same computer, I can use it fine in a front-end project built with vue, but suddenly it doesn’t work in a back-end project built with node.js, i.e. it’s so frustrating that it used to work in a back-end project, but suddenly it doesn’t work.

Hi @inmymind1593

China is not supported by OpenAI:

Screenshot 2023-03-06 at 10.57.09 AM

Also, OpenAI uses Cloudflare and if Cloudflare detects you are using a VPN, it will block you.

If you change VPN, you might get lucky and Cloudflare will not have registered that IP address range as a VPN, but as soon as it does (eventually it detect a VPN), then Cloudflare will block.

Hope this helps.

:slight_smile:

Thank you for your answer, it deepened my pain

You are not missing that much.

Go enjoy life!

:slight_smile:

@ruby_coder
I live in a sewer and my life sucks.

Maybe move to those beautiful mountains in China we see in pictures and live in a tree house with satlink internet?

:slight_smile:

@ruby_coder
The real situation is that my savings are running out, I’m running out of money, and I can’t go anywhere. The more real situation is that it is very difficult to get an IT related job at the moment, please stop giving me advice that looks so positive and good, because every time I think about my real situation in the context of the advice you give me, it makes me suffer again. :melting_face:

2 Likes

I also encountered the same problem today. Accessing the OpenAI API through the server developed by nodeJs always reports request timeout -4039, and I have not tried to access it in Vue.
I am in Shanghai and I also use a VPN.
Is your problem solved now?@ inmymind1593
image

@a598975767
The problem you’re facing is not yet solved, but there are two possible solutions that you can consider:

Use axios and set up a proxy to make requests to OpenAI’s server. This may help bypass any network restrictions that are preventing your requests from going through. You can configure axios to use a proxy by adding a proxy property to your axios config object. Make sure that the proxy server you use is reliable and trustworthy.

Another option is to buy a server from another country. This may help if the issue is related to network restrictions imposed by your local ISP or government. However, this can be an expensive solution and may not provide a complete guarantee that the issue will be resolved.

Now, I solved it by making a post request to openai using axios and, most importantly, specifying my vpn in the request.

1 Like

If you live in China, the first step is to open a vpn and get your computer connected to the international Internet.
Guys,big news, i solved it.
@axing4735 @a598975767 @ruby_coder @sps
and then :point_down::

const axios = require('axios');

const itRealyFuckedMe= async (input) => {
    try {
        let data = {
            model: "gpt-3.5-turbo",
            messages: [
                { "role": "user", "content": input }
            ]
        };

        let config = {
            method: 'post',
            maxBodyLength: Infinity,
            url: 'https://api.openai.com/v1/chat/completions',
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${openAIKeys}`
            },
            data: data,
            proxy: {
            /*
            It depends on your real proxy configuration,
            Open your proxy client and view the configuration information.
            */
                host: "127.0.0.1",
                port: 7890,
                protocol: "http"
            }
        };
        let completion = await axios(config)
            .then((response) => {
                console.log("response.data:", JSON.stringify(response.data));
                return response.data.choices[0].message
            })
            .catch((error) => {
                console.log(error);
            });
      
        return completion
    } catch (error) {
        console.log(error);
    }
};
2 Likes

@ inmymind1593

First of all, congratulations on finding a solution, you are the best!
I followed your scheme in the Vue project, executing your code through axios did solve the problem.
But when using axios in node-serve to execute your code, axios (config) is always in the Pending state, which makes me very distressed. Is there any solution?
I can confirm that the proxy information is correct.

image

@ inmymind1593

I even changed the Proxy to pass in after being encapsulated by https-proxy-agent, but it didn’t change the result, and it was still blocked in the Pending state…

image

@a598975767
I can’t be sure exactly what is going on with your proxy, I can offer some thoughts:

  1. check the vpn logs and find a field like this, or something like this:
msg="Mixed(http+socks) proxy listening at: 127.0.0.1:7890"

Reconfigure the axios proxy according to the fields found.

  1. I can confirm that the problem is only within the proxy-related configuration.

  2. If your vpn is not using https protocol, I don’t think using https-proxy-agent will work for your problem,or you need to provide additional configuration related to https, such as SSL certificate or something like that

Good luck in getting out of the ordeal as soon as possible

Could u share me a github link about this,i am a new js learner,it seems difficult for me still now,thanks

I tested based on the example on the official website, the animal example. However, the API request has been in pending status, but it can be successful as long as I do not use the API middleware in Next.js and switch to using Axios for direct requests. I suspect that there might be an issue with the API middleware when requesting ChatGPT due to the existence of VPN, but I am not sure how to troubleshoot it. Using the API middleware is a great way because I don’t want to expose the API key. Can you help me?

When I use gpt-4 like gpt-3.5-turbo, call “https://api.openai.com/v1/chat/completions”, I get an error “ERR_BAD_REQUEST 404”, But when the model is changed to gpt-3.5-turbo, the code can access successfully.
Error:


Code:
image

I haven’t received the gpt-4 email yet