Skip to content
Is there an AI for this?

Model API

Document extraction with local parsing and a model API

Docling parses each document to markdown locally, a closed model API (GPT-5, Claude or Gemini) fills a JSON schema under structured outputs, code validates the result, and rows that fail go to a person. The pipeline and the parsing are yours; only the model is rented.

Source
Editorial recipe — no step evidence has been fetched yet
Verified
Evidence not verified
Confidence
Low

01Objective


02Recommended stack

5 components
RoleComponent
InferenceClosed model API (OpenAI, Anthropic or Google Gemini)
IngestionDocling
ObservabilityHuman review queue
OrchestrationExtraction pipeline (your own)
StorageObject storage (per-stage landing zone)

Architecture and data flow

Architecture for Document extraction with local parsing and a model API8 components in 5 layers. Trust boundaries: COMPANY NETWORK; VENDOR CLOUD · Model vendor cloud. External data transfer: YES. Data leaves the boundary drawn here.Operations team (exception queue)Docling (local OCR / parse)Extraction pipeline + review screenNormalisation + validation serviceExtracted records + exception queueObject storage (landing zone)Closed model under structured outputsOperations team (exception queue)Operations team (except…PEOPLEDocling (local OCR / parse)Docling (local OCR / pa…STORAGEExtraction pipeline + review screenExtraction pipeline + r…APPLICATIONNormalisation + validation serviceNormalisation + validat…RETRIEVALExtracted records + exception queueExtracted records + exc…DATABASEObject storage (landing zone)Object storage (landing…STORAGEVendor model APIINFERENCE SERVERClosed model under structured outputsClosed model under stru…MODELCOMPANY NETWORKVENDOR CLOUD · Model vendor cloudHTTPSCONFIDENTIALdocuments to indexCONFIDENTIALquestion + user groupsCONFIDENTIALdocuments + permissionsCONFIDENTIALchats, users, settingsPERSONALoriginal filesCONFIDENTIALprompt + retrieved passagesCONFIDENTIALloaded weightsEXTERNAL DATA TRANSFER · YES

Components

  • Operations team (exception queue) — people
  • Docling (local OCR / parse) — storage
  • Extraction pipeline + review screen — application
  • Normalisation + validation service — retrieval
  • Extracted records + exception queue — database
  • Object storage (landing zone) — storage
  • Vendor model API — inference server
  • Closed model under structured outputs — model

Connections

  • Operations team (exception queue) to Extraction pipeline + review screen — HTTPS (confidential data)
  • Docling (local OCR / parse) to Normalisation + validation service — documents to index (confidential data)
  • Extraction pipeline + review screen to Normalisation + validation service — question + user groups (confidential data)
  • Normalisation + validation service to Extracted records + exception queue — documents + permissions (confidential data)
  • Extraction pipeline + review screen to Extracted records + exception queue — chats, users, settings (personal data)
  • Normalisation + validation service to Object storage (landing zone) — original files (confidential data)
  • Normalisation + validation service to Vendor model API — prompt + retrieved passages (confidential data)
  • Vendor model API to Closed model under structured outputs — loaded weights

External data transfer · YES

  • confidential content leaves your control on the Normalisation + validation service → Vendor model API link.
  • Parsing runs on your own machines; the model call sends the parsed text to the vendor, and that text is the content — the transfer to govern by contract.
  • The originals never leave the landing zone; only the extracted text is sent, and only to fill the schema.

03Suitable for

Organisation size
10–5000 employees
Data classes
confidential, personal
Constraints
a team that can build and run a small pipeline, or an implementation partner who will; a paid business account with the model vendor; agreement that the parsed document text may leave the network under contract
Industries
Professional services, Accounting, Logistics, Financial services, Technology
Jurisdictions
any

04Hardware

No hardware profile was sized for this answer.

Indicative costUSD · one-off plus monthly

Software
Docling is MIT-licensed and the pipeline is yours. What you pay the model vendor is metered and sits on the model line.
US$0
Model usage
Not estimated here: priced per token — see the cost section, which multiplies a fetched price by the usage band read from your brief. Nothing in this seed asserts a price.
Not estimated
Parsing compute and storage
Not estimated: Docling runs on CPU for most formats (a GPU speeds up VLM parsing of scanned documents), plus object storage per gigabyte. Priced per your own infrastructure — it scales with document volume, not user count.
Not estimated
Implementation (6–16 FDE-days)
6–16 FDE-days at US$760–1940 per day, converted from the HK$6,000–15,000 band at the HKMA Linked Exchange Rate band of HK$7.75–7.85 to one US dollar. One-off; excludes internal staff time.
US$4,560 – US$31,040
  • The model line is the metered one and scales with document volume; the cost section computes it from a fetched price and the usage band.
  • Implementation covers the parsing stage, the schema and extraction, validation, the review queue and an accuracy measurement; it excludes the metered model bill.
  • Assumes a system to write the validated records into already exists.

05Difficulty

3 / 5

A project week with Linux, Docker and GPU experience


06Skills

API integrationapi-integration
development
Data engineeringdata-engineering
data
OCR and document parsingocr
ml
Prompt engineeringprompt-engineering
ml
Pythonpython
development
Security hardeningsecurity-hardening
security

07Deployment steps

7 steps

Commands are copied from each project’s own documentation, and the page they came from is linked under the step. 0 of 7 steps currently open an evidence record. The rest are linked to their source; §10 says which of those documents were fetched and which were fetched without their anchor being found — two different states, named differently there.

  1. 01

    Parse each document to markdown with Docling, locallyversion-sensitive

    Assessment

    Run Docling on your own machines so the reading happens before anything leaves the network. It offers "extensive OCR support for scanned PDFs and images" and "local execution capabilities for sensitive data and air-gapped environments"; the CLI over a file "generates a .md file in the current directory containing structured document content". Parse once and keep the markdown.

    pip install docling
    docling ./inbox/invoice-0001.pdf

    writes structured markdown next to the input

    Source documentation

  2. 02

    Keep a replayable landing zone

    Assessment

    One bucket per stage — arrived, parsed, extracted, failed — with versioning and a lifecycle rule. Because Docling’s parse runs locally and is deterministic, keeping the originals and the markdown means a schema change or a model swap is a re-run over what you already have, not a fresh request to the business.

    Source documentation

  3. 03

    Have the model fill a JSON schema, not write proseversion-sensitive

    Assessment

    Send the parsed markdown, not the raw image, and constrain the output to a schema. OpenAI describes structured outputs as "a feature that ensures the model will always generate responses that adhere to your supplied" JSON schema; the other vendors have the same capability. Feeding text rather than an image keeps the reading and the normalising separately debuggable.

    Source documentation

  4. 04

    Check in code what the schema cannot guarantee

    Assessment

    A schema-conformant answer is not a correct one: structured outputs guarantee the shape, not the truth. Totals that add up, dates that parse, a supplier that exists in your master data, a currency the contract allows — all of that is arithmetic and lookups, and belongs in code after the model. Record every failed check against the document.

    Source documentation

  5. 05

    Route validation failures to a person

    Assessment

    Rows that fail a check go to a review queue rather than through. Sort the queue by the reason it failed, not by arrival time, and keep the reviewer’s correction — it is the ground truth you measure against and the training data for the next prompt iteration.

    Source documentation

  6. 06

    Verify the vendor’s data terms before real documents flowversion-sensitive

    Assessment

    Only the parsed text reaches the model, but that text is the document. Before real content goes near the endpoint, confirm the commercial data terms: Anthropic states that "by default, we will not use your inputs or outputs from our commercial products" to train, and OpenAI’s enterprise page describes commitments giving you "ownership and control over your business data". Check whether a zero-data-retention mode exists on your account.

    Source documentation

  7. 07

    Measure field-level accuracy on a labelled sample

    Assessment

    Report accuracy per field, not per document: a pipeline that reads the invoice number right 99% of the time and line quantities right 80% has one number worth quoting and one worth fixing. Because Docling’s OCR is deterministic, hold back a labelled set the pipeline never tunes on and re-run it whenever the model version or the prompt changes.

    Source documentation


08Compliance considerations

Structured issue-spotting to support your own review — not legal advice. Verify against the cited primary sources and your counsel.

Applies everywhere

  • Prompt leakage · Confidentialityhigh

    Parsing locally does not keep the content in: the parsed text is sent to the model vendor, and it is the document. Decide what document types may go to the API, and keep anything under a duty of confidence out unless the contract and consent allow it.

  • Data processing agreement · Subprocessors · Model traininghigh

    You need a DPA that covers the API, the subprocessor list, and the no-training default for the plan you buy. Anthropic states it does not use commercial inputs or outputs to train by default; confirm the equivalent for whichever vendor you call and whether a zero-data-retention mode is available.

  • Human oversight · Automated decision-makinghigh

    A schema-conformant extraction can still be wrong. Where an extracted value drives a decision about a person, the code validation and the human-review queue are the oversight step — keep the record of who reviewed and corrected what.

  • Personal data · Retentionmedium

    The landing zone holds the originals and the parsed text, both often personal data. Apply retention to every stage — arrived, parsed, extracted, failed — not only the final records, and minimise what the pipeline keeps.


09Alternatives


10Evidence

0 of 6 fetched

11Community

Deployed this stack, or hit something this page does not cover? Corrections, sources and implementation reports are what keep a recipe worth reading.

Improve this page

Sign in to contribute

From the field

0 deployments · 0 questions

Nobody has reported deploying this here yet, and no question has been opened against this page. Both appear once a reviewer accepts them.


12Hire an FDE

If you would rather not build it, we can introduce a forward-deployed engineer who has deployed this stack before. The enquiry form starts from this recipe.