Sign inConnect your agent
infochanged

Workers AI - Introducing Clairic: an extraction model for typed values, now on Workers AI

Announced
Tags
Workers-AI
Severity
info, set by reef/rss-rule-v1
Source
https://developers.cloudflare.com/changelog/post/2026-10-19-clairic-workers-ai/

<p><a href="https://developers.cloudflare.com/workers-ai/models/clairic/"><code>@cf/cloudflare/clairic</code></a> is now available on Workers AI as a preview. Clairic is the first <a href="https://developers.cloudflare.com/workers-ai/concepts/extraction-models/">extraction model</a>: a System One model that answers with values instead of text. We intend to release the model with open weights soon.</p> <p>Decision models such as <a href="https://developers.cloudflare.com/workers-ai/models/clef/">Clef</a> choose among options you define up front. Many structured-output tasks do not have answers you can list in advance: an invoice total, a delivery date, the number of days a shipment is late, or what a repair will cost. Clairic handles these. You send a state and a schema of typed fields, and it returns one typed value per field. A value is read from the input, computed from it, or predicted beyond it.</p> <p>Clairic does not generate tokens. It reads your input in one pass and decodes each answer under the rules of its type, so every answer is a valid value of the type you asked for, or <code>null</code> when the input does not determine it.</p> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="typed-fields">Typed fields</h4><a class="anchor-link" href="#typed-fields"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Define as many fields as you need. Fields that do not fit beside the input in one pass are split across parallel passes, so there is no upper limit.</p> <div class="table-scroll" tabindex="0" role="region" aria-label="Table"><table> <thead> <tr> <th>Type</th> <th>Returns</th> </tr> </thead> <tbody> <tr> <td><code>text</code></td> <td>An exact span of the input, with its character offsets</td> </tr> <tr> <td><code>number</code></td> <td>A number read or worked out from the input, honoring <code>integer</code> and <code>decimals</code></td> </tr> <tr> <td><code>date</code>, <code>time</code>, <code>datetime</code></td> <td>Real calendar dates and valid times, in ISO form</td> </tr> <tr> <td><code>duration</code></td> <td>A length of time in the unit you choose</td> </tr> <tr> <td><code>list</code></td> <td>Every matching text, number, or date, in input order</td> </tr> <tr> <td><code>estimate</code></td> <td>A distribution inside your <code>min</code> and <code>max</code>, on your <code>step</code> grid, on a linear or log scale</td> </tr> <tr> <td><code>forecast</code></td> <td>One estimate per future step of a series, up to 64 steps</td> </tr> </tbody> </table></div> <p>Every scalar answer includes <code>p_null</code>, the probability that the input does not determine the value, and a <code>confidence</code> score. Estimates and forecasts include a median and an 80% interval (<code>p10</code> to <code>p90</code>). Set <code>options.include_quantiles</code> to also get all 99 percentiles. Use these to decide what to automate and what to send to review.</p> <p>You can also pass up to four images alongside the state.</p> <div><div data-nb-tabs data-nb-sync-key="workersExamples" class><div class="relative flex border-b border-border" role="tablist" data-nb-tabs-list><span class="bg-primary pointer-events-none absolute -bottom-px h-0.5 rounded-t-sm transition-[left,width] duration-200 ease-out" data-nb-tabs-indicator aria-hidden="true"></span></div><div class="mt-3"><div role="tabpanel" data-nb-tabs-content data-nb-tab-label="JavaScript" class><figure class="nb-code-figure" data-nb-lang="js"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="js" data-nb-lang="js"><code><span class="line"><span class="nb-shiki-1itgoe">const</span><span class="nb-shiki-dzsirb"> response</span><span class="nb-shiki-1itgoe"> =</span><span class="nb-shiki-1itgoe"> await</span><span class="nb-shiki-140thh"> env.</span><span class="nb-shiki-dzsirb">AI</span><span class="nb-shiki-140thh">.</span><span class="nb-shiki-1t8gfj">run</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-mdbnqw">"@cf/cloudflare/clairic"</span><span class="nb-shiki-140thh">, {</span></span> <span class="line"><span class="nb-shiki-140thh"> model: </span><span class="nb-shiki-mdbnqw">"clairic"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> state:</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "Invoice INV-2291 from Northwind Supply, issued 2026-09-02, net 30. 4 pallets at $250.00 each, shipping $80.00. Contact: Dana Ruiz, Priya Shah."</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> fields: {</span></span> <span class="line"><span class="nb-shiki-140thh"> invoice_number: { type: </span><span class="nb-shiki-mdbnqw">"text"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> issued: { type: </span><span class="nb-shiki-mdbnqw">"date"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> due_date: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"date"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Issue date plus the net payment days"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> total: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"number"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> decimals: </span><span class="nb-shiki-dzsirb">2</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> unit: </span><span class="nb-shiki-mdbnqw">"USD"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Amount due including shipping"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> contacts: { type: </span><span class="nb-shiki-mdbnqw">"list"</span><span class="nb-shiki-140thh">, items: </span><span class="nb-shiki-mdbnqw">"text"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh">});</span></span> <span class="line"></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.invoice_number.value -> "INV-2291", with its span in the state</span></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.total.value -> the amount due, with p_null and confidence</span></span></code></pre></figure></div><div role="tabpanel" data-nb-tabs-content data-nb-tab-label="TypeScript" class><figure class="nb-code-figure" data-nb-lang="ts"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="ts" data-nb-lang="ts"><code><span class="line"><span class="nb-shiki-1itgoe">const</span><span class="nb-shiki-dzsirb"> response</span><span class="nb-shiki-1itgoe"> =</span><span class="nb-shiki-1itgoe"> await</span><span class="nb-shiki-140thh"> env.</span><span class="nb-shiki-dzsirb">AI</span><span class="nb-shiki-140thh">.</span><span class="nb-shiki-1t8gfj">run</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-mdbnqw">"@cf/cloudflare/clairic"</span><span class="nb-shiki-140thh">, {</span></span> <span class="line"><span class="nb-shiki-140thh"> model: </span><span class="nb-shiki-mdbnqw">"clairic"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> state:</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "Invoice INV-2291 from Northwind Supply, issued 2026-09-02, net 30. 4 pallets at $250.00 each, shipping $80.00. Contact: Dana Ruiz, Priya Shah."</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> fields: {</span></span> <span class="line"><span class="nb-shiki-140thh"> invoice_number: { type: </span><span class="nb-shiki-mdbnqw">"text"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> issued: { type: </span><span class="nb-shiki-mdbnqw">"date"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> due_date: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"date"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Issue date plus the net payment days"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> total: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"number"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> decimals: </span><span class="nb-shiki-dzsirb">2</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> unit: </span><span class="nb-shiki-mdbnqw">"USD"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Amount due including shipping"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> contacts: { type: </span><span class="nb-shiki-mdbnqw">"list"</span><span class="nb-shiki-140thh">, items: </span><span class="nb-shiki-mdbnqw">"text"</span><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh">});</span></span> <span class="line"></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.invoice_number.value -&gt; "INV-2291", with its span in the state</span></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.total.value -&gt; the amount due, with p_null and confidence</span></span></code></pre></figure></div></div></div><script type="module" src="https://developers.cloudflare.com/home/runner/work/cloudflare-docs/cloudflare-docs/src/components/ui/tabs/Tabs.astro?astro&type=script&index=0&lang.ts"></script></div> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="preview">Preview</h4><a class="anchor-link" href="#preview"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>The current endpoint is an early checkpoint, and we expect it to improve:</p> <ul> <li><strong>Arithmetic</strong>: One- and two-step calculations, such as totals, differences, conversions, and date arithmetic, are reliable. Long chains of dependent steps and aggregations across many table rows are not yet. Extract the inputs with Clairic and do the math in code.</li> <li><strong>Estimates</strong>: Clairic estimates best when the input contains evidence such as comparables, history, or descriptive text. Without evidence, the interval is wide.</li> <li><strong>Forecasts</strong>: Forecasting is basic. Next-step forecasts follow recent patterns, but forecasts several steps out flatten toward the average, and Clairic does not anticipate events the series does not show, such as holidays. It does not replace a time-series model trained on your data.</li> <li><strong>Calibration</strong>: Intervals are trained to be calibrated and are on most held-out sets, but they can run narrow on unfamiliar data.</li> <li><strong>Confidence</strong>: Every answer is well formed, not necessarily correct. Use <code>confidence</code>, <code>p_null</code>, and the intervals to decide what to automate and what to send to review.</li> <li><strong>Dates</strong>: Dates without a year are resolved from context. If a field depends on the current date, set <code>reference_date</code> or add a line such as <code>Today: 2026-10-19</code> to the state.</li> </ul> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="pricing">Pricing</h4><a class="anchor-link" href="#pricing"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Clairic costs $0.10 per million input tokens. Because it generates no tokens, there is no output token charge.</p> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="get-started">Get started</h4><a class="anchor-link" href="#get-started"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Use Clairic through the <a href="https://developers.cloudflare.com/workers-ai/configuration/bindings/">Workers AI binding</a> (<code>env.AI.run()</code>) or the REST API at <code>/ai/run</code>. You can also use <a href="https://developers.cloudflare.com/ai-gateway/">AI Gateway</a> with these endpoints.</p> <p>For more information, refer to the <a href="https://developers.cloudflare.com/workers-ai/models/clairic/">Clairic model page</a>, <a href="https://developers.cloudflare.com/workers-ai/concepts/extraction-models/">extraction models</a>, <a href="https://developers.cloudflare.com/workers-ai/platform/pricing/">pricing</a>, and the <a href="https://blog.cloudflare.com/clairic-extraction-model/" target="_blank" rel="noopener">blog post<span class="external-link"> ↗︎</span></a>.</p>

The text above is the source's. reef added the severity, the dates it could read from the text, and the endpoints and scopes named in code.