The problem
Small and medium businesses in Chile work with documents written in English: equipment manuals, datasheets, procedures, supplier material. Translating them into Spanish meant an agency (slow, and expensive for a few pages), a freelancer (slow, and needs coordinating), or pasting text into a chatbot and losing the tables, figures and layout, with nobody checking the result.
TraduFlow was meant to sit between those options: a flat monthly subscription (14,990 CLP, about USD 16, for 200 pages), priced to sit below petty-cash and single-card approval thresholds, so a team could pay for it without a purchasing process. Not only that, but it would also issue invoices directly to the SII (Chilean tax authority).
It takes a PDF and returns a translated PDF with the same content in the same order (headings, tables, lists and figures), re-typeset into a clean standard layout, plus automatic checks for the errors that matter most in technical documents: an inverted safety instruction, a changed number, a dropped warning.
What I built
TraduFlow has two parts: a web app where customers upload PDFs and track jobs, and a pipeline worker that does the translation. They never call each other directly. They communicate through the database and events.
- Web app: Next.js on Vercel. Upload and job status. Accounts and payments were designed but not built.
- Database and storage: Supabase (Postgres + Storage). Jobs, quota, tenants, and every file the pipeline produces.
- Orchestration: Inngest. Each document is one function run, and each pipeline stage is a step with its own retries.
- Worker: Python (FastAPI) on Google Cloud Run. It runs every step and calls the AI providers.
The pipeline
- 01Pre-flightpypdfium2
- 02ParseLlamaParse
- 03Figure textGemini
- 04QuotaPostgres
- 05TranslateClaude
- 06Semantic QAGemini
- 07RenderAPI2PDF
-
Pre-flight. Checks file size, page count, the word count of the PDF's text layer and the customer's remaining quota before anything paid runs. The upload screen waits for the result. Its main goal was to stop documents with over the maximum amount of allowed words fast and cheaply.
-
Parse. LlamaParse converts the PDF into Markdown, with tables as HTML and figures as image files.
-
Figure text. Gemini reads each image and extracts the English text inside it (labels, callouts). The images themselves are never edited: their text is translated and shown as a legend below them. Identical images are detected and labelled once.
-
Quota. The total word count includes everything the pipeline extracted: text from the parser (step 2, including scanned pages with no text layer) and text inside images (step 3). That total decides what the document costs. If it's over the limit, the text is cut at a block boundary to prevent costly retries. It never cuts inside a table or list, and the quota is reserved.
-
Translate. Claude (Haiku, or Sonnet for longer documents) translates numbered text segments, not the whole document, so it never touches tables, tags or markup (which also keeps them out of the input tokens).
-
Semantic QA. Gemini compares source and translation for inverted instructions, changed numbers and omissions.
-
Render and deliver. The translation becomes HTML, then a PDF through API2PDF, with an appendix listing every QA flag. The quota is committed only when the PDF is safely stored.
How the design changed
The first idea was a pipeline that translated a file and added a QA stage: flagged jobs paused so the user could approve each flagged item (useful for false positives), remove it, or edit it themselves.
I soon realized that an automatic pipeline couldn't produce an identical copy of every document. Spanish runs longer than English, so translated text would overflow its space in the best case, and push tables and figures out of place in the worst.
So I made that limitation part of the product and called it "document standardization": the output is re-typeset into a clean template in a standard page size, instead of copying the original layout. It also set the price. I couldn't charge much for that kind of output, both for market positioning and because of liability.
I also considered letting QA fix errors on its own: when too many flags clustered in one area, that part would be re-translated, up to a set number of attempts, since a cluster suggested the whole passage might be compromised. I dropped it. Retrying in the same call invites the model to overcorrect; retrying in a fresh call loses the document's context and terminology; and repeated rolls drift away from what was right to begin with. The flags themselves came from a model and included false positives, so there was no reliable signal to tell an improvement from a regression.
At the same time I realized customers wouldn't want to review flags themselves either, so I removed the blocking QA step entirely: flags are listed in an appendix and the document is delivered immediately.
Design decisions
The model never sees the document's structure. The Markdown is split into a skeleton (tables, lists, image tags, markup) and numbered text segments. Claude receives only [n] text lines and returns them translated, and the document is reassembled deterministically. The model can't break a table it never received. A structural fingerprint compares source and output, and any mismatch triggers a retry.
Numbers, codes and links are checked, not trusted. Every segment is fingerprinted for numbers, codes, URLs and inline formatting. Segments that fail are retried with their neighbours as context.
QA informs; it doesn't block. QA flags go into the PDF appendix and the document is delivered. A reader can check the risky parts without waiting on anyone.
Retries never charge twice. Each step writes its output to storage before reporting success, so a retry resumes from the failed step instead of repeating paid calls. Quota works like a ledger: reserved, then committed on delivery or released on failure, all in single database transactions.
Provider problems hold the job instead of failing it. An empty rendering balance or a reached spend cap doesn't use up retries. The job waits, rechecks every hour and alerts the operator, then gives up after 24 hours.
Every job knows what it cost. Tokens and provider costs are recorded per document from day one, because the margin estimates rested on assumptions that had to be measured.
Beyond the pipeline (designed, not built)
- Quota rule, chosen with a cost model. A document costs
max(words ÷ 500, visual pages ÷ R)quota pages, never the sum of the two. Parsing is billed per visual page, so without the page term a 100-page file with almost no text would cost cents to the customer and dollars to me. I built a cost model to compare values of R. It showed the worst case wasn't at zero words but where both terms are fully used (about 500 ÷ R words per page), and that R = 4 protected the margin best: no more than 4 pages parsed per quota page charged. I also used ceiling division instead of floor, so a 9-page file couldn't ride on one quota page. - A guest trial as the only free tier. No email: an anonymous session, 3 pages and 1,000 words, a watermark, a daily page pool for all guests and a per-IP limit with hashed IPs.
- Dropping the registered free trial. An earlier plan gave registered users 10 pages, 5 MB and 20 visual pages free in exchange for marketing emails. I cut it for three reasons: cost, the legal risk of making consent to marketing a condition of the trial, and because the guest trial already did the job of converting visitors.
- Payments and accounts. Paying customers would give the company RUT (Chilean tax ID) and the RUT of the person operating the account, who guaranteed their authority to act for that company. Payments were planned as a bank-account direct debit through Fintoc instead of cards, to avoid chargebacks on a low-price plan, with invoices issued to the SII.
- Terms and privacy policy, drafted myself, so a lawyer would only need to review them.
Testing
Testing followed a ladder. Each rung had to pass before the next, and each one adds more real infrastructure than the last.
Offline first. Every pipeline module had its own test script with the AI providers faked. The orchestrator was tested against a fake Inngest context that reproduced per-step retries, memoization and unique step IDs, so retry and resume behaviour was verified before any real service was involved.
- Rung 1: one live call per provider. LlamaParse, Gemini, Claude and API2PDF, each called once with real credentials to confirm requests, responses and error handling. All passed. Two API changes surfaced here: Anthropic had removed the sampling parameters (temperature, top_p, top_k), and an empty API2PDF balance comes back as HTTP 401, which the error mapping then had to treat as a hold.
- Rung 2: the full pipeline, locally. Real documents through every step on my machine, from parse to finished PDF. The pipeline ran end to end without errors.
- Rungs 3–4: deployed. The worker was deployed to Cloud Run during setup, but the full pipeline never ran there. I stopped before these rungs, because rung 2 had already answered the question that mattered.
The test documents were real business documents with designed layouts rather than clean samples: a two-page printer quick-setup guide, and a twelve-page equipment manual laid out as double-page spreads, whose text was drawn as vector shapes, with a poor hidden OCR layer.
Rung 2 worked mechanically. The output is what ended the project.
Where it broke
Translation was never the problem. The model translated what it received, the segments came back intact, and every structural check passed. What failed was the step before: reading the document.
The printer quick-setup guide (2 pages, real text layer, dense designed layout) came out as 16 pages. LlamaParse placed image references into the text at the wrong positions, about 21 of 70. I tried every LlamaParse tier (cost-effective, agentic, agentic plus). None fixed it.
The equipment manual (12 double-spread pages, vector-drawn text, bad hidden OCR layer, written in poor English) cost $0.245, took about 6 minutes and finished with status COMPLETED and 0 QA flags. The result was 52 pages and seriously wrong:
- The parser invented data. LlamaParse turned three figures into tables of values that appear nowhere in the document: hourly readings for two charts and a resonance-peak table for a third. Other figures became empty tables, and one legend table was duplicated.
- The figure reader invented text. On small image crops, Gemini Flash-Lite "read" labels that don't exist: a model number and date, a "TOSHIBA Laser Power Controller". They were rendered in the output as translated figure text.
- Layout fell apart. Images were misplaced again, headings in other languages were left untranslated, and raw LaTeX appeared in the output.
- Bad English was translated literally. The translator faithfully reproduced the source's mistakes instead of their meaning.
It wasn't one bad parser
A fair question is whether I just picked the wrong parser. So I went back to Azure Document Intelligence (ADI), the closest thing to what I had wanted: every paragraph with its position on the page, plus colors, bold, tables and even the QR code. To see how far that gets, I rebuilt both documents using only ADI's output, with figures cropped from the original at the coordinates it returned.
On the manual, the text was nearly good enough to translate: the right paragraphs in the right order across the spreads, and a 37-row table with merged headers read correctly. But it also invented a paragraph out of a watermark ("50450klar withisreduced 480m,while remain"), merged separate list items into one, and on the printer guide it read a numbered badge as an image and icons as punctuation. More options didn't converge on a correct reading either: barcode detection recovered the QR code, while formula detection turned ordinary sentences into LaTeX and dropped them from the text.
Original

