DIY LLM Extraction Pipeline vs Managed Service: True Cost Math
Someone on your team ran twenty invoices through a model, got clean JSON back, and calculated that the whole backlog would cost about eleven dollars in tokens. That number is real. It is also the smallest line item in the project, and the gap between the token estimate and the actual cost of running a pipeline in production is where these decisions go wrong.
Short Answer
Model tokens for document extraction cost single-digit dollars per thousand pages at Flash-tier rates. Engineer build time, retry overhead, QA labor, and ongoing maintenance cost several orders of magnitude more, and they show up whether you process 500 pages or 500,000. Building pays when your volume is high, sustained, and homogeneous enough that the fixed cost amortizes. Below that, you are paying an engineer's salary to avoid an invoice.
The Cost Model at a Glance
| Cost line item | DIY LLM pipeline | Managed service |
|---|---|---|
| Model tokens | Roughly $5 to $10 per 1,000 pages at Flash-tier rates | Included in the quoted price |
| Build time | Weeks of engineer time before the first clean file ships | None |
| Retries and reruns | You pay for every failed call and every schema change | Absorbed by the vendor |
| Accuracy testing | You build the eval set and label the ground truth | Vendor's problem |
| Human QA | You staff it, or you ship the errors | Included in the price |
| Maintenance | Ongoing, indefinitely | None |
| Cost shape | High fixed, near-zero marginal | Zero fixed, higher marginal |
| Time to first usable output | Weeks | Days |
| Who gets paged when it breaks | Your engineer | Not your engineer |
Have a messy PDF? Upload 1-3 sample pages and we will tell you if it is clean, OCR-heavy, or needs human QA.
What Tokens Actually Cost
Start with the number your team already calculated, because it is worth getting precise about how small it is.
Google's documentation states that each PDF page sent to Gemini counts as 258 tokens, with a ceiling of 1,000 pages or 50MB per file. At Gemini 3.5 Flash list pricing of $1.50 per million input tokens, the page itself costs about $0.0004. Add your prompt and JSON schema, call it $0.001 of input per page.
Output is where the money actually goes. Gemini 3.5 Flash charges $9.00 per million output tokens, six times the input rate. A structured extraction of an invoice with line items might return 400 to 800 output tokens, which lands around $0.004 to $0.007 per page. Total: somewhere near $0.005 to $0.008 per page, or $5 to $8 per thousand pages, before retries. The Batch API cuts that in half if you can tolerate delayed processing.
For comparison, Amazon Textract lists Analyze Expense at $0.01 per page and the Forms feature at $0.05 per page in US West. A general-purpose LLM doing structured extraction is in the same cost neighborhood as a purpose-built document API, sometimes cheaper.
So at 10,000 pages a month, your model spend is roughly $50 to $80. That is the entire variable cost of the thing everyone is arguing about.
The Line Items Nobody Budgets For
The US Bureau of Labor Statistics put the median annual wage for software developers at $133,080 in May 2024, which is $63.20 an hour of direct wage before benefits, payroll taxes, equipment, and management overhead. Every hour of build time is worth more than a thousand pages of tokens. Here is what those hours go toward.
Ingestion and preprocessing. Native-text PDFs are easy. Scans, faxes, photos taken at an angle, password-protected files, and 300-page multi-document bundles are not. You need an OCR fallback path, a page splitter, and a rule for deciding which path a given file takes.
Schema and prompt iteration. The first prompt works on the twenty documents you tested. Document twenty-one has a credit memo, a foreign currency, or a line item that wraps across a page break, and you rewrite the schema. Every schema rewrite means reprocessing the corpus you already ran.
Retries and failure handling. Structured output calls fail. Models return malformed JSON, time out mid-page, hit rate limits, or drop a field. A production pipeline needs retry logic with backoff, and the retries are billed. Effective token spend is a multiple of the naive per-page figure, not the figure itself.
An eval set. You cannot know whether accuracy is 91% or 99% without hand-labeled ground truth to measure against. Building that set is manual work, and it needs refreshing whenever your document mix shifts.
Human QA. This is the line item that most DIY estimates omit entirely, and it is usually the largest recurring cost. Extraction models fail quietly. They return a plausible number in the right field rather than an error, which means a confidence threshold alone will not catch the misreads that matter. Somebody has to look at flagged output. That somebody costs money every month, forever.
Babysitting. A provider deprecates a model version. A vendor redesigns their invoice. A quarter-end batch arrives at 4x normal volume and hits a rate limit. None of these are hard problems. All of them consume an engineer's afternoon at an unpredictable moment.
A Worked Model
The hours below are placeholders, not benchmarks. Replace them with your own team's estimates. The point is the ratio, not the totals.
| Year one line item | Illustrative hours | Cost at $63.20/hr direct wage |
|---|---|---|
| Discovery, schema design, sample review | 20 | $1,264 |
| Ingestion, OCR fallback, prompt build | 80 | $5,056 |
| Validation rules, retries, error handling | 60 | $3,792 |
| Eval set and accuracy measurement | 40 | $2,528 |
| Deployment, monitoring, alerting | 30 | $1,896 |
| Maintenance at 4 hours per month | 48 | $3,034 |
| Engineer time subtotal | 278 | $17,570 |
| Model tokens at 10,000 pages/month | n/a | ~$780 |
| Human QA labor | Not included above | Your largest recurring cost |
Tokens come to roughly 4% of the engineering line, and that is before you staff review. Note also that the direct wage understates the real number. Loaded cost including benefits, taxes, and overhead typically runs well above the base wage, and the opportunity cost of what that engineer would otherwise be shipping does not appear on any invoice.
Where the Crossover Actually Is
The arithmetic is simple once you have a quote in hand. Take your first-year build and maintenance cost, then divide by the difference between the managed per-page rate and your true DIY per-page cost.
At an $18,000 build cost and a managed rate of $0.50 per page, you break even around 36,000 pages in year one, roughly 3,000 pages a month. At $0.15 per page, break-even moves to about 120,000 pages, or 10,000 a month. Run the division with your own quote rather than trusting either vendor's framing.
Three things move the crossover against building. Layout variety raises build and maintenance hours without raising volume. A high accuracy bar means QA cost scales with pages, so it never amortizes away. Spiky volume means you carry the fixed cost through quiet months.
Three things move it toward building. Sustained high volume with a stable document mix. Data that genuinely cannot leave your environment for regulatory reasons. Extraction that is part of the product you sell rather than back-office plumbing, in which case owning it is a strategic call, not a cost one.
When Neither Option Is Right
If you have one document layout from one sender at high volume, skip both. A commodity API or a template-based tool will beat an LLM pipeline on cost and beat a managed service on unit price, because you are paying for flexibility you do not need. Textract Analyze Expense at $0.01 per page exists precisely for that case.
If you need results inside a week, or you need someone to check the output before it reaches your ledger, a managed service is the honest answer. We deliver clean Excel and CSV with humans reviewing the AI output, which is the QA line item you would otherwise be hiring for.
Frequently Asked Questions
Is token cost really the smallest line item?
For document extraction at typical business volumes, yes. At Flash-tier rates a page costs well under a cent, so 10,000 pages a month is a $50 to $80 bill. A single engineer-week of build time costs more than a year of that token spend. Token cost only becomes the dominant line at very high volume with a fully built and stable pipeline.
We already have engineers on payroll, so is the build free?
No. Their time is already paid for, but it is not free, it is allocated. The relevant question is what they would otherwise ship that quarter. Extraction pipelines are also poor projects for generalist engineers because the hard part is not the model call, it is the long tail of document weirdness, which only surfaces after you are in production.
Can we start managed and build later?
That is often the cheapest sequence. Running a managed service first gives you a real corpus, a real error profile, and verified output you can reuse as labeled ground truth for your eval set. Building against known-good data is substantially faster than building and discovering your accuracy problems in production.
Does a DIY pipeline produce less accurate results?
Not because of the model. Accuracy differences come from the review layer, not the extraction call. A DIY pipeline with a serious QA process can match anything. A DIY pipeline without one ships confident wrong numbers, which is worse than an obvious failure because nobody catches it until reconciliation.
Ready to Convert Your Documents?
Stop wasting time on manual PDF to Excel conversions. Get a free quote and learn how DataConvertPro can handle your document processing needs with AI-assisted extraction and human verification.