curl --request POST \
--url https://api.modellix.ai/api/v1/xai/grok-imagine-image-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Turn this into a vibrant pop-art poster",
"images": [
"https://example.com/photo.png"
]
}
'{
"code": 0,
"message": "success",
"data": {
"status": "pending",
"task_id": "task-xai-i2i-002",
"model_id": "xai/grok-imagine-image-edit",
"get_result": {
"method": "GET",
"url": "https://api.modellix.ai/api/v1/tasks/task-xai-i2i-002"
}
}
}{
"code": 400,
"message": "Invalid parameters: parameter 'images' is required"
}{
"code": 401,
"message": "Authentication failed: invalid API key"
}{
"code": 429,
"message": "Rate limit exceeded: 100 requests per minute, retry after 60 seconds"
}{
"code": 500,
"message": "Internal server error"
}Grok Imagine Image Edit
[Core Function] Grok Imagine Image Edit is xAI’s standard image editing model. [Strengths] It excels at quickly applying prompt-guided edits and style changes to one or more source images. [Best For] Highly recommended for: fast restyling, quick variations, and lightweight image edits. [Limitations] Do NOT use this model when maximum edit fidelity is required; the Quality variant preserves more detail. A maximum of 3 source images is supported. [Routing] Choose this model for fast edits. When the user demands maximum fidelity, route to Grok Imagine Image Edit (Quality).
curl --request POST \
--url https://api.modellix.ai/api/v1/xai/grok-imagine-image-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Turn this into a vibrant pop-art poster",
"images": [
"https://example.com/photo.png"
]
}
'{
"code": 0,
"message": "success",
"data": {
"status": "pending",
"task_id": "task-xai-i2i-002",
"model_id": "xai/grok-imagine-image-edit",
"get_result": {
"method": "GET",
"url": "https://api.modellix.ai/api/v1/tasks/task-xai-i2i-002"
}
}
}{
"code": 400,
"message": "Invalid parameters: parameter 'images' is required"
}{
"code": 401,
"message": "Authentication failed: invalid API key"
}{
"code": 429,
"message": "Rate limit exceeded: 100 requests per minute, retry after 60 seconds"
}{
"code": 500,
"message": "Internal server error"
}Authorizations
API Key authentication. Format: Bearer YOUR_API_KEY.
Body
xAI Grok Imagine image editing request. Shared by the Quality and standard edit models. A single image is passed as a one-element images array.
Text description of the edit to apply
1"Render this as a pencil sketch with detailed shading"
Source images to edit (1-3). Each item is a publicly accessible image URL or a base64 data URI.
1 - 3 elements1["https://example.com/photo.png"]
Number of edited images to generate
x >= 11
Aspect ratio of the edited output image
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 19.5:9, 9:19.5, 20:9, 9:20, auto "16:9"
Output resolution: 1k (1024px) or 2k (2048px). Defaults to 1k.
1k, 2k "1k"
Format of the returned image data
url, b64_json "url"