Overview
Grok Imagine 1.5 Image Generationendpoint, supported Text-to-Image (text-to-image) and Image Editing (image-editing)Two modes.provide Reference image will:If omittedReference imageas Text-to-Image, Reference image (up to 5 images ) as Image Editing.
Base URL: https://mm-internal-cn.leonecloud.com
Authentication
All endpoints require a token in the request header for authentication:
Authorization: Bearer {YOUR_AUTH_TOKEN}Quick Start
cURL Example
Create Task (Text-to-Image)
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/grok-imagine-1.5" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A beautiful sunset over the ocean, oil painting style",
"aspectRatio": "16:9"
}'Create Task (Image Editing, Reference image)
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/grok-imagine-1.5" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Transform the image into watercolor style",
"genType": "i2i",
"imageUrls": ["https://example.com/reference.jpg"]
}'Query Task Status
curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_abc123" \
-H "Authorization: Bearer your_auth_token_here"Endpoints
1. create Grok Imagine 1.5 task
POST /api/v2/open/aigc/grok-imagine-1.5
Create a Grok Imagine 1.5 Image Generationtask.If omitted imageUrls/base64File when as Text-to-Image; Reference image when as Image Editing.
Content-Type: application/json
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | imagePrompt, up to 2,000 characters |
| genType | string | No | Generation type:t2i(Text-to-Image,default) / i2i(Image Editing).can If omitted, Reference image |
| imageUrls | string[] | Condition | Reference image URL list, Image Editingwhen Required,up to 5 images (will ) |
| base64File | string | No | Base64 encodedReference image, supports jpg/png/gif/webp, maximum 10MB |
| aspectRatio | string | No | Aspect ratio, default 1:1, supported:1:1 / 16:9 / 9:16 / 3:2 / 2:3 |
| n | int | No | Number of outputs, range 1-10, default 1.Number of outputs |
| nsfwChecker | bool | No | , defaultfalse |
| callbackUrl | string | No | Callback notification URL after the task is complete |
Description:
-base64FileandimageUrlsprovide Reference image can; when provide,base64Filelocalized example text.
- Image Editingup tosupported 5 images Reference image, will.
Request Example
Text-to-Image:
{
"prompt": "A beautiful sunset over the ocean, oil painting style",
"aspectRatio": "16:9",
"n": 2
}Image Editing:
{
"prompt": "Transform this image into watercolor style",
"genType": "i2i",
"imageUrls": ["https://example.com/reference.jpg"]
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID, used to query task status |
| data.status | string | Task Status, fixed to processing |
| data.createdAt | string | Created Time |
Response Example
Success
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20260810103000_abc12345",
"status": "processing",
"createdAt": "2026-08-10 10:30:00"
}
}2. Query Task Status
GET /api/v2/open/aigc/{taskId}
query task execute Status.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| taskId | string | Yes | Task ID |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID |
| data.status | string | Task Status:processing / success / failed |
| data.result | string[] | image URL list (Successreturned when applicable) |
| data.errorCode | string | Error Codes (Failurereturned when applicable) |
| data.errorMsg | string | Error Message (Failurereturned when applicable) |
| data.taskNickname | string | Task label (create when return ) |
| data.progress | int | , 0-100 |
| data.pointConsume | string | (decimal characters) |
| data.createdAt | string | Created Time (characters) |
| data.updatedAt | string | Updated Time (characters) |
Response Example
Success
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20260810103000_abc12345",
"status": "success",
"result": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/2026/08/10/output_001.png"
],
"createdAt": "2026-08-10 10:30:00",
"updatedAt": "2026-08-10 10:31:30"
}
}Failure
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20260810103000_abc12345",
"status": "failed",
"errorMsg": "Failure:",
"createdAt": "2026-08-10 10:30:00",
"updatedAt": "2026-08-10 10:30:45"
}
}3. Batch Query Task Status
POST /api/v2/open/aigc/batch
query task execute Status (up to 100 ).
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| taskIds | string[] | Yes | Task ID list, up to 100 |
Request Example
{
"taskIds": ["task_20260810103000_abc12345", "task_20260810103200_def67890"]
}Callback Notification
task complete (Success or Failure) when, if Create Task when providecallbackUrl, was provided when creating the task, the system sends a POST request to that URL.
Headers
Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Signature: {localized example text}Body (taskindata fieldin, and「Query Task Status」endpointlocalized example textdata ):```json
{
"event": "task.completed",
"timestamp": "2026-08-10T10:31:30+08:00",
"signature": "a1b2c3d4e5f6...",
"data": {
"taskId": "task_20260810103000_abc12345",
"status": "success",
"result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/images/output_001.png"],
"createdAt": "2026-08-10 10:30:00",
"updatedAt": "2026-08-10 10:31:30"
}
}
---
## Error Codes
| code | Description |
|------|------|
| 0 | Success |
| 10002 | Parametermissing or malformed |
| 10005 | API Key invalid or missing |
| 30003 | Task not found, task_id|
| 90003 | Internal server error |
---
## Best Practices
### Polling Strategy
- First 30 seconds:query every 3 seconds
- 30 seconds ~ 2 minutes:query every 5 seconds
- After 2 minutes:query every 10 seconds
### Processing Time Reference
- Text-to-Image:Usually 10 ~ 60 seconds
- Image Editing:Usually 10 ~ 60 seconds
### Prompt recommended
- use,, can ( oil painting, watercolor, digital art etc. )
- Image Editing when, prompt reference images to
- supported, Usually