Skip to main content

Vector Search

ZeroDB provides vector storage and semantic search with free embeddings — no OpenAI key required.

💡Free Embeddings Included

ZeroDB includes a free embedding service powered by TEI (Text Embeddings Inference). No OpenAI key needed — just send text and get vectors back automatically.

Quick Start

npx zerodb-cli init

Store Vectors

POST/api/v1/public/zerodb/vectors🔒
curl -X POST https://api.ainative.studio/api/v1/public/zerodb/vectors \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"texts": ["ZeroDB is fast", "Semantic search is powerful"],
"metadata": [
{"source": "docs", "category": "product"},
{"source": "docs", "category": "feature"}
]
}'

Embeddings are generated automatically using TEI (HuggingFace Text Embeddings Inference) at zero cost.

Parameters:

ParameterTypeRequiredDescription
textsstring[]YesText content to embed and store
vectorfloat[]NoPre-computed embedding (if omitted, auto-generated)
metadataobject[]NoKey-value metadata for filtering
namespacestringNoNamespace isolation (default: "default")
idsstring[]NoCustom IDs. Auto-generated if omitted.

Search by Meaning

POST/api/v1/public/zerodb/vectors/search🔒
curl -X POST https://api.ainative.studio/api/v1/public/zerodb/vectors/search \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "fast database for AI",
"limit": 5,
"min_score": 0.7,
"filter_metadata": {"source": "docs"}
}'

Response:

{
"results": [
{
"id": "vec_abc...",
"text": "ZeroDB is fast",
"score": 0.94,
"metadata": {"source": "docs", "category": "product"}
}
]
}

Search Parameters:

ParameterTypeRequiredDescription
querystringYesNatural language search query
limitintegerNoMax results (default: 10, max: 100)
min_scorefloatNoMinimum similarity score (0.0–1.0)
namespacestringNoSearch within a specific namespace
filter_metadataobjectNoFilter by metadata key-value pairs

Python SDK

import requests

headers = {"Authorization": "Bearer YOUR_API_KEY"}
base = "https://api.ainative.studio/api/v1/public/zerodb"

# Store vectors
requests.post(f"{base}/vectors", headers=headers, json={
"texts": ["AI agents need persistent memory"],
"metadata": [{"source": "research", "year": 2026}],
"namespace": "papers"
})

# Search
response = requests.post(f"{base}/vectors/search", headers=headers, json={
"query": "How do AI agents use memory?",
"limit": 5,
"min_score": 0.7,
"filter_metadata": {"source": "research"}
})
for result in response.json()["results"]:
print(f"{result['score']:.3f}{result['text'][:80]}")

LangChain Integration

pip install langchain-zerodb
from langchain_zerodb import ZeroDBVectorStore

store = ZeroDBVectorStore(
api_key="your-api-key",
project_id="your-project-id",
)

# Add documents (embeddings generated free)
store.add_texts(["ZeroDB is fast", "Semantic search"])

# Search by meaning
results = store.similarity_search("fast database", k=5)

LlamaIndex Integration

pip install llama-index-vector-stores-zerodb
from llama_index_zerodb import ZeroDBVectorStore
from llama_index.core import VectorStoreIndex

store = ZeroDBVectorStore(
api_key="your-api-key",
project_id="your-project-id",
)

index = VectorStoreIndex.from_vector_store(store)
response = index.as_query_engine().query("What is ZeroDB?")

Embeddings

ZeroDB generates embeddings automatically using TEI with BAAI/bge models:

BAAI/bge-base-en-v1.5

Default

768-dimension embeddings optimized for semantic search

16ms Inference

Fast

Average embedding latency with TEI backend

Free at All Tiers

No Cost

No OpenAI key needed — embeddings included

Bring Your Own

Flexible

Pass a vector field to use custom embeddings

Upsert Alias

POST /zerodb/vectors/upsert is an alias for POST /zerodb/vectors. Use either — both accept the same request body and return the same response.

curl -X POST https://api.ainative.studio/api/v1/public/zerodb/vectors/upsert \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"texts": ["ZeroDB is fast"], "namespace": "docs"}'

All Endpoints

MethodPathDescription
POST/zerodb/vectorsUpsert vectors with text or raw embeddings
POST/zerodb/vectors/upsertAlias for POST /zerodb/vectors
POST/zerodb/vectors/searchSemantic similarity search
GET/zerodb/vectorsList vectors with pagination
DELETE/zerodb/vectors/{id}Delete a vector by ID
GET/zerodb/vectors/statsVector count and storage stats
POST/zerodb/embedGenerate embeddings from text (free)