Edit Grok Image

POST/v1/images/edits
Edit one or more reference images with a Grok image model.

Request Body

application/json
prompt:requiredstring

Text instruction describing the requested output.

aspect_ratio:optionalstring

Aspect ratio of the generated media.

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

Input image used for editing or generation.

images:optionalarray

Input images used for multi-reference editing.

model:requiredstring

Model identifier used for this request.

n:optionalinteger

Number of results to generate.

resolution:optionalstring

Resolution of the generated media.

Allowed1k2k
response_format:optionalstring

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.