Skip to content

创建嵌入

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/embeddings:
    post:
      summary: 创建嵌入
      deprecated: false
      description: |+
        获取给定输入的矢量表示,机器学习模型和算法可以轻松使用该表示。

        相关指南:[嵌入](https://platform.openai.com/docs/guides/embeddings)

        创建表示输入文本的嵌入向量。

      tags:
        - 聊天(Chat)/ChatGpt 接口/ChatGPT嵌入(Embeddings)
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: >-
                    要使用的模型的 ID。您可以使用[List
                    models](https://platform.openai.com/docs/api-reference/models/list)
                    API
                    来查看所有可用模型,或查看我们的[模型概述](https://platform.openai.com/docs/models/overview)以了解它们的描述。
                input:
                  type: string
                  description: >-
                    输入文本以获取嵌入,编码为字符串或标记数组。要在单个请求中获取多个输入的嵌入,请传递一个字符串数组或令牌数组数组。每个输入的长度不得超过
                    8192 个标记。
              required:
                - model
                - input
              x-apifox-orders:
                - model
                - input
            example:
              model: text-embedding-3-large
              input: 喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        object:
                          type: string
                        embedding:
                          type: array
                          items:
                            type: number
                        index:
                          type: integer
                      x-apifox-orders:
                        - object
                        - embedding
                        - index
                  model:
                    type: string
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                      total_tokens:
                        type: integer
                    required:
                      - prompt_tokens
                      - total_tokens
                    x-apifox-orders:
                      - prompt_tokens
                      - total_tokens
                required:
                  - object
                  - data
                  - model
                  - usage
                x-apifox-orders:
                  - object
                  - data
                  - model
                  - usage
              example: |-
                {
                  "object": "list",
                  "data": [
                    {
                      "object": "embedding",
                      "embedding": [
                        0.0023064255,
                        -0.009327292,
                        .... (1536 floats total for ada-002)
                        -0.0028842222
                      ],
                      "index": 0
                    }
                  ],
                  "model": "text-embedding-ada-002",
                  "usage": {
                    "prompt_tokens": 8,
                    "total_tokens": 8
                  }
                }
          headers: {}
          x-apifox-name: Create embeddings
      security:
        - bearer: []
      x-apifox-folder: 聊天(Chat)/ChatGpt 接口/ChatGPT嵌入(Embeddings)
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/5443236/apis/api-232421926-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://www.anyapi.vip
    description: 正式环境
security:
  - bearer: []

AnyAPI — 专业的 AI 接口聚合服务