Create Grok Image

POST/v1/images/generations
Generate an image with a Grok image model.

Request Body

application/json
prompt:requiredstring

Text instruction describing the requested output.

ExampleA collage of London landmarks in a stenciled street‑art style
aspect_ratio:requiredstring

Aspect ratio of the generated media.

Allowed1:13:44:39:1616:92:33:29:19.519.5:99:2020:91:22:1auto
Exampleauto
model:requiredstring

Model identifier used for this request.

Examplegrok-imagine-image-quality
n:requiredinteger

Number of results to generate.

resolution:requiredstring

Resolution of the generated media.

Allowed1k2k
response_format:requiredstring

Format used to return generated media.

Allowedurlb64_json
Exampleurl

Response

200

A successful request returns a JSON response. The complete example is shown in the code panel.