MaaS_Ge batch processing
Google Document URL: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/batch-prediction-from-cloud-storage?hl=zh-cn
1. Upload File
Note: The file supports up to 100 request data entries, with a maximum size not exceeding 50MB, and is permanently stored for 7 days.
batch_requests_for_multimodal_input_2.jsonl
File content example
{"request":{"contents": [{"role": "user", "parts": [{"text": "List objects in this image."}, {"file_data": {"file_uri": "gs://cloud-samples-data/generative-ai/image/office-desk.jpeg", "mime_type": "image/jpeg"}}]}],"generationConfig":{"temperature": 0.4}}}
{"request":{"contents": [{"role": "user", "parts": [{"text": "List objects in this image."}, {"file_data": {"file_uri": "gs://cloud-samples-data/generative-ai/image/gardening-tools.jpeg", "mime_type": "image/jpeg"}}]}],"generationConfig":{"temperature": 0.4}}}
| Parameter Name |
Type |
Required or Not |
Description |
| name |
string |
is |
File Name |
| uploadType |
string |
is |
Fixed value media |
curl
```plain text
curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/batch/gemini/{ENDPOINT}/files?uploadType=media&name=ImageToImage.jsonl' \
--header 'Authorization: Bearer {KEY}' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@C:\Users\Desktop\batch\gemini\ImageToImage.jsonl'
### Output Parameter
```json
{
"kind": "storage#object",
"id": "1779785513731222",
"name": "ImageToImage.jsonl",
"generation": "1779785513731222",
"metageneration": "1",
"contentType": "application/octet-stream",
"storageClass": "STANDARD",
"size": "510",
"md5Hash": "pM5qF/A+Eetto7iq5PZMsA==",
"crc32c": "unFIEg==",
"etag": "CJaJytrJ1pQDEAE=",
"timeCreated": "2026-05-26T08:51:53.742Z",
"updated": "2026-05-26T08:51:53.742Z",
"timeStorageClassUpdated": "2026-05-26T08:51:53.742Z",
"timeFinalized": "2026-05-26T08:51:53.742Z"
}
2. Create a Batch Task
| Parameter Name |
Level |
Type |
Required or Not |
Description |
| displayName |
1 |
string |
is |
Task Name |
| inputConfig |
1 |
object |
is |
|
| instancesFormat |
2 |
string |
is |
Fixed value jsonl |
| gcsSource |
2 |
object |
is |
|
| uris |
3 |
string |
is |
The name value of the uploaded file (the name value of the output parameter in the first step) |
| outputConfig |
1 |
object |
is |
|
| predictionsFormat |
2
|
string |
is |
Fixed value jsonl |
curl
curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/batch/gemini/{ENDPOINT}/batchPredictionJobs' \
--header 'Authorization: Bearer {KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"displayName": "my-cloud-storage-batch-inference-job",
"inputConfig": {
"instancesFormat": "jsonl",
"gcsSource": {
"uris": "{name}"
}
},
"outputConfig": {
"predictionsFormat": "jsonl"
}
}'
Output Parameter
{
"name": "903523130369114112",
"displayName": "my-cloud-storage-batch-inference-job",
"model": "MaaS_Ge_3.1_flash_image_preview_20260226",
"inputConfig": {
"instancesFormat": "jsonl",
"gcsSource": {
"uris": [
"ImageToImage.jsonl"
]
}
},
"outputConfig": {
"predictionsFormat": "jsonl",
"gcsDestination": {
"outputUriPrefix": "response"
}
},
"state": "JOB_STATE_PENDING",
"createTime": "2026-05-28T08:39:00.803441Z",
"updateTime": "2026-05-28T08:39:00.803441Z",
"modelVersionId": "1"
}
3. Batch Processing Status
| Parameter Name |
Type |
Required or Not |
Description |
| name |
string |
is |
The name value of the output parameter in the second step |
curl
curl --location --request GET 'https://genaiapi.cloudsway.net/v1/ai/batch/gemini/{ENDPOINT}/batchPredictionJobs/{name}' \
--header 'Authorization: Bearer {KEY}'
Output Parameter
{
"name": "4787616125208756224",
"displayName": "my-cloud-storage-batch-inference-job",
"model": "MaaS_Ge_3_pro_image_preview_20251118_batch",
"inputConfig": {
"instancesFormat": "jsonl",
"gcsSource": {
"uris": [
"MaaS_Gemini_batch_1780628300511.jsonl"
]
}
},
"outputConfig": {
"predictionsFormat": "jsonl",
"gcsDestination": {
"outputUriPrefix": "response"
}
},
"outputInfo": {
"gcsOutputDirectory": "https://genaiapi.cloudsway.net/v1/ai/batch/gemini/{ENDPOINT}/batchPredictionJobs/4787616125208756224/content"
},
"state": "JOB_STATE_SUCCEEDED",
"error": null,
"completionStats": {
"successfulCount": "3",
"failedCount": null
},
"createTime": "2026-06-05T02:58:27.175092Z",
"startTime": "2026-06-05T02:59:01.122705Z",
"endTime": "2026-06-05T03:01:26.124246Z",
"updateTime": "2026-06-05T03:01:26.124246Z",
"modelVersionId": "1"
}
4. Obtain Batch Processing Results
Note: The returned results are permanently stored for 7 days.
| Parameter Name |
Type |
Required or Not |
Description |
| alt |
string |
No |
When passing json, it returns the metadata information of the result; when passing media, it returns the execution result data. The default is json. |
| name |
string |
is |
The name value of the output parameter in the second step |
curl
curl --location --request GET 'https://genaiapi.cloudsway.net/v1/ai/batch/gemini/{ENDPOINT}/batchPredictionJobs/{name}/content?alt=media' \
--header 'Authorization: Bearer {KEY}'
{"request":{"contents":[{"role":"user","parts":[{"file_data":null,"text":"List objects in this image."},{"file_data":{"file_uri":"gs://cloud-samples-data/generative-ai/image/office-desk.jpeg","mime_type":"image/jpeg"},"text":null}]}],"generationConfig":{"temperature":0.4}},"response":{"modelVersion":"MaaS_Ge_2.5_flash_20250617_batch","candidates":[{"content":{"role":"model","parts":[{"text":"Here are the objects visible in the image:\n\n* Globe\n* Eiffel Tower figurine\n* Airplane model\n* Tablet (with a blank white screen)\n* Miniature shopping cart\n* Red gift box (inside the shopping cart)\n* Coffee cup\n* Saucer\n* Coffee (in the cup)\n* Keyboard\n* Computer mouse\n* Passport\n* Sunglasses\n* One-dollar bill\n* Notebook / Notepad\n* Pen"}]},"score":-75.72122192382813,"avgLogprobs":-0.7011224252206308,"finishReason":"STOP"}],"createTime":"2026-01-29T02:15:37.871417Z","usageMetadata":{"candidatesTokenCount":108,"totalTokenCount":2163,"trafficType":"ON_DEMAND","billablePromptUsage":{"imageCount":1,"textCount":23},"promptTokensDetails":[{"modality":"TEXT","tokenCount":6},{"modality":"IMAGE","tokenCount":1806}],"thoughtsTokenCount":243,"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":108}],"promptTokenCount":1812},"responseId":"ycJ6afmXNYfWitUPtNOwuQE"},"processed_time":"2026-01-29T02:15:47.048543+00:00","status":""}
{"request":{"contents":[{"role":"user","parts":[{"file_data":null,"text":"List objects in this image."},{"file_data":{"file_uri":"gs://cloud-samples-data/generative-ai/image/gardening-tools.jpeg","mime_type":"image/jpeg"},"text":null}]}],"generationConfig":{"temperature":0.4}},"response":{"modelVersion":"MaaS_Ge_2.5_flash_20250617_batch","candidates":[{"content":{"role":"model","parts":[{"text":"Here are the objects visible in the image:\n\n1. **Watering can:** A large green plastic watering can with a white sprinkler head (rose).\n2. **Potted plant:** A small green plant growing in a terracotta pot.\n3. **Terracotta pots:** Two empty terracotta pots, stacked one on top of the other.\n4. **Hand trowel:** A small green gardening shovel with a black handle.\n5. **Hand hoe/cultivator:** A small green gardening tool with a hoe on one side and a three-pronged cultivator on the other, with a black handle.\n6. **Gardening gloves:** A pair of striped green, yellow, and white fabric gloves.\n7. **Grass:** The green lawn serving as the background surface."}]},"score":-168.0503692626953,"avgLogprobs":-1.0002998170398532,"finishReason":"STOP"}],"createTime":"2026-01-29T02:15:30.858407Z","usageMetadata":{"candidatesTokenCount":168,"totalTokenCount":2832,"trafficType":"ON_DEMAND","billablePromptUsage":{"imageCount":1,"textCount":23},"promptTokensDetails":[{"modality":"TEXT","tokenCount":6},{"modality":"IMAGE","tokenCount":1806}],"thoughtsTokenCount":852,"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":168}],"promptTokenCount":1812},"responseId":"wsJ6aaeyNIXVitUP5ruJiAo"},"processed_time":"2026-01-29T02:15:39.343388+00:00","status":""}
Output parameter (alt is json)
{
"kind": "storage#object",
"id": "1780628480806264",
"generation": "1780628480806264",
"metageneration": "1",
"contentType": "application/octet-stream",
"storageClass": "STANDARD",
"size": "13306514",
"crc32c": "40/N2Q==",
"componentCount": 1,
"etag": "CPiazYCO75QDEAE=",
"timeCreated": "2026-06-05T03:01:20.809Z",
"updated": "2026-06-05T03:01:20.809Z",
"timeStorageClassUpdated": "2026-06-05T03:01:20.809Z",
"timeFinalized": "2026-06-05T03:01:20.809Z"
}