Générer des images
Soumets un job de génération d’images — prompt plus modèles entraînés optionnels — et récupère un id de job.
202 Accepted avec un id de job ; interroge
GET /images/generations/{id} pour le
résultat. Combine les modèles entraînés de ton organisation en passant leurs ids ou
leurs noms — style_id, object_ids, person_ids, setting_ids — plus un
color_palette_id. Chaque référence accepte un nom ou un id qui se résout vers un
modèle ou une palette visible pour toi.
Exemple : composer plusieurs modèles entraînés
Passe un modèlestyle, un ou plusieurs modèles person et setting, et une
palette de couleurs ensemble dans une seule requête. Chaque référence de modèle —
par id ou par nom — doit se résoudre vers un modèle completed visible pour toi.
object_ids, person_ids et setting_ids sont des tableaux ; style_id et
color_palette_id prennent une seule valeur (un nom ou un id). num_outputs
(1–4) vaut 1 par défaut et chaque sortie (output) est facturée. Omets engine
pour utiliser la valeur par défaut nano_banana_pro. aspect_ratio accepte 1:1
(par défaut), 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9,
1:4, 4:1, 1:8 et 8:1 ; un ratio non pris en charge renvoie 422 avant
qu’aucun credit ne soit facturé.Autorisations
Organization API key as a bearer token: Authorization: Bearer samsa_sk_....
Corps
POST /images/generations body (ADR §8, §10).
Trained-model refs (style_id, object_ids, person_ids, setting_ids) and the
color_palette_id color-palette ref combine on the Gemini path — each accepts a NAME
or its UUID id, resolved within your visible set (a model/palette you own, including
private ones, or a non-private one shared within your organization); setting_ids
maps to the internal scene_ids (ADR §8.2). engine is a public-safe subset of the
image engines (ADR §8.3). Note num_outputs defaults to 1 for API
ergonomics — the internal app default is 4.
Text prompt. Runs the same validation as the app (rejects empty / malformed / policy-violating prompts with a 422).
1"A minimalist product shot of a ceramic mug on linen, soft daylight"
A style model NAME or its UUID id (from list_models), resolved within your visible set — a model you own (including your own private models) or a non-private one shared with your organization. A name matching more than one visible model is rejected — pass the id. Must be completed.
object models to compose in — each a model NAME or its UUID id (from list_models), resolved within your visible set (a model you own, including private, or a non-private one your organization shares). A name matching more than one visible model is rejected — pass the id.
person models to compose in — each a model NAME or its UUID id (from list_models), resolved within your visible set (a model you own, including private, or a non-private one your organization shares). A name matching more than one visible model is rejected — pass the id.
setting models to compose in — each a model NAME or its UUID id (from list_models), resolved within your visible set (a model you own, including private, or a non-private one your organization shares). A name matching more than one visible model is rejected — pass the id. Maps to internal scenes.
A color palette NAME or its UUID id, resolved within your visible set — a palette you created (including private ones) or a non-private palette shared with your organization. A name matching more than one visible palette is rejected — pass the id.
Generation engine — one of nano_banana_pro (default) or nano_banana_2. Omit to use the default. Unknown engines return 422.
"nano_banana_pro"
Number of images to generate (1-4). Defaults to 1 (the app default is 4); each output is billed.
1 <= x <= 41
Aspect ratio for the generated image(s). One of 1:1 (default), 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1. Unsupported ratios return 422 before any credits are charged.
"1:1"
Output resolution — 1K, 2K, or 4K. Credits scale 1K:1x, 2K:2x, 4K:4x per output.
"1K"
Encoding of the returned images. v1 supports png only.
png "png"
Optional https webhook notified once on terminal status (signed per the webhook signature scheme; see the webhooks docs).
"https://example.com/webhooks/samsa"
Réponse
Successful Response
202 body for POST /images/generations (ADR §7.1).
The image job id — poll GET /images/generations/{id}.
Initial status: always pending at submit.
pending, processing, completed, failed, cancelled "pending"
Credits this job is expected to cost (base 5 x num_outputs x resolution multiplier).
5

