Skip to main content
POST
Generate image with Grok Imagine 2.0

Authorizations

Authorization
string
header
required

API key as a bearer token: Authorization: Bearer bpx_live_xxx

Body

application/json
prompt
string
required

Text description of the image to generate, or the edit to apply when image is supplied.

aspect_ratio
enum<string>
default:1:1

Output aspect ratio. Ignored when image is supplied — an edit always matches the input image's frame.

Available options:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3,
2:1,
1:2,
auto
image
string

Optional input image to edit (one only — this model has no multi-reference form). Provide a public image URL, a data URI, raw base64, or an uploaded-file URL from POST /v1/uploads. Omit for text-to-image. Costs nothing extra.

num_images
integer
default:1

Number of images to generate. This model returns a single image per request.

Required range: 1 <= x <= 1
quality
enum<string>
default:low

Rendering quality. Combines with size to set the price: low bills 50 (1K) / 80 (2K), medium bills 80 (1K) / 100 (2K). This model has no high tier.

Available options:
low,
medium
size
enum<string>
default:1K

Output resolution tier. Combines with quality to set the price: 1K bills 50 credits at low quality and 80 at medium.

Available options:
1K,
2K

Response

Job accepted.

id
string

Opaque job id — use it to poll status.

Example:

"img_a1b2c3d4e5f6"

message
string
model
string
status
enum<string>

Lifecycle state. succeeded/failed/timeout are terminal.

Available options:
pending,
starting,
processing,
completing,
succeeded,
failed,
timeout