模型

文本向量

把文本转成向量表示。

POST /model/v1/embeddings● 支持

官方文档 ↗

请求体

  • modelstring必填

    The model to use for embeddings

    已验证生效。

  • inputstring | array必填◐ 部分支持

    Text, token, or multimodal input(s) to embed

    文本及文本数组生效;token 整数数组返回 400。图片仅 qwen3-vl-embedding、doubao-embedding-vision 支持;text-embedding-3-small 的 16 条批量返回 400。

  • dimensionsinteger可选◐ 部分支持

    The number of dimensions for the output embeddings

    仅 text-embedding-3-small、qwen3-vl-embedding 支持已测的 256 维;text-embedding-3-small 也支持 512,100 返回 400。bge-m3、qwen3-embedding-0.6b、doubao-embedding-vision 的 256 维返回 400。

  • encoding_formatstring可选

    The format of the output embeddings

    float 与 base64 均支持;base64 为向量的二进制编码。

    取值 floatbase64
  • input_typestring可选◐ 部分支持

    The type of input (e.g. search_query, search_document)

    query/document 在 bge-m3、qwen3-embedding-0.6b 生效;search_query 返回 400;text-embedding-3-small 接受但当前不生效。

  • providerobject可选◐ 部分支持

    OpenRouter-style provider preferences, accepted for compatibility. Router support (partial): bge-m3 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.

    bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。

    ▸ 展开子字段(13)
    • allow_fallbacksboolean可选

      Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.

    • data_collectionstring可选

      Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.

      取值 denyallownull
    • enforce_distillable_textboolean可选

      Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.

    • ignorearray可选

      List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.

    • max_priceobject可选

      The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.

    • onlyarray可选

      List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.

    • orderarray可选

      An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.

    • preferred_max_latencynumber | object可选

      Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.

    • preferred_min_throughputnumber | object可选

      Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.

    • quantizationsarray可选

      A list of quantization levels to filter the provider by.

    • require_parametersboolean可选

      Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.

    • sortstring | object可选

      The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.

    • zdrboolean可选

      Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.

  • session_idstring可选◐ 部分支持

    A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.

    bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。

  • traceobject可选◐ 部分支持

    Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.

    bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。

    ▸ 展开子字段(5)
    • generation_namestring可选

      Name of this generation in the trace.

    • parent_span_idstring可选

      Id of the parent span in the trace.

    • span_namestring可选

      Name of this request's span in the trace.

    • trace_idstring可选

      Id that groups several requests into one trace.

    • trace_namestring可选

      Name of the trace.

  • userstring可选◐ 部分支持

    A unique identifier for the end-user

    bge-m3、qwen3-embedding-0.6b 返回 400;text-embedding-3-small 接受,但效果不可观测。

返回

200 list

未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。

鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码

响应

HTTP 200

Embedding response

application/json

名称类型说明
dataarray<object>List of embedding objects
data[].embeddingarray<number> | stringEmbedding vector as an array of floats or a base64 string
data[].indexintegerIndex of the embedding in the input list
data[].objectstringObject type of the entry; always `embedding`.
idstringUnique identifier for the embeddings response
modelstringThe model used for embeddings
objectstringObject type; always `list`.
usageobjectToken usage statistics
usage.costnumberCost of the request in credits
usage.cost_detailsobject | nullBreakdown of upstream inference costs
usage.is_byokbooleanWhether a request was made using a Bring Your Own Key configuration
usage.prompt_tokensintegerNumber of tokens in the input
usage.prompt_tokens_detailsobjectPer-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.
usage.total_tokensintegerTotal number of tokens used

text/event-stream — chunk / 事件对象

○ 未支持

名称类型说明
idstringOptional id of the server-sent event.
eventstringName of the server-sent event.
datastringPayload of the server-sent event.