Huny's Dev Blog
huny.dev

Inside Cloudflare Clairic & Clairic-flash Open-Weight Extraction Models: System One Parallel Slot Autoregression, 32x32 Image Patch Billing, and Multi-Pass Cost Control

A technical deep dive into Cloudflare's open-weight System One extraction models Clairic (27B) and Clairic-flash (9B), covering parallel slot autoregressive generation, typed output heads (clair_head.safetensors), 32x32 image patch tokenization, multi-pass input billing (usage.passes), and the December 1, 2026 pricing transition.

Hun Jang
Hun Jang Dec 2, 2026

Abstract conceptual illustration of unstructured geometric fragments passing through an optical lens and aligning into parallel crystalline slots (generative abstract illustration)

When extracting structured data from unstructured text, receipt images, or multi-page PDFs, replacing general-purpose LLM JSON generation (System Two) with Cloudflare's open-weight System One extraction models—Clairic (27B) and Clairic-flash (9B)—eliminates output token charges ($0), grounds extracted substrings with exact character offsets (span), and provides calibrated null probabilities (p_null) and confidence scores in under a second. However, because every text field executes in its own pass (usage.passes)—re-billing full state and 32x32-patch image tokens per pass—and the promotional discount on 27B Clairic expired on December 1, 2026 (reverting to $0.24 / 1M input tokens), engineering teams must audit their field schemas and multi-pass token multipliers before scaling to production.

Until recently, building document and ticket extraction pipelines meant prompting a frontier LLM to emit JSON and hoping the output parsed cleanly. That approach incurs high latency and per-token generation fees, offers no character-offset provenance to prove where a value appeared in the source, and requires complex retry loops when the model hallucinates plausible-looking values for missing fields. Released under the Apache-2.0 license by Cloudflare's Workers AI Superintelligence team (Alex Reneau, Michelle Chen, and Kevin Flansburg) and trending across developer communities following its December 1, 2026 pricing transition, Clairic and Clairic-flash establish a purpose-built alternative: System One extraction models.

In this deep dive, we cross-verify Cloudflare's engineering posts (Introducing Clairic and An updated Clairic and Clairic-flash are now open-weight), the official Workers AI Clairic documentation, Workers AI Pricing documentation, and the Cloudflare/clairic and Cloudflare/clairic-flash Hugging Face repositories. We break down the redesigned parallel slot autoregressive architecture, the typed output head (clair_head.safetensors), the 32x32 image patch tokenizer, and the multi-pass billing formula, complete with runnable TypeScript and Python verification tools.

Verification Scope & Engineering Disclosure: All accuracy benchmarks (335/336, 1,263/1,263, 576/576), p50/p95 latency figures (155 ms–976 ms), request limits (65,273 max prompt tokens, 4 images/PDF pages up to 8 MiB total), and December 1, 2026 pricing updates ($0.10 to $0.24 / 1M input tokens for 27B Clairic) are verified directly from Cloudflare's official documentation and Hugging Face model cards. The Python multi-pass cost estimator and confidence-gating validator in Section 5 are reference implementations built directly from the documented specifications; independent multi-node vLLM throughput benchmarks on private GPU clusters were not executed for this post.

1. Conceptual Boundaries: How System One Extraction Differs from LLM JSON Mode

Before deploying Clairic in production, three architectural boundaries must be clear:

  • System One Extraction Models (Clairic), System One Decision Models (Clef / Jev), and System Two Generative LLMs Are Distinct: Decision models like Clef take an input state and a fixed list of options, returning calibrated probabilities across that finite set. System Two LLMs generate free-form tokens one by one through deliberate reasoning. Clairic occupies a distinct third category: it predicts values from a continuous space that is strictly typed and bounded by your declared schema (text, number, date, duration, compute, estimate, forecast), returning either a valid value of that type (with character spans or quantile bounds) or null.
  • Preview Single-Pass Extraction and the Redesigned Parallel Slot Autoregressive Architecture Are Distinct: In its October preview, Clairic computed all answers in a single forward pass, which struggled on complex image receipts and multi-page tables. The open-weight release redesigns the architecture: for ordinary text and number extraction fields, Clairic now uses parallel slot autoregressive generation, where each field conditions on the tokens it has already written until reaching its own end marker while all fields advance together in the serving batch. Meanwhile, specialized heads (clair_head.safetensors) handle explicit arithmetic (compute), durations, calculated dates, bounded probability distributions (estimate), and multi-step time-series paths (forecast).
  • Loading the Base Backbone (mlx_lm / generic AutoModel) and Running the Clairic Extraction Pipeline (systemone()) Are Distinct: As noted on both Cloudflare/clairic and community quantizations like mlx-community/clairic-flash-4bit, loading the underlying Qwen3.8-27B or Qwen3.5-9B backbone into a standard chat pipeline will not reproduce Clairic. Structured answers, p_null scoring, and confidence intervals are produced by Cloudflare's request pipeline (clairic_model.py calling load_release_model() and systemone()), which pairs the backbone weights with clair_head.safetensors and xgrammar logits processors.

