Docs
Get an API key
API reference›Embeddings

Create Embeddings

POST /v1/embeddings Models: Embeddings View .md

Embed text in OpenRouter's embeddings shape, which is OpenAI's with input_type and an id added.

Batches: Up to 2048 inputs per request. The API splits them into batches the model's engine accepts and returns the embeddings in input order.

Queries and documents: Instruction-aware models such as qwen3-embedding-4b retrieve better when queries carry an instruction. Set input_type to search_query on queries and the model's instruction is prepended; documents (search_document, or no input_type) are sent unchanged. A query that already starts with the instruction's marker (e.g. Instruct:) is not prefixed again. The prefix's tokens are billed.

Long inputs: An input longer than the model's maximum input length is truncated to it, not rejected.

OpenRouter's embeddings request. OpenRouter's provider, session_id and trace and OpenAI's user are accepted and ignored.

  • model string required

    The embeddings model to use.

  • input string or array of strings or array of integers or array of array of integers required

    A string, a list of strings, a list of token ids, or a list of token id lists. Up to 2048 inputs. Multimodal inputs are rejected.

    One of 4
    • string
    • array of strings
    • array of integers
    • array of array of integers
  • encoding_format string

    base64 returns each embedding as base64-encoded little-endian float32 values.

    default floatfloatbase64
  • dimensions integer

    Truncate embeddings to this many dimensions, for models trained to support it (e.g. Qwen3-Embedding).

    at least 1
  • input_type string

    search_query (or query) marks the inputs as search queries, so instruction-aware models get their query instruction. Any other value, or none, sends the inputs unchanged.

OK

application/json · embeddings-response-payload

5 fields
  • id string required

    Identifier for this response, prefixed emb-.

  • object string required

    Always list.

  • data array of objects required

    One entry per input, in input order.

    3 fields
    • object string required

      Always embedding.

    • index integer required

      Position of the input in the request.

    • embedding array of numbers or string required

      A list of floats, or a base64 string when encoding_format is base64.

      One of 2
      • array of numbers
      • string
  • model string required
  • usage object required
    2 fields
    • prompt_tokens integer

      Tokens the model processed, including any query instruction. This is the billed count.

    • total_tokens integer
curl https://api.vultrinference.com/v1/embeddings \
  -H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-embedding-4b",
    "input": [
      "What is the capital of France?"
    ],
    "input_type": "search_query"
  }'
Response · 200
{
    "id": "string",
    "object": "string",
    "data": [
        {
            "object": "string",
            "index": 0,
            "embedding": [
                null
            ]
        }
    ],
    "model": "string",
    "usage": {
        "prompt_tokens": 0,
        "total_tokens": 0
    }
}