Grok Imagine 2
Overview
Grok Imagine Image 2.0 is xAI’s next-generation image model built for precise generation and editing. It improves instruction following, typography rendering, visual consistency, and reference-based transformation, delivering more controlled and refined image creation capabilities.
Test API KEY: key_00000000000000000000000000000000Endpoints
1. Create Task
Request
POST https://api.pixwithapi.online/api/task/createHeaders
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Api-Key | {API_KEY} | Yes |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text-to-image prompt, 1–2000 characters. |
| model_id | string | Yes | 0-85 |
| options | object | Yes | Generation options. |
| options.prompt_optimization | boolean | No | Translate and optimize the prompt before generation. Default: false. |
| options.aspect_ratio | string | No | Output aspect ratio. Valid values: '1:1', '2:3', '3:2', '3:4', '4:3', '9:16', '16:9'. Default: '1:1'. |
Example Request — Text-to-Image
{
"prompt": "A cinematic coastal city at sunset, detailed architecture and natural lighting",
"model_id": "0-85",
"options": {
"prompt_optimization": true,
"aspect_ratio": "16:9"
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | 1=success, 0=error |
| message | string | Success and failure messages |
| data | object | |
| data.task_id | string | Task identifier. |
| data.estimated_time | int | Estimated time in seconds. |
Response
{
"code": 1,
"message": "success",
"data": {
"task_id": "d425ab4dc256f0ebaa84862b9cea8a3d",
"estimated_time": 100
}
}Last updated on