deCloud
MA CHAIN · 20260131
← All models

xAI: Grok Imagine Image 2.0

Origin
x-ai/grok-imagine-image-2.0

Grok Imagine Image 2.0 is an image generation and editing model from xAI. It is suited for creating images from text prompts and editing images from references, with low and...

Pricing
low_1k · 0.048 MA / image
low_2k · 0.072 MA / image
medium_1k · 0.072 MA / image
medium_2k · 0.096 MA / image

Billing follows the provider's own reported cost. The unit prices here are for reference; a model marked "billed at actual usage" has no reliable pre-call price, so your usage page is the record of what you paid.

Capabilities

VisionImage gen

Call it

Image models are served on POST /v1/images/generations. Pictures come back as inline base64 (data[].b64_json), never as URLs — the upstream provides none, so response_format: "url" is answered with a 400. Up to 3 images per request; streaming is not supported in this release.

curl https://macdecloud.com/v1/images/generations \
  -H "Authorization: Bearer dcld-sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"x-ai/grok-imagine-image-2.0","prompt":"a red panda reading a book","n":1,"resolution":"2K"}'

Python (OpenAI SDK)

Decode the returned base64 and write it to a file. This image-only client sets max_retries=0 to prevent automatic resubmission on failure. Keep the request ID and check the generation result and bill before deciding whether to retry.

import base64
from openai import OpenAI

client = OpenAI(base_url="https://macdecloud.com/v1", api_key="dcld-sk-...", max_retries=0)
resp = client.images.generate(model="x-ai/grok-imagine-image-2.0", prompt="a red panda reading a book", n=1)
with open("image.png", "wb") as f:
    f.write(base64.b64decode(resp.data[0].b64_json))
xAI: Grok Imagine Image 2.0 (ORIGIN) · deCloud