curl --request POST \
--url https://api.aihubmax.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-image",
"prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg"
}
'{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "image"
}{
"error": {
"message": "Invalid request format",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient account balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Grok Imagine
Grok Imagine Image Generation
- Grok Imagine image generation model, supporting text-to-image and image editing
- Supports generating 1-4 images per request, edit mode supports up to 3 input images
- Async processing mode, use the returned task ID to query task status
- Generated image links are valid for 24 hours, please save them promptly
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.aihubmax.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-image",
"prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy",
"num_outputs": 1,
"aspect_ratio": "1:1",
"output_format": "jpg"
}
'{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "image"
}{
"error": {
"message": "Invalid request format",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient account balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Authorizations
All APIs require Bearer Token authentication
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
grok-imagine-image: Supports text-to-image and image editing
Example:
"grok-imagine-image"
Image generation prompt
Notes:
- Text-to-image mode: Describe the image content you want to generate
- Image editing mode: Describe the editing requirements for the input image
Example:
"Abstract human silhouette, golden particles ready to burst outward representing joy"
Number of output images
Notes:
- Range:
1-4 - Each image is billed independently
Example:
1
Output image aspect ratio
Options:
2:1,20:9,19.5:9,16:9,4:3,3:2,1:12:3,3:4,9:16,9:19.5,9:20,1:2
Notes:
- Only supported in text-to-image mode
- Defaults to
1:1upstream when not specified
Example:
"1:1"
Output image format
Options:
jpg/jpegpngwebp
Notes:
- Defaults to
jpegupstream when not specified
Do not pass this parameter unless necessary.
Example:
"jpg"
List of input image URLs
Notes:
- Automatically switches to image editing mode when provided
- Supports up to
3input images - Public accessible image URLs are recommended
Example:
["https://example.com/input-image.png"]
Response
Task created successfully
Task creation timestamp
Example:
1757165031
Task ID
Example:
"task-unified-1757165031-uyujaw3d"
Actual model name used
Specific task type
Available options:
image.generation.task Task progress percentage (0-100)
Required range:
0 <= x <= 100Example:
0
Task status
Available options:
pending, processing, completed, failed Example:
"pending"
Asynchronous task information
Show child attributes
Show child attributes
Task output type
Available options:
image Example:
"image"