Overview
Use the gemini-3-pro-image model (nanobana) for image-to-image generation or image editing. Through the Vertex AI-compatible generateContent interface, it generates edited images based on the original image and text prompts.
API details
Constraints
- The caller must have an API Key. For more information, see Manage AI API Keys.
Request path
POST {BASE_URL}/api/v1/publishers/googleVertexAI/models/gemini-3-pro-image:generateContent
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information |
| Content-Type | Yes | application/json | Request body format |
Request parameters
Path
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| None | This API has no path parameters. |
Query
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| None | This API has no query parameters. |
Body
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| contents | array[object] | Yes | Dialog contents | |
| contents[].role | string | Yes | user | Role, fixed asuser |
| contents[].parts | array[object] | Yes | Content segments, including text and images | |
| contents[].parts[].text | string | Yes | Edit this image: make the sky more blue | Image editing prompt |
| contents[].parts[].inlineData | object | Yes | Original image data | |
| contents[].parts[].inlineData.mimeType | string | Yes | image/png | Image MIME type |
| contents[].parts[].inlineData.data | string | Yes | <base64 image> | Base64-encoded image data |
| generationConfig | object | Yes | Generation configuration | |
| generationConfig.maxOutputTokens | integer | Yes | 8192 | Maximum output tokens |
| generationConfig.responseModalities | array[string] | Yes | ["TEXT", "IMAGE"] | Response modal, must includeTEXTandIMAGE |
Response parameters
Returns the standard Vertex AI generateContent response, containing the generated text and image contents.
Request example
curl -sS -X POST "${BASE_URL}/api/v1/publishers/googleVertexAI/models/gemini-3-pro-image:generateContent" \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Edit this image: make the sky more blue"
},
{
"inlineData": {
"mimeType": "image/png",
"data": "<base64 image>"
}
}
]
}
],
"generationConfig": {
"maxOutputTokens": 8192,
"responseModalities": ["TEXT", "IMAGE"]
}
}'
Response example
Error response
{
"error": {
"message": "error message",
"type": "error_type",
"code": "error_code"
}
}
