xAIImage to imageAvailable now
grok-imagine-image-2.0/edit
grok-imagine-image-2.0/edit is an image to image tool from xAI that runs in the background and returns images. Pay as you go from $0.013 per image, with one API key.
Try itfrom $0.013 / image
Pricing
quality / resolution: low / 1k (default) $0.052, low / 1.5k $0.065, low / 2k $0.078, otherwise / 1k (default) $0.078, otherwise / 1.5k $0.091, otherwise / 2k $0.104 per image. image adds $0.013 per image. Each item in images adds $0.013. Billed on n, default 1.
Limits
- Runs
- In the background
- Returns
- image
- Longest queue wait
- 3600s
- Run deadline
- 1800s
- Largest inline input
- 1024 KB
- Largest input file
- 500 MB
- Largest output
- 4768 MB
- Outputs per run
- 16
Input
| Field | Kind | Default | Description |
|---|---|---|---|
prompt required | text | — | Prompt for image editing. |
n | number (whole) | — | Number of image edits to be generated. |
image | JSON | — | Input image to perform edit on. Mutually exclusive with `images`. |
images | JSON | — | List of input images for multi-reference editing. Mutually exclusive with `image`. When multiple images are provided, refer to them as \<IMAGE_0\>, \<IMAGE_1\>, etc. in the prompt. |
quality | one of low, medium, auto | — | Quality of the edited image (grok-imagine-image-2.0). `auto` uses `medium` for edits. |
resolution | one of 1k, 2k, 1.5k | — | Resolution of the generated image. Defaults to `1k`. Only supported by grok-imagine models. |
aspect_ratio | one of 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, 21:9, 5:2, auto | — | Aspect ratio of the output image for image editing with multiple images. For single image editing, do not set this. It will always auto-detect from the input image. |
Same request in code
curl https://api.spiral.ai/v1/runs \
-H "Authorization: Bearer $SPIRAL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"provider": "xai",
"model": "grok-imagine-image-2.0/edit",
"input": {
"prompt": "<prompt>"
}
}'