Skip to main content
POST

Authorizations

Authorization
string
required
All APIs require Bearer Token authenticationGet API Key:Visit the API Key Management Page to obtain your API KeyAdd the following to your request header:

Body

model
string
default:"imagen-4.0-apimart"
required
Image generation model nameFixed value: imagen-4.0-apimart
prompt
string
required
Text description for image generationBoth English and Chinese descriptions are supported
n
integer
default:"1"
Number of images to generateValue range: 1
size
string
default:"16:9"
Image generation ratioSupported formats:
  • 1:1 - Square
  • 4:3 - Landscape
  • 3:4 - Portrait
  • 16:9 - Landscape (default)
  • 9:16 - Portrait
Ratios not in the supported list (e.g. 21:9) will automatically fall back to the default 16:9 without raising an error.
Unsupported fields: image, image_urls, mask, quality, etc. will be ignored. If image_urls / image is passed, it will error directly: google_imagen4 currently supports text-to-image only.

Response

code
integer
Response status code
data
array
Response data array