{"model":"gpt-image-2","prompt":"A childrens book drawing of a veterinarian using a stethoscope to listen to the heartbeat of a baby otter.","n":1,"size":"1024x1024","quality":"low","format":"jpeg"}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl--location'/v1/images/generations' \
--header'Accept: application/json' \
--header'Authorization: Bearer {{YOUR_API_KEY}}' \
--header'Content-Type: application/json' \
--data'{
"model": "gpt-image-2",
"prompt": "A childrens book drawing of a veterinarian using a stethoscope to listen to the heartbeat of a baby otter.",
"n": 1,
"size": "1024x1024",
"quality": "low",
"format": "jpeg"
}'
Responses
🟢200OK
application/json
Bodyapplication/json
Example
{"id":"chatcmpl-123","object":"chat.completion","created":1677652288,"choices":[{"index":0,"message":{"role":"assistant","content":"\n\nHello there, how may I assist you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":9,"completion_tokens":12,"total_tokens":21}}