Embeddings
POST /v1/embeddings turns text into vectors for semantic search, clustering and deduplication. It follows OpenAI's Embeddings API, so the OpenAI SDKs, and most frameworks built on them, work by changing the base URL.
Model: vectorize-io/vectorize-embedding-base-112m-multilingual-001
| Dimensions | 384 by default; 256, 128 or 64 on request |
| Languages | 8, including English |
| Max input length | 8,192 tokens (longer inputs are truncated) |
| Vectors | Normalized to unit length |
Quick Start
- curl
- Python (OpenAI SDK)
- Self-hosted Hindsight
curl https://inference.hindsight.vectorize.io/v1/embeddings \
-H "Authorization: Bearer $HINDSIGHT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "vectorize-io/vectorize-embedding-base-112m-multilingual-001",
"input": ["Paris is the capital of France."]
}'
from openai import OpenAI
# The OpenAI SDK appends /embeddings itself.
client = OpenAI(
api_key="<your Hindsight API key>",
base_url="https://inference.hindsight.vectorize.io/v1",
)
response = client.embeddings.create(
model="vectorize-io/vectorize-embedding-base-112m-multilingual-001",
input=["Paris is the capital of France.", "Berlin is in Germany."],
)
vector = response.data[0].embedding # 384 floats
Self-hosted Hindsight can embed memories with this API through its OpenAI provider:
HINDSIGHT_API_EMBEDDINGS_PROVIDER=openai
HINDSIGHT_API_EMBEDDINGS_OPENAI_BASE_URL=https://inference.hindsight.vectorize.io/v1
HINDSIGHT_API_EMBEDDINGS_OPENAI_MODEL=vectorize-io/vectorize-embedding-base-112m-multilingual-001
HINDSIGHT_API_EMBEDDINGS_OPENAI_API_KEY=<your Hindsight API key>
HINDSIGHT_API_EMBEDDINGS_OPENAI_BATCH_SIZE=128
Vectors from different embedding models are not comparable. Switching the embedding model of a Hindsight instance that already holds memories requires re-embedding them.
Request
| Field | Type | Required | Description |
|---|---|---|---|
input | string or array of strings | Yes | Up to 128 non-empty strings per request |
model | string | No | The model ID above (the default) |
dimensions | integer | No | 384 (default), 256, 128 or 64. See Shorter Vectors |
encoding_format | string | No | float (default) or base64 |
Token-array inputs are not supported; send text.
Response
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, …] }
],
"model": "vectorize-io/vectorize-embedding-base-112m-multilingual-001",
"usage": { "prompt_tokens": 8, "total_tokens": 8 }
}
data is in the same order as input, and each item's index says which input it belongs to. With encoding_format: "base64", each embedding is a base64 string of little-endian float32 values. The OpenAI Python SDK requests and decodes this format automatically.
Shorter Vectors
The model is trained so that the first 256, 128 or 64 dimensions of its vector are themselves a usable embedding (Matryoshka representation learning). Shorter vectors cut storage and search cost at a small loss in quality.
Pass dimensions to get a shorter vector, re-normalized to unit length. Other sizes return 400. Use the same size for your documents and your queries.
Comparing Vectors
Vectors are unit length, so cosine similarity and dot product give the same ranking. Embed queries and documents with the same model and the same dimensions.
For the best search quality, retrieve candidates by vector similarity, then rerank the top results.
Billing
Embeddings cost $0.01 per 1M input tokens. usage.prompt_tokens reports exactly what was billed.