so I have tried copying the API from open AI and pasted it on replit for writing my 1st AI Code but got an exit status 1 error.
also I have logged into my bolt cloud Is there a setup process?
does this have anything to do with my API issue?
import openai
import os
import sys
try:
openai.api_key = os.environ[‘OPENAI_API_KEY’]
except KeyError:
sys.stderr.write(“”"
You haven’t set up your API key yet.
If you don’t have an API key yet, visit:
- Make an account or sign in
- Click “View API Keys” from the top right menu.
- Click “Create new secret key”
Then, open the Secrets Tool and add OPENAI_API_KEY as a secret.
“”")
exit(1)
response = openai.ChatCompletion.create(
model=“gpt-3.5-turbo”,
messages=[
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: “Who won the world series in 2020?”},
{“role”: “assistant”, “content”: “The Los Angeles Dodgers won the World Series in 2020.”},
{“role”: “user”, “content”: “Where was it played?”}
]
)
print(response)
I tried deleting the entire repel and do it in a new one but it did not work
also tried generating new APL and repeat the process yet nothing changed
Hi, @gtaruni456 Firstly check about credits of OpenAi account , make sure it doesn’t reach the credit limit .
Hi I have been trying the above method again and again but it did not work out. can you elaborate more about the credits?
Hi, In each openAi account , you get a fixed credits . For every request it gets deducted. I Also attach a post, do check and let me know if it helps you.
Getting an error
Hi gtarun, In each openAi account , you get a fixed credits . For every request it gets deducted.
Thank you so much! my error got solved
Hey I had a same error how did you solve your error
Could you please elaborate the error you are facing? Also do share screenshots of the code and the error as well.