Skip to main content
POST
/
generate
/
image
/
openai
/
gpt-image-2
ChatGPT 2
curl --request POST \
  --url https://api.krea.ai/generate/image/openai/gpt-image-2 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "prompt": "Monasteries in Bhutan, perched like eagles' nests on cliffs."
}
EOF
{
  "job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "completed_at": null,
  "result": null,
  "error": {
    "code": "<string>",
    "message": "<string>"
  }
}
These aliases are accepted for compatibility only and are not shown in the request schema.
DeprecatedUse insteadAccepted until
imageUrlsimage_urls2026-06-19
styleImagesstyle_images2026-06-19

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Webhook-URL
string<uri>

URL to receive a POST request when the job completes. The webhook will receive the job data including results.

Body

application/json
prompt
string
required
Minimum string length: 1
quality
enum<string>
default:high
Available options:
low,
medium,
high,
auto
image_urls
string[]
Maximum array length: 10
width
number

Width of the generated image in pixels.

height
number

Height of the generated image in pixels.

aspect_ratio
enum<string>

Aspect ratio. One of: 16:9, 2:1, 3:2, 4:3, 1:1, 3:4, 2:3, 1:2, 9:16.

Available options:
16:9,
2:1,
3:2,
4:3,
1:1,
3:4,
2:3,
1:2,
9:16
resolution
enum<string>

Resolution scale. One of: 1K, 2K, 4K.

Available options:
1K,
2K,
4K
style_images
object[]

Image prompts to use for the generation

Maximum array length: 10

Response

The resulting job data. This will be returned in a pending state until the job is completed. See /jobs/{id} for retrieving the results.

job_id
string<uuid>
required
status
enum<string>
required
Available options:
backlogged,
queued,
scheduled,
processing,
sampling,
intermediate-complete,
completed,
failed,
cancelled
created_at
string<date-time>
required
completed_at
null
required
result
null
required
error
object