外观
Embeddings API
文本向量嵌入接口。
POST https://api.ashpetals.com/v1/embeddings请求
bash
curl https://api.ashpetals.com/v1/embeddings \
-H "Authorization: Bearer sk-你的APIKey" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-m3",
"input": "今天天气真好"
}'参数
| 参数 | 类型 | 说明 |
|---|---|---|
model | string | 必填,Embedding 模型 ID(如 bge-m3,以 /v1/models 为准) |
input | string/array | 必填,单条文本或文本数组 |
encoding_format | string | 可选,float(默认)或 base64 |
返回
json
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0189, "..."]
}
],
"model": "bge-m3",
"usage": { "prompt_tokens": 6, "total_tokens": 6 }
}注意事项
- 向量维度以所选模型为准。
- 大批量文本请分批请求,避免超出单次长度限制。