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

# 创建向量嵌入

> 将文本转换为向量

| 字段                | 类型           | 必填 | 说明                      |
| ----------------- | ------------ | -- | ----------------------- |
| `model`           | string       | 是  | Embedding 模型 ID。        |
| `input`           | string/array | 是  | 文本、文本数组或 token 数组。不得为空。 |
| `encoding_format` | string       | 否  | `float` 或 `base64`。     |
| `dimensions`      | integer      | 否  | 支持该能力的模型所返回的维数。         |
| `user`            | string       | 否  | 终端用户标识。                 |

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.bianxie.ai/v1/embeddings \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "your-model",
      "input": "要嵌入的文本"
    }'
  ```

  ```python Python theme={null}
  client.embeddings.create(model="your-model", input="要嵌入的文本")
  ```

  ```javascript Node.js theme={null}
  await client.embeddings.create({ model: "your-model", input: "Text to embed" });
  ```
</CodeGroup>

响应包含 `object: "list"`、`data[]`（`embedding`、`index`、`object`）、`model` 与 `usage`。此接口不支持流式输出。
