主题
Embeddings
文本向量接口,兼容 OpenAI Embeddings。
请求
http
POST /v1/embeddings
Authorization: Bearer <API Key>
Content-Type: application/json1
2
3
2
3
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 嵌入模型 ID |
input | string / array | 是 | 要向量化的文本 |
encoding_format | string | 否 | float 或 base64 |
dimensions | integer | 否 | 输出维度(模型支持时) |
示例
bash
curl https://api.monoai.today/v1/embeddings \
-H "Authorization: Bearer $MONOIZE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<嵌入模型 ID>",
"input": "MonoAI 是一个大模型统一网关。"
}'1
2
3
4
5
6
7
2
3
4
5
6
7
响应
json
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.0456, ...]
}
],
"model": "<嵌入模型 ID>",
"usage": { "prompt_tokens": 12, "total_tokens": 12 }
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
只使用模型列表中标明支持嵌入的模型。