Beginner Woes-Authentification Error

Hello!

I’m pretty new to python and APIs in general.
I’ve tried out the curl method of making requests and it works.

However, python bindings aren’t working and I’m not sure why. I’ve attached images of the error and my code (which is just the beginner test code lol).

I’d love to know where I’m going wrong.


1 Like

I think I realized my mistake.

I never made a separate .env file with my authkey, I was just filling in the “OPEN_AI_KEY” with it.
But I understand that os.getenv doesn’t work if I do that.

I changed the code to "openai.api_key = “sk-######” and I think it works now

1 Like