Docs navigation

API

Embeddings

The OpenAI-compatible /v1/embeddings endpoint.

POST /v1/embeddings mirrors the OpenAI Embeddings API and routes to any provider with embedding models that you hold keys for.

Request

bash
curl https://api.tokenrouter.io/v1/embeddings \
  -H "Authorization: Bearer tr_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": "TokenRouter routes this to your provider with zero markup."
  }'

Response

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0132, -0.0271, 0.0088, "..."]
    }
  ],
  "model": "openai/text-embedding-3-small",
  "usage": {"prompt_tokens": 12, "total_tokens": 12}
}
  • input accepts a string or an array of strings (batch), like OpenAI.
  • dimensions and encoding_format are forwarded when the provider supports them.
  • Embedding calls count as requests and are attributed to budgets and analytics like any other call.