Source: https://ailoot.ai/docs/zh-hant-tw/api/embeddings/
Canonical: https://ailoot.ai/docs/zh-hant-tw/api/embeddings/
Language: zh-hant-tw

[API](https://ailoot.ai/docs/zh-hant-tw/) 

# 嵌入向量

[Markdown](https://ailoot.ai/docs/zh-hant-tw/api/embeddings/index.md)

用於搜尋、RAG與分群的文字向量表示。

POST`https://api.ailoot.ai/v1/embeddings`

嵌入向量

```bash
curl https://api.ailoot.ai/v1/embeddings \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "nvidia/nemotron-3-embed-1b", "input": ["第一份文件", "第二份文件"]}' 
```

```python
emb = client.embeddings.create(
    model="nvidia/nemotron-3-embed-1b",
    input=["第一份文件", "第二份文件"],
)
vectors = [d.embedding for d in emb.data]
```

200 OK

```json
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789, …] },
    { "object": "embedding", "index": 1, "embedding": [-0.0321, 0.0654, 0.0987, …] }
  ],
  "model": "nvidia/nemotron-3-embed-1b",
  "usage": { "prompt_tokens": 8, "total_tokens": 8 }
}
```

## 身分驗證

| 參數 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| `Authorization` | header | 必填 | 金鑰格式為`Bearer sk-…`。也可使用標頭`x-api-key`或`x-goog-api-key`。 |

## 請求本文

| 參數 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| `model` | string | 必填 | 嵌入向量模型：`nvidia/nemotron-3-embed-1b`，`nvidia/llama-nemotron-embed-vl-1b-v2`。 |
| `input` | string \| array | 必填 | 字串或字串陣列。單一輸入的長度受模型上下文限制 (NVIDIA 模型為 4096 個 token)。 |
| `encoding_format` | string | 選填 | `float` (預設) 或`base64` —模型支援時才可使用。 |

## 回應

| 參數 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| `data[].embedding` | array |  | 每個輸入各有一個數值向量，順序與輸入相同。 |
| `usage` | object |  | 輸入 token 數。嵌入向量的輸出不收費。 |

還有疑問嗎？請提供 Request ID與問題描述，我們會協助釐清。[聯絡支援](mailto:support@ailoot.ai)

## Ailoot · 公司及其專案組合





Ailoot以累積的營運經驗、廣大的客戶群、穩定的服務及持續的KPI管理為基礎。





公司及其專案組合：數百萬客戶，每月銷售額達數十億。





Ailoot將這些營運經驗用於API存取，讓客戶的產品、代理、應用程式及自動化流程使用AI功能。
