ChromaDotNet.Client
A .NET client for Chroma and Chroma Cloud, tested with Chroma 0.4.10 to 1.5.9. It covers collections, tenants and databases, records and nearest neighbor queries with filters, the Search API with hybrid BM25 search, and OpenTelemetry traces and metrics.
- Latest release 2.18.0
- NuGet
- GitHub
- Documentation
- Tested versions
- OpenSSF Best Practices: passing
Install
dotnet add package ChromaDotNet.Client For Microsoft.Extensions.DependencyInjection, with AddChromaClient, AddKeyedChromaClient and CreateChromaClient:
dotnet add package ChromaDotNet.Client.DependencyInjection The packages are named ChromaDotNet.*. The namespaces keep their original names, such as ChromaDB.Client.
Example
Start Chroma, for example with Docker:
docker run -p 8000:8000 chromadb/chroma:1.5.9 Then add two records with their embeddings and query the nearest one:
using ChromaDB.Client;
using ChromaDB.Client.Models;
using var client = new ChromaClient("http://localhost:8000");
var collection = await client.GetOrCreateCollectionAsync("fruits");
var fruits = client.GetCollectionClient(collection);
await fruits.AddAsync(["apple", "lemon"],
embeddings: [new([1f, 0f, 0f]), new([0f, 1f, 0f])],
documents: ["A crunchy apple", "A sour lemon"]);
var results = await fruits.QueryAsync(new ReadOnlyMemory<float>([0f, 0.9f, 0.1f]),
nResults: 1, include: ChromaQueryInclude.Documents | ChromaQueryInclude.Distances);
foreach (var result in results)
Console.WriteLine($"{result.Id}: {result.Document} ({result.Distance})");Tested on 25 October 2026 with ChromaDotNet.Client 2.18.0 on Chroma 1.5.9.
Try it in your browser: a GitHub Codespace with .NET and Chroma, then dotnet run Samples/quickstart.cs.
Documentation
- Connecting: the URI, the
HttpClient, threads, the API version, authentication and connection strings. - Dependency injection:
AddChromaClientandAddKeyedChromaClient. - Collections: collections, tenants and databases, collections by id.
- Records: URIs, large writes, deletes and base64 embeddings.
- Embeddings: embeddings from an
IEmbeddingGenerator, query texts and the default embedding function of Chroma. - Metadata values: values, lists, deletions in updates and upserts, document copies, conversions.
- Queries and filters: queries,
GetAsyncin pages, where and document filters. - Upsert strategies:
ServerandSkipUnchangedEmbeddings. - Index settings: the distance, the HNSW and SPANN settings,
ModifyConfigurationAsync. - Errors:
ChromaExceptionandCollectionExistsAsync. - Mocks in tests: mocking
ChromaClientandChromaCollectionClient. - Health, traces and metrics:
HealthcheckAsyncand OpenTelemetry. - Chroma Cloud: options, identity, batches, quotas and the operations of Chroma Cloud.
- Search: the Search API and hybrid search with BM25.
- Sparse vectors and schema: sparse vectors, BM25 indexes and the indexes of a schema.
- Platforms: the builds, trimming and NativeAOT.
The compatibility table shows every check of the latest release on Chroma 1.5.9 and on Chroma Cloud, on each .NET runtime and platform.