Embeddings API

Turn texts into vectors and search by meaning, not by keywords. One key, the OpenAI /v1/embeddings format and payment in rubles for input tokens only.

What is an embedding

An embedding is a list of numbers (a vector) that describes the meaning of a text. The model reads a phrase, a paragraph or a document and returns a vector of several hundred to several thousand numbers.

Texts with similar meaning get similar vectors even when they share no words. “How do I return an item?” and “Return and exchange policy” end up close together, while “How do I repay a loan?” lands further away. Closeness is measured with cosine similarity: the closer to 1, the closer the meaning.

You store the vectors once in a database (pgvector, Qdrant, Milvus, Elasticsearch, Redis) and then find the nearest ones to a user query in milliseconds.

What embeddings are for

  • Semantic search

    Search across a knowledge base, catalog or docs that understands paraphrased queries and typos.

  • RAG for chatbots

    Find relevant document chunks and pass them to a language model so it answers from your data.

  • Recommendations

    Similar products, articles and questions based on the meaning of their descriptions, with no manual tagging.

  • Clustering and analytics

    Group reviews, support tickets and requests by topic and spot recurring problems.

  • Classification

    Detect the topic, sentiment or department of a request by its closeness to examples of each class.

  • Duplicate detection

    Find repeated listings, questions and documents even when they are worded differently.

How to connect

  1. Sign up and top up your balance: embeddings cost a fraction of a kopeck per request.
  2. Create an API key in your profile. The key is shown once, so save it.
  3. Set the base URL and key in the OpenAI SDK or any app that supports the OpenAI API and send texts to /v1/embeddings.

Base URL: https://sujik.ru/v1

Request examples
from openai import OpenAI

client = OpenAI(base_url="https://sujik.ru/v1", api_key="sk-sujik-...")

result = client.embeddings.create(
    model="text-embedding-3-small",
    input=["How do I return an item?", "Return and exchange policy"],
)
print(len(result.data[0].embedding), result.usage.total_tokens)
Sample response
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789, …] },
    { "object": "embedding", "index": 1, "embedding": [0.0098, -0.0411, 0.0802, …] }
  ],
  "model": "text-embedding-3-small",
  "usage": { "prompt_tokens": 14, "total_tokens": 14 }
}

You can send up to 2048 texts in one request. The dimensions parameter shortens the vector on models that support it, and encoding_format: base64 makes the response smaller.

Semantic search in 15 lines

Get document vectors once, then compare the query vector against them.

import numpy as np
from openai import OpenAI

client = OpenAI(base_url="https://sujik.ru/v1", api_key="sk-sujik-...")
docs = ["Return and exchange policy", "...", "..."]

def embed(texts):
    result = client.embeddings.create(model="text-embedding-3-small", input=texts)
    return np.array([item.embedding for item in result.data])

doc_vectors = embed(docs)
query = embed(["How do I return an item?"])[0]
scores = doc_vectors @ query  # unit vectors: dot product = cosine
best = int(scores.argmax())
print(docs[best], round(float(scores[best]), 3))

Models and prices

Prices are per 1M input tokens. The API is 10% cheaper than the test on the website.

Prices did not load right now. The current list is on the pricing page.

All prices

Tips

  • Only compare vectors from the same model: different models have different spaces.
  • Split long documents into chunks of 200–800 tokens with a small overlap for more accurate search.
  • Store the source text and the model id next to each vector so you can rebuild the index if you switch models.
  • A short vector (dimensions 256–1024) saves database space with almost no loss in quality.

FAQ

How much do embeddings cost?

You pay only for input tokens at the model price. A thousand short phrases usually cost less than one ruble. If the model returns an error, the charge goes back to your balance.

Will my OpenAI code work?

Yes. The endpoint is compatible with OpenAI /v1/embeddings: change the base URL and key, and the rest of your code and the official SDKs work unchanged.

Which model should I choose?

Text Embedding 3 Small is a fast and cheap model for most tasks. Text Embedding 3 Large and Gemini Embedding are more accurate on complex texts and across languages.

Do embeddings work with languages other than English?

Yes, all models are multilingual: you can mix Russian, English and other languages in one index.

Do embeddings use free limits?

No. Embeddings are paid from your balance, so free generations and subscriptions are not spent on them.

Embeddings API for semantic search and RAG | SUJIK AI