向量嵌入 API
把文本转成向量嵌入,用于语义搜索、RAG、聚类与分类。嵌入通过 Cohere 提供,按输入 token 从你的积分余额计费。
概览
发送一个或多个字符串,每个输入返回一个浮点向量。与生成不同,这是单次同步调用 —— 无需任务轮询。
认证
在 /api-keys 创建 API 密钥,然后作为 Bearer token 发送。
Authorization: Bearer <YOUR_API_KEY>创建嵌入
POST
POST https://97ai.97claude.com/api/embeddingscURL
curl -X POST "https://97ai.97claude.com/api/embeddings" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "embed/embed-4.0",
"input": ["hello world", "a second document"],
"input_type": "search_document"
}'参数
model string 必填嵌入模型 slug,例如 embed/embed-4.0。
input string | string[] 必填一段文本,或最多 96 段文本的数组。
input_type string 可选search_document(默认)、search_query、classification 或 clustering。
响应
JSON
{
"model": "embed/embed-4.0",
"embeddings": [[0.0123, -0.0456, ...], [0.0789, ...]],
"tokens": 12,
"credits": 1,
"balance": 9998
}计费
按 输入 token × 模型费率 × 平台加价 向上取整计费(每次请求最低 1 积分)。
模型
| 模型 | 供应商 | slug | 价格 |
|---|---|---|---|
| Cohere Embed 4.0 | Cohere | embed/embed-4.0 | $0.12 / 1M tokens |