Rebuilt from ADI's output

Original

Rebuilt from ADI's output

Excerpts from the Brother SP-1 Quick Setup Guide (D0330U001-00), shown for comparison only. Not affiliated with or endorsed by Brother.
ADI made smaller mistakes than LlamaParse, but the same kind: wrong in places, with nothing in the output saying where. The only thing that catches those is a model that looks at the page and the parse together. And a model that can do that can read the page itself, as the comparison below shows. A better parser wouldn't have saved the pipeline. It would have just made the same check slightly cheaper.
Why every check passed
The QA step and the number checks compared the translation against the parser's output, and the parser's output already contained the invented content. The checks verified that the translation was faithful to the wrong thing. A pipeline can be correct at every step and still deliver a document that misrepresents the original.
The design assumed that a plainer document in the right reading order would still carry the same information. Rung 2 showed two problems with that. On designed pages the parser's reading was unreliable, and even a correct order couldn't save complex layouts: flattening everything into a single column removed the spatial relationships the page depended on, such as callouts next to the parts they label, side-by-side panels and legends tied to one figure. Information that belonged together ended up apart. On simple black-on-white documents the approach worked, but those are also the documents anyone can translate by copying the text.
The comparison
I sent the same two documents to Claude Pro, the $20-a-month chat subscription, with a one-line prompt: "Tradúcelo al español".
The two-page printer guide took about 7 minutes and came back as a near-perfect in-place translation. Claude didn't parse the document into text at all. It wrote a script that erased the English from the original PDF and placed the Spanish into about 100 text boxes, choosing each position by looking at the page itself. The result kept the original design, with only minor issues.
Original

