APIImage Generation
Gemini 3.1 Flash Image Preview
Configurable fields and supported values for gemini-3.1-flash-image-preview.
Model ID
gemini-3.1-flash-image-preview
Capabilities
| Capability | Supported value |
|---|---|
| Text-to-image | Yes |
| Image-to-image | Yes |
| Multi-image reference | No |
Aspect ratio (aspect_ratio) | 1:1, 5:4, 4:5, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9 |
resolution | Controlled by quality |
quality | 512 (512 px), low (1K), medium (2K), high (4K) |
| Reference field | image |
Configurable fields
| Field | Required | Notes |
|---|---|---|
model | Yes | Must be gemini-3.1-flash-image-preview. |
prompt | Yes | Text description or editing instruction. |
aspect_ratio | No | Preferred aspect-ratio field; select one supported value listed above. |
size | No | Compatibility alias for aspect_ratio. New integrations should use aspect_ratio. |
quality | No | Defaults to the 1K output specification. |
n | No | Defaults to 1; account/model limit comes from the model list endpoint. |
image | No | Single reference image URL for image-to-image generation. |
response_format | No | url (default) or b64_json. |
output_format | No | png or jpeg. |
wait_for_completion | No | Defaults to false, which returns an asynchronous task ID. Set to true to wait in the create request. |
polling_timeout | No | Polling timeout used only when wait_for_completion is true. |
Pricing
Text input is $0.25/M tokens. Image output costs $0.0450 at 512 px, $0.0672 at 1K, $0.1008 at 2K, or $0.1512 at 4K. Any text output is billed at $1.50/M tokens.
Example
{
"model": "gemini-3.1-flash-image-preview",
"prompt": "Create a cinematic editorial image",
"aspect_ratio": "21:9",
"quality": "high"
}Last updated on