Skip to content

ThinkEx-OSS/filerouter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileRouter

FileRouter

FileRouter SDK on npm FileRouter documentation GitHub stars Join Discord

Composable engines. Durable document jobs.

FileRouter is one TypeScript SDK and CLI for hosted parsers and commercial engines. Pick the engine that fits each document, compare a few side by side, or call providers directly with your own keys. FileRouter runs the durable jobs: uploads, retries, results, and cleanup.

What FileRouter handles

Each engine has its own SDK, input rules, options, async job flow, and response shape. Mixing cheap paths with heavier parsers 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.
  • Engine 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 engines.
  • Side-by-side comparisons: fan out one document across engines and keep each success or failure in one result.

Start with a cheap engine for simple pages. Escalate or bake off later without another document integration. Recipe guides live in the docs.

Get started

Install the SDK:

npm install @file_router/sdk

Parse 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: "liteparse",
  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 or direct

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"],
})

Engines

  • LiteParse for cheap, open-source parsing with optional OCR, screenshots, and Office conversion.
  • PDF Inspector for fast PDF classification and text-layer inspection.
  • Mistral OCR for OCR with structured document output.
  • Datalab for document conversion and extraction.
  • LlamaParse for layout-aware document parsing.

More engines 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.

Supporters

Programs and platforms supporting FileRouter with credits, tools, and infrastructure.

Capy      Greptile      The Context Company

PostHog      Mintlify      CodeRabbit

Development

FileRouter requires Node.js 22.14 or newer.

vp install
pnpm dev

Run the checks before pushing changes:

pnpm check
pnpm test

Community

FileRouter is open source under the MIT License.

About

Durable document parsing across providers: optimize for accuracy, reliability, latency, and cost.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages