Ocr Document Analysis Model Router
БесплатноНе проверенBYOK model router for OCR document analysis, invoice extraction, bank statement extraction, scanned PDFs, and long PDFs.
Описание
BYOK model router for OCR document analysis, invoice extraction, bank statement extraction, scanned PDFs, and long PDFs.
README
Route OCR, PDF parsing, invoice extraction, bank statement extraction, and long-document analysis jobs to the cheapest AI model that can still do the work correctly.
DocRouter is a BYOK model router for OCR document analysis: invoices, bank statements, scanned PDFs, table-heavy forms, and long financial documents. It runs non-LLM OCR first, profiles the document, ranks the user's enabled models by cost, quality, latency, and document difficulty, then records deterministic evaluation feedback for a learning layer.
It is not a general-purpose chatbot router. It is built for OCR and structured extraction.

Demo
Watch the local V2 workflow: preset extraction fields, model ranking, readable extracted output, and deterministic eval.
The demo can be regenerated:
python scripts/create-demo-video.py
python scripts/create-social-preview.py
Why This Exists
Document AI stacks usually choose one of two bad defaults:
- Always use the strongest model, which wastes money on simple PDFs.
- Always use the cheapest model, which breaks on dense statements, tables, scans, and reconciliation-heavy documents.
This OCR document analysis model router sits before the model call. It asks: based on this document's OCR profile, layout, page count, table density, requested fields, latency target, and cost policy, which model should run this extraction?
What It Does
- Runs non-LLM OCR/preflight before any model call.
- Supports invoices, bank statements, receipts, tax forms, contracts, loan docs, financial reports, scanned images, and long PDFs.
- Lets each user bring their own model API keys during onboarding.
- Stores user model preferences and encrypted provider credentials.
- Ranks commercial and open-source/self-hosted models.
- Explains routing math: estimated tokens, cost, quality, latency, difficulty, and final score.
- Shows extracted output as readable fields and tables, not just raw JSON.
- Runs deterministic eval checks for required fields, totals, transactions, and reconciliation.
- Records clicks, decisions, feedback, model outcomes, document fingerprints, and learning signals in Supabase-ready tables.
Quick Start
npm install
npm run build
# PowerShell
$env:TRANSPORT="http"; $env:PORT="3100"; node dist/index.js
# macOS/Linux
TRANSPORT=http PORT=3100 node dist/index.js
Open:
- V2 BYOK learning workflow:
http://localhost:3100/v2.html - Demo recording mode:
http://localhost:3100/v2.html?demo=1 - V1 routing dashboard:
http://localhost:3100/dashboard.html - Health check:
http://localhost:3100/health
Run checks:
npm test
Product Flow
flowchart LR
A["Upload PDF/image"] --> B["Non-LLM OCR + document profile"]
B --> C["Lookup table + routing algorithm"]
C --> D["Rank user's enabled models"]
D --> E["Run selected provider or dry-run fallback"]
E --> F["Readable extracted fields + tables"]
F --> G["Deterministic eval"]
G --> H["User feedback + learning ledger"]
Routing Logic
The router does not use an AI to choose an AI. It uses deterministic scoring:
- Document type: bank statement, invoice, long PDF, table-heavy scan, etc.
- Page count and character count.
- Text layer quality: good, partial, poor, none.
- Image quality and handwriting flags.
- Layout complexity and table density.
- Financial validation needs: totals, transactions, reconciliation.
- User policy: balanced, quality, cost, or latency.
- User's enabled models and available provider keys.
- Learned user/global model outcomes from deterministic eval and feedback.
The final score blends model quality, estimated cost, expected latency, task fit, document difficulty, and learned score. Every ranked row has an Explain button that shows the math.
V2 BYOK + Learning Layer
Users choose providers and models during onboarding. Their API keys are encrypted server-side and never displayed back. Extraction runs are tied to the user's selected model pool.
V2 records:
- Document profiles and OCR warnings.
- Model recommendations and selected ranks.
- Estimated cost and latency.
- Extraction instruction and requested fields.
- Provider execution or dry-run fallback.
- Rule-based eval checks.
- Happy/not-happy feedback and escalation.
- Document intelligence fingerprints for future routing improvement.
Local development writes to .docrouter/*. Production can mirror to Supabase using the migrations in supabase/migrations.
API Surface
| Endpoint | Purpose |
|---|---|
POST /api/v2/onboarding |
Save user onboarding, strategy, and enabled model pool. |
GET /api/v2/onboarding?user_id=... |
Load saved onboarding/model preferences. |
POST /api/v2/provider-credentials |
Save encrypted provider credentials. |
GET /api/v2/provider-credentials?session_id=... |
List credential summaries without exposing keys. |
POST /api/v2/extract |
Upload a document, OCR it, route it, execute/dry-run, evaluate, and log. |
POST /api/v2/feedback |
Record happy/not-happy feedback and update learning signals. |
GET /api/v2/learning?user_id=... |
Read global and user-specific learning summaries. |
MCP Tools
| Tool | Purpose |
|---|---|
router_route_request |
Recommend the model before OCR/extraction/validation. |
router_execute_request |
Route and execute provider extraction, or dry-run without keys. |
router_list_models |
Browse model catalog, pricing, and capabilities. |
router_get_trajectory |
Inspect spend and step history for an extraction session. |
router_get_stats |
Aggregate routing stats and savings. |
router_estimate_cost |
Estimate document extraction cost across models. |
router_record_outcome |
Record eval feedback, validation status, latency, and cost. |
router_get_learned_scores |
Inspect adaptive model/task scores. |
v2_log_event |
Record V2 recommendations, clicks, evals, selections, and feedback. |
v2_evaluate_extraction |
Run deterministic rule checks on extraction JSON. |
Environment
Start with:
cp .env.example .env
Important production variables:
TRANSPORT=httpPORT=3100V2_CREDENTIAL_ENCRYPTION_KEYSUPABASE_URLSUPABASE_PUBLISHABLE_KEYSUPABASE_SERVICE_ROLE_KEYorSUPABASE_SECRET_KEYSUPABASE_DB_URL- Provider keys only for server-owned testing. In V2, end users can save their own keys during onboarding.
Never commit .env, .docrouter, uploaded documents, or local credential stores.
Documentation
| File | Contents |
|---|---|
| SYSTEM.md | Architecture, data flow, tool contracts, and core types. |
| DEVELOPMENT.md | Local setup, env vars, build commands, and testing. |
| docs/document-routing-logic.md | OCR-specific lookup table and routing heuristics. |
| docs/testing.md | Manual curl and smoke-test paths. |
| docs/extending.md | Add models, policies, task types, and tools. |
| docs/docker.md | Docker and deployment notes. |
| docs/troubleshooting.md | Common errors and fixes. |
Suggested GitHub Topics
ocr, document-analysis, document-ai, llm-router, model-router, model-routing, pdf-extraction, invoice-extraction, bank-statement-extraction, bank-statements, financial-documents, supabase, mcp-server, byok, typescript, express
Status
This is an early product build. It includes the router, dashboard, V2 BYOK flow, deterministic eval, Supabase migrations, demo assets, and dry-run mode. Real provider extraction requires user-supplied API keys or configured server/provider credentials.
Установка Ocr Document Analysis Model Router
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/sushii15/ocr-document-analysis-model-routerFAQ
Ocr Document Analysis Model Router MCP бесплатный?
Да, Ocr Document Analysis Model Router MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Ocr Document Analysis Model Router?
Нет, Ocr Document Analysis Model Router работает без API-ключей и переменных окружения.
Ocr Document Analysis Model Router — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Ocr Document Analysis Model Router в Claude Desktop, Claude Code или Cursor?
Открой Ocr Document Analysis Model Router на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Stripe
Payments, customers, subscriptions
автор: Stripemalamutemayhem/unclick-agent-native-endpoints
110+ tools for AI agents spanning social media, finance, gaming, music, AU-specific services, and utilities. Zero-config local tools plus platform connectors. n
автор: malamutemayhemwhiteknightonhorse/APIbase
Unified API hub for AI agents with 56+ tools across travel (Amadeus, Sabre), prediction markets (Polymarket), crypto, and weather. Pay-per-call via x402 micropa
автор: whiteknightonhorsetrackerfitness729-jpg/sitelauncher-mcp-server
Deploy live HTTPS websites in seconds. Instant subdomains ($1 USDC) or custom .xyz domains ($10 USDC) on Base chain. Templates for crypto tokens and AI agent pr
embeddedlayers/mcp-analytics
Statistical analysis, forecasting, and ML for business data (Shopify, Stripe, WooCommerce, eBay, GA4, Search Console). Upload a CSV or connect live data sources
автор: embeddedlayerscarrierone/verilexdata-mcp
20 structured datasets (NPI healthcare, SEC filings, OFAC sanctions, crypto whales, Polymarket signals, patents, economic indicators) via x402 pay-per-query wit
автор: carrieronetipdotmd/tip-md-x402-mcp-server
MCP server for cryptocurrency tipping through AI interfaces using x402 payment protocol and CDP Wallet.
автор: tipdotmdlaundromatic/shopgraph
Structured product data from the open web — Schema.org + AI extraction for e-commerce enrichment. Pay per call via Stripe. [shopgraph.dev](https://shopgraph.dev
автор: laundromaticmrslbt/xendit-mcp
Xendit payment gateway for Southeast Asia. Invoices, disbursements, balance checks, and bank transfers across Indonesia, Philippines, Thailand, Vietnam, and Mal
автор: mrslbt@arbitova/mcp-server
Non-custodial on-chain escrow + AI dispute arbitration for agent-to-agent USDC payments on Base. Seven tools covering the full EscrowV1 contract surface: create
автор: jiayuanliang0716-maxCompare Ocr Document Analysis Model Router with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории finance
