Image generation
Grok Imagine images
xAI's Grok Imagine image models, called with xAI's image API.
Parsec serves xAI’s image API, so code written for https://api.x.ai/v1
switches by changing the base URL and the key.
| Model id | xAI model | |
|---|---|---|
grok-imagine-image | grok-imagine-image | Fast text-to-image and editing. |
grok-imagine-image-2 | grok-imagine-image-2.0 | Adds quality (low, medium, auto). |
grok-imagine-image-quality | grok-imagine-image-quality | Higher realism and text rendering. |
HTTP
curl https://platform.parseclab.ai/v1/images/generations \
-H "Authorization: Bearer $PARSEC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "grok-imagine-image-2", "prompt": "A watercolor lighthouse at dusk",
"n": 2, "aspect_ratio": "16:9", "resolution": "2k", "response_format": "b64_json"}'
Edit an image with POST /v1/images/edits and the source as
"image": {"url": "https://…", "type": "image_url"} (a URL or a data URI).
The request body and the response are xAI’s, relayed as sent:
{"data": [{"url": …} | {"b64_json": …}]}. URLs are xAI’s and expire, so
download them promptly.
Usage and limits
- Billed per image returned, at xAI’s list price on the models page. A failed call is free.
- Calls answer at once;
deferredrequests are not supported.