GET
/v1/schemas/grok/image/v1%2Fimages%2Fgenerations
Accept:
Request body
8 properties · 0 required · 5 $defs| property | type | description | constraints |
|---|---|---|---|
| aspect_ratio | enum | Aspect ratio of the generated image. Can be `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `2:3`, `3:2`, `9:19.5`, `19.5:9`, `9:20`, `20:9`, `1:2`, `2:1`, or `auto`. Defaults to `auto` for automatically selecting the best ratio for the prompt. Only supported by grok-ima… | 1:1 | 3:4 | 4:3 | 9:16 | 16:9 | 2:3 · +8 more · nullable |
| model | any | Model to be used. | |
| n | any | Number of images to be generated | 1 ≤ n ≤ 10 · format: int32 · default: 1 |
| prompt | string | Prompt for image generation. | |
| resolution | enum | Resolution of the generated image. Defaults to `1k`. Only supported by grok-imagine models. | 1k | 2k · nullable |
| response_format | any | Response format to return the image in. Can be url or b64_json. If b64_json is specified, the image will be returned as a base64-encoded string instead of a url to the generated image file. | default: "url" |
| storage_options | StorageOptions | Optional output storage configuration. When present, the generated image(s) are stored in the Files API and a `file_output` reference is returned in the response alongside the ephemeral URL. | nullable |
| user | any | A unique identifier representing your end-user, which can help xAI to monitor and detect abuse. |
Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"grok","endpointId":"v1/images/generations","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}