This simple script requests an image be created from the prompt. “n=” is the number of images to return, and we do a for x loop to print only the URL’s from the JSON response.
import openai
openai.api_key = "APIKEY"
response = openai.Image.create(
prompt="A clone of instagram",
n=2,
size="1024x1024"
)
for x in response['data']:
print(x['url'])
Code language: JavaScript (javascript)