Edit and modify images based on text prompts using Gemini Flash Image HD model
enable_sync_mode set to true (some models do not support this parameter, but you still need to query the result by id), you must call the Query Result endpoint to retrieve the final output.
data.id – the unique identifier of the predictiondata.urls[0].get – a ready-to-use GET URL that already embeds the id| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
model | string | ✅ Yes | - | - | The model to use for image editing |
prompt | string | ✅ Yes | - | - | A text description of the desired image(s). The maximum length is 32000 characters. |
image | array | ❌ No | - | - | Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images. |
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
size | string | ❌ No | - | 1K2K4K | Approximate size of the generated image. If not specified, the model will use the default value of 1K. only Gemini 3 Pro Image Preview, |
aspect_ratio | string | ❌ No | 1:1 | 1:12:33:23:44:34:55:49:1616:921:9 | The aspect ratio of the generated image. |
enable_sync_mode | boolean | ❌ No | false | truefalse | Whether to enable synchronous mode for image generation. |
enable_base64_output | boolean | ❌ No | false | truefalse | Whether to enable base64 output for image generation. |
output_format | string | ❌ No | png | pngjpg | The format in which the generated images are returned. |
aspect_ratio field under image_config in your request, as shown below:
Gemini 2.5 Flash Image
| Aspect ratio | Resolution | Tokens |
|---|---|---|
| 1:1 | 1024x1024 | 1290 |
| 2:3 | 832x1248 | 1290 |
| 3:2 | 1248x832 | 1290 |
| 3:4 | 864x1184 | 1290 |
| 4:3 | 1184x864 | 1290 |
| 4:5 | 896x1152 | 1290 |
| 5:4 | 1152x896 | 1290 |
| 9:16 | 768x1344 | 1290 |
| 16:9 | 1344x768 | 1290 |
| 21:9 | 1536x672 | 1290 |
| Aspect ratio | 1K resolution | 1K tokens | 2K resolution | 2K tokens | 4K resolution | 4K tokens |
|---|---|---|---|---|---|---|
| 1:1 | 1024x1024 | 1120 | 2048x2048 | 1120 | 4096x4096 | 2000 |
| 2:3 | 848x1264 | 1120 | 1696x2528 | 1120 | 3392x5056 | 2000 |
| 3:2 | 1264x848 | 1120 | 2528x1696 | 1120 | 5056x3392 | 2000 |
| 3:4 | 896x1200 | 1120 | 1792x2400 | 1120 | 3584x4800 | 2000 |
| 4:3 | 1200x896 | 1120 | 2400x1792 | 1120 | 4800x3584 | 2000 |
| 4:5 | 928x1152 | 1120 | 1856x2304 | 1120 | 3712x4608 | 2000 |
| 5:4 | 1152x928 | 1120 | 2304x1856 | 1120 | 4608x3712 | 2000 |
| 9:16 | 768x1376 | 1120 | 1536x2752 | 1120 | 3072x5504 | 2000 |
| 16:9 | 1376x768 | 1120 | 2752x1536 | 1120 | 5504x3072 | 2000 |
| 21:9 | 1584x672 | 1120 | 3168x1344 | 1120 | 6336x2688 | 2000 |
| Error Code | Error Name | Description |
|---|---|---|
| 401 | Unauthorized | API key is missing or invalid |
| 403 | Forbidden | Your API key doesn’t have permission to access this resource, or insufficient balance for the requested operation |
| 429 | Too Many Requests | You’ve exceeded your rate limit |
| 500 | Internal server error | An internal server error occurred |
| 503 | Content policy violation | Content blocked due to safety concerns (actual status code is 400) |