Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I troubleshoot an empty AuthenticationError when using the OpenAI API in Python?

I am having a problem with this code

import openai

openai.api_key = "api_key"

completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Give me 3 ideas for apps I could build with openai apis "}])
print(completion.choices[0].message.content)

whenever i run it, it gives me a openai.error.AuthenticationError:

i tried many solutions like regenerating the api key and going through their docs many times but to no solution i come here.

like image 738
ShadowDevi Avatar asked May 29 '26 19:05

ShadowDevi


1 Answers

I come to the same error like this every time I create a new API key it gets deleted. I have solved this in organizations settings by changing the organizations name.

like image 175
SANJAR SAIDOV Avatar answered May 31 '26 07:05

SANJAR SAIDOV



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!