Gemini Image API
Google's Gemini image generation models. Supports text-to-image and image editing with flexible resolution and aspect ratio control.
Authentication
Authorization: Bearer YOUR_API_KEYModels & pricing
| Model | model | Price | Notes |
|---|---|---|---|
| Gemini 2.5 Flash Image | gemini-2.5-flash-image | $0.0200/image | Standard |
| Gemini 3 Pro Image | gemini-3-pro-image | $0.08-$0.13/image | 1K/2K $0.08 (40% off official), 4K $0.13 (46% off), highest quality |
| Gemini 3.1 Flash Image | gemini-3.1-flash-image | $0.04-$0.10/image | GA release; 512 $0.04, 1K/2K $0.06, 4K $0.10 |
| Nanobanana2 | nanobanana2/gemini-3.1-flash-image-preview | $0.05 / 4K $0.08 | 1K/2K $0.05, 4K $0.08 |
| Nano Banana 2.1 | nano-banana-2-1 | $0.022-$0.06/image | 1K $0.022, 2K $0.036, 4K $0.06; up to 10 references, 15 aspect ratios (full parameters on its own page) |
| Nanobanana-2-lite | nanobanana-2-lite/gemini-3.1-flash-image-preview | $0.025 | Text-to-image + editing (up to 10 reference images); flat $0.025, 1K only |
| Nanobanana-2-beta | nanobanana-2-beta/gemini-3.1-flash-image-preview | $0.05 / 4K $0.08 | 1K/2K $0.05, 4K $0.08 |
| Nanobananapro-gemini | gemini-3-pro-image-gemini | $0.03/image | Gemini 3 Pro, budget channel |
| Nanobanana2-gemini | gemini-3.1-flash-image-gemini | $0.025/image | Gemini 3.1 Flash, budget channel |
Code examples
# Step 1: Create task (text-to-image)
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3-pro-image-preview",
"prompt": "A futuristic cityscape at sunset with flying cars",
"aspect_ratio": "16:9",
"resolution": "2k"
}'
# Image editing with reference image
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3-pro-image",
"prompt": "Add dramatic storm clouds to the sky",
"image_url": "https://example.com/photo.jpg",
"aspect_ratio": "16:9"
}'
# Step 2: Poll status
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"Request parameters
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | gemini-2.5-flash-image / gemini-3-pro-image / gemini-3.1-flash-image / gemini-3-pro-image-gemini / gemini-3.1-flash-image-gemini / nanobanana2/gemini-3.1-flash-image-preview / nanobanana-2-lite/gemini-3.1-flash-image-preview / nanobanana-2-beta/gemini-3.1-flash-image-preview |
| prompt | Yes | string | Text description or editing instructions |
| image_url | No | string | Single reference image URL for image editing |
| image_urls | No | string[] | Multiple reference image URLs for multi-image editing |
| aspect_ratio | No | string | "auto" (default), "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3" |
| resolution | No | string | "1k", "2k", "4k" -- price varies by resolution |
| callback_url | No | string | Webhook URL called when task completes |
Notes
- Pro Lite (97%) and Pro (99%) differ in success rate and price
- Resolution affects price: 1k < 2k < 4k
- Supports multiple reference images (image_url for single, image_urls for array)
- Nanobananapro-gemini ($0.03/image) and Nanobanana2-gemini ($0.025/image) are budget channels
- Nano Banana 2.1 has its own docs page (extra ratios such as 1:4 / 4:1 / 1:8 / 8:1, up to 10 references): Nano Banana 2.1 API
Try it in the Playground
FAQ
Which Gemini image models are available and what do they cost?
Gemini 2.5 Flash Image ($0.02), Gemini 3 Pro Image ($0.08-$0.13, below official), Gemini 3.1 Flash Image ($0.04-$0.10), plus Nano Banana budget channels from $0.025 per image — all on one key.
Does the Gemini image API support editing with multiple references?
Yes — pass image_url for a single reference or image_urls[] for multi-image fusion, with aspect_ratio and resolution (1k/2k/4k) control.