Overview
Use the gemini-3-pro-image model (Nano Banana Pro) to generate images from text. The Vertex AI-compatible generateContent API generates images based on 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
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. | |
| contents[].parts[].text | string | Yes | Generate an image of a red apple on a white table | Text-to-image prompt |
| 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
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": "Generate an image of a red apple on a white table"
}
]
}
],
"generationConfig": {
"maxOutputTokens": 8192,
"responseModalities": ["TEXT", "IMAGE"]
}
}'
Response example
Error response
{
"error": {
"message": "error message",
"type": "error_type",
"code": "error_code"
}
}
