Model market
xAI

Grok Imagine 2.0

Image generation2.0 · 7 aspect ratios · n=1–4
TPool price$0.008per image
Output spec2.0 · 7 aspect ratios · n=1–4See the parameter table below
1 route

About this model

Imagine 2.0 text-to-image

Request parameters

Text-to-image · POST /v1/images/generations

ParameterAccepted valuesDefaultDescription
modelRequiredModel ID—This page’s model ID
promptRequiredString,1–4000 characters—Prompt
nInteger,1 to 41Number of outputs
size1024x1024 / 1280x720 / 720x1280 / 1536x1024 / 1024x1536—Output size; choose this or aspect_ratio
aspect_ratio1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3—Aspect ratio; choose this or size
providerRoute ID or autoautoPin a route for multi-route models; auto uses the lowest price

aspect_ratio and size Only one may be provided.

Parameters outside this list return HTTP 400 with the field name and supported parameters. Parameters marked “Ignored” are accepted but unused by Web models.

Quick call

quickstart.py
from openai import OpenAI

client = OpenAI(api_key="$TPOOL_API_KEY", base_url="https://tpool.dev/v1")

image = client.images.generate(
    model="x-ai/grok-imagine-image-2.0",
    prompt="A white lighthouse by the sea at dawn, light fog, a film look",
    size="1024x1024",
)
print(image.data[0].url)