# Gemini 下载批量任务结果

> 大语言模型

下载已完成 Gemini 批量任务的 `predictions.jsonl`。`file_id` 必须传任务查询响应中的输出目录 `outputInfo.gcsOutputDirectory`，不是单个文件名；服务会在该目录下定位并返回结果文件。

## 请求地址

`GET https://api.modelverse.cn/v1/batchPredictionJobs/content`

## 请求参数

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| file_id | query | string | Yes | 任务输出目录，例如 `gs://gemini-batch-001/output/prediction-model-...`。 |

## 响应

- **200** — `predictions.jsonl` 文件内容。
- **default** — 错误响应。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "gemini-addons接口文档",
    "version": "v1beta",
    "description": "本文档说明 ModelVerse 上 Gemini 的扩展接口，覆盖媒体分析、显式缓存、Gemini Embedding 2 向量嵌入和 Vertex 风格批量预测任务，包含请求体、响应体、示例以及错误响应等内容。"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "中国大陆节点，国内用户推荐，访问延迟低。"
    },
    {
      "url": "https://api-sg.umodelverse.ai",
      "description": "新加坡节点，东南亚用户推荐，访问更快。"
    },
    {
      "url": "https://api-us-ca.umodelverse.ai",
      "description": "美国洛杉矶节点，海外用户推荐，数据不回国。"
    },
    {
      "url": "https://api-ge-fra.umodelverse.ai",
      "description": "法兰克福节点，欧洲用户推荐，访问更快。"
    }
  ],
  "tags": [
    {
      "name": "Gemini Add-ons",
      "description": "Gemini 媒体分析、显式缓存、向量嵌入和批量预测任务。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "xGoogApiKey": []
    }
  ],
  "paths": {
    "/v1beta/models/{modelsId}:generateContent": {
      "post": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "geminiMediaAnalysis",
        "summary": "Gemini 媒体分析",
        "description": "使用 Gemini `generateContent` 分析图片、视频、音频或文档。\n\n1. 通过 `POST /v1/files`（`purpose=batch:gcs`）上传媒体文件，从响应中取 `s3_url`。\n2. 调用本接口，把 `s3_url` 作为 `file_data.file_uri` 传入；也可以直接使用其他服务端可访问的公网地址。\n3. 从响应 `candidates[].content.parts[].text` 读取分析结果。\n\n媒体 Part 支持 `file_data.mime_type` / `file_data.file_uri` 与 `fileData.mimeType` / `fileData.fileUri` 两种命名，同一字段不要同时传两种写法，`mime_type` 必须与实际文件格式一致。参考 [Gemini 官方文档](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/image-understanding)。",
        "parameters": [
          {
            "name": "modelsId",
            "in": "path",
            "required": true,
            "description": "Gemini 模型 ID，例如 `gemini-3-flash-preview`。",
            "schema": {
              "type": "string",
              "example": "gemini-3-flash-preview"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiMediaGenerateContentRequest"
              },
              "examples": {
                "image": {
                  "summary": "图片分析",
                  "value": {
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "file_data": {
                              "mime_type": "image/jpeg",
                              "file_uri": "https://example-file-host/modelverse/demo-image.jpg"
                            }
                          },
                          {
                            "text": "请描述这张图片中的主要对象和场景。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "video": {
                  "summary": "视频分析",
                  "value": {
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "file_data": {
                              "mime_type": "video/mp4",
                              "file_uri": "https://example-file-host/modelverse/demo-video.mp4"
                            }
                          },
                          {
                            "text": "请总结这个视频的主要事件，并按时间顺序列出关键片段。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "audio": {
                  "summary": "音频分析",
                  "value": {
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "file_data": {
                              "mime_type": "audio/mpeg",
                              "file_uri": "https://example-file-host/modelverse/demo-audio.mp3"
                            }
                          },
                          {
                            "text": "请转写这段音频，并总结其核心观点。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "textFile": {
                  "summary": "文本文件分析",
                  "value": {
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "fileData": {
                              "mimeType": "text/plain",
                              "fileUri": "https://example-file-host/modelverse/demo.txt"
                            }
                          },
                          {
                            "text": "这个文本文件里写了什么内容？"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "分析成功，返回 Gemini 内容生成响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiMediaGenerateContentResponse"
                },
                "examples": {
                  "success": {
                    "summary": "媒体分析结果",
                    "value": {
                      "candidates": [
                        {
                          "content": {
                            "role": "model",
                            "parts": [
                              {
                                "text": "画面中包含一台笔记本电脑和一杯咖啡，整体场景像是办公桌面。"
                              }
                            ]
                          },
                          "finishReason": "STOP"
                        }
                      ],
                      "usageMetadata": {
                        "promptTokenCount": 258,
                        "candidatesTokenCount": 32,
                        "totalTokenCount": 290
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求错误。常见原因包括媒体地址不可访问、MIME 类型不匹配、API Key 无效或模型无权限。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiMediaErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiMediaErrorResponse"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "python",
            "label": "Python SDK",
            "source": "from google import genai\nfrom google.genai.types import HttpOptions, Part\n\nclient = genai.Client(\n    http_options=HttpOptions(api_version=\"v1beta\", base_url=\"https://api.modelverse.cn\"),\n    api_key=\"<MODELVERSE_API_KEY>\",\n)\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-flash-preview\",\n    contents=[\n        Part.from_uri(file_uri=\"https://example-file-host/modelverse/demo-video.mp4\", mime_type=\"video/mp4\"),\n        \"请总结这个视频的主要事件，并按时间顺序列出关键片段。\",\n    ],\n)\nprint(response.text)"
          }
        ]
      }
    },
    "/v1beta/cachedContents": {
      "post": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "createGeminiCachedContent",
        "summary": "Gemini 显式缓存",
        "description": "Gemini 显式缓存用于复用需要反复发送的大段上下文，例如产品手册、知识库、固定系统规则、图片、音频或视频。先把公共上下文创建为缓存，后续请求只发送 `cache_id` 和本次的新问题，可以减少重复传输与重复处理。\n\n创建请求中的 `systemInstruction`（可选的固定角色和回答规则，仅支持文本 Part）和 `contents`（需要反复使用的文本或媒体资料）作为同一个缓存整体保存，两者至少要有一个非空 Part。缓存内容创建后不可修改，也不支持手动删除，只能延长有效期（见「Gemini 延长缓存有效期」），到期自动失效并从查询结果中消失。\n\n## 支持模型与最低缓存 token 数\n\n| 模型 ID | 最低缓存 token 数 |\n| --- | ---: |\n| `gemini-2.5-flash` | 2,048 |\n| `gemini-3.5-flash-lite`、`gemini-3.5-flash`、`gemini-3.6-flash`、`gemini-3.1-pro-preview`、`gemini-3-flash-preview` | 4,096 |\n\n不在表中的 Gemini 模型即使能正常生成内容也不能创建显式缓存；缓存内容低于最低 token 数会创建失败。\n\n## 使用缓存\n\n创建成功后保存响应中的 `cache_id`（不要使用 Google 的 `projects/.../cachedContents/...` 资源名），再调用同一模型的 `generateContent` 或 `streamGenerateContent`，只发送 `cachedContent` 和本次新问题：\n\n```json\n{\n  \"cachedContent\": \"cache_abc123\",\n  \"contents\": [{ \"role\": \"user\", \"parts\": [{ \"text\": \"请根据缓存的产品手册总结主要功能。\" }] }]\n}\n```\n\n- 必须使用创建缓存时的同一个 API Key 和同一个模型，且缓存仍在有效期内；同公司的其他 API Key 不可见该缓存。\n- 不要再次传入 `systemInstruction`、`tools`、`toolConfig`；`generationConfig`、`safetySettings` 和本次独有的 `contents`（可包含新的 `inlineData` 图片）照常传。\n- 本次请求的新内容不会写回原缓存，需要复用时必须创建新缓存。\n- 命中缓存时，响应 `usageMetadata.cachedContentTokenCount` 为本次复用的缓存 token 数。\n\n## 有效期与计费\n\n- `ttl` 与 `expire_time` 只能传一个；都不传时默认约 60 分钟，实际过期时间以响应的 `expire_time` 为准。\n- `ttl` 最小 60 秒，创建或更新后的最终过期时间不能超过本次请求时间起 7 天。\n- 创建时缓存内全部 token 计一次输入费用，从 `created_at` 到 `expire_time` 期间产生存储费用；延长有效期只对新增的存储时段计费。\n- 使用缓存时缓存 token 按缓存读取计费，且不会自动刷新有效期；实际价格以 ModelVerse 计费说明为准。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiCacheCreateCachedContentRequest"
              },
              "examples": {
                "create": {
                  "summary": "创建产品手册缓存",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "product-manual",
                    "ttl": "3600s",
                    "systemInstruction": {
                      "parts": [
                        {
                          "text": "你是产品支持助手。优先依据缓存资料回答；资料中没有答案时明确说明，不要猜测。"
                        }
                      ]
                    },
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "text": "这里放入需要反复使用的完整产品手册、常见问题和处理流程……"
                          }
                        ]
                      }
                    ]
                  }
                },
                "textImage": {
                  "summary": "文本和图片",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "product-image-context",
                    "ttl": "3600s",
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "text": "这是产品控制台截图，蓝色区域表示可用额度，灰色区域表示已使用额度。"
                          },
                          {
                            "inlineData": {
                              "mimeType": "image/png",
                              "data": "<IMAGE_BASE64>",
                              "displayName": "console.png"
                            }
                          },
                          {
                            "text": "后续回答需要结合上述界面含义解释截图内容。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "pdfText": {
                  "summary": "PDF 和文本说明",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "product-manual",
                    "ttl": "7200s",
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "inlineData": {
                              "mimeType": "application/pdf",
                              "data": "<PDF_BASE64>",
                              "displayName": "product-manual.pdf"
                            }
                          },
                          {
                            "text": "后续问题优先依据这份产品手册回答；手册没有相关信息时明确说明。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "audioGlossary": {
                  "summary": "音频和背景词表",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "meeting-audio",
                    "ttl": "3600s",
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "text": "背景词表：ModelVerse 是产品名，UMInfer 是服务名，UCloud 是公司名。"
                          },
                          {
                            "inlineData": {
                              "mimeType": "audio/mpeg",
                              "data": "<AUDIO_BASE64>",
                              "displayName": "weekly-meeting.mp3"
                            }
                          },
                          {
                            "text": "后续生成摘要时保留以上专有名词的大小写。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "fewShot": {
                  "summary": "系统规则、多轮文本和图片",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "inspection-examples",
                    "ttl": "3600s",
                    "systemInstruction": {
                      "parts": [
                        {
                          "text": "你是设备质检助手，必须按照“外观、接口、风险”三个部分输出。"
                        }
                      ]
                    },
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "text": "请检查这台样例设备。"
                          },
                          {
                            "inlineData": {
                              "mimeType": "image/jpeg",
                              "data": "<SAMPLE_IMAGE_BASE64>",
                              "displayName": "sample-device.jpg"
                            }
                          }
                        ]
                      },
                      {
                        "role": "model",
                        "parts": [
                          {
                            "text": "外观：外壳完整。接口：接口无遮挡。风险：未发现明显风险。"
                          }
                        ]
                      }
                    ]
                  }
                },
                "multiImage": {
                  "summary": "文本和多张图片",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "device-images",
                    "ttl": "3600s",
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "text": "第一张是设备正面："
                          },
                          {
                            "inlineData": {
                              "mimeType": "image/jpeg",
                              "data": "<FRONT_IMAGE_BASE64>",
                              "displayName": "device-front.jpg"
                            }
                          },
                          {
                            "text": "第二张是设备背面："
                          },
                          {
                            "inlineData": {
                              "mimeType": "image/jpeg",
                              "data": "<BACK_IMAGE_BASE64>",
                              "displayName": "device-back.jpg"
                            }
                          }
                        ]
                      }
                    ]
                  }
                },
                "videoRequirement": {
                  "summary": "视频和分析要求",
                  "value": {
                    "model": "gemini-2.5-flash",
                    "displayName": "console-demo-video",
                    "ttl": "3600s",
                    "contents": [
                      {
                        "role": "user",
                        "parts": [
                          {
                            "inlineData": {
                              "mimeType": "video/mp4",
                              "data": "<VIDEO_BASE64>",
                              "displayName": "console-demo.mp4"
                            }
                          },
                          {
                            "text": "这是控制台操作录屏。后续回答需要区分页面跳转、用户输入和系统返回结果。"
                          }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "创建成功，返回 ModelVerse 缓存 ID。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheCachedContent"
                },
                "examples": {
                  "success": {
                    "summary": "创建成功",
                    "value": {
                      "cache_id": "cache_abc123",
                      "model": "gemini-2.5-flash",
                      "display_name": "product-manual",
                      "status": "active",
                      "created_at": "2026-07-24T02:00:00Z",
                      "updated_at": "2026-07-24T02:00:00Z",
                      "expire_time": "2026-07-24T03:00:00Z",
                      "total_token_count": 11426
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效，例如缓存内容过短、`ttl` 与 `expire_time` 同时传入、模型不支持显式缓存。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "listGeminiCachedContents",
        "summary": "Gemini 查询缓存列表",
        "description": "查询当前 API Key 下仍有效的 Gemini 显式缓存。缓存的创建与使用见「Gemini 显式缓存」。\n\n- 只返回当前 API Key 创建、尚未过期且状态为 `active` 的缓存，同公司下的其他 API Key 不可见。\n- 每个 `cache_id` 只返回最新的成功状态，按创建时间倒序排列。\n- 没有有效缓存时返回 `{\"cachedContents\":[]}`。\n- 创建和更新响应的时间字段为 `created_at`、`updated_at`、`expire_time`；本接口沿用 Gemini 列表结构，时间字段为 `createTime`、`updateTime`、`expireTime`。",
        "responses": {
          "200": {
            "description": "缓存列表。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheListCachedContentsResponse"
                },
                "examples": {
                  "success": {
                    "value": {
                      "cachedContents": [
                        {
                          "cache_id": "cache_abc123",
                          "model": "gemini-2.5-flash",
                          "status": "active",
                          "display_name": "product-manual",
                          "createTime": "2026-07-24T02:00:00Z",
                          "updateTime": "2026-07-24T02:00:00Z",
                          "expireTime": "2026-07-24T03:00:00Z",
                          "total_token_count": 11426
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1beta/cachedContents/{cache_id}": {
      "patch": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "updateGeminiCachedContent",
        "summary": "Gemini 延长缓存有效期",
        "description": "延长 Gemini 显式缓存的有效期，不修改缓存内容和模型。请求体必须且只能包含 `ttl` 或 `expire_time` 之一，缓存的创建与使用见「Gemini 显式缓存」。\n\n- `ttl` 叠加在**当前过期时间**上，而不是从请求时间重新计算：当前过期时间为 `10:30:00Z` 时，`{\"ttl\":\"600s\"}` 之后的新过期时间为 `10:40:00Z`。\n- `expire_time` 必须晚于当前过期时间、比请求时间至少晚 60 秒；无需查询或回传旧的过期时间，服务端会读取并校验缓存当前状态。\n- 最终过期时间不能超过本次请求时间起 7 天，因此可延长的时长受剩余有效期影响。\n- 响应中 `old_expire_time` 为更新前的过期时间，`expire_time` 为更新后实际生效的过期时间。",
        "parameters": [
          {
            "name": "cache_id",
            "in": "path",
            "required": true,
            "description": "创建缓存返回的 ModelVerse 缓存 ID。",
            "schema": {
              "type": "string",
              "example": "cache_abc123"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiCacheUpdateCachedContentRequest"
              },
              "examples": {
                "ttl": {
                  "summary": "使用相对 TTL 延长",
                  "value": {
                    "ttl": "600s"
                  }
                },
                "expireTime": {
                  "summary": "使用绝对时间延长",
                  "value": {
                    "expire_time": "2026-07-24T12:00:00Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "更新成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheCachedContent"
                },
                "examples": {
                  "success": {
                    "value": {
                      "cache_id": "cache_abc123",
                      "model": "gemini-2.5-flash",
                      "display_name": "product-manual",
                      "status": "active",
                      "created_at": "2026-07-24T02:00:00Z",
                      "updated_at": "2026-07-24T02:10:00Z",
                      "old_expire_time": "2026-07-24T03:00:00Z",
                      "expire_time": "2026-07-24T03:10:00Z"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiCacheErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1beta/models/{modelsId}:embedContent": {
      "post": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "embedGeminiContent",
        "summary": "Gemini Embedding 2 向量嵌入",
        "description": "Gemini Embedding 2（`gemini-embedding-2`）是 Google 的多模态嵌入模型，可将文本、图片、视频、音频和 PDF 转换为高维向量，用于多模态语义搜索、内容推荐、聚类分析和异常检测。单个请求可以混合多种模态；只需要纯文本嵌入时也可以使用 OpenAI 兼容的 `POST /v1/embeddings`。\n\n`content.parts[]` 既支持文本 Part `{\"text\":\"...\"}`，也支持文件 Part `{\"file_data\":{\"mime_type\":\"...\",\"file_uri\":\"...\"}}`，文件需通过服务端可访问的地址提供。响应返回 `embedding.values` 向量和 `usageMetadata` 分模态 token 用量。\n\n## 输出维度\n\n`outputDimensionality` 支持 128 至 3072，默认 3072。降到 768 或 1536 可减少存储和计算成本，语义搜索精度略有下降但多数场景可忽略；追求最高精度时保持默认值。\n\n## 单请求限制\n\n| 模态 | 数量上限 | 其他限制 | 支持的 MIME |\n| --- | --- | --- | --- |\n| 图片 | 6 | — | `image/png`、`image/jpeg`、`image/webp`、`image/bmp`、`image/heic`、`image/heif`、`image/avif` |\n| 文档 | 1 | 最多 6 页 | `application/pdf` |\n| 视频 | 1 | 含音频最长 80 秒，不含音频最长 120 秒 | `video/mp4`、`video/mpeg` |\n| 音频 | 1 | 最长 180 秒 | `audio/mp3`、`audio/wav` |",
        "parameters": [
          {
            "name": "modelsId",
            "in": "path",
            "required": true,
            "description": "固定使用 `gemini-embedding-2`。",
            "schema": {
              "type": "string",
              "example": "gemini-embedding-2"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiEmbeddingEmbedContentRequest"
              },
              "examples": {
                "multimodal": {
                  "summary": "多模态嵌入",
                  "value": {
                    "content": {
                      "parts": [
                        {
                          "text": "这是什么？"
                        },
                        {
                          "text": "这个和什么类似？"
                        },
                        {
                          "file_data": {
                            "mime_type": "video/mp4",
                            "file_uri": "https://example.com/video.mp4"
                          }
                        },
                        {
                          "file_data": {
                            "mime_type": "image/png",
                            "file_uri": "https://example.com/image.png"
                          }
                        },
                        {
                          "file_data": {
                            "mime_type": "audio/wav",
                            "file_uri": "https://example.com/audio.wav"
                          }
                        },
                        {
                          "file_data": {
                            "mime_type": "application/pdf",
                            "file_uri": "https://example.com/document.pdf"
                          }
                        }
                      ]
                    }
                  }
                },
                "outputDimensionality": {
                  "summary": "指定输出维度",
                  "value": {
                    "outputDimensionality": 768,
                    "content": {
                      "parts": [
                        {
                          "text": "查找关于机器学习的视频教程"
                        },
                        {
                          "file_data": {
                            "mime_type": "image/png",
                            "file_uri": "https://example.com/ml-diagram.png"
                          }
                        }
                      ]
                    }
                  }
                },
                "semanticSearch": {
                  "summary": "多模态语义搜索",
                  "value": {
                    "content": {
                      "parts": [
                        {
                          "text": "查找关于机器学习的视频教程"
                        },
                        {
                          "file_data": {
                            "mime_type": "image/png",
                            "file_uri": "https://example.com/ml-diagram.png"
                          }
                        }
                      ]
                    }
                  }
                },
                "videoOnly": {
                  "summary": "视频内容嵌入",
                  "value": {
                    "content": {
                      "parts": [
                        {
                          "file_data": {
                            "mime_type": "video/mp4",
                            "file_uri": "https://example.com/tutorial.mp4"
                          }
                        }
                      ]
                    }
                  }
                },
                "pdf": {
                  "summary": "PDF 文档嵌入",
                  "value": {
                    "content": {
                      "parts": [
                        {
                          "text": "总结这份报告的关键点"
                        },
                        {
                          "file_data": {
                            "mime_type": "application/pdf",
                            "file_uri": "https://example.com/report.pdf"
                          }
                        }
                      ]
                    }
                  }
                },
                "audio": {
                  "summary": "音频内容嵌入",
                  "value": {
                    "content": {
                      "parts": [
                        {
                          "file_data": {
                            "mime_type": "audio/wav",
                            "file_uri": "https://example.com/speech.wav"
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "嵌入向量和用量信息。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiEmbeddingEmbedContentResponse"
                },
                "examples": {
                  "success": {
                    "summary": "嵌入响应",
                    "value": {
                      "embedding": {
                        "values": [
                          0.0015015427,
                          0.014678672,
                          -0.018105509,
                          -0.013457718,
                          0.015227248,
                          0.003112343
                        ]
                      },
                      "usageMetadata": {
                        "promptTokenCount": 2517,
                        "totalTokenCount": 2517,
                        "promptTokensDetails": [
                          {
                            "modality": "VIDEO",
                            "tokenCount": 330
                          },
                          {
                            "modality": "TEXT",
                            "tokenCount": 5
                          },
                          {
                            "modality": "DOCUMENT",
                            "tokenCount": 1548
                          },
                          {
                            "modality": "IMAGE",
                            "tokenCount": 258
                          },
                          {
                            "modality": "AUDIO",
                            "tokenCount": 376
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效，例如 `outputDimensionality` 超出范围、文件 URI 不可访问或 MIME 类型不匹配。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiEmbeddingErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiEmbeddingErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "uploadGeminiBatchGcsFile",
        "summary": "Gemini 上传批量输入文件",
        "description": "上传 Gemini 批量任务输入文件。`purpose` 固定为 `batch:gcs`，文件为 JSONL。上传返回的 `id` 是 GCS 对象名，创建任务时需拼成完整 GCS URI，例如 `gs://gemini-batch-001/<上传返回的id>`。",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GeminiBatchUploadGeminiBatchFileRequest"
              },
              "examples": {
                "default": {
                  "summary": "上传 JSONL 文件",
                  "value": {
                    "purpose": "batch:gcs",
                    "file": "/path/to/your-input.jsonl"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "上传成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchFileObject"
                },
                "examples": {
                  "success": {
                    "value": {
                      "id": "1773236148797418904_gemini-3.1-pro-preview.jsonl",
                      "object": "file",
                      "bytes": 224,
                      "created_at": 1773236150,
                      "expires_at": 0,
                      "filename": "1773236148797418904_gemini-3.1-pro-preview.jsonl",
                      "purpose": "batch:gcs"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1beta/batchPredictionJobs": {
      "post": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "createGeminiBatchPredictionJob",
        "summary": "Gemini 批量任务",
        "description": "创建 Gemini（Vertex 风格）批量预测任务，适用于大批量异步文本生成。`model` 须使用完整资源名，当前支持 `publishers/google/models/gemini-3.1-pro-preview`、`publishers/google/models/gemini-3-flash-preview`、`publishers/google/models/gemini-3-pro-image-preview`。\n\n完整流程分四步，每步对应一个接口：\n\n1. **上传输入文件**（`POST /v1/files`，见「Gemini 上传批量输入文件」）：上传 JSONL，`purpose` 固定 `batch:gcs`，记下响应中的 `id`。\n2. **创建批量任务**（本接口）：`inputConfig.gcsSource.uris` 传上一步 `id` 拼成的完整 GCS URI `gs://gemini-batch-001/<id>`，只支持单个字符串（不是数组）；`outputConfig.gcsDestination.outputUriPrefix` 必须为 `gs://gemini-batch-001/output`。Bucket `gemini-batch-001` 由平台分配。\n3. **查询任务状态**（`GET /v1beta/batchPredictionJobs/{job_id}`，见「Gemini 查询批量任务状态」）：`job_id` 取创建响应 `name` 的最后一段，轮询到 `JOB_STATE_SUCCEEDED` 或失败为止。\n4. **下载结果**（`GET /v1/batchPredictionJobs/content`，见「Gemini 下载批量任务结果」）：`file_id` 传任务查询响应中的 `outputInfo.gcsOutputDirectory`（输出目录，不是单个文件），服务会返回该目录下的 `predictions.jsonl`。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiBatchCreateBatchPredictionJobRequest"
              },
              "examples": {
                "default": {
                  "summary": "创建 Gemini 批量预测任务",
                  "value": {
                    "displayName": "my-cloud-storage-batch-inference-job",
                    "model": "publishers/google/models/gemini-3.1-pro-preview",
                    "inputConfig": {
                      "instancesFormat": "jsonl",
                      "gcsSource": {
                        "uris": "gs://gemini-batch-001/1773236148797418904_gemini-3.1-pro-preview.jsonl"
                      }
                    },
                    "outputConfig": {
                      "predictionsFormat": "jsonl",
                      "gcsDestination": {
                        "outputUriPrefix": "gs://gemini-batch-001/output"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "创建成功，返回 Vertex 风格任务对象。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchBatchPredictionJob"
                },
                "examples": {
                  "success": {
                    "value": {
                      "name": "projects/279887244472/locations/global/batchPredictionJobs/7737084104264384512",
                      "displayName": "my-cloud-storage-batch-inference-job",
                      "model": "publishers/google/models/gemini-3.1-pro-preview",
                      "inputConfig": {
                        "instancesFormat": "jsonl",
                        "gcsSource": {
                          "uris": [
                            "gs://gvideo.modelverse.cn/batch_prompt_for_batch_gemini_predict.jsonl"
                          ]
                        }
                      },
                      "outputConfig": {
                        "predictionsFormat": "jsonl",
                        "gcsDestination": {
                          "outputUriPrefix": "gs://gvideo.modelverse.cn/test"
                        }
                      },
                      "outputInfo": {
                        "gcsOutputDirectory": "gs://gvideo.modelverse.cn/test/prediction-model-2026-02-28T08:22:20.427871Z"
                      },
                      "state": "JOB_STATE_SUCCEEDED",
                      "completionStats": {
                        "successfulCount": "2"
                      },
                      "createTime": "2026-02-28T08:22:22.313780Z",
                      "startTime": "2026-02-28T08:23:12.172401Z",
                      "endTime": "2026-02-28T08:27:35.914509Z",
                      "updateTime": "2026-02-28T08:27:35.914509Z",
                      "modelVersionId": "1"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效，例如 GCS URI 格式错误、输入输出格式不支持或模型不可用。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1beta/batchPredictionJobs/{job_id}": {
      "get": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "getGeminiBatchPredictionJob",
        "summary": "Gemini 查询批量任务状态",
        "description": "根据创建任务后得到的 `job_id` 查询 Gemini 批量任务状态。`job_id` 通常是创建响应 `name` 的最后一段。任务完成后，从 `outputInfo.gcsOutputDirectory` 取输出目录用于下载结果。",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "任务 ID，即创建任务响应 `name` 中最后一段。",
            "schema": {
              "type": "string",
              "example": "7737084104264384512"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务详情。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchBatchPredictionJob"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/batchPredictionJobs/content": {
      "get": {
        "tags": [
          "Gemini Add-ons"
        ],
        "operationId": "downloadGeminiBatchPredictionJobContent",
        "summary": "Gemini 下载批量任务结果",
        "description": "下载已完成 Gemini 批量任务的 `predictions.jsonl`。`file_id` 必须传任务查询响应中的输出目录 `outputInfo.gcsOutputDirectory`，不是单个文件名；服务会在该目录下定位并返回结果文件。",
        "parameters": [
          {
            "name": "file_id",
            "in": "query",
            "required": true,
            "description": "任务输出目录，例如 `gs://gemini-batch-001/output/prediction-model-...`。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`predictions.jsonl` 文件内容。",
            "content": {
              "application/jsonl": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiBatchErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "xGoogApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key",
        "description": "Gemini 兼容 API Key 请求头。"
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key"
      }
    },
    "schemas": {
      "GeminiMediaGenerateContentRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "contents"
        ],
        "properties": {
          "contents": {
            "type": "array",
            "minItems": 1,
            "description": "对话内容列表。媒体分析时通常传入一个 user 消息，包含媒体 Part 和文本问题。",
            "items": {
              "$ref": "#/components/schemas/GeminiMediaContent"
            }
          }
        }
      },
      "GeminiMediaContent": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "role": {
            "type": "string",
            "description": "消息角色。媒体分析通常只传一条 `user` 消息。",
            "enum": [
              "user",
              "model"
            ]
          },
          "parts": {
            "type": "array",
            "description": "消息部件数组，可同时包含媒体 Part 和文本问题。",
            "items": {
              "$ref": "#/components/schemas/GeminiMediaPart"
            }
          }
        }
      },
      "GeminiMediaPart": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "text": {
            "type": "string",
            "description": "问题或指令文本。"
          },
          "file_data": {
            "$ref": "#/components/schemas/GeminiMediaFileData"
          },
          "fileData": {
            "$ref": "#/components/schemas/GeminiMediaFileDataCamel"
          }
        }
      },
      "GeminiMediaFileData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mime_type",
          "file_uri"
        ],
        "description": "媒体文件（snake_case 写法）。与 `fileData` 等价，同一个 Part 只使用其中一种。",
        "properties": {
          "mime_type": {
            "type": "string",
            "description": "媒体 MIME 类型，必须与实际文件格式一致。",
            "examples": [
              "image/jpeg",
              "video/mp4",
              "audio/mpeg",
              "application/pdf"
            ]
          },
          "file_uri": {
            "type": "string",
            "format": "uri",
            "description": "媒体文件地址，建议使用上传接口返回的 `s3_url`。"
          }
        }
      },
      "GeminiMediaFileDataCamel": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mimeType",
          "fileUri"
        ],
        "description": "媒体文件（camelCase 写法）。与 `file_data` 等价，同一个 Part 只使用其中一种。",
        "properties": {
          "mimeType": {
            "type": "string",
            "description": "媒体 MIME 类型，必须与实际文件格式一致。"
          },
          "fileUri": {
            "type": "string",
            "format": "uri",
            "description": "媒体文件地址，建议使用上传接口返回的 `s3_url`。"
          }
        }
      },
      "GeminiMediaGenerateContentResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "candidates": {
            "type": "array",
            "description": "生成结果列表，文本分析结果在 `candidates[].content.parts[].text`。",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usageMetadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "token 用量，包含 `promptTokenCount`、`candidatesTokenCount`、`totalTokenCount`。"
          }
        }
      },
      "GeminiMediaErrorResponse": {
        "$ref": "#/components/schemas/ModelVerseErrorResponse"
      },
      "GeminiCacheCreateCachedContentRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "支持显式缓存的 Gemini 模型 ID。创建缓存和使用缓存时必须保持一致。",
            "examples": [
              "gemini-2.5-flash",
              "gemini-3-flash-preview"
            ]
          },
          "contents": {
            "type": "array",
            "description": "需要缓存的实际资料，支持 `text` 和 `inlineData` Part。",
            "items": {
              "$ref": "#/components/schemas/GeminiCacheContent"
            }
          },
          "systemInstruction": {
            "$ref": "#/components/schemas/GeminiCacheSystemInstruction"
          },
          "displayName": {
            "type": "string",
            "description": "便于识别缓存的展示名称。"
          },
          "ttl": {
            "description": "相对有效期，推荐使用字符串，例如 `3600s`。也兼容 seconds/nanos 对象。",
            "oneOf": [
              {
                "type": "string",
                "title": "string"
              },
              {
                "type": "object",
                "additionalProperties": true,
                "title": "object"
              }
            ]
          },
          "expire_time": {
            "type": "string",
            "format": "date-time",
            "description": "绝对过期时间，使用 RFC 3339 格式。"
          }
        },
        "description": "创建缓存请求。支持字段命名兼容：`displayName/display_name`、`systemInstruction/system_instruction`、`inlineData/inline_data`、`mimeType/mime_type`、`cachedContent/cached_content`、`expireTime/expire_time`。同一字段不要同时传入两种写法。"
      },
      "GeminiCacheUpdateCachedContentRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "延长有效期请求。必须且只能包含 `ttl` 或 `expire_time` 之一。",
        "properties": {
          "ttl": {
            "description": "在当前过期时间上继续增加的时长，推荐字符串如 `600s`，也兼容 seconds/nanos 对象。最小 60 秒。",
            "oneOf": [
              {
                "type": "string",
                "title": "string"
              },
              {
                "type": "object",
                "additionalProperties": true,
                "title": "object"
              }
            ]
          },
          "expire_time": {
            "type": "string",
            "format": "date-time",
            "description": "新的绝对过期时间，RFC 3339 格式。必须晚于当前过期时间，比请求时间至少晚 60 秒，且不超过 7 天。"
          }
        },
        "minProperties": 1,
        "maxProperties": 1
      },
      "GeminiCacheSystemInstruction": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "parts": {
            "type": "array",
            "description": "一起缓存的固定角色和回答规则，只支持文本 Part。",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "text": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "GeminiCacheContent": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "role": {
            "type": "string",
            "description": "消息角色。Few-shot 示例可用 `model` 角色给出示范回答。",
            "enum": [
              "user",
              "model"
            ]
          },
          "parts": {
            "type": "array",
            "description": "需要缓存的部件数组，可混合 `text` 和 `inlineData`。",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "text": {
                  "type": "string",
                  "description": "文本内容。"
                },
                "inlineData": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "Base64 编码的 Blob。所有 `inlineData` 解码后的二进制内容合计不能超过 10 MiB。",
                  "required": [
                    "mimeType",
                    "data"
                  ],
                  "properties": {
                    "mimeType": {
                      "type": "string",
                      "description": "文件的标准 MIME 类型，必须与实际内容一致。",
                      "examples": [
                        "image/png",
                        "application/pdf",
                        "audio/mpeg",
                        "video/mp4"
                      ]
                    },
                    "data": {
                      "type": "string",
                      "description": "文件内容的 Base64 字符串（例如 `base64 -w 0 product-manual.pdf`），不要加 `data:application/pdf;base64,` 之类的 Data URL 前缀。"
                    },
                    "displayName": {
                      "type": "string",
                      "description": "便于模型和调用方识别文件的名称。"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "缓存内容消息。同一个 `parts` 数组可以混合多个文本和 Blob，但每个 Part 只能是 `text` 或 `inlineData` 其中一种；`systemInstruction.parts[]` 只支持文本，媒体必须放在 `contents[].parts[].inlineData`。缓存接口不支持 `fileData`、Cloud Storage URI 和本地文件路径。\n\n常见 MIME 包括 `image/png`、`image/jpeg`、`image/webp`、`image/heic`、`application/pdf`、`text/plain`、`audio/mpeg`、`audio/wav`、`audio/flac`、`video/mp4`、`video/webm`、`video/quicktime` 等，实际支持取决于所选模型的多模态能力，切换模型时需重新确认。"
      },
      "GeminiCacheCachedContent": {
        "type": "object",
        "additionalProperties": true,
        "description": "缓存对象。创建和更新响应使用 `created_at`、`updated_at`、`expire_time`；查询缓存列表沿用 Gemini 列表结构，使用 `createTime`、`updateTime`、`expireTime`。",
        "properties": {
          "cache_id": {
            "type": "string",
            "description": "ModelVerse 缓存 ID，后续使用、更新时都传这个值。"
          },
          "model": {
            "type": "string",
            "description": "创建缓存使用的 ModelVerse 模型 ID。"
          },
          "display_name": {
            "type": "string",
            "description": "创建时提供的展示名称；未提供则不返回。"
          },
          "status": {
            "type": "string",
            "description": "缓存状态，有效缓存为 `active`。"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "缓存创建时间（创建、更新响应）。"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "最近一次更新时间（创建、更新响应）。"
          },
          "old_expire_time": {
            "type": "string",
            "format": "date-time",
            "description": "更新前的过期时间，仅延长有效期的响应返回。"
          },
          "expire_time": {
            "type": "string",
            "format": "date-time",
            "description": "上游实际生效的过期时间。"
          },
          "createTime": {
            "type": "string",
            "format": "date-time",
            "description": "缓存创建时间（查询缓存列表响应）。"
          },
          "updateTime": {
            "type": "string",
            "format": "date-time",
            "description": "最近一次更新时间（查询缓存列表响应）。"
          },
          "expireTime": {
            "type": "string",
            "format": "date-time",
            "description": "上游实际生效的过期时间（查询缓存列表响应）。"
          },
          "total_token_count": {
            "type": "integer",
            "description": "整个缓存的 token 数，含 `systemInstruction` 和 `contents`。"
          }
        }
      },
      "GeminiCacheListCachedContentsResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "cachedContents": {
            "type": "array",
            "description": "仍然有效的缓存列表，没有有效缓存时为空数组。",
            "items": {
              "$ref": "#/components/schemas/GeminiCacheCachedContent"
            }
          }
        }
      },
      "GeminiCacheErrorResponse": {
        "$ref": "#/components/schemas/ModelVerseErrorResponse"
      },
      "GeminiEmbeddingEmbedContentRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "content"
        ],
        "properties": {
          "content": {
            "$ref": "#/components/schemas/GeminiEmbeddingContent"
          },
          "outputDimensionality": {
            "type": "integer",
            "minimum": 128,
            "maximum": 3072,
            "default": 3072,
            "description": "输出嵌入向量维度。较低维度可减少存储和计算成本。"
          }
        }
      },
      "GeminiEmbeddingContent": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "parts"
        ],
        "properties": {
          "parts": {
            "type": "array",
            "minItems": 1,
            "description": "内容部件数组，支持文本和多模态文件。",
            "items": {
              "$ref": "#/components/schemas/GeminiEmbeddingPart"
            }
          }
        }
      },
      "GeminiEmbeddingPart": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "text": {
            "type": "string",
            "description": "要嵌入的文本内容。"
          },
          "file_data": {
            "$ref": "#/components/schemas/GeminiEmbeddingFileData"
          }
        }
      },
      "GeminiEmbeddingFileData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mime_type",
          "file_uri"
        ],
        "properties": {
          "mime_type": {
            "type": "string",
            "description": "文件 MIME 类型，例如 `video/mp4`、`image/png`、`audio/wav` 或 `application/pdf`。"
          },
          "file_uri": {
            "type": "string",
            "format": "uri",
            "description": "可被服务端访问的文件地址。"
          }
        },
        "description": "文件 Part。常见类型：图片 image/png、image/jpeg、image/webp；视频 video/mp4、video/mpeg；音频 audio/wav、audio/mp3、audio/mpeg；文档 application/pdf。文件 URI 需要服务端可访问。"
      },
      "GeminiEmbeddingEmbedContentResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "embedding": {
            "type": "object",
            "additionalProperties": true,
            "description": "嵌入结果。",
            "properties": {
              "values": {
                "type": "array",
                "description": "嵌入向量，浮点数列表。",
                "items": {
                  "type": "number"
                }
              }
            }
          },
          "usageMetadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "token 用量。",
            "properties": {
              "promptTokenCount": {
                "type": "integer",
                "description": "输入的总 token 数。"
              },
              "totalTokenCount": {
                "type": "integer",
                "description": "总 token 数。"
              },
              "promptTokensDetails": {
                "type": "array",
                "description": "各模态的 token 用量明细。",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "modality": {
                      "type": "string",
                      "description": "模态类型。",
                      "enum": [
                        "TEXT",
                        "IMAGE",
                        "VIDEO",
                        "AUDIO",
                        "DOCUMENT"
                      ]
                    },
                    "tokenCount": {
                      "type": "integer",
                      "description": "该模态的 token 数。"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "GeminiEmbeddingErrorResponse": {
        "$ref": "#/components/schemas/ModelVerseErrorResponse"
      },
      "GeminiBatchUploadGeminiBatchFileRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "purpose",
          "file"
        ],
        "properties": {
          "purpose": {
            "type": "string",
            "const": "batch:gcs",
            "description": "Gemini 批量任务输入文件固定为 `batch:gcs`。"
          },
          "file": {
            "type": "string",
            "format": "binary",
            "description": "JSONL 输入文件。"
          }
        }
      },
      "GeminiBatchFileObject": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "description": "文件在存储中的对象名。创建任务时需拼成完整 GCS URI `gs://gemini-batch-001/<id>`。"
          },
          "object": {
            "type": "string",
            "const": "file",
            "description": "固定为 `file`。"
          },
          "bytes": {
            "type": "integer",
            "format": "int64",
            "description": "文件大小（字节）。"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "创建时间戳。"
          },
          "filename": {
            "type": "string",
            "description": "文件名。"
          },
          "purpose": {
            "type": "string",
            "description": "与请求一致，固定为 `batch:gcs`。"
          }
        }
      },
      "GeminiBatchCreateBatchPredictionJobRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "model",
          "inputConfig",
          "outputConfig"
        ],
        "properties": {
          "displayName": {
            "type": "string",
            "description": "任务展示名称。"
          },
          "model": {
            "type": "string",
            "description": "支持 batch 的 Gemini 模型资源名，须使用完整资源名。",
            "examples": [
              "publishers/google/models/gemini-3.1-pro-preview",
              "publishers/google/models/gemini-3-flash-preview"
            ]
          },
          "inputConfig": {
            "type": "object",
            "additionalProperties": true,
            "description": "输入配置。",
            "required": [
              "instancesFormat",
              "gcsSource"
            ],
            "properties": {
              "instancesFormat": {
                "type": "string",
                "examples": [
                  "jsonl"
                ]
              },
              "gcsSource": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "uris": {
                    "oneOf": [
                      {
                        "type": "string",
                        "title": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "title": "array"
                      }
                    ],
                    "description": "输入文件的完整 GCS URI，只支持单个字符串形式，格式为 `gs://gemini-batch-001/<上传返回的 id>`。"
                  }
                }
              }
            }
          },
          "outputConfig": {
            "type": "object",
            "additionalProperties": true,
            "description": "输出配置。",
            "required": [
              "predictionsFormat",
              "gcsDestination"
            ],
            "properties": {
              "predictionsFormat": {
                "type": "string",
                "examples": [
                  "jsonl"
                ]
              },
              "gcsDestination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "outputUriPrefix": {
                    "type": "string",
                    "description": "输出目录前缀，必须为 `gs://gemini-batch-001/output`。"
                  }
                }
              }
            }
          }
        }
      },
      "GeminiBatchBatchPredictionJob": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "name": {
            "type": "string",
            "description": "任务资源名或短 ID。"
          },
          "state": {
            "type": "string",
            "description": "任务状态。`JOB_STATE_PENDING` 已创建等待调度，`JOB_STATE_RUNNING` 进行中，`JOB_STATE_SUCCEEDED` 成功完成，`JOB_STATE_FAILED` 失败，`JOB_STATE_CANCELLED` 已取消，`JOB_STATE_PAUSED` 已暂停。",
            "enum": [
              "JOB_STATE_PENDING",
              "JOB_STATE_RUNNING",
              "JOB_STATE_SUCCEEDED",
              "JOB_STATE_FAILED",
              "JOB_STATE_CANCELLED",
              "JOB_STATE_PAUSED"
            ]
          },
          "outputInfo": {
            "type": "object",
            "additionalProperties": true,
            "description": "输出信息，任务完成后可用。",
            "properties": {
              "gcsOutputDirectory": {
                "type": "string",
                "description": "输出目录，用于下载结果时作为 `file_id`。"
              }
            }
          },
          "completionStats": {
            "type": "object",
            "additionalProperties": true,
            "description": "完成统计，例如 `successfulCount`。"
          }
        }
      },
      "GeminiBatchErrorResponse": {
        "$ref": "#/components/schemas/ModelVerseErrorResponse"
      },
      "ModelVerseErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "description": "错误响应。`error.message` 为错误描述，`error.code` 为错误码，`error.param` 通常为便于排查的请求标识。",
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": true,
            "description": "错误详情。"
          }
        }
      }
    }
  }
}
```
