Skip to content

Instantly share code, notes, and snippets.

@grantwforsythe
Created February 28, 2023 18:50
Show Gist options
  • Save grantwforsythe/9ee9f4a9cb316a942ae15c99adfc467e to your computer and use it in GitHub Desktop.
Save grantwforsythe/9ee9f4a9cb316a942ae15c99adfc467e to your computer and use it in GitHub Desktop.
Save DALL-E Image
#!/usr/bin/env
curl https://api.openai.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"prompt": "a photo of a happy corgi puppy sitting and facing forward, studio light, longshot",
"n": 1,
"size": "1024x1024"
}' |
python3 -c "import sys, json; sys.stdout.write(json.load(sys.stdin)['data'][0]['url'])" |
xargs curl > image.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment