> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inputapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini synchronous batch embeddings

> Synchronous batch vectors and the current model-alias limitation.

At revision `30a6d88a4`, `controller/relay.go` dispatches native embeddings with case-sensitive `strings.Contains(path, "embed")`. The action `:batchEmbedContents` contains no lowercase `embed`, so the path model ID must contain lowercase `embed`, such as an available embedding model name. Other aliases can enter the wrong handler. The example rejects such batch aliases before sending. This is a current gateway limitation, not a Gemini protocol requirement; review it after upgrading.

`POST /v1beta/models/{model}:batchEmbedContents`

Send `requests`, each with `model` and `content.parts`, using one model per batch. Associate `embeddings[].values` with inputs in order.

Use a bare path model ID. The gateway maps the path model and rewrites body model values. `taskType`, `title`, and `outputDimensionality` depend on the model. Empty input is outside the example. This is neither SSE nor asynchronous Batch. See [native embeddings](/en/guides/gemini-embeddings.md).

[阅读中文版](/zh/api-reference/gemini-batch-embed.md)


## OpenAPI

````yaml openapi/relay.json POST /v1beta/models/{model}:batchEmbedContents
openapi: 3.0.3
info:
  title: API — Core inference API
  version: 0.5.0
  description: >-
    面向接入的精选规范，不是全部管理或供应商接口。 / Curated integration specification, not the entire
    management or provider API.
  license:
    name: AGPL-3.0-or-later
servers:
  - url: https://gateway.example.com
    description: >-
      Example only; replace with your gateway origin and optional path prefix,
      without /v1.
security:
  - BearerAuth: []
paths:
  /v1beta/models/{model}:batchEmbedContents:
    post:
      summary: Gemini 同步批量向量 / Gemini synchronous batch embeddings
      description: >-
        发送 `requests` 数组，每项包含 `model` 和 `content.parts`，同一请求使用相同模型。返回
        `embeddings[].values`，按输入顺序关联。 / Send `requests`, each with `model` and
        `content.parts`, using one model per batch. Associate
        `embeddings[].values` with inputs in order. 当前版本要求路径模型名含小写 embed，详见指南 /
        This revision requires lowercase embed in the path model name; see the
        guide.
      operationId: gemini_batch_embed
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                requests:
                  type: array
                  items:
                    type: object
                    properties:
                      model:
                        type: string
                        description: models/ 前缀的模型名 / Model name prefixed with models/
                      content:
                        type: object
                        properties:
                          parts:
                            type: array
                            items:
                              type: object
                              properties:
                                text:
                                  type: string
                              additionalProperties: true
                              required:
                                - text
                        additionalProperties: true
                        required:
                          - parts
                      taskType:
                        type: string
                      title:
                        type: string
                      outputDimensionality:
                        type: integer
                        minimum: 1
                    additionalProperties: true
                    required:
                      - content
              additionalProperties: true
              required:
                - requests
      responses:
        '200':
          description: >-
            读取业务字段，不只检查 HTTP 状态 / Validate business fields, not only HTTP
            status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  embeddings:
                    type: array
                    items:
                      type: object
                      properties:
                        values:
                          type: array
                          items:
                            type: number
                      additionalProperties: true
                      required:
                        - values
                additionalProperties: true
                required:
                  - embeddings
              example:
                embeddings:
                  - values:
                      - 0.1
                      - 0.2
        default:
          description: 错误格式与状态取决于入口 / Error status and shape depend on the entry.
      security:
        - GeminiApiKey: []
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 模型调用 API Key，不是控制台登录凭据 / Model API key, not console login credentials
    GeminiApiKey:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: 网关令牌 / Gateway token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.