Claude Pro

TraduFlow

Excerpts from the Brother SP-1 Quick Setup Guide (D0330U001-00), shown for comparison only. Not affiliated with or endorsed by Brother.
The equipment manual came back as a 24-page A4 rebuild in HTML that followed the original page by page:
- real tables, including merged cells
- figures cropped from the original, with their labels translated in the captions
- the meaning of the bad English fixed rather than reproduced ("midcourt line" became conductor neutro, the neutral wire)
- a list of every correction it had made to the source
| TraduFlow pipeline | Claude Pro | |
|---|---|---|
| Printer guide (2 pages) | 16 pages, images misplaced | In-place translation, original layout kept |
| Manual (12 double spread pages) | 52 pages, invented tables and figure text | 24 faithful pages, real tables, figures cropped |
| Bad source English | Translated literally | Meaning fixed, changes disclosed |
| QA result | 0 flags, every check passed | No QA step; corrections stated |
| Cost | ~$0.25 per document | Part of a $20 monthly subscription |
The difference is in how each one reads the page. My pipeline handed the document to a parser and trusted its text. Claude looked at the page images, worked out the layout itself and wrote code for each specific document. A frontier model with vision and code execution did the step that no dedicated parser could.
It isn't a product, though. Each run is improvised: a different method per document, a few minutes of work, no guarantee of the same approach twice, and the usual limits of a chat session on very long files. But for a company translating a handful of documents a month, it already beats what TraduFlow offered, for about what TraduFlow would have charged.
What I got wrong
I treated reading the document as solved. The whole architecture assumed a parser would turn a PDF into reliable text and structure, and that the hard parts came after: translation, checks, retries, cost. I spent most of my engineering on the downstream steps and tested parsers mainly on tables, where even the best one passed every structure but turned a column of ticks and crosses into all crosses. The failures were upstream, on designed layouts and bad text layers: the documents businesses actually send. The risk wasn't unknown: my own Terms warned that images could be omitted or misplaced, and that text inside images had a higher error rate. I had accepted those as edge cases under "review before use". Rung 2 showed they were the normal case.
I verified against the wrong source. Every check compared the translation with the parser's output, so when the parser invented content the checks protected the invention. The rule I'd apply now is to verify against the page image, never against an intermediate representation of it. Even the best parser I tested made errors it didn't flag.
I misjudged the gap with the real competitor. I knew a frontier AI subscription was the alternative, and that translation and formatting are easy for those models. My bet was that my output would be somewhat worse but close, maybe 80% of what a frontier model produced, and that a lower price, SII invoicing and a streamlined process would cover the difference. That only works if parsing holds up. On complex documents it didn't, and the gap was much bigger than 20%, too big for price or convenience to make up. And a product built on top of frontier models has a price ceiling of roughly that subscription, while its cost floor is the same models plus parsing and rendering. The margin in between was too thin for what it had to cover.
The decision
After the tests I listed five options:
- Rebuild around an agent. Give a frontier model vision and code execution through the API, the way Claude Pro had worked, and add my own layer on top: glossaries, verification against page images, volume handling, invoicing. The cost per page was unknown, the price was still capped by the subscription it imitated, and the product would have been a thin wrapper over a frontier model that everyone has access to.
- A human-in-the-loop service. An AI draft signed off by a translator, selling responsibility and turnaround instead of automation.
- A narrow niche. Use the pipeline less as a translator and more as a converter: documents that come from other countries and have to follow a Chilean standard, filled into a template built in advance for that standard.
- Simple documents only. A pipeline limited to plain documents: black text on a white background, single column.
- Stop the product and keep it as a case study.
I stopped. Option 1 meant competing with the platform I'd be building on. Option 2 was viable, but as a service, not as software, and it didn't need the platform I'd built. Option 3 still depended on reading the source documents reliably, which was the part that had failed; a fixed template only helps once the content has been extracted correctly. And for option 4, countless services already do that, and word processors now include it by default.
Stopping was cheap because the project was built to find out. Rung 2 cost cents per document, each comparison run took minutes, and nothing had been sold or promised to customers.
What this shows
- Building on LLMs, not just calling them. Multi-provider orchestration (Claude, Gemini, LlamaParse, API2PDF) with fallbacks, error mapping and holds; segment-based translation that keeps the model away from structure it could break; deterministic checks around every model output.
- Backend work that survives failure. Event-driven steps with retries, durable artifacts and resume-from-failure; a quota ledger with reserve, commit and release in single transactions; multi-tenant data with row-level security; cost recorded per job.
- Evaluating document AI honestly. Concrete failure modes (invented tables, invented figure text, misplaced images), why parser benchmarks don't measure reconstruction (I rebuilt pages from a parser's own output to see what it actually captured), and the principle of verifying against the page image rather than the parser's output.
- Product judgment. Unit economics against the real alternative, a direct test against it, and the decision to stop when the evidence said so. I also drafted the Terms and Conditions myself, so a lawyer would only need to review them rather than write them from scratch.
Closing thoughts
I built TraduFlow soon after getting my Translation degree, and as such, I had a rather naive idea of what the valuable part of translating was.
Because my formal training and academic background placed most of the importance on the semantic transfer between languages, I saw translation as the product. If the text was translated well, a low price would make the purchase easy, even if the layout wasn't a perfect copy.
But plain text translation has been a commodity for years. I ignored that tools like this already existed and that it's also a small part of what a subscription to a frontier LLM already does.
I realized part of that, and intended the distinction of TraduFlow to be the affordable price (priced < 20 USD), the streamlined processing of documents, and the issuing of invoices to the SII.
I also misjudged how many documents the pipeline could handle well: the floor of acceptable documents was much higher than I expected.
However, my biggest problem was another.
I had an assumption most translators share: that what clients pay for is the translation itself, moving meaning from one language to another. That part is now nearly free. A frontier model does it well enough for most documents, and companies with an AI specialist can do it in-house.
What clients actually pay a translator for is accountability: a third party who stands behind the text and answers for it if something goes wrong. That's why companies still buy translation as a service instead of doing it themselves. An automated pipeline removes the cost, but it removes the accountability with it, which was the part that made the service worth buying.
Even a perfect pipeline wouldn't have changed that. With a frontier model checking every page, the output would be the same black box the client already has in their own subscription, with no one standing behind it either. At that point the only thing left to compete on is price, and reselling the same models, I couldn't sell the same capability for less than the client already paid for it.
So the question was never only "can the pipeline parse this file?" but "what is the customer buying?". I answered the first and assumed the second.
I build applications on top of LLMs and test where they fail. A background in translation means I know what a correct output looks like, which is how I could tell this one wasn't. If you're working on document AI, LLM evaluation, or products where models meet real-world documents, I'd like to hear from you.
The code is in a private repository, available on request.