by Tane H.

Full-featured JS/TS SDK for the Qdrant vector search engine, offering both REST (OpenAPI) and gRPC clients for Node.js, Deno, browsers, and Cloudflare Workers.
This block is the TypeScript REST client for the Qdrant vector search engine. It exposes QdrantClient, a typed facade over Qdrant's OpenAPI surface, handling connection setup, auth, timeouts, and error classification. Typical buyers are backend engineers embedding vector search (semantic search, RAG pipelines, recommendation engines) into Node.js or edge-runtime services.
openapi/ - Generated OpenAPI schema, typed client factory, and client type definitionsapi-client.ts - Low-level HTTP client factory; wires middleware for timeouts and error handlingclient-version.ts - Version string constant and compatibility checker between client and serverdispatcher.ts - Internal request dispatcher used by the API clienterrors.ts - Typed error classes for unexpected responses, config problems, timeouts, and rate limitsindex.ts - Public re-exports: QdrantClient, QdrantClientParams, Schemas, and all error classesqdrant-client.ts - Main high-level client class with collection and vector operation methodstypes.ts - Shared TypeScript types (RestArgs, Schemas)openapi/generated_api_client.ts - Auto-generated method bindings for every Qdrant REST endpointopenapi/generated_client_type.ts - TypeScript interface describing the full API surfaceopenapi/generated_schema.ts - Raw OpenAPI path/schema types used by the fetch layernpm install @qdrant/openapi-typescript-fetch
No native modules, pod installs, or Android linking steps are required. The client uses the standard fetch API and runs on Node.js >= 18, Deno, browsers, and Cloudflare Workers without additional polyfills.
Copy source - Place the source/ directory into your project, for example at src/qdrant/.
tsconfig.json - Ensure moduleResolution is set to "bundler" or "node16"/"nodenext" so extension imports resolve correctly. The source uses explicit extensions throughout.
Spin up an isolated sandbox and run it server-side — no local setup.
Tetrees AI Review of this version
This TypeScript cli / script completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Pipeline avcp-2026-08-04.1 · SHA-256 bc363b01f62df41a…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Reviewed Aug 4, 2026
Push this product straight into your AI IDE, web builder or cloud IDE.
Connect Tetrees to a compatible AI IDE, list products you own, and request the verified ZIP without exposing seller upload controls.
No reviews yet.
Sign in to join the discussion
Loading discussion…
.js.js{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true
}
}
const client = new QdrantClient({
url: process.env.QDRANT_URL ?? 'http://127.0.0.1:6333',
apiKey: process.env.QDRANT_API_KEY,
});
tsconfig.json:{
"compilerOptions": {
"paths": {
"@qdrant/*": ["./src/qdrant/*"]
}
}
}
docker run -p 6333:6333 qdrant/qdrant
class QdrantClient {
constructor(params?: QdrantClientParams): QdrantClient;
// Collection operations, vector upsert/search, payload management, etc.
// all available as async methods on this instance.
}
The primary entry point. Instantiate once per process and reuse. Pass url for simple local/cloud connections, or host/port/https for finer-grained control. Set checkCompatibility: false to suppress server version warnings.
type QdrantClientParams = {
port?: number | null; // default: 6333
apiKey?: string; // enables HTTPS automatically when set
https?: boolean;
prefix?: string;
url?: string;
host?: string;
timeout?: number; // milliseconds, default: 300_000
headers?: Record<string, number | string | string[] | undefined>;
maxConnections?: number;
checkCompatibility?: boolean; // default: true
};
Use this type to annotate factory functions or dependency-injection containers that create clients. When apiKey is present, HTTPS is enabled automatically unless https: false is explicitly set.
class QdrantClientUnexpectedResponseError extends Error {
static forResponse(response: ApiResponse<unknown>): QdrantClientUnexpectedResponseError;
}
Thrown when the server returns any status outside 200/201. Inspect error.message for a formatted status code, reason phrase, and truncated response body. Catch this to handle server-side validation failures or unexpected states.
class QdrantClientTimeoutError extends Error {}
Thrown when a request exceeds the configured timeout. Catch separately from network errors to implement retry logic with backoff.
class QdrantClientResourceExhaustedError extends Error {
retry_after: number; // seconds parsed from Retry-After header
}
Thrown on HTTP 429 responses that include a Retry-After header. Use error.retry_after to schedule a retry without guessing.
Connect to a local Qdrant instance and retrieve all existing collections to verify the connection is healthy.
import { QdrantClient } from './src/qdrant/index.js';
const client = new QdrantClient({ url: 'http://127.0.0.1:6333' });
async function listCollections() {
const result = await client.getCollections();
console.log('Collections:', result.collections);
}
listCollections().catch(console.error);
Authenticate against Qdrant Cloud using an API key. The client enables HTTPS automatically. A 10-second timeout prevents hanging requests in serverless environments.
import { QdrantClient, QdrantClientTimeoutError } from './src/qdrant/index.js';
const client = new QdrantClient({
url: 'https://your-cluster.us-east-0-1.aws.cloud.qdrant.io',
apiKey: process.env.QDRANT_API_KEY,
timeout: 10_000,
});
async function fetchCollections() {
try {
const result = await client.getCollections();
return result.collections;
} catch (err) {
if (err instanceof QdrantClientTimeoutError) {
console.error('Request timed out - retry with backoff');
}
throw err;
}
}
Wrap calls to respect the Retry-After header returned by Qdrant Cloud when quotas are exceeded.
import {
QdrantClient,
QdrantClientResourceExhaustedError,
} from './src/qdrant/index.js';
const client = new QdrantClient({
url: process.env.QDRANT_URL ?? 'http://127.0.0.1:6333',
apiKey: process.env.QDRANT_API_KEY,
});
async function withRetry<T>(fn: () => Promise<T>, retries = 3): Promise<T> {
for (let attempt = 0; attempt < retries; attempt++) {
try {
return await fn();
} catch (err) {
if (err instanceof QdrantClientResourceExhaustedError) {
const waitMs = err.retry_after * 1000;
console.warn(`Rate limited. Retrying in ${err.retry_after}s`);
await new Promise((r) => setTimeout(r, waitMs));
continue;
}
throw err;
}
}
throw new Error('Max retries exceeded');
}
const collections = await withRetry(() => client.getCollections());
console.log(collections);
index.ts - Re-exports the three public surface areas: QdrantClient, QdrantClientParams, Schemas, and all error classes. Import exclusively from here.qdrant-client.ts - Implements QdrantClient. Reads config, constructs the REST URI, instantiates the OpenAPI client, and exposes high-level methods.api-client.ts - Creates the underlying Fetcher instance and attaches middleware for timeout (via AbortController) and error classification (429 → QdrantClientResourceExhaustedError, non-2xx → QdrantClientUnexpectedResponseError).client-version.ts - Exports PACKAGE_VERSION ('1.17.0') and ClientVersion utilities for parsing and comparing semver strings to gate compatibility warnings.errors.ts - Defines the error class hierarchy: CustomError base, then QdrantClientUnexpectedResponseError, QdrantClientConfigError, QdrantClientTimeoutError, QdrantClientResourceExhaustedError.dispatcher.ts - Internal; creates the request dispatcher consumed by api-client.ts. Not part of the public API.types.ts - Defines RestArgs (headers, timeout, connections) and re-exports Schemas from generated types.openapi/generated_schema.ts - Raw paths type map generated from Qdrant's OpenAPI spec. Updated when the spec changes.openapi/generated_client_type.ts - ClientApi interface enumerating every typed endpoint method.openapi/generated_api_client.ts - createClientApi factory that binds ClientApi methods to the fetch client..js extension errors in Node ESM - The source imports with explicit .js extensions; set "moduleResolution": "bundler" or "node16" in tsconfig.json or TypeScript will fail to resolve them.fetch not defined (Node < 18) - The client relies on the global fetch; upgrade to Node.js >= 18 or polyfill with node-fetch assigned to globalThis.fetch.host + port instead of url, HTTPS is only auto-enabled when apiKey is set; pass https: true explicitly if needed without an API key.QdrantClientConfigError on construction - Thrown when conflicting connection params are supplied (e.g., both url and host). Read the message; it indicates the exact conflict.retry_after is seconds, not milliseconds - QdrantClientResourceExhaustedError.retry_after is already parsed as a number in seconds; multiply by 1000 for setTimeout.openapi/generated_schema.ts and generated_api_client.ts from the updated OpenAPI spec to avoid type mismatches.I have a copy of the Qdrant JS REST client source at `src/qdrant/` in my project.
The public API is documented in `USAGE.md` next to this source directory.
The upstream package is `@qdrant/monorepo@0.0.0` (js-client-rest).
Please integrate this client into my project step by step:
1. Read `USAGE.md` to understand the exported symbols and file layout.
2. Install the single required dependency: `@qdrant/openapi-typescript-fetch`.
3. Update my `tsconfig.json` so `.js` extension imports resolve (moduleResolution: bundler or node16).
4. Create a `src/services/qdrantService.ts` that:
- Instantiates `QdrantClient` using environment variables `QDRANT_URL` and `QDRANT_API_KEY`.
- Exports helper functions for listing collections, upserting vectors, and searching.
- Wraps calls in try/catch blocks that handle `QdrantClientTimeoutError` and
`QdrantClientResourceExhaustedError` (with retry logic using `retry_after`).
5. Show me where to add the env vars and how to call the service from an Express route.
Only use symbols and imports visible in `USAGE.md`. Do not invent methods.
The upstream project is licensed under the Apache 2.0 License (see source/LICENSE if present, or refer to the upstream repository). This block is derived from @qdrant/js-client-rest as published in the qdrant-js monorepo.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
The full install guide and integration prompts unlock after purchase.
Automation, Utilities & Developer Tools
Free