#openAI API keys not being recognized, anywhere.

3 messages · Page 1 of 1 (latest)

marsh wraith
#

My API Keys are not working for me at all, anywhere. I need someone to help me figure out why. I've got three apps I built that were working before, now they are not. It's not my code, as none of them work. I tried making an API call using Postman, its not working either. AutoGPT is not working with my keys anymore either.

past lake
#

Ask chatGPT (free) to write a python script to TRY use your openAI API keys. Maybe the error messages it returns in python will give you useful information. CopyPaste the error messages into ChatGPT to interpret situation.

#

import openai

Set your OpenAI API key

openai.api_key = 'YOUR_API_KEY'

Example API call

def test_openai_api():
try:
response = openai.Completion.create(
engine='davinci',
prompt='Hello, world!',
max_tokens=5
)
print("API call successful!")
print("Response:", response)
except Exception as e:
print("API call failed!")
print("Error message:", str(e))

Test the OpenAI API

test_openai_api()