xAI
Grok Imagine
Image generationQuality · 7 aspect ratios · n=1–4
TPool price$0.006per image
Output specQuality · 7 aspect ratios · n=1–4See the parameter table below
1 route
About this model
Quality text-to-image with 7 aspect ratios
Request parameters
Text-to-image · POST /v1/images/generations
| Parameter | Accepted values | Default | Description |
|---|---|---|---|
modelRequired | Model ID | — | This page’s model ID |
promptRequired | String,1–4000 characters | — | Prompt |
n | Integer,1 to 4 | 1 | Number of outputs |
size | 1024x1024 / 1280x720 / 720x1280 / 1536x1024 / 1024x1536 | — | Output size; choose this or aspect_ratio |
aspect_ratio | 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3 | — | Aspect ratio; choose this or size |
provider | Route ID or auto | auto | Pin 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
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",
prompt="A white lighthouse by the sea at dawn, light fog, a film look",
size="1024x1024",
)
print(image.data[0].url)