嵌入向量
嵌入向量
将文本转换为向量表示,用于语义搜索、聚类等场景。
请求
POST https://ai.czmanong.com/v1/embeddings
Authorization: Bearer <API_KEY>
Content-Type: application/json
请求体
{
"model": "text-embedding-3-small",
"input": "码农AI 模型网关",
"encoding_format": "float"
}
常用参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | 嵌入模型名称 |
input |
string / array | 是 | 待嵌入文本,可为字符串或字符串数组 |
encoding_format |
string | 否 | float 或 base64 |
响应示例
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.0456, 0.0789]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}