Docling SDK supports three client modes, each with its own requirements:
| Client | Runtime | Requirement |
|---|---|---|
| API | Node.js >= 18, Bun, Deno | A running Docling Serve instance |
| CLI | Node.js >= 18 | Python with Docling installed |
| Web | Browser with WebGPU or WASM | Peer dependencies (see below) |
npm install docling-sdknpm install @btwld/docling-sdkBoth packages are identical. The GitHub Package Registry version is available for enterprise environments.
All peer dependencies are optional and only needed for specific features:
# Web OCR (browser-based OCR)
npm install @huggingface/transformers onnxruntime-web
# PDF rendering in Web client
npm install unpdf
# TypeScript (development)
npm install -D typescript| Use case | Client | Why |
|---|---|---|
| Server-side conversion through Docling Serve | API | Fastest, supports streaming, chunking, async tasks |
| Local conversion without a server | CLI | Uses Python Docling directly, batch and watch modes |
| In-browser OCR without any server | Web | Runs entirely client-side via WebGPU/WASM |
Start a Docling Serve instance, then:
import { readFile } from "node:fs/promises";
import { Docling } from "docling-sdk";
const client = new Docling({
api: { baseUrl: "http://localhost:5001" },
});
const buffer = await readFile("./document.pdf");
const result = await client.convert(buffer, "document.pdf", {
to_formats: ["md"],
});
console.log(result.document.md_content);See the full API Client guide for conversion options, streaming, async tasks, and more.
Install the Python Docling CLI (pip install docling), then:
import { Docling } from "docling-sdk";
const client = new Docling({
cli: { outputDir: "./output" },
});
const result = await client.convert(
"./document.pdf",
"document.pdf",
{ to_formats: ["md"] }
);
console.log(result.document.md_content);See the full CLI Client guide for batch processing, directory watching, and error handling.
Install the required peer dependencies first:
npm install @huggingface/transformers onnxruntime-webimport { createWebClient } from "docling-sdk/web";
const client = createWebClient({ device: "webgpu" });
client.on("loading", ({ progress, status }) => {
console.log(`Loading: ${Math.round(progress * 100)}% - ${status}`);
});
await client.initialize();
const result = await client.processImage(imageFile);
console.log(result.markdown);
client.destroy();The model (~500 MB) is cached in IndexedDB after the first download.
See the full Web Client guide for events, cache management, and standalone utilities.
- Configuration -- all available options for each client
- API Reference -- method-by-method reference
- Examples -- runnable example scripts