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

# Embed v4.0

> Cohere 多語言向量模型，支援長文本檢索。

Cohere 多語言向量模型，支援長文本檢索。

## 模型資訊

| 欄位                   | 說明                  |
| -------------------- | ------------------- |
| `model`              | embed-v4.0          |
| `context`            | 128K tokens         |
| `default dimensions` | 1536                |
| `endpoint`           | POST /v1/embeddings |

上下文和輸出長度為模型規格；實際請求限制、可用性與計費取決於 MixRoute 路由。

## 能力與使用

* 入庫文件設定 input\_type=search\_document，檢索問題設定 search\_query；其他任務可使用 classification 或 clustering。
* 本介面示例處理文本；不要假設 Cohere 原生圖片/PDF 輸入物件可直接用於 OpenAI 相容的 input 欄位。
* 文件和查詢必須使用相同模型及向量維度；輸出位於 data\[].embedding。

## 請求示例

呼叫前設定 `MIXROUTE_API_KEY`。

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/embeddings" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "embed-v4.0",
  "input": [
    "An API reference for developers."
  ],
  "input_type": "search_document",
  "encoding_format": "float"
}'
```

## 請求欄位

| 欄位                | 說明                       |
| ----------------- | ------------------------ |
| `model`           | 必填，使用上方完整模型 ID。          |
| `input`           | 必填，文本字串或字串陣列。            |
| `input_type`      | Cohere 向量模型需要指定任務型別。     |
| `encoding_format` | 使用 float 返回 JSON 浮點向量陣列。 |

完整請求格式見[介面說明](/zh-hant/api-reference/endpoint/embeddings)。