2. Model Lineup and the December 1, 2026 Endpoint & Pricing Transition

During the initial preview, @cf/cloudflare/clairic served a 9B model at $0.10 / 1M input tokens. With the open-weight release, Cloudflare moved the 9B model to @cf/cloudflare/clairic-flash and upgraded @cf/cloudflare/clairic in-place to the 27B model (clairic-27b). Crucially, on December 1, 2026, the promotional discount on @cf/cloudflare/clairic ended, restoring its standard price of $0.24 / 1M input tokens.

Attribute
Clairic (27B Flagship Model)
Clairic-flash (9B High-Speed Model)
Engineering & Migration Impact
Workers AI Selector
@cf/cloudflare/clairic
(Response model: "clairic-27b")
@cf/cloudflare/clairic-flash
(Response model: "clairic-flash")
Existing integrations calling @cf/cloudflare/clairic were automatically upgraded in-place to the 27B model
Hugging Face Repo & License
Cloudflare/clairic
(Apache-2.0, 18 shards + clair_head.safetensors)
Cloudflare/clairic-flash
(Apache-2.0, BF16/F32 + clair_head.safetensors)
Full weights, clair_head_config.json, and Python runtime helper (clairic_model.py) released under Apache-2.0
Base Backbone & Parameter Count
Fine-tuned from Qwen/Qwen3.8-27B
(~28B total params, BF16)
Fine-tuned from Qwen/Qwen3.5-9B
(~10B total params, BF16/F32)
Combines multimodal VLM backbone with typed numeric/distribution heads and xgrammar decoding constraints
Context Window & Hard Prompt Cap
65,536 tokens
(Max 65,273 input tokens per prompt)
65,536 tokens
(Max 65,273 input tokens per prompt)
Inputs are never silently truncated; oversized requests exceeding 65,273 tokens are rejected
Workers AI Pricing (Effective Dec 1, 2026)
$0.24 / 1M input tokens
(58% launch promo ended Dec 1, 2026)
$0.00 output tokens
$0.10 / 1M input tokens
(9,091 Neurons per 1M input tokens)
$0.00 output tokens
Switching cost-sensitive workloads to @cf/cloudflare/clairic-flash cuts input token spend by 58.3%
Multimodal Limits (Images & PDFs)
Up to 4 images or rendered PDF pages total (4 MiB each, 8 MiB combined, 16 MiB body max)
Up to 4 images or rendered PDF pages total (4 MiB each, 8 MiB combined, 16 MiB body max)
Remote image URLs and encrypted PDFs are rejected; pass embedded Base64, Data URIs, or PIL images

3. Accuracy and Latency (p50/p95) Benchmarks

In Cloudflare's evaluation benchmarks, the redesigned Clairic and Clairic-flash models substantially outperformed both the October preview and competing extraction pipelines (Liquid AI D1.2 pipelined with Apple Vision OCR, and ScaleDown Extract), eliminating all 207 image-reading errors from the preview benchmark while keeping end-to-end HTTP latency under one second.

Evaluation Dataset (Volume & Modality)
Clairic-preview (Legacy 9B)
Clairic (Redesigned 27B)
Clairic-flash (Redesigned 9B)
Liquid AI D1.2 + OCR
ScaleDown Extract
Clairic (27B) Latency (p50 / p95)
Clairic-flash (9B) Latency (p50 / p95)
Fresh text fields (96 requests, 336 fields)
295 / 336 (87.8%)
335 / 336 (99.7%)
328 / 336 (97.6%)
304 / 336 (90.5%)
259 / 336 (77.1%)
358 ms / 736 ms
155 ms / 328 ms
Internal eval (mchen) (36 mixed-input requests, 226 fields)
207 / 226 (91.6%)
221 / 226 (97.8%)
213 / 226 (94.2%)
116 / 226 (51.3%)
156 / 226 (69.0%)
—
—
Tracked customer assertions (139 request shapes, 1,263 assertions)
1,033 / 1,263 (81.8%)
1,263 / 1,263 (100%)
1,263 / 1,263 (100%)
973 / 1,263 (77.0%)
653 / 1,263 (51.7%)
—
—
Synthetic receipt fields (576 fields across text & images)
369 / 576 (64.1%)
576 / 576 (100%)
576 / 576 (100%)
397 / 576 (68.9%)
280 / 576 (48.6%)
—
—
Fresh image fields (48 requests)
—
—
—
—
—
453 ms / 976 ms
305 ms / 605 ms
Commercial leases (180 requests)
—
—
—
—
—
691 ms / 803 ms
379 ms / 519 ms
Loan pricing & Traffic forecasting (600 / 114 requests)
—
—
—
—
—
395 / 407 ms (Loan)
532 / 585 ms (Traffic)
188 / 192 ms (Loan)
243 / 261 ms (Traffic)

