Skip to main content

Chroma-compatible API backed by ZeroDB cloud. No Docker, no server, instant vector DB.

Project description

chromadb-zerodb

Chroma-compatible API backed by ZeroDB cloud. No Docker, no server, instant vector DB.

Drop-in replacement for chromadb — same Collection API, but vectors are stored in ZeroDB cloud. Auto-provisions on first use. Free tier included.

Why?

chromadb chromadb-zerodb
Setup Docker server or in-memory (lost on restart) pip install and go
Persistence Requires server config Cloud-persisted automatically
Embeddings Bring your own Free BAAI BGE models included
Scaling Self-managed Managed infrastructure
Cost Server hosting Free tier, pay as you grow

Install

pip install chromadb-zerodb

Quick Start

import chromadb_zerodb as chromadb

# Auto-provisions a free project on first use
client = chromadb.Client()

# Create a collection
collection = client.create_collection("my_docs")

# Add documents (auto-embedded with free BGE models)
collection.add(
    documents=[
        "Python is a great programming language",
        "JavaScript powers the web",
        "Rust is fast and memory-safe",
    ],
    ids=["doc1", "doc2", "doc3"],
    metadatas=[
        {"topic": "python"},
        {"topic": "javascript"},
        {"topic": "rust"},
    ],
)

# Query by text
results = collection.query(
    query_texts=["best language for beginners"],
    n_results=2,
)

print(results["documents"])  # [["Python is a great...", "JavaScript powers..."]]
print(results["distances"])  # [[0.05, 0.12]]

Migration from chromadb

Change one import:

# Before
import chromadb
client = chromadb.Client()

# After
import chromadb_zerodb as chromadb
client = chromadb.Client()

Everything else stays the same.

Authentication

Three ways to authenticate (checked in order):

  1. Constructor arguments:

    client = chromadb.Client(api_key="zdb_...", project_id="proj_...")
    
  2. Environment variables:

    export ZERODB_API_KEY=zdb_...
    export ZERODB_PROJECT_ID=proj_...
    
  3. Auto-provision: If neither is set, a free project is created automatically. Credentials are cached in ~/.zerodb/credentials.json.

API Reference

Client

client = chromadb.Client(api_key=None, project_id=None, base_url=None)

client.create_collection(name, metadata=None)    # -> Collection
client.get_collection(name)                       # -> Collection
client.get_or_create_collection(name, metadata=None)  # -> Collection
client.list_collections()                         # -> List[str]
client.delete_collection(name)                    # -> None
client.heartbeat()                                # -> int (nanosecond timestamp)

Collection

collection.add(
    ids=None,           # auto-generated if omitted
    documents=None,     # auto-embedded if provided
    embeddings=None,    # or pass pre-computed vectors
    metadatas=None,
)

collection.query(
    query_texts=None,
    query_embeddings=None,
    n_results=10,
    where=None,         # metadata filter
)
# Returns: {"ids": [[...]], "documents": [[...]], "metadatas": [[...]], "distances": [[...]]}

collection.get(ids=None, where=None)
# Returns: {"ids": [...], "documents": [...], "metadatas": [...]}

collection.update(ids, documents=None, embeddings=None, metadatas=None)
collection.upsert(ids, documents=None, embeddings=None, metadatas=None)
collection.delete(ids=None, where=None)
collection.count()  # -> int

Bring Your Own Embeddings

collection.add(
    ids=["id1"],
    embeddings=[[0.1, 0.2, 0.3, ...]],  # your vectors
    documents=["the original text"],
    metadatas=[{"source": "my_model"}],
)

collection.query(
    query_embeddings=[[0.1, 0.2, 0.3, ...]],
    n_results=5,
)

Metadata Filtering

results = collection.query(
    query_texts=["search term"],
    where={"topic": "python"},
    n_results=5,
)

How It Works

  • Collections are namespaced via ID prefixes (collection_name::doc_id)
  • Auto-embedding uses ZeroDB's free BAAI BGE-M3 model
  • Storage is ZeroDB's managed vector database (same infra as ZeroDB MCP)
  • Credentials are cached at ~/.zerodb/credentials.json

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chromadb_zerodb-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chromadb_zerodb-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file chromadb_zerodb-0.1.0.tar.gz.

File metadata

  • Download URL: chromadb_zerodb-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for chromadb_zerodb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ae8e1dcfb5ea3bd0efde90378cfc5d67b7d534b7e24d5778060255ca52e1f02
MD5 753ed5638fe82e949965dcd483641602
BLAKE2b-256 cb7a4beb33443892c35d760852597d13c8903d5de27a8b671011632ec17b983a

See more details on using hashes here.

File details

Details for the file chromadb_zerodb-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chromadb_zerodb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec8b3968fda7d890c681f8eff8a8e6bca29b4bc794242eddb52655434f839bdd
MD5 d186b160ab741496d0579710e416caf0
BLAKE2b-256 64cbc3b7b7d98d536fdad81f45ae4a6cf54e20aa1bd93a9076e497b1b03be0e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page