#how works this API ? I dont know how implement. API key doesnt work.

14 messages · Page 1 of 1 (latest)

keen spoke
#

Somebody help me? Thank you

candid peak
#

Did you generate api key ??

#

openai.api_key="Your API KEY"

#

at 1st you need to import openai

keen spoke
#

yes

#

I did

candid peak
#

if your api key did not work generate another one

keen spoke
#

no omg wait

#

you have to save this api key in os

#

and I did

#

nothing same

#

No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module
at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com for details, or email support@openai.com if you have any questions.

#

same same same

#
import os
import openai


api_key = os.environ.get('API_KEY')




response = openai.Image.create(
  prompt="a white siamese cat",
  n=1,
  size="1024x1024"
)
image_url = response['data'][0]['url']



print(image_url)