Gemini 3 Pro Image Preview
Request ID gemini-3-pro-image-preview
Protocols
POST /v1/images/generations· Generate images examplePOST /v1/images/edits· Edit images examplePOST /v1beta/models/gemini-3-pro-image-preview:generateContent· Gemini generateContent exampleGET /v1/images/tasks/{task_id}· Check image task example
Authentication
Requests require an API key from API key management. For JSON requests, set Content-Type: application/json.
Authorization: Bearer YOUR_API_KEY- Gemini ·
x-goog-api-key: YOUR_API_KEY
Request parameters
POST /v1/images/generations
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Use this model ID gemini-3-pro-image-preview. |
prompt | string | Required | Describe the image to generate. |
aspect_ratio | string | Optional | Output aspect ratio. For example, 1:1 or 16:9. When omitted, the value is derived from size. Default 1:1. |
image_size | string | Optional | Output resolution tier. Accepted values 1K, 2K, 4K. When omitted, the value is derived from size. Default 1K. |
n | integer | Optional | Number of images per request. Use 1 for a single result. Default 1. |
image_urls | string[] | Optional | Reference images as a JSON array. Each item is a public HTTPS image URL or a Base64 image data URL. Also accepts image_input. Maximum reference images 4. |
?async | string | Optional | URL query parameter. Set 1, true, or yes to receive 202 and a task_id. Omit it to wait for the result. |
POST /v1/images/edits
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Required | Use this model ID gemini-3-pro-image-preview. |
prompt | string | Required | Describe the changes to make to the reference image. |
aspect_ratio | string | Optional | Output aspect ratio. For example, 1:1 or 16:9. When omitted, the value is derived from size. Default 1:1. For edits, set this in the JSON request body. |
image_size | string | Optional | Output resolution tier. Accepted values 1K, 2K, 4K. When omitted, the value is derived from size. For edits, set this in the JSON request body. Default 1K. |
n | integer | Optional | Number of images per request. Use 1 for a single result. Default 1. |
image_urls | string[] | Conditional | Reference images as a JSON array. Each item is a public HTTPS image URL or a Base64 image data URL. Also accepts image_input. Maximum reference images 4. Provide at least one reference when sending JSON edits. |
image[] | file[] | Conditional | With multipart/form-data edits, upload at least one image and repeat the field for more. A single file can also use image. Maximum reference images 4. |
?async | string | Optional | URL query parameter. Set 1, true, or yes to receive 202 and a task_id. Omit it to wait for the result. |
POST /v1beta/models/gemini-3-pro-image-preview:generateContent
| Field | Type | Required | Description |
|---|---|---|---|
model (path) | string | Required | Use gemini-3-pro-image-preview as the model ID in the URL path. |
contents | object[] | Required | Conversation contents in order. Each item holds its input parts in parts. |
contents[].role | string | Optional | Message role. Use user for user input and model for model messages in history. |
contents[].parts | object[] | Required | Array of parts within a content item. Text parts use text. |
contents[].parts[].inlineData | object | Conditional | Inline media object. Provide mimeType and Base64-encoded data. Accepted media types depend on the model and endpoint. |
systemInstruction | object | Optional | System instruction object. Put instruction text in parts[].text. |
generationConfig.maxOutputTokens | integer | Optional | Caps output tokens. The accepted limit depends on the model and endpoint. |
generationConfig.responseModalities | string[] | Optional | Output modalities. Use ["IMAGE"] to request an image. |
Request examples
Set your API key in the local ICODEEASY_API_KEY environment variable and choose an endpoint that accepts direct HTTP calls. For endpoints that require a specific client, follow that client’s setup guide.
Replace example media URLs and asset IDs with your own valid assets.
Images Generations
curl -sS 'https://api.icodeeasy.cc/v1/images/generations' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "gemini-3-pro-image-preview",
"prompt": "A watercolor illustration of a paper lantern by a lake.",
"aspect_ratio": "16:9",
"image_size": "1K"
}'
Images Edits
curl -sS 'https://api.icodeeasy.cc/v1/images/edits' \
-H "Authorization: Bearer $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "gemini-3-pro-image-preview",
"prompt": "Change the background to a pale blue wall. Preserve the subject.",
"image_urls": [
"https://example.com/reference.png"
],
"aspect_ratio": "16:9",
"image_size": "1K"
}'
Gemini generateContent
curl -sS 'https://api.icodeeasy.cc/v1beta/models/gemini-3-pro-image-preview:generateContent' \
-H "x-goog-api-key: $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "A watercolor illustration of a paper lantern by a lake."
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
]
}
}'
Check image task
curl -sS 'https://api.icodeeasy.cc/v1/images/tasks/YOUR_TASK_ID' \
-H "Authorization: Bearer $ICODEEASY_API_KEY"
Responses and tasks
/v1/images/generations · /v1/images/edits
HTTP 200 · Synchronous success
With ?sync=1, read the generated image URLs from data[].url. created is a Unix timestamp in seconds, and id is the task ID.
{
"id": "d142c93a-de26-40c9-be62-0de840d10960",
"created": 1781599773,
"data": [
{
"url": "https://example.com/generated-image.png"
}
]
}
HTTP 202 · Asynchronous submission
{
"task_id": "d142c93a-de26-40c9-be62-0de840d10960",
"status": "pending"
}
With ?async=1, use the same API key to poll GET /v1/images/tasks/{task_id}. status is pending, completed, or failed. On completion, read the image URL from result_url.
HTTP 200 · Completed task lookup
{
"task_id": "d142c93a-de26-40c9-be62-0de840d10960",
"status": "completed",
"model": "gemini-3-pro-image-preview",
"result_url": "https://example.com/generated-image.png"
}
Common errors
When the lookup returns failed, read error. If error_detail is present, check retryable before submitting again.
Gemini generateContent · JSON
Read images from parts with inlineData in candidates[].content.parts[]. Decode data from Base64 and use mimeType to identify the image format.
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"mimeType": "image/png",
"data": "BASE64_IMAGE_DATA"
}
}
]
}
}
]
}
Full integration guide · See the full API guide for request fields, task states, and response formats.
Capabilities and limits
text_to_image· Supportedimage_to_image· Supportedimage_editing· Supportednative_generation· Supportedreference_images· Conditional — Requires valid reference images in a supported request format- Limits Reference images: up to 4 · Resolutions: 1k, 2k, 4k
Compatibility aliases and retired redirects
gemini-3-pro-image→gemini-3-pro-image-preview(Alias)
Model Capability Catalog · View pricing
Related guides
Image Generation API
Generate or edit images with the OpenAI-compatible API. Send prompts, size options, and reference images, then read results or check async job status.
Gemini generateContent
Send native Gemini requests and read JSON responses or SSE streams. Put the model ID in the URL path and text in contents[].parts[].
Model Capability Catalog
Compare public text, image, and video models by normalized request ID, compatible protocols, supported clients, tool use, media capabilities, limits, and review date.