Skip to main content
POST /v1/embeddings Send JSON with an explicit model and nonempty text input. Use a string array for a batch. This reference covers portable text inputs; upstream token-ID arrays are not guaranteed across channels. Start with encoding_format: float. Confirm channel support for dimensions, Base64, and model-specific parameters. Match responses to inputs by data[].index and check counts, dimensions, and values before storing. This endpoint returns vectors, not a document index, and the request described here is not SSE. Guide and runnable example 简体中文

Authorizations

Authorization
string
header
required

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

Body

application/json
model
string
required

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

Example:

"YOUR_MODEL_ID"

input
required

可迁移基线:非空文本或非空文本数组;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

Available options:
float,
base64
dimensions
integer

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

Required range: x >= 1
user
string

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

Response

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

data
object[]
required
object
string
Example:

"list"

model
string
usage
object