Model Capabilities
Multi-Image Editing
Use up to three source images for a single image edit. You can specify images in the order they are sent in the request. By default, the output aspect ratio follows the first input image. You can override this by setting the aspect_ratio parameter to a specific ratio, such as "1:1" or "16:9".
Click to select




Select at least 2 source images
import xai_sdkclient = xai_sdk.Client()response = client.image.sample( prompt="Show all subjects sitting together on the grass in a sunny park. Casual relaxed mood, natural daylight, warm tones. No additional people or animals.", model="grok-imagine-image", image_urls=[ "https://docs.x.ai/assets/api-examples/images/image-merge/woman.jpg", "https://docs.x.ai/assets/api-examples/images/image-merge/man.jpg", # "<image_url>", ], aspect_ratio="3:2",)print(response.url)Related
- Image Generation — Generate images from text prompts
- Image Editing — Edit a source image with natural language
- API Reference — Full endpoint documentation
- Imagine API Landing Page — Showcase of the Imagine API in action
Did you find this page helpful?
Last updated: March 23, 2026