Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tokmodel.com/llms.txt

Use this file to discover all available pages before exploring further.

The /v1/embeddings endpoint converts text into numerical vector representations (embeddings). You can pass a single string or a batch of strings in one request. The resulting vectors can be stored in a vector database and used for semantic search, document clustering, classification, or as input to a retrieval-augmented generation (RAG) pipeline. This endpoint is compatible with the OpenAI embeddings format.

Request parameters

model
string
required
The embedding model to use. Use the list models endpoint to find available embedding model IDs.
input
string | string[]
required
The text to embed. Pass a single string or an array of strings to embed multiple inputs in one request. Token limits vary by model.
encoding_format
string
default:"float"
The format in which to return the embedding vectors. Use "float" for an array of floating-point numbers, or "base64" for a Base64-encoded string.

Response fields

object
string
Always "list".
data
array
An array of embedding objects, one for each input string. Objects are returned in the same order as the input.
model
string
The model used to generate the embeddings.
usage
object
Token usage for the request.

Example

Request

curl https://tokmodel.com/v1/embeddings \
  --request POST \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "openai/text-embedding-3-small",
    "input": ["TokModel is a unified LLM gateway.", "It supports 30+ AI providers."],
    "encoding_format": "float"
  }'

Response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0412, -0.0188, "..."]
    },
    {
      "object": "embedding",
      "index": 1,
      "embedding": [0.0071, -0.0033, 0.0299, -0.0144, "..."]
    }
  ],
  "model": "openai/text-embedding-3-small",
  "usage": {
    "prompt_tokens": 16,
    "total_tokens": 16
  }
}