# Grok Imagine Image Generation This file is the focused AI-readable context for one UniAll documentation page. URL: https://docs.uniall.ai/models/video/grok/grok-imagine-image Locale: en Markdown: https://docs.uniall.ai/ai/pages/models/video/grok/grok-imagine-image.md Description: Grok Imagine image source documentation. Agent guidance: - Use this page when the user is asking about this specific route or model capability. - Preserve endpoint paths, JSON keys, model IDs, and placeholder values exactly. - Treat examples such as `sk-***`, `{BASE_URL}`, and `task_xxx` as safe placeholders, not real secrets. ## Page Markdown Updated: 2026-05-29 This document explains how to call Grok Imagine image model. user requires using this sitestable model and OpenAI compatible image endpoint. ## 1. Model | Model | scenario | Billing basis | | --- | --- | --- | | `grok-imagine-image` | standard, image editing | image, Input image billing detail | | `grok-imagine-image-quality` | quality, image editing | quality, image billing detail | recommended generate and editing use `grok-imagine-image`. requires quality or resolution use `grok-imagine-image-quality`. ## 2. Endpoint Overview ### 2.1 recommended: async image task ```http POST /v1/images/tasks GET /v1/images/tasks/{task_id} ``` async task Grok generation. supports, pass through this site supports Parameters, `resolution`, `aspect_ratio`, `output_format`, `num_images`. ### 2.2 compatibility: OpenAI imageEndpoint ```http POST /v1/images/generations POST /v1/images/edits ``` Endpoint OpenAI image format. `/v1/images/edits` supports JSON image URL, supports `multipart/form-data` pass image file. ### 2.3 Details Endpoint use Bearer Token: ```http Authorization: Bearer sk-*** Content-Type: application/json ``` ## 3. fast ### 3.1 async ```bash curl -X POST "{BASE_URL}/v1/images/tasks" \ -H "Authorization: Bearer sk-***" \ -H "Content-Type: application/json" \ -d '{"model": "grok-imagine-image", "task_type": "text2image", "prompt": ", and ", "aspect_ratio": "1:1", "resolution": "1k", "output_format": "jpeg", "num_images": 1, "response_format": "url"}' ``` submitSuccess returntask ID: ```json { "task_id": "task_xxx", "status": "queued", "progress": "0%", "result_url": "", "metadata": { "task_type": "text2image" }, "error": null } ``` Query Task: ```bash curl "{BASE_URL}/v1/images/tasks/task_xxx" \ -H "Authorization: Bearer sk-***" ``` completed responses: ```json { "code": "success", "message": "", "data": { "task_id": "task_xxx", "status": "succeeded", "progress": "100%", "result_url": "https://example.com/result-1.jpeg", "metadata": { "task_type": "text2image", "result_count": 1, "result_urls": [ "https://example.com/result-1.jpeg" ] }, "error": null } } ``` ### 3.2 async image editing ```bash curl -X POST "{BASE_URL}/v1/images/tasks" \ -H "Authorization: Bearer sk-***" \ -H "Content-Type: application/json" \ -d '{"model": "grok-imagine-image-quality", "task_type": "image2image", "prompt": " subject structure, to change into style, ", "image": "https://example.com/source-watch.png", "aspect_ratio": "auto", "resolution": "2k", "output_format": "webp", "num_images": 2, "response_format": "url"}' ``` ### 3.3 multiple reference imagesediting ```bash curl -X POST "{BASE_URL}/v1/images/tasks" \ -H "Authorization: Bearer sk-***" \ -H "Content-Type: application/json" \ -d '{"model": "grok-imagine-image-quality", "task_type": "image2image", "prompt": "to change one, Ratioand, style", "images": ["https://example.com/product.png", "https://example.com/stage.png"], "aspect_ratio": "16:9", "resolution": "2k", "output_format": "png", "num_images": 1, "response_format": "url"}' ``` ### 3.4 synchronous compatibilitycall ```bash curl -X POST "{BASE_URL}/v1/images/generations" \ -H "Authorization: Bearer sk-***" \ -H "Content-Type: application/json" \ -d '{"model": "grok-imagine-image", "prompt": "one, ", "n": 1, "response_format": "url"}' ``` responses: ```json { "created": 1773980459, "data": [ { "url": "https://example.com/image.png", "revised_prompt": "" } ] } ``` ### 3.5 synchronousimage editingcompatibilitycall JSON image URL: ```bash curl -X POST "{BASE_URL}/v1/images/edits" \ -H "Authorization: Bearer sk-***" \ -H "Content-Type: application/json" \ -d '{"model": "grok-imagine-image", "prompt": "reserved, to change, ", "image": "https://example.com/person.png", "n": 1, "response_format": "url"}' ``` multipart file pass: ```bash curl -X POST "{BASE_URL}/v1/images/edits" \ -H "Authorization: Bearer sk-***" \ -F "model=grok-imagine-image" \ -F "prompt=reserved subject, into " \ -F "n=1" \ -F "response_format=url" \ -F "image=@/path/to/source.png" ``` ## 4. Parameter Reference | Parameters | Type | Required | Note | | --- | --- | --- | --- | | `model`| string | Yes |`grok-imagine-image` or `grok-imagine-image-quality` | | `prompt` | string | Yes | generation or editing prompt | | `task_type`| string | No | async taskuse,`text2image` or `image2image`; pass the platform Whether image | | `image` | string | Required | Input image URL; synchronouseditingandasyncediting supports | | `images` | string[] | editingRequired | multiple reference images URL; recommendedFor new integrations, use Field | | `image_url` | string | No | URL compatibility field | | `image_urls` | string[] | No | URL compatibility field | | `aspect_ratio`| string | No | output aspect ratio;`1:1`, `16:9`, `9:16`, `4:3`, `3:4`, image editing `auto` | | `resolution`| string | No | Resolution tier,`1k`, `2k`; recommended `/v1/images/tasks` use | | `output_format`| string | No |`jpeg`, `png`, `webp` | | `num_images`| integer | No | Generate Images,`1-4`; async taskrecommended to use | | `n`| integer | No | OpenAI compatibility Field, default `1` | | `response_format`| string | No | recommended `url` | recommended: - use for single-image input `image`. - use for multi-image input `images`. - do not `image`, `image_url`, `images`, `image_urls`. ## 5. Billing Notes Grok image this siteuse billing detail, publicpricing Model. | scenario | billing detail | | --- | --- | | | image, Resolution tier, quality | | image editing | Input image, image, Resolution tier, quality | publicpricing Model, " image / ""Input image / "" image / ". submit, Yestask andbalance, public. ## 6. Common Errors ### to changevideo model imageEndpoint `grok-imagine` Yesvideo model, call `/v1/videos` orcompatibilityvideo task endpoint. ### image editing do not pass image `/v1/images/edits` and `task_type=image2image` pass `image` or `images`. ### pass `aspect_ratio=auto` `auto` image editing. recommended pass `1:1`, `16:9`, `9:16` Ratio. ### synchronousEndpointandasyncEndpoint Field If required `resolution`, `num_images` Grok Parameters, prefer using `/v1/images/tasks`. synchronouscompatibilityEndpoint OpenAI image.