Embeddings API

One POST with the same key as chat: text in, a vector of numbers out. Parameters, the batch mode, examples in three languages and the billing rules are collected here.

The endpoint and authentication

Embeddings live on the OpenAI-compatible entry point and use the same key as chat: only the path changes.

MethodPathPurpose
POSThttps://api.tokenator.top/v1/embeddingsA vector for a string or a batch of strings.

The key goes in Authorization: Bearer sk-your-tokenator-key. There is no separate key for embeddings.

Your first request

A vector for a single string
curl https://api.tokenator.top/v1/embeddings \
  -H "Authorization: Bearer sk-your-tokenator-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-embedding-2",
    "input": "how to connect my own domain"
  }'
Response
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0147, 0.0091]
    }
  ],
  "model": "gemini-embedding-2",
  "usage": { "prompt_tokens": 6, "total_tokens": 6 }
}

The answer always has this shape: data in the order of the input strings, the Tokenator model name and a usage block with the token count. Whatever the upstream added of its own never reaches the client.

Which models compute vectors

ModelAPI IDContextMultiplier
Gemini Embedding 2gemini-embedding-28.2K tokens1.4×
Text Embedding 3 Largetext-embedding-3-large8.2K tokens1.2×
Text Embedding 3 Smalltext-embedding-3-small8.2K tokens
Gemini Embedding 001gemini-embedding-00120K tokens1.35×

Request parameters

FieldTypeWhat it does
modelstring, requiredThe API ID of a model from the catalog. A model that is not marked as an embedding one is refused with a 400 — the request never reaches the provider.
inputstring or an array of stringsThe text to embed. An array is a batch: each string gets its own vector, in the same order.
encoding_formatstringfloat or base64 — the form in which the provider returns the numbers. The field is passed upstream as is.
dimensionsintegerThe vector length you want, when the model supports shortening it. Support depends on the model.

A batch of strings in one request

The input field accepts an array. That is one request, one response and one round trip — noticeably faster for indexing a corpus than one string at a time. The vectors come back in the order of the strings, and each element's index field confirms the match.

A batch of three strings
curl https://api.tokenator.top/v1/embeddings \
  -H "Authorization: Bearer sk-your-tokenator-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-embedding-2",
    "input": ["the first paragraph", "the second paragraph", "the third paragraph"]
  }'

SDKs and ready-made examples

The endpoint is compatible with the OpenAI SDKs: only the base URL and the key change.

Python — openai
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-tokenator-key",
    base_url="https://api.tokenator.top/v1",
)

result = client.embeddings.create(
    model="gemini-embedding-2",
    input=["the first paragraph", "the second paragraph"],
)

print(len(result.data[0].embedding))
Node.js — openai
import OpenAI from "openai"

const client = new OpenAI({
  apiKey: "sk-your-tokenator-key",
  baseURL: "https://api.tokenator.top/v1",
})

const result = await client.embeddings.create({
  model: "gemini-embedding-2",
  input: "how to connect my own domain",
})

console.log(result.data[0].embedding.length)

The base URL and the key are the same as for chat, so one client can hold both chat and embeddings.

How embeddings are billed

Exactly like ordinary tokens. The prompt_tokens figure from the provider's answer is multiplied by the model's multiplier and drawn from the key's limit — there is no separate bundle for embeddings. A request has no output, so you pay for the input text only.

The spending shows up in the key dashboard next to chat, and the remainder in /v1/tokens.

Error codes

CodeWhen it comesWhat to do
400 model requiredThe body carries no model field, or is not JSON.Check Content-Type: application/json and a non-empty model.
400 is not an embedding modelThe model is in the catalog, but it is not marked as an embedding one.Use a model from the table above. Ordinary chat models work on /v1/chat/completions.
401The key is missing, expired or revoked.Check the Authorization: Bearer header and the key's expiry in your account.
502 Request errorAn error on the provider side. Its text is not passed through.Retry — Tokenator fails over to the next provider on its own. If it persists, contact support.
503 Model temporarily unavailableNo provider of the model answered.Retry later or pick another model from the table.

FAQ

How does an embedding model differ from a chat one?

It writes no text; it returns a vector of numbers used to compare texts with each other: semantic search, deduplication, clustering, RAG. So it has no streaming, no tools and no max output — only a context, meaning how much text fits into one request.

Why does a model answer 400 on /v1/embeddings?

The endpoint serves only models marked as embedding ones. The list is in the table above and in the catalog under the Embeddings filter. A request with an ordinary chat model is refused before the provider is contacted, so such an error costs nothing.

Can I reach an embedding model from chat?

No. On /v1/chat/completions, /v1/responses and /v1/messages such a model answers 400 naming the right path — that guards against a request which would come back as nonsense anyway.

How many strings can I send at once?

There is one limit — the model's context: the total length of all strings in the batch has to fit into it. It is in the table above and on the model page.

Does Tokenator store the text I send?

The request body goes into the key's technical log, as with every other endpoint. What exactly is kept and for how long is described in the security section.