Error in python

I am new to the code.
i was trying to setup the API in python but for some reason unable to do so
import os
import openai

openai.api_key = os.getenv(sk-qh9JA88NUxxxx)

response = openai.Completion.create(
model=“text-davinci-002”,
prompt=“difference between anime and cartoon”,
temperature=0.7,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)

I am getting the error sk isn’t defined and also the key after it
pls can anybody help we this.
i searched yt and google but got no solution

edit:
openai.api_key = ‘sk-qh9JA88NUxxxx’

doing this I got no error but no response either so hoping someone will help me

Instead of
openai.api_key = os.getenv(sk-qh9JA88NUxxxx)
use
openai.api_key = “sk-qh9JA88NUxxxx”

Because the key is already generated and it is not required to get it from any environment.

1 Like