Embeddings

Openai Embeddings

Changed on
post/v1/embeddings

Request

  • Base URL: https://api.deepinfra.com
  • URL: https://api.deepinfra.com/v1/embeddings
  • Auth: HTTP bearer

Headers

x-deepinfra-sourcestring nullable
user-agentstring nullable
x-deepinfra-service-tierstring nullable

Per-request service tier (priority or flex) for clients that cannot set the service_tier body field. The body field wins when both are present; unrecognized values ride the default tier.

xi-api-keystring nullable
x-api-keystring nullable

Request body

service_tier'default' | 'priority' | 'flex'
fail_fastboolean

If true, the request is rejected immediately with HTTP 429 when the model has no spare capacity, instead of waiting in the queue. Opt-in; the default (false) keeps standard queueing behavior.

modelstring required

model name

input_type'query' | 'passage' | 'document' nullable

Role hint for asymmetric retrieval models: 'query' embeds a search query, 'passage'/'document' embeds a document. Controls the query:/passage: prefix on VL embedding models; ignored by symmetric models.

task'search_query' | 'document' | 'question_answering' | 'fact_checking' | 'code_retrieval' | 'classification' | 'clustering' | 'sentence_similarity' nullable

Task the embedding is optimized for, on models trained with task prompts (e.g. google/embeddinggemma-2). Applied to items containing text; mutually exclusive with input_type.

encoding_format'float' | 'base64'

format used when encoding

dimensionsinteger nullable

The number of dimensions in the embedding. If not provided, the model's default will be used.If provided bigger than model's default, the embedding will be padded with zeros.

Example request

{
  "model": "thenlper/gte-large",
  "dimensions": 1536
}

Response

Successful Response

unknown required

Changes

    • info

      added the new optional request property

    • info

      added audio_url input_audio video_url discriminator mapping keys to the //// request property

    • info

      added to the //// request property oneOf list

    • info

      added the new optional header request parameter x-deepinfra-service-tier