{
"object": "list",
"model": "YOUR_MODEL_ID",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.6,
0.8
]
}
],
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}API 参考
生成向量
请求参数、响应与渠道兼容边界。
{
"object": "list",
"model": "YOUR_MODEL_ID",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.6,
0.8
]
}
],
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<unknown>"
}
}POST /v1/embeddings
发送 JSON,显式提供 model 与非空文本 input。批量输入使用字符串数组;本参考只描述可迁移的文本输入,不把上游 token ID 数组能力作为全渠道保证。
推荐从 encoding_format: float 开始。dimensions、Base64 和模型专用参数需确认渠道支持。成功响应按 data[].index 对应输入,验证向量数量、维度和数值后再保存。此接口返回向量,不创建文档索引,也不支持本文请求的 SSE。
完整指南与可运行示例
Read in English授权
模型调用 API Key,不是控制台登录凭据 / Model API key, not console login credentials
请求体
application/json
支持此接口且当前密钥可用的模型 / Model available to this key and supporting this endpoint
示例:
"YOUR_MODEL_ID"
可迁移基线:非空文本或非空文本数组;token ID 输入不保证跨渠道兼容 / Portable baseline: nonempty text or text array; token-ID inputs are not guaranteed across channels
Minimum string length:
1请求向量编码,需渠道支持;推荐显式 float / Requested vector encoding when supported; explicitly request float for the baseline
可用选项:
float, base64 输出维度,仅部分模型/渠道支持,不能任意截断 / Output dimensions, only for supporting models/channels; do not truncate arbitrarily
必填范围:
x >= 1可选应用用户标识;非认证凭据,转发取决于渠道 / Optional application user identifier, not authentication; forwarding depends on channel