Grok Imagine Image 2.0 API guide
Grok Imagine Image 2.0 API: Generate images from a text prompt with Grok Imagine Image 2.0. The public request exposes resolution, aspect ratio, and batch quantity; reference-image editing is not exposed for this item.
Model overview
Generate images from a text prompt with Grok Imagine Image 2.0. The public request exposes resolution, aspect ratio, and batch quantity; reference-image editing is not exposed for this item.
API integration
| Documentation | Value |
|---|---|
| API invocation identifier | grok-imagine-image-2.0 |
| Integration | Async task API |
Use this invocation identifier in API requests. Check your authorized model catalog for access. Follow the Quickstart for your first complete call.
Request parameters
Studio presets describe the form setup, not guaranteed server defaults. Send preset values explicitly to reproduce them.
Describe the image to generate. Only text-to-image generation is supported.
Length: minimum 1.
Generation quality mode. The supported value is quality; this is not a pixel-resolution tier.
Allowed values: "quality".
Studio preset: "quality".
Choose the output aspect ratio. This controls the image shape, not a 1K or 2K resolution tier.
Allowed values: "1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9".
Studio preset: "1:1".
Number of independent generations managed by the application. Each provider request uses n=1.
Repeats MuseSpark execution within one logical task. This is separate from a model-native output count.
Value: minimum 1; maximum 12.
Studio preset: 1.
No parameters match. Clear the search or reset the filters.
Model rules
Parameter meaning
- Use the declared ratio whitelist. A convenient ratio from another image model can be invalid here.
- This model uses a quality-mode value rather than a conventional 1K/2K resolution ladder. Use the values declared for this item.
batch_size controls repeated MuseSpark executions. Output grouping, sequential image generation, and video shot count are separate concepts.
Request examples
Replace example media URLs and YOUR_... input identifiers with your own valid resources. Examples are checked against the exported item schema; media access and paid execution are separate runtime checks.
Set MUSESPARK_API_KEY and a stable MUSESPARK_REQUEST_ID before submitting. Preserve the request ID for retries of the same request and use a new ID for new work. Python examples use requests; JavaScript examples use Node.js 20 or later. The standalone Quickstart includes task polling and recovery.
Standard request
curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
-H "Authorization: Bearer $MUSESPARK_API_KEY" \
-H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
-H 'Content-Type: application/json' \
-d '{
"item_key": "grok-imagine-image-2.0",
"parameters": {
"batch_size": 1,
"resolution": "quality",
"aspect_ratio": "1:1",
"prompt": "A paper city under soft morning light"
}
}'Parameters used: batch_size · resolution · aspect_ratio · prompt.
Output
Creation returns a task ID inside data. Poll that task until completion, then save data.result.output_urls and any data.result.batch_results. See the task lifecycle for terminal states, result retention, and errors.
Troubleshooting
For rejected inputs, check the field type, accepted values, and conditional requirements in Request parameters and Model rules. Correct the affected fields before submitting again.
If creation times out, preserve the request identity and any known task ID. Follow Errors, timeouts and retries before submitting again.
Related docs
The public input snapshot was exported on 2026-11-09. Current prices and availability are listed in the model center.