Skip to content

ThinkEx-OSS/filerouter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileRouter

FileRouter

FileRouter SDK on npm FileRouter documentation GitHub stars Join Discord

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.

What FileRouter handles

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.

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

Adapters

  • 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.

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

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors