--- title: ChromaDB emoji: 🗄️ colorFrom: blue colorTo: purple sdk: docker app_port: 7860 pinned: false short_description: ChromaDB Auth Proxy --- # 🗄️ ChromaDB Auth Proxy A ChromaDB server with auth proxy. ## 🚀 Quick Start ### Connection Information - **Host**: `https://hyperdemocracy.chromadb-usc-vecs.hf.space` - **Authentication**: Secret bearer token ## 💻 Usage ### Python HttpClient Example ```python import os import time import uuid import chromadb from chromadb.config import Settings, APIVersion # Get host and token from environment variable host = os.getenv("CHROMA_PROXY_BASE") token = os.getenv("CHROMA_AUTH_TOKEN") if not host or not token: raise ValueError("Set CHROMA_PROXY_BASE and CHROMA_AUTH_TOKEN") headers = {"Authorization": f"Bearer {token}"} settings = Settings(chroma_server_api_default_path=APIVersion.V2, anonymized_telemetry=False) client = chromadb.HttpClient(host=host, headers=headers, settings=settings) # Test the connection print("HB:", client.heartbeat()) # Collection: create → add → query → delete name=f"demo_{int(time.time())}_{uuid.uuid4().hex[:6]}" coll=client.get_or_create_collection(name=name, metadata={"purpose":"smoke"}) coll.add( ids=["doc-1", "doc-2", "doc-3"], documents=[ "The Eiffel Tower is located in Paris and was completed in 1889.", "Mount Fuji is the highest mountain in Japan and an active stratovolcano.", "The Great Wall of China is a series of fortifications built across ancient China.", ], metadatas=[ {"country": "France", "city": "Paris"}, {"country": "Japan"}, {"country": "China"}, ], ) print(coll.query(query_texts=["Which landmark is in France?"], n_results=2)) client.delete_collection(name=name) print("OK") ``` ### curl example ```bash # Test proxy health without authentication curl https://hyperdemocracy-chromadb-usc-vecs.hf.space/health # Test chromadb API with authentication curl -H "authorization: Bearer $CHROMA_AUTH_TOKEN" https://hyperdemocracy-chromadb-usc-vecs.hf.space/api/v2/heartbeat ``` ---