Durable document parsing across providers.
FileRouter gives you one TypeScript SDK and CLI for durable document parsing across providers. Choose a parser, compare the same document across parsers, or call providers directly with your own keys.
Each parser has its own SDK, input rules, options, async job flow, and response shape. Supporting more than one usually means rebuilding the same document pipeline. FileRouter handles that work behind one interface:
- Inputs: pass a file path, URL,
File,Blob, buffer, or stream. - Provider adapters: keep each provider's authentication and options separate without changing the rest of your app.
- Long-running jobs: hosted processing manages uploads, provider submission, polling, timeouts, result storage, and cleanup.
- Consistent results: work with the same page numbering, outputs, timing, warnings, and errors across providers.
- Side-by-side comparisons: parse a document with multiple providers at once and keep each success or failure in one result.
Start with one parser today. Switching or comparing later is a configuration change, not another document integration.
Install the SDK:
npm install @file_router/sdkParse a document with the hosted API:
import { FileRouter } from "@file_router/sdk"
const router = new FileRouter({
apiKey: process.env.FILEROUTER_API_KEY,
})
const result = await router.parse("https://example.com/report.pdf", {
provider: "llamaparse",
outputs: ["markdown"],
})
console.log(result.outputs.markdown)Or use the CLI:
npx @file_router/cli@latest login
npx @file_router/cli@latest parse report.pdf| Hosted API | Direct with your keys | |
|---|---|---|
| Best for | The fastest setup | Keeping provider calls in your runtime |
| Authentication | A FileRouter API key | Your provider API keys |
| Document sent through | FileRouter, then the selected provider | The selected provider only |
| Billing | FileRouter credits | Provider billing |
| TypeScript | FileRouter |
DirectFileRouter |
| CLI | Default after filerouter login |
Add --local |
Credits pay for hosted processing. Each account receives 5,000 free credits each month, purchased credits never expire, and direct requests do not use FileRouter credits.
Direct TypeScript example:
import { DirectFileRouter } from "@file_router/sdk"
import { llamaparse } from "@file_router/sdk/llamaparse"
const router = new DirectFileRouter({
providers: { llamaparse: llamaparse() },
})
const result = await router.parse("./report.pdf", {
provider: "llamaparse",
outputs: ["markdown"],
})- LlamaParse for layout-aware document parsing.
- Mistral OCR for OCR with structured document output.
- Datalab for document conversion and extraction.
- LiteParse for open-source parsing with optional OCR, screenshots, and Office conversion.
- PDF Inspector for fast PDF classification and text-layer inspection.
More adapters are coming.
Tech stack
- App: TypeScript, React 19, TanStack Start, Router, and Query.
- API and auth: Hono with OpenAPI and Zod, plus Better Auth.
- Durable backend: Cloudflare Workers and Workflows, with D1 through Drizzle ORM and R2 for documents and results.
- SDK and CLI: A pnpm workspace with provider-neutral TypeScript packages.
- UI and tooling: Tailwind CSS 4, Radix UI, Vite+, and Vitest.
FileRouter requires Node.js 22.14 or newer.
vp install
pnpm devRun the checks before pushing changes:
pnpm check
pnpm testFileRouter is open source under the MIT License.