# 多模态向量嵌入

**方法**: `POST`
**路径**: `/v1/embeddings`

获取给定输入的矢量表示，机器学习模型和算法可以轻松使用该表示。

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

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

## 请求参数

### Header 参数

```text
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
model
string
必需
要使用的模型的 ID。您可以使用
List models
API 来查看所有可用模型，或查看我们的
模型概述
以了解它们的描述。
input
array
[object]
必需
输入文本以获取嵌入，编码为字符串或标记数组。要在单个请求中获取多个输入的嵌入，请传递一个字符串数组或令牌数组数组。每个输入的长度不得超过 8192 个标记。
text
string
必需
image
string
必需
normalized
boolean
必需
embedding_type
string
必需
示例
{
"model"
:
"string"
,
"input"
:
[
{
"text"
:
"string"
,
"image"
:
"string"
}
]
,
"normalized"
:
true
,
"embedding_type"
:
"string"
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/v1/embeddings' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "string",
    "input": [
        {
            "text": "string",
            "image": "string"
        }
    ],
    "normalized": true,
    "embedding_type": "string"
}'
```

## 返回响应

### 🟢 200 Create embeddings

**内容类型**: `application/json`

#### 响应结构

```text
object
string
必需
data
array
[object]
必需
object
string
可选
embedding
array
[number]
可选
index
integer
可选
model
string
必需
usage
object
必需
prompt_tokens
integer
必需
total_tokens
integer
必需
```
