Skip to main content
POST /v1/embeddings 发送 JSON,显式提供 model 与非空文本 input。批量输入使用字符串数组;本参考只描述可迁移的文本输入,不把上游 token ID 数组能力作为全渠道保证。 推荐从 encoding_format: float 开始。dimensions、Base64 和模型专用参数需确认渠道支持。成功响应按 data[].index 对应输入,验证向量数量、维度和数值后再保存。此接口返回向量,不创建文档索引,也不支持本文请求的 SSE。 完整指南与可运行示例 Read in English

授权

Authorization
string
header
必填

模型调用 API Key,不是控制台登录凭据 / Model API key, not console login credentials

请求体

application/json
model
string
必填

支持此接口且当前密钥可用的模型 / Model available to this key and supporting this endpoint

示例:

"YOUR_MODEL_ID"

input
必填

可迁移基线:非空文本或非空文本数组;token ID 输入不保证跨渠道兼容 / Portable baseline: nonempty text or text array; token-ID inputs are not guaranteed across channels

Minimum string length: 1
encoding_format
enum<string>

请求向量编码,需渠道支持;推荐显式 float / Requested vector encoding when supported; explicitly request float for the baseline

可用选项:
float,
base64
dimensions
integer

输出维度,仅部分模型/渠道支持,不能任意截断 / Output dimensions, only for supporting models/channels; do not truncate arbitrarily

必填范围: x >= 1
user
string

可选应用用户标识;非认证凭据,转发取决于渠道 / Optional application user identifier, not authentication; forwarding depends on channel

响应

成功结构;仍需校验索引与实际数值,示例向量维度和分数仅作结构演示 / Success shape; validate indices and values; example vector dimensions and scores are illustrative

data
object[]
必填
object
string
示例:

"list"

model
string
usage
object