Skip to main content
POST
/
ai
/
xai
/
image
/
generate
xai generate image
curl --request POST \
  --url https://ai.pmock.com/api/ai/xai/image/generate \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "grok-imagine-image",
  "aspectRatio": "1:1",
  "images": [
    "<string>"
  ]
}
'
{
  "code": 200,
  "message": "<string>",
  "data": {
    "taskId": "<string>"
  },
  "traceId": "<string>"
}

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