AI data extraction with Cloudflare Clairic: the cost, the accuracy and the Worker that runs it
An extraction model that bills only for what it reads changes the arithmetic of keying invoices by hand. Here is the bill at your volume, a review rule you can set per field, and the code to try it today.
What does AI data extraction with Cloudflare Clairic cost, and how accurate is it?#
Clairic bills input tokens only, $0.100 per million on Cloudflare's Workers AI pricing page in October 2026, so 10,000 documents of 8,192 tokens cost $8.19 a month. That is the whole bill for the model, because Clairic writes no tokens back. Instead, it returns typed values: text, numbers, dates, lists and estimates, each one shaped by a field you define.
But accuracy is a different matter, and Cloudflare says so itself. Its extraction models page, updated 19 October 2026, puts it plainly. "Typed results provide a predictable structure but do not guarantee correctness." So a well-formed answer can still be the wrong answer. For that reason, every text, number and date answer carries two scores. One is a confidence, and the other is a p_null, the chance the value is not in the input at all.
So the rest of the argument follows from those two facts. First, the bill is small enough that cost rarely decides the project. Then accuracy has to be measured on your own documents, field by field. Finally, the scores decide which fields a system can trust and which ones a person checks.
What does a month of document extraction automation cost at your volume?#
On Cloudflare's October 2026 Clairic rate, 1,000 full-pass documents a month cost $0.82 and 200,000 cost $163.84, and about 134 a day fit inside the free allocation. So at published rates, the model bill for document extraction automation stays small. It reaches double digits of dollars only once volume passes tens of thousands of documents a month.
Your monthly Clairic model bill
Set your documents per month and tokens per document. The defaults are the worked example below: 10,000 documents of one full 8,192-token pass each.
Monthly Clairic model bill
$8.19
- Input tokens a month, in millions
- 81.9
Monthly Clairic model bill at Cloudflare's October 2026 rate of $0.100 per million input tokens, an estimate before the free allocation. Source: Cloudflare, Workers AI pricing and Clairic model documentation, October 2026. Modelled, not measured.
Take an accounts payable team as the worked example. Say it reads 10,000 invoices a month. From each one it pulls the invoice number, due date, total, contacts and purchase order number. Assume each invoice becomes one full 8,192-token pass, the pass size on Cloudflare's Clairic model page of 19 October 2026. Then the month is 81.92 million input tokens, so at Cloudflare's October 2026 rate of $0.100 per million it costs $8.19.
Behind that rate, Workers AI bills in Neurons, its own unit of compute. Cloudflare's pricing page, read in October 2026, charges $0.011 per 1,000 Neurons. It rates Clairic at 9,091 Neurons per million input tokens. The same page gives every account 10,000 free Neurons a day. As a result, on that October 2026 page's rates, about 1.1 million Clairic input tokens a day cost nothing, which is 134 full-pass documents.
| Inside the free allocation | Per day |
|---|---|
| Input tokens per day inside the free allocation | 1,099,989 |
| 8,192-token documents per day inside it | 134 |
Also, two cautions keep the estimate honest. First, the free Neurons are shared with every other Workers AI model on the account. Second, converting files to text is a separate step. Cloudflare's Markdown Conversion page, updated 21 April 2026, says toMarkdown, its file-to-text converter, "is free for most format conversions". But image conversion uses Workers AI models, and those may add cost.
Why does a typed extraction model cost less than an LLM writing JSON?#
On Cloudflare's October 2026 pricing, GLM-5.3 output costs $4.400 per million tokens, while Clairic charges $0.100 per million input tokens and nothing for output. A generative model pays for every token of the JSON it writes. Because a single-pass extraction model writes none, the output side of the bill disappears.
Show data table
| Item | US dollars per million tokens |
|---|---|
| Clef-flash input | 0.038 |
| Clairic input | 0.1 |
| Clef input | 0.24 |
| GLM-5.3 input | 1.4 |
| GLM-5.3 output | 4.4 |
GLM-5.3 output at $4.400 is the tallest column, and Clairic has no output line at all.
Here GLM-5.3 is a general text model on Workers AI. Structured data extraction with a large language model (LLM) like it usually means JSON mode. JSON is JavaScript Object Notation, the plain text format most systems read. Cloudflare's JSON Mode page shows the pattern. You pass a response_format with a json_schema, and the model writes the object one token at a time. So every brace, key and value in that reply is an output token.
Instead, Clairic works another way, and Cloudflare's launch post of 19 October 2026 says it "only processes input tokens with a single forward pass". As a result, it has no charge for output tokens. The answer comes back as typed values, not as text for your code to parse.
The gap shows up in Cloudflare's own test. In its 19 October 2026 post, output tokens cost $11,194 per million claims in the all-LLM pipeline, out of a total of $11,740. Because output dominates a generative bill, removing it is where the saving comes from.
Why can the field schema cost more tokens than the document itself?#
In the Clairic example on Cloudflare's model page of 19 October 2026, 472 schema tokens describe the fields for a 61-token invoice, and the call bills 655 input tokens. For short documents the field definitions dominate the input, so tight field instructions cut cost more than shorter documents do.
61
Invoice text
472
Field definitions
On a short invoice, the field list is most of the bill: the call bills 655 input tokens.
| Option | tokens |
|---|---|
| Invoice text | 61 |
| Field definitions | 472 |
Source: Cloudflare, Clairic model documentation, 19 October 2026
Cloudflare's launch post of 19 October 2026 says that "asking for thirty fields costs about the same as asking for three". That holds for speed, because every field is answered in the same parallel pass. Yet the usage block on the same 19 October 2026 model page bills the 472 schema tokens as input, like any other text. And since the same block reports three passes, 655 equals the 472 schema tokens plus the 61-token invoice three times over.
So each field's name, type and instructions are part of what you pay to send. For short receipts or forms, trim the instructions and drop unused fields, because that saves more than a shorter document would. For long contracts, the document itself is the bill.
Show data table
| Stage | US dollars per million documents |
|---|---|
| 500-token document | 97.2 |
| 2,000-token document | 247.2 |
| 8,000-token document | 847.2 |
| 32,000-token document | 3,247.2 |
A million 500-token documents cost $97.20 and a million 32,000-token documents cost $3,247.20.
On those October 2026 Cloudflare figures, a million 500-token documents cost $97.20 and a million 32,000-token documents cost $3,247.20. Therefore the schema is about half the bill at the short end and a rounding error at the long end.
How accurate is AI data extraction from unstructured documents, and how do you measure it?#
Accuracy is a per-field number, and ExtractBench on arXiv in February 2026 found frontier models produced 0% valid output on a 369-field financial schema. So measure accuracy field by field on a labelled sample of your own documents. Schema breadth and field type move it more than any single headline figure.
ExtractBench, posted to arXiv on 13 February 2026, pairs 35 PDF documents with JSON schemas and human labels, for 12,867 fields in all. PDF is the Portable Document Format most invoices arrive in. Its authors found that "Performance degrades sharply with schema breadth". In particular, the paper scores each field by its own rule. Identifiers need an exact match, quantities get a tolerance, and names get a looser match. It also counts a missing value apart from an invented one.
Also, a second paper points the same way. LLMStructBench, posted to arXiv on 16 February 2026, tested 22 models and five prompting strategies. It found the prompting strategy mattered more than model size for valid JSON. But the strategies that fixed the structure added more errors in the values.
Here is a method that copies the papers' rules on your own documents:
Sample
Pull a sample that looks like a normal month, for example 200 documents, an illustrative size, including the bad scans.
Label
Have a person record the correct value for every field, and mark the fields that are truly absent.
Score
Score each field with its own rule, such as an exact match for invoice numbers and a cent tolerance for totals.
Count
Count three outcomes per field: right, wrong, and returned null when a value existed.
Keep the scores
Keep each answer's confidence and p_null next to its score, so you can see where errors cluster.
As a result, you get a table of accuracy by field, not one percentage. Often the invoice number is near perfect and the payment terms are not. That table is what the review rule in the next section is built on.
How should confidence and p_null decide what is automated and what a person checks?#
Every Clairic text, number and date answer returns a confidence score and a p_null, the probability the value is absent, so a threshold per field routes it to automation or review. So set a confidence floor and a p_null ceiling per field, based on the cost of a wrong value. Then send everything outside them to a person.
Cloudflare's own example shows why both scores matter. On its Clairic model page of 19 October 2026, the invoice number came back with confidence 1 and a span of characters 8 to 16. However, the purchase order field came back with a p_null of 1 and a value of null, because the invoice has no purchase order number. Yet in that 19 October 2026 example, its guess field still held "INV-2291" at a confidence of 0.9995. So a system that reads guess instead of value would file the invoice number as a purchase order number.
Cloudflare's extraction models page, updated 19 October 2026, gives the rule in four words. "Match safeguards to risk." Before "consequential or irreversible actions", the page says to check results against other evidence or require human review. It also warns that confidence scores "do not replace application-level checks".
| Field | What a wrong value costs | Starting rule |
|---|---|---|
| Total used to approve a payment | Money leaves the account | Confidence of 0.99 or higher, and the total matches the purchase order, or a person checks |
| Invoice number | A duplicate or a lost invoice | Confidence of 0.98 or higher, with the span found in the text |
| Purchase order number | A wrong match to an order | A null value goes to a person, never to a default |
| Estimated payment date | A forecast is off by days | Automate, and show the p10 to p90 range beside it |
Illustrative thresholds: set your own from the accuracy table you measured, field by field.
Then tune the floors with data. When your labelled sample shows no errors above a confidence of 0.98 on a field, that field can run without a person. If errors still appear there, raise the floor or keep the check.
What did Cloudflare's own Clairic and Clef cascade measure against an all-LLM pipeline?#
In Cloudflare's test published on 19 October 2026, extraction took 0.46 seconds on Clairic against 16.1 seconds on GLM-5.3, and the whole claim ran in 19.3 seconds instead of 61.7. Cloudflare's own test puts typed extraction and decision steps under a second, with the generative model kept only for the reply.
Show data table
| Dimension | All-LLM pipeline (GLM-5.3) | Clairic, Clef and GLM-5.3 cascade |
|---|---|---|
| Extract | 16.1 | 0.46 |
| Decide | 21.9 | 0.22 |
| Reply | 16.4 | 18.6 |
| Whole claim | 61.7 | 19.3 |
Extraction took 0.46 seconds on Clairic against 16.1 seconds on GLM-5.3, and the whole claim ran in 19.3 seconds instead of 61.7.
For this test, Cloudflare used a customer's email claiming a damaged product. Clairic pulled the facts, Clef chose the decision, and GLM-5.3 wrote the reply. In the all-LLM version, GLM-5.3 did all three steps. Cloudflare's 19 October 2026 post reports the cost per million claims for each: the cascade at $6,032, and the all-LLM pipeline at $11,740, so the cascade cost 49% less. It also says both pipelines got the facts and the decision right in every run.
Since this is a vendor measuring its own model, treat it as a direction, not a benchmark. Still, it shows where extraction sits. It is the first typed step, and its values feed a decision model next. Our comparison of Cloudflare Clef, Clef-flash and Clef-omni covers that second step.
Which Cloudflare docs do you build a Clairic extraction Worker from?#
Build from the Cloudflare pages in this order: the toMarkdown binding, its supported formats, the Clairic model reference, the extraction models concept page, and Workers AI pricing. Together they cover conversion, the request, interpretation and the bill.
- Markdown Conversion Workers Binding: the
env.AI.toMarkdown()call and its result, whosedataholds the text andtokensthe estimated count. - Supported formats: PDF files, images, web pages in HTML and XML, Office and Open Document files, CSV spreadsheets and Apple Numbers files.
- Clairic model reference: the
stateandfieldsrequest, the field types, up to 4 images per call, and the 8,192-token pass (updated 19 October 2026). - Extraction models concept page: what a null means, how uncertainty is shown, and how to match safeguards to risk.
- Workers AI pricing: the $0.100 per million input token rate and the 10,000 free Neurons a day (October 2026).
If the documents live outside Cloudflare, the same model answers over the Workers AI REST application programming interface (API), which takes plain web requests. So an AI data extraction API call from any backend sends the same state and fields body.
What is the smallest Worker that extracts invoice fields with Clairic?#
The smallest working version is a single TypeScript Worker that converts the upload with toMarkdown, calls Clairic with typed fields, and holds back answers below a confidence floor. Four steps turn an uploaded PDF into typed fields with a review flag. First, add an ai binding named AI to your Wrangler file, the config for Cloudflare's command-line tool, as the binding page shows.
export interface Env {
AI: Ai;
}
const CONFIDENCE_FLOOR = 0.98; // below this, a person checks the field
const P_NULL_CEILING = 0.5; // above this, treat the value as missing
export default {
async fetch(request, env): Promise<Response> {
// Step 1: read the uploaded file from a form field named "file".
const form = await request.formData();
const file = form.get("file") as File;
// Step 2: convert the PDF or image to text with toMarkdown.
const doc = await env.AI.toMarkdown({
name: file.name,
blob: new Blob([await file.arrayBuffer()], { type: file.type }),
});
if (doc.format === "error") {
return Response.json({ error: doc.error }, { status: 422 }); // for example, an unreadable scan
}
// Step 3: ask Clairic for typed fields.
const response = await env.AI.run("@cf/cloudflare/clairic", {
model: "clairic",
state: doc.data,
fields: {
invoice_number: { type: "text" },
due_date: { type: "date", instructions: "Issue date plus the net payment days" },
total: { type: "number", decimals: 2, unit: "USD", instructions: "Amount due including shipping" },
po_number: { type: "text", instructions: "Purchase order number" },
},
});
// Step 4: flag null or low-confidence answers for review.
const review = Object.entries(response.answers)
.filter(([, a]) => a.value === null || a.confidence < CONFIDENCE_FLOOR || a.p_null > P_NULL_CEILING)
.map(([name]) => name);
return Response.json({ answers: response.answers, review, tokens: doc.tokens });
},
} satisfies ExportedHandler<Env>; The field list comes from Cloudflare's Clairic model page, so you can compare answers with its documented response. Also, keep doc.data beside the answers, because text spans point into that string. For a photo, the 19 October 2026 model page allows up to 4 embedded images per call. It does not accept remote image addresses.
When is Clairic the wrong tool for document extraction?#
Clairic is the wrong tool for long chains of arithmetic, totals across many table rows, open-ended summaries, and systems that cannot depend on a preview model. So let code do multi-step math and table totals. Use a generative model for summaries, and keep a fallback while Clairic is in preview.
First, take arithmetic, where Cloudflare's launch post of 19 October 2026 says one and two-step sums "seem reliable". But longer chains are hard, and so is "aggregating across many rows of a table". Its advice is to "have Clairic predict the value and let code do the math". So extract each line item and add them up in your Worker.
Second, say you need a note on why an invoice and an order disagree. For that, Cloudflare's extraction models page points to a generative model. Use a text model with JSON mode for that step, and keep Clairic for the values.
Third, there is the preview risk, since the Clairic model page says Cloudflare "may cease providing it" with no refund or credit. So if a process cannot stop, keep the LLM path you have today as a fallback behind a flag. Finally, you may need a review screen, trained templates and an audit trail on day one. Then a dedicated extraction platform may be faster than building those yourself, though it is one more vendor and one more system to connect.
Where typed extraction goes next in your pipeline#
Typed extraction is the first step of a document pipeline, and the decision model, the order flow and the system that receives the fields come next. So AI data extraction with Cloudflare Clairic hands typed values to whatever runs after it.
For the decision step, read how to pick between Clef, Clef-flash and Clef-omni. For the same job on orders, read how AI purchase order entry works. The purchase order entry case study sits behind it. Before launch, read the numbers to settle for any System One model. Then, to route typed values as they arrive, read real-time AI decisions on the page.
If you want a hand, our teams do Cloudflare development. They also do API integrations that push extracted fields into the systems that use them. That said, the five Cloudflare pages above are enough to build and run this on your own.