Skip to main content
POST
xai generate image

Body

application/json
prompt
string
required

Video generated prompt words, currently only supporting English explanations

Minimum string length: 1
model
enum<string>
required

image model

Available options:
grok-imagine-image
aspectRatio
enum<string>

image aspectRatio

Available options:
1:1,
3:2,
2:3,
16:9,
9:16
images
string[]

Reference image URL (Image generated/edited, up to 1 image, provided with image size following the reference image)

Response

200 - */*

OK

Unified return structure for response results

code
integer<int32>

Response status code

Example:

200

message
string

Response message

data
object

Response result

traceId
string

Response traceId