Generate image with Grok Imagine 2.0
xAI Grok Imagine 2.0 — the latest Grok image model: precise editing, infographics, ads, game assets, UI/UX mockups and storyboards. Text-to-image, plus editing from a single input image (the input image is free). Billing: per image, quality × resolution — low 1K = 50, low 2K = 80, medium 1K = 80, medium 2K = 100 credits. Use POST /v1/cost for an exact quote.
Asynchronous. Returns a job id (the image is not in this response). Poll GET /v1/images/{id} until status is succeeded — the generated image URLs are in that response’s images array (each { url, position }).
Authorizations
API key as a bearer token: Authorization: Bearer bpx_live_xxx
Body
Text description of the image to generate, or the edit to apply when image is supplied.
Output aspect ratio. Ignored when image is supplied — an edit always matches the input image's frame.
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, auto Optional input image to edit (one only — this model has no multi-reference form). Provide a public image URL, a data URI, raw base64, or an uploaded-file URL from POST /v1/uploads. Omit for text-to-image. Costs nothing extra.
Number of images to generate. This model returns a single image per request.
1 <= x <= 1Rendering quality. Combines with size to set the price: low bills 50 (1K) / 80 (2K), medium bills 80 (1K) / 100 (2K). This model has no high tier.
low, medium Output resolution tier. Combines with quality to set the price: 1K bills 50 credits at low quality and 80 at medium.
1K, 2K