import openai
openai.apikey = os.environ.get(‘OPENAI_API_KEY’)
responses = openai.ChatCompletion.create(
model=“gpt-4o”,
messages=[
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: “Who won the world series in 2020?”},
]
)
print(responses)
AuthenticationError Traceback (most recent call last)
in <cell line: 4>()
2 openai.apikey = os.environ.get(‘OPENAI_API_KEY’)
3
----> 4 responses = openai.ChatCompletion.create(
5 model=“gpt-4o”,
6 messages=[
4 frames
/usr/local/lib/python3.10/dist-packages/openai/api_requestor.py in _interpret_response_line(self, rbody, rcode, rheaders, stream)
**AuthenticationError: Incorrect API key provided: [api-key] You can find your API key at https://platform.openai.com/account/api-keys.