Overview
This interface provides a stream content generation feature compatible with Google Vertex AI. It is suitable for scenarios that require real-time and continuous AI-generated content (such as text and code). Calling this interface will start a streaming response, continuously returning generated content fragments.
API details
Constraints
- The caller needs to have an API Key. For details, see Manage AI API Key.
Request path
POST {BASE_URL}/api/vertex-ai/v1/publishers/{provider}/models/{model}:streamGenerateContent
Note: The same processor is also mounted under the /api/v1 and /api/vertex-ai/v1beta paths and supports the /models/{provider}/{model}:streamGenerateContent alias.
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information |
| Content-Type | No | application/json | Request body format |
Request parameters
Path
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| provider | string | Yes | Model publisher | |
| model | string | Yes | gemini-pro | Model name |
Body
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| model | string | Yes | gemini-pro | Specify the model to use |
| contents | array[object] | No | [{"role": "user", "parts": [{"text": "Hello"}]}] | List of conversation contents |
| instances | array[object] | No | [] | List of instances |
| parameters | object | No | {"temperature": 0.7} | Generation parameters |
| voice | object | No | {} | Voice parameters |
Response
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Return code |
| message | string | Return information |
| data | object | Business return data |
data
Name |
Type |
Description |
|---|---|---|
| id | string | Resource unique ID |
| name | string | Resource name |
| status | string | Resource status |
| createTime | string | Creation time |
Request example
curl --request POST '{BASE_URL}/api/vertex-ai/v1/publishers/google/models/gemini-pro:streamGenerateContent' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-pro",
"contents": [
{
"role": "user",
"parts": [
{
"text": "Please introduce artificial intelligence."
}
]
}
],
"parameters": {
"temperature": 0.7,
"maxOutputTokens": 256
}
}'
Response example
{
"success": true,
"code": "200",
"message": "successful",
"data": {
"id": "gen-123456",
"name": "stream-generation-task",
"status": "STREAMING",
"createTime": "2026-04-10T10:00:00Z"
}
}
