> ## 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 单条向量

> 原生 content.parts 输入与 embedding.values 输出。

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

发送 `content.parts`，每个文本 part 使用 `text`；返回 `embedding.values`。

路径 `model` 使用裸 ID。网关会按路径模型映射并改写请求模型。`taskType`、`title`、`outputDimensionality` 支持依模型而定，不接受空输入作为有效示例。不是 SSE 或异步 Batch；更多边界和可运行示例见[原生向量指南](/zh/guides/gemini-embeddings.md)。

[Read in English](/en/api-reference/gemini-embed.md)


## OpenAPI

````yaml openapi/relay.json POST /v1beta/models/{model}:embedContent
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}:embedContent:
    post:
      summary: Gemini 单条向量 / Gemini single embedding
      description: >-
        发送 `content.parts`，每个文本 part 使用 `text`；返回 `embedding.values`。 / Send
        `content.parts` with text parts; read `embedding.values`.
      operationId: gemini_embed
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              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
      responses:
        '200':
          description: >-
            读取业务字段，不只检查 HTTP 状态 / Validate business fields, not only HTTP
            status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  embedding:
                    type: object
                    properties:
                      values:
                        type: array
                        items:
                          type: number
                    additionalProperties: true
                    required:
                      - values
                additionalProperties: true
                required:
                  - embedding
              example:
                embedding:
                  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.