grok-imagine-image-2.0 to eligible API-key groups. Use /v1/images/generations for text-to-image and the OpenAI-compatible multipart/form-data /v1/images/edits endpoint for one to three reference images. The current price is $0.055 per successfully returned image, and batch requests are billed by the number of outputs returned.
This is the complete LaoZhang integration guide for Grok Imagine image models.
grok-imagine-image-2.0 is an exact model ID. The legacy grok-imagine-image and grok-imagine-image-quality IDs remain separate models.Create an API key
Create a token and confirm its balance, visible models, and eligible group
Check current model pricing
Recheck the live price and call records before a large batch
Current integration scope
Choose among the three models
Test
grok-imagine-image-2.0 first for new integrations. Existing workloads do not need to migrate immediately. Compare one image from each relevant model with the same prompt, ratio, and resolution before switching.
Before you call the API
1
Create and protect a token
Create an API key in Token Management. Keep it in a server-side environment variable, never in browser code, a public repository, or logs.
2
Confirm the model and price
Open model pricing, verify that the token can see
grok-imagine-image-2.0, and confirm that the current price is still $0.055.3
Accept one real image first
Start with
n=1. Download the output and inspect its pixels, content, and call record before increasing resolution, output count, or concurrency.Text-to-image quick start
This request creates one 2K, 16:9, Medium image:data:
response_format to b64_json when you need the image bytes in the response.
Python SDK
Aspect ratio, resolution, and quality
LaoZhang verified these fixedgrok-imagine-image-2.0 aspect ratios:
Omit
aspect_ratio to let the model choose. Pass an explicit value when the layout must be predictable.
resolution="1k"is faster and fits drafts, thumbnails, and batch candidates;resolution="2k"creates larger files with longer latency for final assets and cropping;quality="low"prioritizes speed;quality="medium"prioritizes detail;- do not send
quality="high"orresolution="4k".
Edit one reference image
Editing requires a file upload. Do not put an xAI-style JSON image object in the request body:Edit with two or three references
Repeatimage[] for multi-image editing. This three-image request provides the subject, scene, and style separately:
api2.laozhang.ai that returned a 1248×832 JPEG on September 3, 2026.
Python SDK editing
Parameters
Pricing and billing
grok-imagine-image-2.0 currently costs $0.055 per successfully returned image:
LaoZhang currently uses the same public price for 1K/2K and Low/Medium. LaoZhang pricing and xAI list pricing are separate billing contracts. Recheck the console before large batches and use call records as the final billing source.
Error handling
Use jittered exponential backoff for valid requests that hit 429, network errors, or clearly temporary 5xx failures. After a client timeout, check the call record before resubmitting to avoid duplicate generation and billing.
Production acceptance checklist
- Generate one 1K Low image with the production token;
- download the URL or decode Base64 and inspect the real MIME type and dimensions;
- test the exact 2K, Medium, ratio, and
nvalues used in production; - use distinct, non-sensitive references and verify that each subject affects the output;
- enforce the three-reference edit limit;
- use at least a 60-second timeout for 1K Low and 120–180 seconds for Medium and 2K;
- reconcile success rate, latency, output count, and call records before increasing concurrency.
Frequently asked questions
What is the exact new model ID?
Usegrok-imagine-image-2.0, including the final .0. The legacy grok-imagine-image and grok-imagine-image-quality IDs remain separate models.
Is pricing per request or per output image?
It is per successfully returned image. A successfuln=10 response with ten images costs 0.055 charge.
How many reference images can I upload?
grok-imagine-image-2.0 currently accepts up to three references through multipart file upload. Four and five references are not supported.
Can I use xAI’s JSON image-editing request format?
Not currently. LaoZhang has verified OpenAI-compatible multipart uploads. JSON image objects return HTTP 400; wait for a future compatibility update if your application requires that contract.Do 1K, 2K, Low, and Medium have the same LaoZhang price?
Yes, the current public price is $0.055 per successfully returned image. Latency and upstream cost vary by tier, so recheck the console before a large batch.How should I store generated results?
Download URL responses promptly into your own storage. Useb64_json when the image must travel in the API response. Do not assume temporary URLs remain available indefinitely.
Sources and related documentation
- Grok Imagine Image 2.0 launch announcement — current price, availability, and three-image editing scope
- xAI Grok Imagine Image 2.0 model — official model ID and resolution/quality pricing
- xAI image generation — official ratios, resolution, quality, batching, and response formats
- xAI image editing — official JSON editing contract, which differs from LaoZhang’s current multipart interface
- xAI multi-image editing — upstream five-image capability, not LaoZhang’s current three-image limit
- LaoZhang Images API reference — common Images API request and response structure
- LaoZhang image generation guide — compare other image models
- LaoZhang model pricing — current models, groups, retail prices, and call records