Skip to main content
The gateway exposes a typed extraction model under /v1/extractions, with the same API key, rate limits, wallet, and spend caps as every other route. Behind it sits Cloudflare’s Clairic model: you send a state (text, optionally with up to four images) and a schema of typed fields, and get back a value for every field in one forward pass — a text field is a character span of your input, a number is computed, a date is ISO, a list is the matching items in input order, an estimate is a distribution with a median and an 80% interval. Every answer carries a calibrated confidence and a p_null: a field the input does not determine comes back null rather than a guess, and the guess is still there under guess if you want it. Use it for the parts of a pipeline that are reading rather than writing: invoice and receipt fields, dates and amounts out of contracts, structured attributes out of listings or support tickets, numbers out of screenshots. There is no prompt to engineer and no JSON to repair — the model can only answer in the shape you declared. An extraction is a few hundred milliseconds and a fraction of a cent, so it fits in front of every row. You never create a Cloudflare account or hold a Cloudflare token. AI Reserve holds one account, each extraction is billed to your wallet at the published per-token rate, and every call appears in your usage analytics under the model clairic.
Sibling of Decisions. Clef answers typed questions (yes/no, choice, score) with probabilities; Clairic fills typed fields with values. Both are one forward pass over the same kind of state, so an agent can ask “is this an invoice?” and “what is the total?” against the same text with two cheap calls.

Quickstart

Every response carries an aireserve envelope with the request id to quote to support and the model the extraction billed under. Note the due date: the input said “due in 30 days”, and the model computed it from the issue date — with a lower confidence than the dates it could read directly.

Request

Field types

Every field takes a type and instructions — what the field should contain, plus any rule the model should apply. The other knobs depend on the type: Every answer also carries confidence and, for nullable types, p_null and guess. A field is null when p_null exceeds its null_threshold (default 0.5) — set the threshold per field to trade recall for precision. Fields are answered independently against the same state. Fields that do not fit next to the state in one 8,192-token pass are split across parallel passes upstream (usage.passes), so a large schema still returns in one round trip.
Extractions are calibrated: a confidence of 0.6 means “probably right, not certainly”. Accept the confident fields automatically and route the uncertain band — or any null — to a person or a larger model. Keep arithmetic in your code: the model computes simple derived values (a due date, a total) but multi-step math belongs in a number field per operand, not one field per result.

Images

Send a scanned receipt, a screenshot or a chart as an embedded image; state may then be empty. Text fields read from an image carry "source": "image" and no span.

Billing

Rates match Cloudflare’s published Workers AI list price. Extractions have no output tokens, so a request costs its input alone: the state and the serialized fields (each field adds its own template tokens — usage.schema_tokens shows the count), plus images, which are tokenized at one token per 32×32 pixel block and capped at 4,096 tokens each. The wallet holds an in-process estimate before the call and settles on the token count Cloudflare reports; an extraction that fails — at the provider, on a timeout, or because the surface is not configured — is never charged. Current rates are always on the pricing page.

Data handling

Request bodies are sent to Cloudflare, Inc. (United States; served from Cloudflare’s global network). Under Cloudflare’s published Workers AI data-usage terms, inputs and outputs are Customer Content that Cloudflare does not use to train models or improve its services, does not make available to other customers, and stores only when paired with a Cloudflare storage product — which this route does not use — so it carries no data-retention consent gate. Still, send the minimum state the extraction needs. Details on the data-handling page.

Errors