Skip to Content

Create embeddings

Turn text into vectors with an embedding model, in the request format of OpenAI's embeddings API. Set the OpenAI SDK base URL to https://api.munito.ai/inference/v1 and call embeddings.create.

  • The embedding models are a preview. See Embeddings for the models and for access.
  • Send one text or an array of at most 2,048 texts, with at most 1,200,000 characters in one request. The answer has one vector for each text, in the same order.
  • Send text only. A token array gets 400, because each model has its own tokenizer.
  • Each vector is normalized to a length of 1, so a dot product gives the cosine similarity.

The answer bills the input tokens at the input price of the model. An embedding has no output tokens.

POST
/embeddings

Authorization

headerAuthorizationBearer <token>

Your Munito API key.

Header Parameters

munito-service-tier?string

priority, standard or flex. The response names the tier that is billed; see x-ratelimit-over-limit. See Service tiers.

Default"standard"
Value in"priority""standard""flex"

Request Body

application/json
  1. body
model*string

An embedding model from GET /models, such as google/embeddinggemma-2.

input*|array<string>

The text to embed: one string, or an array of 1 to 2,048 strings, with at most 1,200,000 characters in one request. Each text must fit the context of the model.

encoding_format?string

float (the default) gives each vector as an array of numbers. base64 gives the 32-bit floats of the vector as a base64 string, which the OpenAI SDKs decode.

Value in"float""base64"
dimensions?integer

A vector size of the model. For a shorter size, the model returns the first values of the vector, normalized again. Omit it for the full vector.

user?string

An identifier of your end user. Munito AI does not use it.

Response Body

One vector for each text, in the order of the request.

application/json
  1. response
object*"list"
Value in"list"
data*array<>
model*string

The model that made the vectors.

usage*
curl -X POST 'https://api.munito.ai/inference/v1/embeddings' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/embeddinggemma-2",
  "input": [
    "task: search result | query: Which city is the capital of France?"
  ]
}'
Example Response
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.0123,
        -0.0456,
        0.0789
      ]
    }
  ],
  "model": "google/embeddinggemma-2",
  "usage": {
    "prompt_tokens": 16,
    "total_tokens": 16
  }
}