Skip to main content

Requirements

Node.js 18 or later
TypeScript 5.0+ (recommended)
pnpm, npm, or yarn

Quick Install

Install the core packages for document extraction:
pnpm add @doclo/flows @doclo/providers-llm
This installs everything you need to get started:
  • @doclo/flows - Flow builder and all processing nodes
  • @doclo/providers-llm - LLM/VLM provider integrations

Package Overview

The SDK is modular. Install only what you need:

Core Packages

PackageDescriptionInstall
@doclo/flowsFlow builder, nodes, orchestrationRequired
@doclo/providers-llmOpenAI, Anthropic, Google, xAIRequired
@doclo/coreTypes, utilities (auto-installed)-

Optional Packages

PackageDescriptionWhen to use
@doclo/providers-datalabSurya, Marker OCROCR-first pipelines
@doclo/providers-reductoReducto parsing/splittingDocument splitting
@doclo/schemasPre-built schemasCommon document types
@doclo/clientCloud API clientUsing Doclo Cloud

Install by Use Case

For simple document extraction using VLM:
pnpm add @doclo/flows @doclo/providers-llm

TypeScript Setup

The SDK is written in TypeScript and includes type definitions. No additional @types packages needed.

tsconfig.json

Recommended settings:
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true
  }
}

Running TypeScript

Use tsx for running TypeScript files directly:
pnpm add -D tsx
npx tsx your-script.ts
Or compile first:
pnpm tsc your-script.ts
node your-script.js

Environment Variables

Create a .env.local file for API keys:
# LLM Providers (choose one or more)
OPENROUTER_API_KEY=sk-or-v1-...    # OpenRouter (recommended)
OPENAI_API_KEY=sk-...              # OpenAI direct
ANTHROPIC_API_KEY=sk-ant-...       # Anthropic direct

# OCR Providers
DATALAB_API_KEY=...                # Surya/Marker

# Doclo Cloud
DOCLO_API_KEY=dc_live_...          # Cloud API

Loading Environment Variables

Install dotenv:
pnpm add dotenv
Import at the top of your script:
import 'dotenv/config';

Verify Installation

Create a test file to verify everything works:
import 'dotenv/config';
import { createFlow, extract } from '@doclo/flows';
import { createVLMProvider } from '@doclo/providers-llm';

const provider = createVLMProvider({
  provider: 'google',
  model: 'google/gemini-2.5-flash',
  apiKey: process.env.OPENROUTER_API_KEY!,
  via: 'openrouter'
});

console.log('✅ SDK installed successfully');
console.log('Provider:', provider);
Run it:
npx tsx test.ts

Troubleshooting

Make sure you’re in your project directory and packages are installed:
pnpm add @doclo/flows @doclo/providers-llm
Ensure your tsconfig.json has:
{
  "compilerOptions": {
    "moduleResolution": "bundler"
  }
}
The SDK uses ESM. If you see “require is not defined”, ensure your package.json has:
{ "type": "module" }

Next Steps