Welcome to the InfinityFree community forum! Good to have you here.
Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
Solving an issue is a joint effort. Try the suggestions you get and report back what happened.
Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.
What exactly happens when the POST fails? I need the HTTP status code and the response body, or the curl_error() text if no response comes back at all. Without that, “fails” could mean a refusal from OpenAI, a connection problem, or something in the script.
I searched the forum and knowledge base and found nothing saying that POST requests to api.openai.com are blocked or limited on InfinityFree. So I can’t say whether the hosting is involved. The error text should show whether the request leaves your site and what OpenAI sends back.
It would also help to see the POST code with the API key removed. Please don’t post the key itself.
Error 2 and 3 very much look like problems with your API call, not something that we as a hosting provider can influence.
It would be good to check that the API request body actually matches what you use locally. Configuration or latent bugs can result in different results which could explain the behavior. Some debug statements in your code to dump the JSON before sending it can help rule out a lot of issues.