Quality Parameter and Render Optimization
On this page
Lesson rewritten on November 2, 2026. The previous version described a
highvalue and aqualityparameter that had no effect on price, for a “pro” model now retired. According to current xAI documentation,qualityis specific to Imagine 2.0, acceptslow,medium, andauto, and each image is billed at the quality at which it is served.
Control Generation Quality

In the Grok app, the Speed / Quality selector balances speed and finesse. In the API, this balance involves two choices: the model (Imagine 1.0 or Imagine 2.0) and, for Imagine 2.0, the quality parameter.
The quality Parameter
quality is accepted by grok-imagine-image-2.0, for both generation and editing. Three values:
low: the cheapest setting for Imagine 2.0 ($0.04 per image at listed rates), and where requests from the old “pro” model are redirected;medium: more compute per image for finer details, reserve for images where quality matters more than cost;auto: the default value when the parameter is omitted; it currently serveslowin generation andmediumin editing, and the image is billed at the served quality.
To control both the render and the bill, set the quality explicitly rather than letting auto decide. With the OpenAI SDK pointed at the xAI API, it passes via extra_body:
# Quick draft: Imagine 1.0, the cheapest
brouillon = client.images.generate(
model="grok-imagine-image",
prompt="E-commerce website mockup, wireframe style",
)
# Standard visual: Imagine 2.0, low quality
courant = client.images.generate(
model="grok-imagine-image-2.0",
prompt="Illustration of a mobile fitness app",
extra_body={"quality": "low"},
)
# Final visual: Imagine 2.0, medium quality, 2k resolution
final = client.images.generate(
model="grok-imagine-image-2.0",
prompt="Advertising poster for a luxury perfume, photorealistic render",
extra_body={"quality": "medium", "resolution": "2k"},
)
Model + quality + resolution Combination
Three parameters, three effects: the model sets the base price and available features, quality the detail level for Imagine 2.0 (and its rate), resolution the image definition (1k by default, or 2k).
| Use Case | Model | Quality | Resolution |
|---|---|---|---|
| Quick prototype | Imagine 1.0 | — | 1k |
| Web content | Imagine 1.0 | — | 1k |
| Social media | Imagine 2.0 | low | 1k |
| Marketing visual | Imagine 2.0 | medium | 1k |
| Print, poster | Imagine 2.0 | medium | 2k |
3-Step Optimization Workflow
Find the right idea where it’s cheap, refine it, and only pay for the most expensive render on the selected image.
Step 1: Explore
prompts_candidats = [
"A robot barista making coffee, cartoon style",
"A robotic arm pouring coffee, realistic style",
"A mechanical hand holding a steaming cup, steampunk style",
]
for prompt in prompts_candidats:
response = client.images.generate(
model="grok-imagine-image",
prompt=prompt,
n=3,
)
# Cost: 3 x $0.02 = $0.06 per prompt
Step 2: Refine
best_prompt = "A robotic arm pouring coffee, realistic style"
response = client.images.generate(
model="grok-imagine-image-2.0",
prompt=best_prompt,
n=4,
extra_body={"quality": "low", "resolution": "1k"},
)
# Cost: 4 x $0.04 = $0.16
Step 3: Finalize
response = client.images.generate(
model="grok-imagine-image-2.0",
prompt=best_prompt + ", cinematic lighting, fine mechanical details",
n=2,
extra_body={"quality": "medium", "resolution": "2k"},
)
# Cost: 2 images at the current "medium" rate
The first two steps cost $0.34 for nine drafts and four variants; only the two final images are billed at the medium rate.
Automate Quality Selection
Centralize this choice in a function to prevent it from scattering across the code. If rates change or a model is added, only one place needs modification.
CONFIGS = {
"prototype": {"model": "grok-imagine-image", "extra_body": {"resolution": "1k"}},
"web": {"model": "grok-imagine-image", "extra_body": {"resolution": "1k"}},
"social": {"model": "grok-imagine-image-2.0", "extra_body": {"quality": "low", "resolution": "1k"}},
"marketing": {"model": "grok-imagine-image-2.0", "extra_body": {"quality": "medium", "resolution": "1k"}},
"print": {"model": "grok-imagine-image-2.0", "extra_body": {"quality": "medium", "resolution": "2k"}},
}
def generate_smart(prompt, usage="web"):
"""Generate an image with parameters suited to the use case."""
config = CONFIGS.get(usage, CONFIGS["web"])
return client.images.generate(prompt=prompt, **config)
Official sources: Image Generation — Quality · grok-imagine-image-quality Retirement on November 2, 2026 · Pricing
Key Takeaways
qualityis specific to Imagine 2.0 and acceptslow,medium, andauto(default value)- The image is billed at the served quality: set the quality explicitly to control the bill
- With the OpenAI SDK,
qualityandresolutionpass viaextra_body - 3-step workflow: explore with Imagine 1.0, refine in
low, finalize inmedium - Centralize parameter selection in a configuration function