Api 404 error? plz help me

I paid for an API key and used API to make the Discord bot. but he sends a 404 Error

Weird. What does the error say? Maybe it has a clue for us to follow?

Let us know!

2 Likes

Thank you sir.


I made the code use chat-gpt and when I talk on Discord, it says the API request failed

The Korean language in the chat is that the API key has failed to be retrieved, and the following number is the status code.

And I posted this picture when I went to https ://api.openai.com/v1/completions and I got this message. (Google translation)

Very interesting.

Are you certain you have your API key in the code?

ChatGPT is known to generate fake code.

Have you checked GitHub for a recent / updated Discord bot, perchance?

Thank you. I have API key but I 'm not checked Github so…let me check it!

click this cord
My first GPT-based Discord bot I finally made while watching YouTube. But I want to make it go back to the assitant API-based, how do I fix it?

Are you familiar with programming?

There’s quite a few guides on using Assistant API.

Is this your first programming project?

Yes, this is my first time programming entirely. I’ve never done it before

The OpenAI Python and node.js libraries will obtain the API key from the system’s environment variable OPENAI_API_KEY.

It is important that you do not commit or sync code containing hard-coded API keys. They are a secret that must remain securely behind the code on the platform that is running the bot, and precautions must be taken against hackers that want to obtain that key to use your account.

Properly setting the API key that code will use is the apparent fault here. Employing an API key that you have generated in your API account organization project is required. The API error messages indicate that you are not sending an API key in the header (which is automatically done by SDK libraries).

Thank you, I did it environment variable…!

You need to create an OpenAI API key and pass it in the header of the request