OpenRouter 上的提取 API(Extractions API)现已进入 Alpha 测试阶段。您可以使用它通过描述所需字段,从文本、图像和 PDF 中提取特定详细信息,例如电子邮件中的姓名或收据上的总金额。
我们首批推出了来自 Cloudflare、Inception 和 ScaleDown 的三个提取模型。您可以通过阅读文档或在 Playground 中试用来开始使用。
提取(Extraction)是指一个请求,其中指定了您希望从文档中提取的字段名称,并针对每个字段返回一个已键入的值。state 携带文本(或图像/PDF 在 assets 中的键),而 fields 将每个名称映射到一个规范:包括类型(type),以及可选地说明该字段含义的指令。
共有九种字段类型,每种都返回为一种无需解析即可存储的 JSON 类型。以下是向这张发票提出的六个问题,发票作为 state 发送;表格中的示例是 Clairic 返回的结果,高亮显示的单词是值的来源:
state · 发票,以文本形式
来自 Larkspur Studio 的发票 INV-4417,开具日期为 2026-10-14,付款条款为 net 45。账单收件人:Harbor & Pine LLC。联系人:Dana Ruiz (dana@harborpine.example)、Priya Shah。行项目:品牌审计 2,400.00;图标集 1,150.00;加急费 300.00。应付总额 $3,850.00。逾期付款每月累积 1.5% 的利息。
所请求的字段为 invoice_number: text、total: number、due_date: date、contacts: list、po_number: text 和 days_to_pay: estimate。
| 类型 | 获取的内容 | 示例 |
|---|---|---|
| text | 从文档中读取的字符串 | "INV-4417" |
| number | 数字,包含您选择的小数位和单位 | 3850 |
| date | ISO 日期,读取或计算得出 | "2026-11-28" |
| time | ISO 时间(一天中的时刻) | 未向此发票请求 |
| datetime | ISO 日期和时间 | 未向此发票请求 |
| list | 文本、数字或日期项的数组(items 指定具体类型) |
["Dana Ruiz", "Priya Shah"] |
| duration | 您选择单位的数字,从秒到年 | 45,单位:"days" |
| estimate | 文档暗示的数量分布,在您设定的最小值和最大值之间 | 中位数 45, p10 42, p90 47 |
| forecast | 同上,针对未来间隔步骤的预测;value、mean、median、p10 和 p90 是包含每个步骤一个条目的数组 |
未向此发票请求 |
每个答案都携带其值;其他携带的内容取决于字段类型和模型。在 Clairic 上,从文本中读取的值会附带一个跨度(span),即 [start, end),基于 Unicode 码点计算 state 中的位置,这样您就可以切片文档并显示值的来源(列表会携带多个跨度,每个项目一个)。单个值会携带 p_null,即文档中该字段为空的可能性;当 p_null 超过 0.5 时,值变为 null(可通过设置每字段的 null_threshold 来移动这条线),而 guess 则是即使在这种情况下最可能的值。它们还携带 confidence,即模型对该值的置信度,而从图像中读取的字符串会额外添加拼写置信度(spell_confidence)。估计值或预测值不携带置信度;mean、median、p10 和 p90 描述其分布,而 p10 到 p90 的宽度即为不确定性。Extract 返回每个值的置信度且不返回 p_null;在文本上它也会返回跨度,而在 PDF 上则不返回(见第 3 节)。
这些字段构成了信任模型。设置一个置信度下限,将低于该下限的内容发送给人工处理,并存储其余部分。null 是一个答案,而非低分:模型判断该字段不存在(其 p_null 超过了阈值),而 guess 表示它原本会尝试获取的值。没有置信度的值(如估计值)则通过其分布进行判断。
输入的是文档和一组命名、已键入的字段列表。输出的是每个字段一个值、从文本中读取值的跨度、单个值的置信度和 p_null,以及估计值的分布。
在 Clairic 上运行此请求的费用为 $0.00011:
curl https://openrouter.ai/api/alpha/extractions \
-H "Authorization: Bearer $OPENROUTER_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "cloudflare/clairic",
"state": "Invoice INV-4417 from Larkspur Studio, issued 2026-10-14, payment terms net 45. Bill to: Harbor & Pine LLC. Contacts: Dana Ruiz (dana@harborpine.example), Priya Shah. Line items: brand audit 2,400.00; icon set 1,150.00; rush fee 300.00. Total due $3,850.00. Late payments accrue 1.5% per month.",
"fields": {
"invoice_number": { "type": "text" },
"total": { "type": "number", "decimals": 2, "unit": "USD" },
"due_date": { "type": "date", "instructions": "Issue date plus the net payment days" },
"contacts": { "type": "list", "items": "text", "instructions": "People named as contacts" },
"po_number": { "type": "text", "instructions": "Purchase order number, if any" },
"days_to_pay": { "type": "estimate", "min": 0, "max": 120, "step": 1, "instructions": "How many days after issue this invoice will actually be paid" }
},
"reference_date": "2026-11-06"
}'
Clairic 读取了 1,138 个输入 token 并给出了回答(响应中除去模型行):
{
"answers" : {
"invoice_number" : { "type" : "text" , "value" : "INV-4417" , "span" : [ 8 , 16 ], "p_null" : 4.9e-6 , "confidence" : 0.9999 },
"total" : { "type" : "number" , "value" : 3850 , "p_null" : 1.6e-5 , "confidence" : 0.9999 },
"due_date" : { "type" : "date" , "value" : "2026-11-28" , "p_null" : 4.4e-5 , "confidence" : 0.9994 },
"contacts" : { "type" : "list" , "value" : [ "Dana Ruiz" , "Priya Shah" ], "spans" : [[ 118 , 127 ], [ 155 , 165 ]] },
"po_number" : { "type" : "text" , "value" : null , "guess" : "INV-4417" , "p_null" : 0.9999 },
"days_to_pay" : { "type" : "estimate" , "value" : 45 , "mean" : 44.79 , "median" : 45 , "p10" : 42 , "p90" : 47 }
},
"truncated" : false ,
"usage" : { "input_tokens" : 1138 , "output_tokens" : 0 , "cost" : 0.0001138 , "state_tokens" : 118 , "schema_tokens" : 666 , "passes" : 4 },
"id" : "gen-dec-1794000212-JVtrkaQ2JbqaR59u2bjZ" ,
"provider" : "Cloudflare"
}
由于文本中没有日期,因此模型根据开具日期和条款计算了 due_date;po_number 返回为 null,guess 显示了如果存在时会匹配到的值;days_to_pay 是一个估计值,因此它返回的是一个分布而非单点值,其中 80% 的概率质量分布在 42 到 47 天之间。通过每个 span 切片状态以在值旁边显示证据。在 Python 中,设 r 为上述调用的 requests 响应:
state = "Invoice INV-4417 from Larkspur Studio, issued 2026-10-14, payment terms net 45. Bill to: Harbor & Pine LLC. Contacts: Dana Ruiz (dana@harborpine.example), Priya Shah. Line items: brand audit 2,400.00; icon set 1,150.00; rush fee 300.00. Total due $3,850.00. Late payments accrue 1.5% per month."
answers = r.json()[ "answers" ]
for name, answer in answers.items():
spans = answer.get( "spans" ) or ([answer[ "span" ]] if answer.get( "span" ) else [])
evidence = [state[start:end] for start, end in spans]
print ( f " { name } : { answer[ 'value' ] !r } <- { evidence !r } " )
输入的是图像,在 assets 中通过 state 中的键引用,以及相同类型的字段列表。输出是与上述相同的记录结构,其中模型标记为从图片读取的值带有 source: "image"(source 是可选的,且下方的 paid_on 没有该字段,因此不要以其作为键),并且文本带有 spell_confidence。剪辑中照片上的方框是为演示而绘制的;API 返回的是值而非图像坐标。
在 Clairic 上运行请求的费用为 $0.00025:
import base64
import os
import requests
API = "https://openrouter.ai/api/alpha/extractions"
HEADERS = { "Authorization" : f "Bearer { os.environ[ 'OPENROUTER_API_KEY' ] } " }
with open ( "receipt.png" , "rb" ) as f:
receipt = base64.b64encode(f.read()).decode()
r = requests.post(
API ,
headers = HEADERS ,
json = {
"model" : "cloudflare/clairic" ,
"state" : "receipt" ,
"assets" : { "receipt" : { "type" : "image" , "format" : "png" , "data_base64" : receipt}},
"fields" : {
"merchant" : { "type" : "text" },
"total" : { "type" : "number" , "decimals" : 2 },
"paid_on" : { "type" : "date" },
"tax" : { "type" : "number" , "decimals" : 2 , "instructions" : "Sales tax charged" },
"tip" : { "type" : "number" , "decimals" : 2 , "instructions" : "Gratuity, if any" },
},
},
)
r.raise_for_status()
print (r.json()[ "answers" ])
Clairic 读取了 1,064 个图像 token,总计 2,532 个,并给出了回答(响应内容,不含模型行):
{
"merchant" : { "type" : "text" , "value" : "NORTH HAROR C" , "p_null" : 8.0e-5 , "confidence" : 0.733 , "source" : "image" , "spell_confidence" : 0.733 },
"total" : { "type" : "number" , "value" : 29.04 , "p_null" : 5.3e-8 , "confidence" : 0.9995 , "source" : "image" },
"paid_on" : { "type" : "date" , "value" : "2026-10-24" , "p_null" : 0.0061 , "confidence" : 0.9999 },
"tax" : { "type" : "number" , "value" : 3.79 , "p_null" : 2.8e-4 , "confidence" : 0.9982 , "source" : "image" },
"tip" : { "type" : "number" , "value" : null , "guess" : 0 , "p_null" : 0.9999 , "confidence" : 0.8923 }
}
所有非空数值和日期字段的置信度均超过 0.99,而 tip 字段明确返回为 null 而非虚构的零值,其 p_null 值为 0.9999。商户名称有误(收据上显示的是“NORTH HARBOR CAFE”),Clairic 也指出了这一点:spell_confidence 为 0.73,比响应中其他所有值低了三分之一。这就是你需要路由给人工处理的那个字段,而响应已经告诉你该选哪一个了。
PDF 也可以放入 assets 中,设置 "type": "document" 和 "format": "pdf" 。Clairic 仅读取图像,因此 PDF 会发送至 ScaleDown Extract,它每次请求读取一个 PDF 或图像,并回答文本和列表字段。代码片段中页面上的方框仅为演示目的绘制;Extract 返回的是值和置信度,而非页面坐标。
在 Extract 上运行的请求,费用为 $0.00016:
curl https://openrouter.ai/api/alpha/extractions \
-H "Authorization: Bearer $OPENROUTER_API_KEY " \
-H "Content-Type: application/json" \
-d @- << EOF
{
"model": "scaledown/extract",
"state": "po",
"assets": { "po": { "type": "document", "format": "pdf", "data_base64": "$( base64 < purchase-order.pdf | tr -d '\n')" } },
"fields": {
"po_number": { "type": "text" },
"vendor": { "type": "text", "instructions": "The supplier the order is placed with" },
"total": { "type": "text", "instructions": "Order total including shipping" },
"delivery_date": { "type": "text", "instructions": "Requested delivery date" },
"items": { "type": "list", "items": "text", "instructions": "Ordered line items" },
"approver": { "type": "text", "instructions": "Who approved the order" }
}
}
EOF
Extract 从 PDF 中读取了 3,972 个输入 token,并在 2.9 秒内完成回答(响应内容,不含模型行):
{
"answers" : {
"po_number" : { "type" : "text" , "value" : "PO-20931" , "confidence" : 1 , "source" : "document" },
"vendor" : { "type" : "text" , "value" : "Meridian Office Supply" , "confidence" : 1 , "source" : "document" },
"total" : { "type" : "text" , "value" : "$4,200.00" , "confidence" : 0.814 , "source" : "document" },
"delivery_date" : { "type" : "text" , "value" : "November 18, 2026" , "confidence" : 0.979 , "source" : "document" },
"items" : { "type" : "list" , "value" : [ "Standing desk, 60 in, walnut" , "Task chair, mesh back" , "Monitor arm, dual" ], "confidences" : [ 0.994 , 0.999 , 1 ], "source" : "document" },
"approver" : { "type" : "text" , "value" : "Priya Shah" , "confidence" : 1 , "source" : "document" }
},
"truncated" : false ,
"usage" : { "input_tokens" : 3972 , "output_tokens" : 0 , "cost" : 0.00015888 },
"id" : "gen-dec-1794274074-RzjUzkyrf7WfR9LpFUTO" ,
"provider" : "ScaleDown"
}
所有数值均正确,包括表格中的三个明细项。与 Clairic 相比,有两个差异需要规划:Extract 没有数字或日期类型,因此总额和交货日期以页面上的字符串形式返回,并且它为每个值(以及列表中的每一项)报告置信度,但不提供 p_null 或 span。0.81 的总额是需要注意的字段;其余字段的置信度都在 1 或接近 1。
模型列表
发布时提供三种模型,相同的请求适用于所有这些模型,因此你可以选择最适合该任务的模型。对于图像(如收据照片)以及需要返回数字、日期或估算值的情况,请使用 Clairic。若要提取 PDF 中的文本(如合同中的各方信息),请使用 ScaleDown Extract。若要从纯文本(如电子邮件或支持工单)中提取名称或短语,请使用 Mercury Decide。
模型读取字段类型 输入价格 提供商选项
Clairic ( cloudflare/clairic ) 文本和最多 4 张 PNG 或 JPEG 图像 每种类型 $0.10/M include_quantiles , return_state_text under provider.options.cloudflare
Extract ( scaledown/extract ) 文本,或一个 PDF 或图像 文本,以及文本列表 $0.04/M threshold , top_n under provider.options.scaledown
Mercury Decide ( inception/mercury-decide ) 仅限文本 文本,以及文本列表 $0.02/M snap_to_words , threshold , group_fields under provider.options.inception
所有三种模型的输出均免费。价格为 2026 年 11 月 6 日的目录值;模型页面上有当前价格。
Cloudflare 的 Clairic
Clairic ( cloudflare/clairic ) 是 Cloudflare 在 Workers AI 上的提取模型,应作为起点使用。它每次请求可读取文本和最多四张 PNG 或 JPEG 图像,支持所有字段类型,并且是唯一返回 p_null 、spans 以及用于估算和预测的分布的发布模型。上面第 1 节和第 2 节均在其上运行。两个提供商选项扩展了响应:include_quantiles: true 为每个估算和预测返回 99 个百分位数,return_state_text: true 回显 span 偏移量索引指向的确切文本,以便你可以对其进行检查切片。
Extract ( scaledown/extract ) 读取文本,或每次请求一个 PDF 或图像,并以每个值的置信度回答文本和列表字段。它是今天处理 PDF 的模型(第 3 节)。它不报告空值概率,因此拒绝 null_threshold;threshold 和 top_n 在 provider.options.scaledown 下用于调整其选择值的方式。
Inception 的 Mercury Decide
Mercury Decide ( inception/mercury-decide ) 仅读取文本,并以三种模型中最低的输入价格回答文本和列表字段。它拒绝 reference_date;snap_to_words 、threshold 和 group_fields 在 provider.options.inception 下是其选项。
仅限文本的字段可在任何地方运行。我们将第 1 节中发票的文本和列表字段发送给 Mercury Decide 和 Extract:两者返回相同的值,且在文本方面与 Clairic 返回相同的 spans,价格分别为 $0.000015 和 $0.000014。Extract 不返回 PDF 的 spans(第 3 节)。
两种路由都使用相同的信封( model , state , assets , provider ),区别在于你交给模型的内容以及它返回的内容。
决策(Decisions):你提供选项,模型进行权衡。一个决策请求包含问题,每个问题都附带其答案空间:noul 表示一个真或假的命题;choice 列出可选项目;score 指定一个评分尺度;box 要求识别图像中的某个区域。对于 noul、choice 或 score,模型绝不会生成你未列出的值;它仅在你写下的答案之间分配概率(box 则返回你所描述区域的坐标)。这正是处理任何需要判断力事项的正确工具:这是发票吗?这五个术语中哪一个适用?严重程度如何?这张图片是否包含收据。输出是一个可设定阈值校准数值,而错误答案也是你已处理的选项之一。
提取(Extractions):你指定字段名,模型查找对应值。一个提取请求包含字段,每个字段由名称和类型组成:text(文本)、number(数字)、date(日期)、list(列表)、duration(时长)、estimate(估算值)、forecast(预测值)。答案空间是类型本身,而非你列出的选项列表,因此模型必须在文档中定位该值(或根据开票日期和条款计算到期日,或对付款天数进行估算)。由于取值范围开放,答案会附带证据:读取该值的文本跨度、p_null(表示文档中是否完全不存在相关内容)、以及置信度。当答案本身就是内容时,这是正确的工具:收据上的金额、合同中的姓名、表格上的日期。
与第 1 节相同的发票,通过 Clef Flash 的决策功能处理:
{
"questions" : {
"overdue" : { "type" : "noul" , "instruc
The Extractions API is now live on OpenRouter in alpha. Use it to pull specific details out of text, images, and PDFs by describing the fields you need, like the names in an email or the total on a receipt.
We’re launching with three extraction models from Cloudflare, Inception, and ScaleDown. Get started by reading the docs or trying it out in the Playground .
An extraction is a request that names the fields you want out of a document and gets one typed value per field back. state carries the text (or the key of an image or PDF in assets ), and fields maps each name to a spec: a type , and optionally instructions that say what the field means.
There are nine field types, and each comes back as a JSON type you can store without parsing. Six of them were asked of this invoice, sent as state ; the examples in the table are what Clairic returned, and the highlighted words are where the values came from:
state · invoice, as text
Invoice INV-4417 from Larkspur Studio, issued 2026-10-14 , payment terms net 45 . Bill to: Harbor & Pine LLC. Contacts: Dana Ruiz (dana@harborpine.example), Priya Shah . Line items: brand audit 2,400.00; icon set 1,150.00; rush fee 300.00. Total due $3,850.00 . Late payments accrue 1.5% per month.
The fields asked for were invoice_number: text , total: number , due_date: date , contacts: list , po_number: text and days_to_pay: estimate .
Type What you get Example
text A string read from the document "INV-4417"
number A number, with decimals and unit you choose 3850
date An ISO date, read or computed "2026-11-28"
time An ISO time of day not asked of this invoice
datetime An ISO date and time not asked of this invoice
list An array of text , number or date items ( items picks which) ["Dana Ruiz", "Priya Shah"]
duration A number in the unit you choose, from seconds to years 45 with unit: "days"
estimate A distribution for a quantity the document implies, between a min and max you set median 45, p10 42, p90 47
forecast The same, for horizon steps into the future at an interval you set; value , mean , median , p10 and p90 are arrays with one entry per step not asked of this invoice
Every answer carries its value ; what else it carries depends on the field type and the model. On Clairic, a value read from the text comes with a span , [start, end) into the state counted in Unicode code points, so you can slice the document and show where it came from (a list carries spans , one per item). Single values carry p_null , the probability that the document holds nothing for the field; a value becomes null when it passes 0.5 (set null_threshold per field to move that line), and guess is the most likely value even then. They also carry confidence , the model’s confidence in the value, and a string read from an image adds spell_confidence for its spelling. An estimate or forecast carries no confidence; mean , median , p10 and p90 describe its distribution, and the width of p10 to p90 is the uncertainty. Extract returns a confidence per value and no p_null ; on text it returns spans too, on a PDF none (section 3).
Those fields are the trust model. Set a confidence floor, send anything under it to a person, and store the rest. A null is an answer, not a low score: the model judges the field absent (its p_null passed the threshold), and guess says what it would have reached for. A value with no confidence , such as an estimate, is judged by its distribution instead.
What goes in is the document and a list of named, typed fields. What comes out is one value per field, a span where a value was read from the text, a confidence and p_null on single values, and a distribution for an estimate.
The request, run on Clairic for $0.00011:
curl https://openrouter.ai/api/alpha/extractions \
-H "Authorization: Bearer $OPENROUTER_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "cloudflare/clairic",
"state": "Invoice INV-4417 from Larkspur Studio, issued 2026-10-14, payment terms net 45. Bill to: Harbor & Pine LLC. Contacts: Dana Ruiz (dana@harborpine.example), Priya Shah. Line items: brand audit 2,400.00; icon set 1,150.00; rush fee 300.00. Total due $3,850.00. Late payments accrue 1.5% per month.",
"fields": {
"invoice_number": { "type": "text" },
"total": { "type": "number", "decimals": 2, "unit": "USD" },
"due_date": { "type": "date", "instructions": "Issue date plus the net payment days" },
"contacts": { "type": "list", "items": "text", "instructions": "People named as contacts" },
"po_number": { "type": "text", "instructions": "Purchase order number, if any" },
"days_to_pay": { "type": "estimate", "min": 0, "max": 120, "step": 1, "instructions": "How many days after issue this invoice will actually be paid" }
},
"reference_date": "2026-11-06"
}'
Clairic read 1,138 input tokens and answered (the response, less its model line):
{
"answers" : {
"invoice_number" : { "type" : "text" , "value" : "INV-4417" , "span" : [ 8 , 16 ], "p_null" : 4.9e-6 , "confidence" : 0.9999 },
"total" : { "type" : "number" , "value" : 3850 , "p_null" : 1.6e-5 , "confidence" : 0.9999 },
"due_date" : { "type" : "date" , "value" : "2026-11-28" , "p_null" : 4.4e-5 , "confidence" : 0.9994 },
"contacts" : { "type" : "list" , "value" : [ "Dana Ruiz" , "Priya Shah" ], "spans" : [[ 118 , 127 ], [ 155 , 165 ]] },
"po_number" : { "type" : "text" , "value" : null , "guess" : "INV-4417" , "p_null" : 0.9999 },
"days_to_pay" : { "type" : "estimate" , "value" : 45 , "mean" : 44.79 , "median" : 45 , "p10" : 42 , "p90" : 47 }
},
"truncated" : false ,
"usage" : { "input_tokens" : 1138 , "output_tokens" : 0 , "cost" : 0.0001138 , "state_tokens" : 118 , "schema_tokens" : 666 , "passes" : 4 },
"id" : "gen-dec-1794000212-JVtrkaQ2JbqaR59u2bjZ" ,
"provider" : "Cloudflare"
}
due_date has no date in the text, so the model computed it from the issue date and the terms; po_number came back null with guess showing what it would have reached for; days_to_pay is an estimate , so it returns a distribution rather than a point, with 80% of the mass between 42 and 47 days. Slice the state with each span to show the evidence next to the value. In Python, with r the requests response to the call above:
state = "Invoice INV-4417 from Larkspur Studio, issued 2026-10-14, payment terms net 45. Bill to: Harbor & Pine LLC. Contacts: Dana Ruiz (dana@harborpine.example), Priya Shah. Line items: brand audit 2,400.00; icon set 1,150.00; rush fee 300.00. Total due $3,850.00. Late payments accrue 1.5% per month."
answers = r.json()[ "answers" ]
for name, answer in answers.items():
spans = answer.get( "spans" ) or ([answer[ "span" ]] if answer.get( "span" ) else [])
evidence = [state[start:end] for start, end in spans]
print ( f " { name } : { answer[ 'value' ] !r } <- { evidence !r } " )
What goes in is the image, in assets , referenced by its key from state , plus the same kind of field list. What comes out is the same shape of record, with source: "image" on values the model marks as read off the picture ( source is optional and paid_on below lacks it, so do not key on it) and a spell_confidence on text. The boxes on the photo in the clip are drawn for the demo; the API returns values, not image coordinates.
The request, run on Clairic for $0.00025:
import base64
import os
import requests
API = "https://openrouter.ai/api/alpha/extractions"
HEADERS = { "Authorization" : f "Bearer { os.environ[ 'OPENROUTER_API_KEY' ] } " }
with open ( "receipt.png" , "rb" ) as f:
receipt = base64.b64encode(f.read()).decode()
r = requests.post(
API ,
headers = HEADERS ,
json = {
"model" : "cloudflare/clairic" ,
"state" : "receipt" ,
"assets" : { "receipt" : { "type" : "image" , "format" : "png" , "data_base64" : receipt}},
"fields" : {
"merchant" : { "type" : "text" },
"total" : { "type" : "number" , "decimals" : 2 },
"paid_on" : { "type" : "date" },
"tax" : { "type" : "number" , "decimals" : 2 , "instructions" : "Sales tax charged" },
"tip" : { "type" : "number" , "decimals" : 2 , "instructions" : "Gratuity, if any" },
},
},
)
r.raise_for_status()
print (r.json()[ "answers" ])
Clairic read 1,064 image tokens and 2,532 in total, and answered (the response, less its model line):
{
"merchant" : { "type" : "text" , "value" : "NORTH HAROR C" , "p_null" : 8.0e-5 , "confidence" : 0.733 , "source" : "image" , "spell_confidence" : 0.733 },
"total" : { "type" : "number" , "value" : 29.04 , "p_null" : 5.3e-8 , "confidence" : 0.9995 , "source" : "image" },
"paid_on" : { "type" : "date" , "value" : "2026-10-24" , "p_null" : 0.0061 , "confidence" : 0.9999 },
"tax" : { "type" : "number" , "value" : 3.79 , "p_null" : 2.8e-4 , "confidence" : 0.9982 , "source" : "image" },
"tip" : { "type" : "number" , "value" : null , "guess" : 0 , "p_null" : 0.9999 , "confidence" : 0.8923 }
}
Every non-null numeric and date field came back above 0.99 confidence, and tip is an explicit null rather than a made-up zero, with p_null at 0.9999. The merchant name is wrong (the receipt says “NORTH HARBOR CAFE”), and Clairic says so: spell_confidence is 0.73, a third below everything else in the response. That is the field you route to a person, and the response told you which one.
PDFs go in assets too, with "type": "document" and "format": "pdf" . Clairic reads images only, so a PDF goes to ScaleDown Extract , which reads one PDF or image per request and answers text and list fields. The boxes on the page in the clip are drawn for the demo; Extract returns values and confidences, not page coordinates.
The request, run on Extract for $0.00016:
curl https://openrouter.ai/api/alpha/extractions \
-H "Authorization: Bearer $OPENROUTER_API_KEY " \
-H "Content-Type: application/json" \
-d @- << EOF
{
"model": "scaledown/extract",
"state": "po",
"assets": { "po": { "type": "document", "format": "pdf", "data_base64": "$( base64 < purchase-order.pdf | tr -d '\n')" } },
"fields": {
"po_number": { "type": "text" },
"vendor": { "type": "text", "instructions": "The supplier the order is placed with" },
"total": { "type": "text", "instructions": "Order total including shipping" },
"delivery_date": { "type": "text", "instructions": "Requested delivery date" },
"items": { "type": "list", "items": "text", "instructions": "Ordered line items" },
"approver": { "type": "text", "instructions": "Who approved the order" }
}
}
EOF
Extract read 3,972 input tokens from the PDF and answered in 2.9 seconds (the response, less its model line):
{
"answers" : {
"po_number" : { "type" : "text" , "value" : "PO-20931" , "confidence" : 1 , "source" : "document" },
"vendor" : { "type" : "text" , "value" : "Meridian Office Supply" , "confidence" : 1 , "source" : "document" },
"total" : { "type" : "text" , "value" : "$4,200.00" , "confidence" : 0.814 , "source" : "document" },
"delivery_date" : { "type" : "text" , "value" : "November 18, 2026" , "confidence" : 0.979 , "source" : "document" },
"items" : { "type" : "list" , "value" : [ "Standing desk, 60 in, walnut" , "Task chair, mesh back" , "Monitor arm, dual" ], "confidences" : [ 0.994 , 0.999 , 1 ], "source" : "document" },
"approver" : { "type" : "text" , "value" : "Priya Shah" , "confidence" : 1 , "source" : "document" }
},
"truncated" : false ,
"usage" : { "input_tokens" : 3972 , "output_tokens" : 0 , "cost" : 0.00015888 },
"id" : "gen-dec-1794274074-RzjUzkyrf7WfR9LpFUTO" ,
"provider" : "ScaleDown"
}
Every value is right, including the three line items out of a table. Two differences from Clairic to plan for: Extract has no number or date types, so the total and the delivery date come back as the strings on the page, and it reports a confidence per value (and per list item) but no p_null or span . The total at 0.81 is the field to glance at; the rest are at or near 1.
Model list
Three models are available at launch, and the same request works with all of them, so you can pick the one that fits the job. Use Clairic for images, like a photo of a receipt, and when you need numbers, dates, or estimates back. Use ScaleDown Extract to pull text out of a PDF, like the parties in a contract. Use Mercury Decide to pull names or phrases out of plain text, like emails or support tickets.
Model Reads Field types Input price Provider options
Clairic ( cloudflare/clairic ) Text and up to 4 PNG or JPEG images Every type $0.10/M include_quantiles , return_state_text under provider.options.cloudflare
Extract ( scaledown/extract ) Text, or one PDF or image text , and list of text $0.04/M threshold , top_n under provider.options.scaledown
Mercury Decide ( inception/mercury-decide ) Text only text , and list of text $0.02/M snap_to_words , threshold , group_fields under provider.options.inception
Output is free on all three. Prices are the catalog values on November 6, 2026; the model pages have the current ones.
Cloudflare’s Clairic
Clairic ( cloudflare/clairic ), Cloudflare’s extraction model on Workers AI, is the one to start with. It reads text and up to four PNG or JPEG images per request, supports every field type, and is the only launch model that returns p_null , spans and distributions for estimate and forecast . Sections 1 and 2 above ran on it. Two provider options extend the response: include_quantiles: true returns 99 percentiles for every estimate and forecast , and return_state_text: true echoes back the exact text the span offsets index into, so you can check a slice against it.
Extract ( scaledown/extract ) reads text, or one PDF or image per request, and answers text and list fields with a confidence per value. It is the model for PDFs today (section 3). It reports no null probability, so it rejects null_threshold ; threshold and top_n under provider.options.scaledown tune how it picks values.
Inception’s Mercury Decide
Mercury Decide ( inception/mercury-decide ) reads text only and answers text and list fields at the lowest input price of the three. It rejects reference_date ; snap_to_words , threshold and group_fields under provider.options.inception are its options.
Text-only fields run anywhere. We sent the text and list fields of the invoice in section 1 to Mercury Decide and Extract: both returned the same values, and on text the same spans as Clairic, for $0.000015 and $0.000014. Extract returns no spans for a PDF (section 3).
Both routes take the same envelope ( model , state , assets , provider ) and differ in what you hand the model and what it hands back.
Decisions: you write the answers, the model weighs them. A Decisions request carries questions , and every question comes with its answer space: a noul is one proposition that is true or false, a choice lists the options, a score names a scale, a box asks for a region in an image. For a noul , choice or score , the model never produces a value you did not write down; it distributes probability over the answers you wrote (a box returns coordinates for the region you described). That is what makes it the right tool for anything that is a judgment call: is this an invoice, which of these five terms applies, how severe is this, does this image contain a receipt. The output is a calibrated number you can threshold, and a wrong answer is one of the options you already handle.
Extractions: you name the field, the model finds the value. An Extractions request carries fields , and each field is a name and a type: text , number , date , list , duration , estimate , forecast . The answer space is the type, not a list you wrote, so the model has to locate the value in the document (or compute it, for a due date from issue date and terms, or estimate it, for days to payment). Because the value is open, the answer comes with evidence: the span it was read from, p_null for whether the document holds anything for it at all, and confidence . That is the right tool when the answer is the content itself: the number on the receipt, the names on the contract, the date on the form.
The same invoice as section 1, through Decisions on Clef Flash :
{
"questions" : {
"overdue" : { "type" : "noul" , "instruc
首次收录 · 2026-11-12 · 9.22 分