SandBase is live — $1 in free credits on signupStart free ›
Use in agentxAI models

xAI modelsimage generation api

xai/grok-imagine-image/edit

Grok Imagine Image Edit is xAI's intelligent image editing model. Transform, retouch, and reimagine existing images using text prompts - from background replacement to artistic style conversion.

Input
Text description of the desired image.

PNG, JPEG, WebP, or GIF · 20 MiB maximum each

List of URLs of the images to edit. A maximum of 3 images are supported.
Resolution of the generated image. `1k` for standard resolution, `2k` for high resolution. Allowed values: 1k, 2k.
The aspect ratio of the generated image. Allowed values: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16.
The format of the generated image. Allowed values: jpeg, png.
Idle

Example output — click Run to generate your own

API README

Grok Imagine Image Edit

Grok Imagine Image Edit is a specialized SandBase endpoint built to revise up to three supplied images through natural-language direction. It is most useful when teams need controlled image revision and reference blending, with the route’s inputs defining a repeatable production contract instead of leaving critical delivery choices to an ad-hoc manual workflow.

Use this exact route when its input mode matches the creative asset already in hand: describe the visual or spoken result clearly, set only the controls that support the intended delivery, and keep the subject, action, environment, camera or performance direction internally consistent. The result is returned asynchronously as a downloadable media URL suitable for review, automation, or downstream finishing.

Highlights

  • Direct semantic edits. Tell the model what to add, remove, replace, or restyle instead of constructing masks and layer operations by hand.
  • Up to three visual inputs. Multiple source images can contribute identity, product, palette, or styling information to the requested revision.
  • Canvas-aware revision. Ten target ratios make it possible to recompose an edited asset for a new placement rather than merely crop the source.
  • Publishing formats. Return JPEG for compact distribution or PNG where a lossless asset is the better downstream handoff.

Pricing

Each edit request costs $0.0220.

OperationPrice
Image edit$0.0220

When to Use

ScenarioWhy this route fits
Concept developmentChoose Grok Imagine Image Edit when its edit workflow matches the starting material and you need several clearly directed variations.
Production iterationUse explicit duration, resolution, ratio, seed, or quality controls to compare versions without changing the core creative brief.
Channel adaptationGenerate directly in the landscape, square, portrait, or vertical format required by the destination whenever that control is available.
Automated pipelinesIntegrate the asynchronous media URL into review queues, asset libraries, publishing tools, or a later finishing stage.
Alternative routePick a related text-, image-, reference-, edit-, or turbo route when the available source media or required degree of control is different.

Prompt Guide

Lead with the main subject or source asset, then describe the intended action or transformation, environment, composition, camera or vocal delivery, lighting and mood. Keep instructions concrete and compatible; use the route’s explicit fields for duration, resolution, ratio, quality, voice, or reproducibility instead of burying those settings in prose.

{
  "prompt": "A cinematic product reveal with deliberate subject motion, coherent lighting, and a slow camera push.",
  "resolution": "1k",
  "aspect_ratio": "21:9",
  "output_format": "jpeg",
  "images": [
    "https://example.com/reference-1.jpg"
  ]
}

Technical Specs

PropertyDetails
Model IDxai/grok-imagine-image/edit
Required inputsprompt
ExecutionAsynchronous; poll the returned generation ID
OutputDownloadable media URL
imagesarray; optional
promptstring; required
resolutionstring; optional; choices: 1k, 2k; default: 1k
aspect_ratiostring; optional; choices: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
output_formatstring; optional; choices: jpeg, png; default: jpeg

Related Models

ModelBest for
xai/grok-ttsAlternative grok tts workflow
xai/grok-imagine-video/text-to-videoAlternative text to video workflow
xai/grok-imagine-video/extendAlternative extend workflow
xai/grok-imagine-video/image-to-videoAlternative image to video workflow

Related Models