Embeddings

Embeddings LLM

Generate embeddings for the given input text using the specified model.

The model field in the request body specifies the model to use. Check the /models route for complete list of embedding models. You can specify the encoding format (float or np) and the dimensions (up to 1536) of the output embedding vector.

post/v1/embeddings

Request

  • Base URL: https://apipie.ai
  • URL: https://apipie.ai/v1/embeddings
  • Auth: API key in header Authorization

Request body

modelstring required

Model to use for generating embeddings.

inputstring required

Input text to generate embeddings for.

encoding_format'float' | 'np'

Format of the output encoding. Only supported by OpenAI

dimensionsinteger

Number of dimensions for the embedding vector. Maximum value is 384-1536 check the models route for max_tokens per model. Only supported by OpenAI

Example request

{
  "model": "text-embedding-3-small",
  "input": "why is the sky blue?",
  "encoding_format": "float",
  "dimensions": 1024
}

Response

Embedding vector generated successfully

objectstring
providerstring
modelstring

Example response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": {
        "object": "embedding"
      }
    }
  ],
  "provider": "openai",
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 6,
    "total_tokens": 6,
    "prompt_characters": 20,
    "cost": "0.0000001260",
    "latency_ms": 349
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.