Create embeddings
Turn text into vector embeddings.
/model/v1/embeddings● SupportedRequest body
modelstring必填The model to use for embeddings
Verified to take effect.
inputstring | array必填◐ Partially supportedText, token, or multimodal input(s) to embed
Text and text arrays work; integer token arrays return 400. Images work only on qwen3-vl-embedding and doubao-embedding-vision; a 16-item text-embedding-3-small batch returns 400.
dimensionsinteger可选◐ Partially supportedThe number of dimensions for the output embeddings
Only text-embedding-3-small and qwen3-vl-embedding support the tested 256 dimensions; text-embedding-3-small also supports 512, while 100 returns 400. 256 returns 400 on bge-m3, qwen3-embedding-0.6b and doubao-embedding-vision.
encoding_formatstring可选The format of the output embeddings
Both float and base64 are supported; base64 encodes the vector bytes.
input_typestring可选◐ Partially supportedThe type of input (e.g. search_query, search_document)
query/document work on bge-m3 and qwen3-embedding-0.6b; search_query returns 400. text-embedding-3-small accepts but currently ignores this field.
providerobject可选◐ Partially supportedOpenRouter-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 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.
▸ 展开子字段(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.
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可选◐ Partially supportedA 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 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.
traceobject可选◐ Partially supportedMetadata 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 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.
▸ 展开子字段(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可选◐ Partially supportedA unique identifier for the end-user
bge-m3 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.
Returns
200 list
Unknown top-level fields are forwarded unchanged to same-protocol upstream providers, which decide whether to accept them. Declared fields still undergo type and range validation; invalid values return 400 naming the field.
Platform errors (auth, rate limits, validation) and OCR errors use problem+json; other model call errors follow the endpoint's own format (OpenAI or Anthropic) — see error codes
Response
HTTP 200
Embedding response
application/json
| Name | Type | Description |
|---|---|---|
| data | array<object> | List of embedding objects |
| data[].embedding | array<number> | string | Embedding vector as an array of floats or a base64 string |
| data[].index | integer | Index of the embedding in the input list |
| data[].object | string | Object type of the entry; always `embedding`. |
| id | string | Unique identifier for the embeddings response |
| model | string | The model used for embeddings |
| object | string | Object type; always `list`. |
| usage | object | Token usage statistics |
| usage.cost | number | Cost of the request in credits |
| usage.cost_details | object | null | Breakdown of upstream inference costs |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.prompt_tokens | integer | Number of tokens in the input |
| usage.prompt_tokens_details | object | Per-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_tokens | integer | Total number of tokens used |
text/event-stream — chunk / event object
○ Unsupported
| Name | Type | Description |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | string | Payload of the server-sent event. |