API INTEGRATION with my website

I created an account at open ai. to obtain the api key. I took the api key and put 5$ in credits. I took this key to put it in my application but it doesn’t work. I don’t know if I’m the one generating the wrong key or the application is bugged

We need waaaaay more context. Can you show us the code?

You can start by talking with models at the API Playground.

That uses your API account, and would deny you if you had no account balance.

Then you can generate a new key and put it into a very basic app.

A common failure, is putting the key into example code where an environment variable name is supposed to go.

openai.api_key = os.getenv("OPENAI_API_KEY")

Remove all the os.getenv, and replace it with “sk-1234yourkey” to test.


this is code my .env