Overview
Use the gemini-3-pro-image model (Nano Banana Pro) for image-to-image generation or image editing. The Vertex AI-compatible generateContent API generates edited images based on the original image and text prompts.
API details
Constraints
- You must have an API key. For more information, see Manage AI API keys.
Request path
POST https://ai-api-g.oceanbase.com/api/v1/publishers/googleVertexAI/models/gemini-3-pro-image:generateContent
Note
gemini-3.1-flash-image uses the same request structure. You can call it by replacing the model name in the URL. For example: /api/v1/publishers/googleVertexAI/models/gemini-3.1-flash-image:generateContent.
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer YOUR_API_KEY | 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 | Conversation content. | |
| contents[].role | string | Yes | user | Role. The value is fixed to user. |
| contents[].parts | array[object] | Yes | Content parts, 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 modalities. The value must include TEXT and IMAGE. |
Response parameters
Returns the standard Vertex AI generateContent response, containing the generated text and image contents.
Request example
curl -sS -X POST "https://ai-api-g.oceanbase.com/api/v1/publishers/googleVertexAI/models/gemini-3-pro-image:generateContent" \
-H "Authorization: Bearer YOUR_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"
}
}
