Embeddings
Last updated:
text
POST https://api.staik.se/v1/embeddingsOpenAI-compatible embedding endpoint with bge-m3 — multilingual (excellent at Swedish), 1024-dimensional vectors, 8,192 token context. Building RAG or semantic search? Start here.
python
from openai import OpenAI
client = OpenAI(api_key="sk-st-your-key", base_url="https://api.staik.se/v1")
response = client.embeddings.create(
model="bge-m3:latest",
input=["First document to index", "Second document"],
)
vectors = [d.embedding for d in response.data] # 1024 dimensions per vectorinput takes a string or a list of strings. The response follows the OpenAI
format: data[].embedding (1024 floats), data[].index, and usage.total_tokens.
With pgvector
Configure the column for 1024 dimensions:
sql
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE documents (
id bigserial PRIMARY KEY,
content text,
embedding vector(1024)
);
-- Nearest neighbors via cosine distance
SELECT content FROM documents
ORDER BY embedding <=> $1
LIMIT 5;Same token pool
Embedding requests count against the same token quota as the chat models — see Plans and quotas.