Edit Grok Image
POST
/v1/images/editsEdit one or more reference images with a Grok image model.
Request Body
application/jsonprompt:requiredstringText instruction describing the requested output.
Example
Render this as a pencil sketch with detailed shadingaspect_ratio:requiredstringAspect ratio of the generated media.
Allowed
1:13:44:39:1616:92:33:29:19.519.5:99:2020:91:22:1autoExample
autoimage:requiredobjectInput image used for editing or generation.
Example
{"url":"https://docs.x.ai/assets/api-examples/images/style-realistic.png","type":"image_url"}images:requiredarrayInput images used for multi-reference editing.
model:requiredstringModel identifier used for this request.
Example
grok-imagine-image-qualityn:requiredintegerNumber of results to generate.
resolution:requiredstringResolution of the generated media.
Allowed
1k2kresponse_format:requiredstringFormat used to return generated media.
Allowed
urlb64_jsonExample
urlResponse
200A successful request returns a JSON response. The complete example is shown in the code panel.