Skip to main content
POST

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Validation rules:

  • Requests must use application/json; multipart file upload is not supported
  • model and a non-empty prompt are required
  • image_urls must contain publicly accessible HTTP or HTTPS image URLs; grok_imagine_image accepts at most 3
  • An empty image_urls array creates a text-to-image task; a non-empty array creates an image-to-image task
  • aspect_ratio defaults to auto; Grok text-to-image maps it to 1:1, while Grok image-to-image preserves the first input ratio
  • grok_imagine_image supports only 1K and 2K resolution
  • quality defaults to low for gpt_image_2; auto is accepted as an alias for low; other models ignore it
  • output_format must be jpeg, png, or webp; it is supported by gpt_image_2 (default png) and grok_imagine_image (default jpeg)
model
enum<string>
required

Image model to use. Each model has different parameter support; see the model-specific parameter rules in this operation's description.

Available options:
gpt_image_2,
nano_banana_2_lite,
nano_banana_2,
nano_banana_pro,
gemini_25_flash_image,
grok_imagine_image
prompt
string
required

Text instruction for image generation or editing.

Minimum string length: 1
image_urls
string<uri>[]

Publicly accessible HTTP or HTTPS input image URLs. Omit or pass an empty array for text-to-image. gpt_image_2 accepts up to 16 images; grok_imagine_image accepts up to 3 images. Multipart file upload is not supported.

Maximum array length: 16
aspect_ratio
enum<string>
default:auto

Output aspect ratio. Supported values vary by model. For grok_imagine_image, auto resolves to 1:1 for text-to-image and preserves the first input image ratio for image-to-image.

Available options:
auto,
9:16,
2:3,
3:4,
4:5,
1:1,
5:4,
4:3,
3:2,
16:9,
20:9,
19.5:9,
21:9,
9:21,
9:19.5,
9:20,
1:2,
2:1,
1:4,
4:1,
1:8,
8:1
resolution
enum<string>
default:1K

Output resolution. nano_banana_2_lite and gemini_25_flash_image support only 1K; grok_imagine_image supports 1K and 2K; the other models support 1K, 2K, and 4K.

Available options:
1K,
2K,
4K
quality
enum<string>
default:low

Output quality for gpt_image_2. Defaults to low when omitted. auto is accepted as a backward-compatible alias for low. Other models ignore this field.

Available options:
auto,
low,
medium,
high
output_format
enum<string>

Output image format. Supported by gpt_image_2 (default png) and grok_imagine_image (default jpeg). Other models must omit this field.

Available options:
jpeg,
png,
webp
count
integer
default:1

Number of output images.

Required range: 1 <= x <= 4

Response

Task created successfully

code
integer
trace_id
string
message
string | null
data
object