4. Typed Field Specifications, 32x32 Image Patch Tokenization, and Multi-Pass Billing (usage.passes)

According to the official Clairic documentation and Hugging Face model card, field specifications support 13 types: text, number, date, time, datetime, duration, boolean, enum, object, list, compute, estimate, and forecast (plus modifiers like source_only: true for literal printed numbers/dates, knowledge: true, and nullable: true). Two mechanics directly govern token consumption and billing:

4.1. Multi-Pass Execution (usage.passes) on text Fields

While Clairic charges $0 for output tokens, it answers each text field in its own pass. All non-text fields share a pass (unless the combined schema exceeds the context window and must be split across additional passes). Crucially, every pass includes the full state text and all attached images, billing their input tokens once per pass (usage.passes in the response reports the exact pass count).

If you attach two high-resolution receipt photos (~4,000 image tokens) and declare five text fields alongside three number fields, Clairic executes 5 + 1 = 6 passes, billing the 4,000 image tokens six times (24,000 image tokens total). To prevent pass multiplication, never declare numeric, date, boolean, or fixed-category fields as text—use number, date, boolean, or enum so they share a single pass.

4.2. The 32x32 Patch Image Tokenization Formula

Unlike VLMs that aggressively downsample large images into a fixed tile budget, Clairic preserves high-resolution detail for OCR:

  1. Aspect-Preserving 32-Pixel Rounding: Each side is rounded to a multiple of 32 pixels.
  1. Upscaling Small Images Only: Images with an area under ~65,000 pixels (256x256) are scaled up to reach that area, whereas larger images are never scaled down.
  1. Patch Count + Start/End Markers: Every 32x32 pixel block becomes 1 token, plus 2 tokens per image to mark where the image starts and ends:

$\text{Image Tokens} = \left(\frac{\text{Width}_{32}}{32} \times \frac{\text{Height}_{32}}{32}\right) + 2$

5. Implementation: Workers AI TypeScript Handler, Local Open-Weight Inference & Python Cost/Confidence Gate

5.1. Cloudflare Workers (TypeScript) Extraction, Arithmetic & Distribution Estimation

The following Worker extracts an exact character-offset substring (invoice_number), computes a payment due date from relative terms (due_date), sums line-item and shipping costs (total), detects an absent purchase order number (po_number -> null with p_null: 1), and estimates a payment timeline distribution (days_to_pay with median, p10, and p90):

5.2. Pre-Flight Multi-Pass Cost Calculator & Post-Flight Confidence/Span Validator (Python)

Below is a standalone Python utility that calculates exact 32x32 image patch tokens, predicts multi-pass billing (usage.passes) under the post-December 1, 2026 pricing schedule, and validates returned answers against truncated, p_null, confidence, and character span slices:

For self-hosted GPU deployments using the Apache-2.0 open weights on Hugging Face, load the full release pipeline via clairic_model.py:

6. Production Readiness Checklist

  • Audit Model Selectors After the December 1, 2026 Pricing Change: Workloads still pointing to @cf/cloudflare/clairic are now running the 27B model at $0.24 / 1M input tokens. Migrate latency- and cost-sensitive extraction jobs to @cf/cloudflare/clairic-flash ($0.10 / 1M input tokens, 155–393 ms p50 latency).
  • Replace Unnecessary text Fields with Typed Primitives (enum, number, date): Because each text field triggers a separate pass (usage.passes) that re-bills the entire document and image token payload, reserve text strictly for open-ended substring extraction and use enum, number, date, duration, or boolean for everything else so they share a single pass.
  • Downscale Raw Camera Photos Before Sending: Because Clairic never downscales images larger than 256x256 and bills one token per 32x32 patch, a raw 12-megapixel smartphone receipt (4032x3024) consumes ~12,000 tokens on every pass. Resize document images so the long edge is 1024px–1536px before encoding.
  • Enforce a Three-Way Gate on truncated, p_null, and confidence: Reject or retry any response where truncated: true, treat fields with value: null (p_null near 1.0) as absent rather than persisting the diagnostic guess field into production databases, and route fields with confidence < 0.90 to human review.

7. References & Cross-Verified Sources (Verified 2026-12-02)

Korean version: Cloudflare Clairic · Clairic-flash 오픈웨이트 아키텍처 해부: System One 병렬 슬롯 자기회귀 추출, 32x32 이미지 패치·멀티패스 과금과 12월 1일 단가 전환 점검하기Cloudflare Clairic · Clairic-flash 오픈웨이트 아키텍처 해부: System One 병렬 슬롯 자기회귀 추출, 32x32 이미지 패치·멀티패스 과금과 12월 1일 단가 전환 점검하기

추천 글