Skip to content
中文

Create embeddings

POST/openai/v1/embeddings● Supported

Official OpenAI docs ↗

Request body

  • modelstringrequired

    The model to use for embeddings

    Verified to take effect.

  • dimensionsintegeroptional◐ Partially supported

    The 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_formatstringoptional

    The format of the output embeddings

    Both float and base64 are supported; base64 encodes the vector bytes.

    values floatbase64
  • inputstring | arrayrequired◐ Partially supported

    Text, 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.

  • input_typestringoptional◐ Partially supported

    The 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.

  • providerobjectoptional◐ Partially supported

    Provider routing preferences for the request.

    bge-m3 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.

    Expand sub-fields (13)
    • allow_fallbacksbooleanoptional

      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_collectionstringoptional

      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.

      values denyallownull
    • enforce_distillable_textbooleanoptional

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

    • ignorearrayoptional

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

    • max_priceobjectoptional

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

    • onlyarrayoptional

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

    • orderarrayoptional

      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 | objectoptional

      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 | objectoptional

      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.

    • quantizationsarrayoptional

      A list of quantization levels to filter the provider by.

    • require_parametersbooleanoptional

      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 | objectoptional

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

    • zdrbooleanoptional

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

  • session_idstringoptional◐ Partially supported

    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 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.

  • traceobjectoptional◐ Partially supported

    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 and qwen3-embedding-0.6b return 400; text-embedding-3-small accepts it, with an unobservable effect.

    Expand sub-fields (5)
    • generation_namestringoptional

      Name of this generation in the trace.

    • parent_span_idstringoptional

      Id of the parent span in the trace.

    • span_namestringoptional

      Name of this request's span in the trace.

    • trace_idstringoptional

      Id that groups several requests into one trace.

    • trace_namestringoptional

      Name of the trace.

  • userstringoptional◐ Partially supported

    A 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

Forwarded the same way as chat completions, and usage is billed on the same account. 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.

Errors follow the OpenAI format — see error codes

Request

curl
curl https://api.deepraxis.com/openai/v1/embeddings \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"text-embedding-3-small","input":"你好"}'
Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepraxis.com/openai/v1",
    api_key="$PRAXIS_API_KEY",
)

resp = client.embeddings.create(
    model="text-embedding-3-small",
    input="你好",
)
TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.deepraxis.com/openai/v1",
  apiKey: "$PRAXIS_API_KEY",
});

const resp = await client.embeddings.create({
  model: "text-embedding-3-small",
  input: "你好",
});

Response 200

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        0.007704960182309151,
        -0.06173783168196678,
        0.07302535325288773,
        0.06841219216585159,
        "… (1024 项)"
      ],
      "index": 0
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2
  }
}

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
id string Unique identifier for the embeddings response
model string The model used for embeddings
object string
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

Name Type Description
$ string Not used for embeddings - embeddings do not support streaming