curl --request POST \
--url https://openrouter.ai/api/alpha/extractions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"contacts": {
"items": "text",
"type": "list"
},
"days_to_pay": {
"max": 120,
"min": 0,
"step": 1,
"type": "estimate"
},
"due_date": {
"instructions": "Issue date plus the net payment days",
"type": "date"
},
"invoice_number": {
"type": "text"
},
"total": {
"decimals": 2,
"type": "number",
"unit": "USD"
}
},
"model": "cloudflare/clairic",
"reference_date": "2026-10-28",
"state": "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080."
}
'import requests
url = "https://openrouter.ai/api/alpha/extractions"
payload = {
"fields": {
"contacts": {
"items": "text",
"type": "list"
},
"days_to_pay": {
"max": 120,
"min": 0,
"step": 1,
"type": "estimate"
},
"due_date": {
"instructions": "Issue date plus the net payment days",
"type": "date"
},
"invoice_number": { "type": "text" },
"total": {
"decimals": 2,
"type": "number",
"unit": "USD"
}
},
"model": "cloudflare/clairic",
"reference_date": "2026-10-28",
"state": "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: {
contacts: {items: 'text', type: 'list'},
days_to_pay: {max: 120, min: 0, step: 1, type: 'estimate'},
due_date: {instructions: 'Issue date plus the net payment days', type: 'date'},
invoice_number: {type: 'text'},
total: {decimals: 2, type: 'number', unit: 'USD'}
},
model: 'cloudflare/clairic',
reference_date: '2026-10-28',
state: 'Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.'
})
};
fetch('https://openrouter.ai/api/alpha/extractions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/alpha/extractions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'contacts' => [
'items' => 'text',
'type' => 'list'
],
'days_to_pay' => [
'max' => 120,
'min' => 0,
'step' => 1,
'type' => 'estimate'
],
'due_date' => [
'instructions' => 'Issue date plus the net payment days',
'type' => 'date'
],
'invoice_number' => [
'type' => 'text'
],
'total' => [
'decimals' => 2,
'type' => 'number',
'unit' => 'USD'
]
],
'model' => 'cloudflare/clairic',
'reference_date' => '2026-10-28',
'state' => 'Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/alpha/extractions"
payload := strings.NewReader("{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openrouter.ai/api/alpha/extractions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/alpha/extractions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}"
response = http.request(request)
puts response.read_body{
"answers": {
"contacts": {
"confidence": 0.9999,
"spans": [
[
53,
62
],
[
64,
74
]
],
"type": "list",
"value": [
"Dana Ruiz",
"Priya Shah"
]
},
"days_to_pay": {
"mean": 29.5,
"median": 30,
"p10": 21,
"p90": 38,
"type": "estimate",
"value": 30
},
"due_date": {
"guess": "2026-10-02",
"p_null": 1.9e-8,
"type": "date",
"value": "2026-10-02"
},
"invoice_number": {
"confidence": 1,
"guess": "INV-2291",
"p_null": 3.8e-10,
"span": [
8,
16
],
"type": "text",
"value": "INV-2291"
},
"total": {
"confidence": 0.9999,
"guess": 1080,
"p_null": 2.3e-8,
"type": "number",
"value": 1080
}
},
"id": "gen-dec-1793251006-X5e5eKGQdvR9rblyX250",
"model": "cloudflare/clairic",
"provider": "Cloudflare",
"truncated": false,
"usage": {
"cost": 0.0000655,
"image_tokens": 0,
"input_tokens": 655,
"output_tokens": 0,
"passes": 3,
"schema_tokens": 472,
"state_tokens": 61
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 402,
"message": "Insufficient credits. Add more using https://openrouter.ai/credits"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 413,
"message": "Request payload too large"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}{
"error": {
"code": 524,
"message": "Request timed out. Please try again later."
}
}{
"error": {
"code": 529,
"message": "Provider returned error"
}
}Submit an Extractions request
Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.
curl --request POST \
--url https://openrouter.ai/api/alpha/extractions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"contacts": {
"items": "text",
"type": "list"
},
"days_to_pay": {
"max": 120,
"min": 0,
"step": 1,
"type": "estimate"
},
"due_date": {
"instructions": "Issue date plus the net payment days",
"type": "date"
},
"invoice_number": {
"type": "text"
},
"total": {
"decimals": 2,
"type": "number",
"unit": "USD"
}
},
"model": "cloudflare/clairic",
"reference_date": "2026-10-28",
"state": "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080."
}
'import requests
url = "https://openrouter.ai/api/alpha/extractions"
payload = {
"fields": {
"contacts": {
"items": "text",
"type": "list"
},
"days_to_pay": {
"max": 120,
"min": 0,
"step": 1,
"type": "estimate"
},
"due_date": {
"instructions": "Issue date plus the net payment days",
"type": "date"
},
"invoice_number": { "type": "text" },
"total": {
"decimals": 2,
"type": "number",
"unit": "USD"
}
},
"model": "cloudflare/clairic",
"reference_date": "2026-10-28",
"state": "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: {
contacts: {items: 'text', type: 'list'},
days_to_pay: {max: 120, min: 0, step: 1, type: 'estimate'},
due_date: {instructions: 'Issue date plus the net payment days', type: 'date'},
invoice_number: {type: 'text'},
total: {decimals: 2, type: 'number', unit: 'USD'}
},
model: 'cloudflare/clairic',
reference_date: '2026-10-28',
state: 'Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.'
})
};
fetch('https://openrouter.ai/api/alpha/extractions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/alpha/extractions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
'contacts' => [
'items' => 'text',
'type' => 'list'
],
'days_to_pay' => [
'max' => 120,
'min' => 0,
'step' => 1,
'type' => 'estimate'
],
'due_date' => [
'instructions' => 'Issue date plus the net payment days',
'type' => 'date'
],
'invoice_number' => [
'type' => 'text'
],
'total' => [
'decimals' => 2,
'type' => 'number',
'unit' => 'USD'
]
],
'model' => 'cloudflare/clairic',
'reference_date' => '2026-10-28',
'state' => 'Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/alpha/extractions"
payload := strings.NewReader("{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openrouter.ai/api/alpha/extractions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/alpha/extractions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": {\n \"contacts\": {\n \"items\": \"text\",\n \"type\": \"list\"\n },\n \"days_to_pay\": {\n \"max\": 120,\n \"min\": 0,\n \"step\": 1,\n \"type\": \"estimate\"\n },\n \"due_date\": {\n \"instructions\": \"Issue date plus the net payment days\",\n \"type\": \"date\"\n },\n \"invoice_number\": {\n \"type\": \"text\"\n },\n \"total\": {\n \"decimals\": 2,\n \"type\": \"number\",\n \"unit\": \"USD\"\n }\n },\n \"model\": \"cloudflare/clairic\",\n \"reference_date\": \"2026-10-28\",\n \"state\": \"Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.\"\n}"
response = http.request(request)
puts response.read_body{
"answers": {
"contacts": {
"confidence": 0.9999,
"spans": [
[
53,
62
],
[
64,
74
]
],
"type": "list",
"value": [
"Dana Ruiz",
"Priya Shah"
]
},
"days_to_pay": {
"mean": 29.5,
"median": 30,
"p10": 21,
"p90": 38,
"type": "estimate",
"value": 30
},
"due_date": {
"guess": "2026-10-02",
"p_null": 1.9e-8,
"type": "date",
"value": "2026-10-02"
},
"invoice_number": {
"confidence": 1,
"guess": "INV-2291",
"p_null": 3.8e-10,
"span": [
8,
16
],
"type": "text",
"value": "INV-2291"
},
"total": {
"confidence": 0.9999,
"guess": 1080,
"p_null": 2.3e-8,
"type": "number",
"value": 1080
}
},
"id": "gen-dec-1793251006-X5e5eKGQdvR9rblyX250",
"model": "cloudflare/clairic",
"provider": "Cloudflare",
"truncated": false,
"usage": {
"cost": 0.0000655,
"image_tokens": 0,
"input_tokens": 655,
"output_tokens": 0,
"passes": 3,
"schema_tokens": 472,
"state_tokens": 61
}
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 402,
"message": "Insufficient credits. Add more using https://openrouter.ai/credits"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 413,
"message": "Request payload too large"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}{
"error": {
"code": 524,
"message": "Request timed out. Please try again later."
}
}{
"error": {
"code": 529,
"message": "Provider returned error"
}
}Authorizations
API key as bearer token in Authorization header
Body
Map of field name to typed field spec.
Show child attributes
Show child attributes
The text to read from. May be empty only when the request carries image assets.
Assets keyed by reference string. Write a reference wherever the asset belongs in state or a field instructions; every asset must be referenced at least once. A state that is exactly the sole asset's key carries no text of its own and is read as file-only. A model that reads either text or a document per request, not both (ScaleDown Extract with a PDF), needs that form: any other text around the key is state text and is rejected with 400.
Show child attributes
Show child attributes
Provider routing preferences for the request.
Show child attributes
Show child attributes
{ "allow_fallbacks": true }
ISO date that anchors dates written without a year.
^\d{4}-\d{2}-\d{2}$A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
256"session-1234"
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
Show child attributes
Show child attributes
{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
}
256Response
Extractions response
Was this page helpful?