More document fields right than Claude Sonnet 5.5, for 88% less
Pull the fields you need out of checks, invoices, statements and forms as typed JSON that fits your schema. SIE runs Gemma 4 31B, an open vision model: send a page image, get the record back.
SIE Gemma 4 31B
Specs match the note
{
"power": {
"watts": 662, "efficiency": 91,
"powerFactor": 0.98, "inputVoltage": "220-240v"
},
"ratings": { "protection": "ip65" },
"physical": {
"weight": 1.4, "material": "steel",
"mountingType": "recessed"
}
}
{
"watts": 662,
"efficiency": 91,
"powerFactor": 0.98,
"inputVoltage": "220-240v"
} Frontier APIs misread fields and reject large schemas
GPT-6.1 Sol, reasoning xhigh
11 of 15 fields right{
"checkNumber": 535,
"routingNumber": 799263305,
"address": "6537 Moylett Station",
"city": "Rempelport"
} SIE Gemma 4 31B
15 of 15 fields right{
"checkNumber": 8535,
"routingNumber": 99263305,
"address": "6537 Maybell Station",
"city": "Rennerport"
} Claude Sonnet 5.5 and Claude Haiku 5.5
82 of 546 schemas rejected400 invalid_request_error: Schemas contains too many optional parameters (42), which would make grammar compilation inefficient. Reduce the number of optional parameters in your tool schemas (limit: 24).
61 for too many optional fields, 21 as "Schema is too complex."
SIE Gemma 4 31B
546 of 546 schemas acceptedEvery schema went in unchanged, as the strict response format, and came back as typed fields.
- arXiv:2607.21617 Amazon study: AI document readers turn unusual words into familiar ones. GPT-5.4 mini did it to 1 in 4.
Do VLMs Read or Rewrite? On Transcription Faithfulness in Vision-Language Models
“they often tend to rewrite it into a more plausible form”
- ACL Anthology 2026.findings-acl.1237 Findings of ACL 2026 ACL 2026 study: every vision model tested reported numbers it could not see
Perceptual Hallucination in Vision–Language Models: Definition, Analysis and Verification
“perceptual hallucination occurs across all models”
98% of GPT-6.1 Sol's accuracy, for 85% less
| Model | Fields read correctly | Cost per 1,000 documents |
|---|---|---|
| GPT-6.1 Sol | 96.1% | $14.63 |
| SIE Gemma 4 31B | 94.3% | $2.11 |
| GPT-6 Luna, high | 92.3% | $1.12 |
| Claude Sonnet 5.5 | 92.2% | $18.68 |
| Claude Haiku 5.5 | 88.2% | $1.19 |
| Mistral OCR 4.1 | 83.4% | $9.00 |
546 business documents in 17 formats
- Documents
- OmniAI OCR Benchmark: checks, invoices, statements, forms
- Scoring
- Answer-key fields returned exactly; failed or cut-off replies score zero
- Settings
- Each API at its default or a stronger setting, every model with 8,192 output tokens
- Prices
- Real-time list prices on each model's own recorded tokens; Gemma 4 31B at its Serverless rate
Send a page and your schema, get typed fields back
from pathlib import Pathimport base64import jsonfrom sie_sdk import SIEClientclient = SIEClient(api_key="API keysk-sie-…")schema = json.loads("""schema{ "type": "object", "properties": { "items": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {···"brand": ···, "quantity": ···, "reference": ···, "productSpecsJson": {···"watts": ···, "efficiency": ···}, {"type": "null"}]}, "header": {"type": "object", "properties": {···"date": ···} }, "required": ["items", "header"], "additionalProperties": false}""")instruction = "instruction···Copy values as they appear on the document.···"prompt = f"{instruction}\n\nJSON schema:\n{json.dumps(schema, indent=2, ensure_ascii=False)}"image = base64.b64encode(Path(fileJPGdelivery-note.jpgbrowse).read_bytes()).decode("ascii")# Messages: the prompt as the system message, the image as the user message. Copy includes them.result = client.chat_completions( "modelgoogle/gemma-4-31B-it:h100-96k-hires-out8k-no-spec", messages, max_completion_tokens=8192, extra_body={"temperature":0,"presence_penalty":0}, # Strict JSON-schema response_format. Copy includes it.)# Copy also reads and parses the JSON reply.import { readFile } from 'node:fs/promises';
import { SIEClient } from '@superlinked/sie-sdk';
const client = new SIEClient(undefined, { apiKey: 'sk-sie-…' });
const schema = {
"type": "object",
"properties": {
"items": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {···"brand": ···, "quantity": ···, "reference": ···, "productSpecsJson": {···"watts": ···, "efficiency": ···}, {"type": "null"}]},
"header": {"type": "object", "properties": {···"date": ···}
},
"required": ["items", "header"],
"additionalProperties": false
};
const instruction = "···Copy values as they appear on the document.···";
const prompt = `${instruction}\n\nJSON schema:\n${JSON.stringify(schema, null, 2)}`;
const image = await readFile("delivery-note.jpg");
const result = await client.chatCompletions({
model: 'google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec',
// Messages: the prompt as the system message, the image as the user message. Copy includes them.
max_completion_tokens: 8192,
temperature: 0,
presence_penalty: 0,
// Strict JSON-schema response_format. Copy includes it.
});
// Copy also reads and parses the JSON reply.document_image=$(base64 < 'delivery-note.jpg' | tr -d '\n')
curl https://api.superlinked.com/v1/chat/completions \
-H "Authorization: Bearer sk-sie-…" \
-H "Content-Type: application/json" \
-d "{\"model\":\"google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec\",\"messages\":[{\"role\":\"system\",\"content\":\"···Copy values as they appear on the document.···\\n\\nJSON schema:\\n{\\n \\\"type\\\": \\\"object\\\",\\n \\\"properties\\\": {\\n \\\"items\\\": {\\\"anyOf\\\": [{\\\"type\\\": \\\"array\\\", \\\"items\\\": {\\\"type\\\": \\\"object\\\", \\\"properties\\\": {···\\\"brand\\\": ···, \\\"quantity\\\": ···, \\\"reference\\\": ···, \\\"productSpecsJson\\\": {···\\\"watts\\\": ···, \\\"efficiency\\\": ···}, {\\\"type\\\": \\\"null\\\"}]},\\n \\\"header\\\": {\\\"type\\\": \\\"object\\\", \\\"properties\\\": {···\\\"date\\\": ···}\\n },\\n \\\"required\\\": [\\\"items\\\", \\\"header\\\"],\\n \\\"additionalProperties\\\": false\\n}\"},{\"role\":\"user\",\"content\":[{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/jpeg;base64,$document_image\"}}]}],\"max_completion_tokens\":8192,\"temperature\":0,\"presence_penalty\":0,\"response_format\":{\"type\":\"json_schema\",\"json_schema\":{\"name\":\"fields\",\"strict\":true,\"schema\":{\"type\":\"object\",\"properties\":{\"items\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"sn\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"type\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"LED Luminaire\",\"Power Supply\",\"Control System\",\"Mounting Bracket\",\"LED Driver\",\"Cable Assembly\",\"Junction Box\",\"Sensor Module\"]},{\"type\":\"null\"}]},\"unit\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"pcs\",\"set\",\"unit\"]},{\"type\":\"null\"}]},\"brand\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"Philips\",\"Osram\",\"Schneider Electric\",\"Siemens\",\"ABB\",\"Lutron\",\"Legrand\",\"Mean Well\"]},{\"type\":\"null\"}]},\"quantity\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"productSpecsJson\":{\"type\":\"object\",\"properties\":{\"power\":{\"type\":\"object\",\"properties\":{\"watts\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"efficiency\":{\"anyOf\":[{\"description\":\"Efficiency in percentage, 0-100\",\"type\":\"number\"},{\"type\":\"null\"}]},\"powerFactor\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"inputVoltage\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"100-240v\",\"100-277v\",\"220-240v\"]},{\"type\":\"null\"}]}},\"required\":[\"watts\",\"efficiency\",\"powerFactor\",\"inputVoltage\"],\"additionalProperties\":false},\"ratings\":{\"type\":\"object\",\"properties\":{\"protection\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"ip65\",\"ip66\",\"ip67\"]},{\"type\":\"null\"}]}},\"required\":[\"protection\"],\"additionalProperties\":false},\"physical\":{\"type\":\"object\",\"properties\":{\"weight\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"material\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"aluminum\",\"steel\",\"plastic\"]},{\"type\":\"null\"}]},\"mountingType\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"surface\",\"recessed\",\"track\"]},{\"type\":\"null\"}]}},\"required\":[\"weight\",\"material\",\"mountingType\"],\"additionalProperties\":false}},\"required\":[\"power\",\"ratings\",\"physical\"],\"additionalProperties\":false}},\"required\":[\"sn\",\"type\",\"unit\",\"brand\",\"quantity\",\"reference\",\"productSpecsJson\"],\"additionalProperties\":false}},{\"type\":\"null\"}]},\"header\":{\"type\":\"object\",\"properties\":{\"to\":{\"type\":\"object\",\"properties\":{\"tel\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"email\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"location\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"attention\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"vatNumber\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"companyName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"tel\",\"email\",\"location\",\"attention\",\"reference\",\"vatNumber\",\"companyName\"],\"additionalProperties\":false},\"date\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"from\":{\"type\":\"object\",\"properties\":{\"tel\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"email\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"location\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"vatNumber\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"companyName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"tel\",\"email\",\"location\",\"reference\",\"vatNumber\",\"companyName\"],\"additionalProperties\":false},\"projectName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"to\",\"date\",\"from\",\"projectName\"],\"additionalProperties\":false}},\"required\":[\"items\",\"header\"],\"additionalProperties\":false}}}}"Build the "Doc field extraction" capability into my app using the Superlinked Inference Engine (SIE).
Context
- SIE is an OpenAI-style inference API. Python SDK: `from sie_sdk import SIEClient`; TypeScript: `@superlinked/sie-sdk`.
- Base URL: https://api.superlinked.com (or my regional endpoint). Auth: Bearer key from env `SIE_API_KEY` (never hard-code it).
- Model: google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec (OpenAI-compatible endpoint: /v1/chat/completions). Keep the model id configurable.
Task
- Input: an uploaded document plus the JSON schema for its fields.
- Behaviour: parse the document, then return fields matching the JSON schema
- Send one POST /v1/chat/completions request (SDK: chat_completions / chatCompletions) with a system message and a user message. The system message is "Extract data from the document image into the JSON schema. Copy values as they appear on the document. Use null for a field the document does not contain. Return only the JSON.", a blank line, "JSON schema:" and the submitted schema as JSON indented by two spaces; response_format only constrains decoding, so the model reads the field descriptions from this text. The user message holds only an image_url part. Base64-encode the original local image bytes as a canonical data:image/png, data:image/jpeg or data:image/webp URI (normalize jpg to image/jpeg). Use max_completion_tokens 8192, temperature 0 and response_format {type: "json_schema", json_schema: {name: "fields", strict: true, schema}} with the submitted schema unchanged. Parse choices[0].message.content as JSON and fail loudly when it is missing or invalid.
Deliverables
- A typed client wrapper, an application-level function for this task, error handling for timeouts/empty input, and unit tests with a stubbed client.
- Wire it into my existing stack (ask me which framework if unclear) and add a short usage example.deliveryDate 2025-02-12
| reference | brand | quantity | watts | efficiency |
|---|---|---|---|---|
| ASDZPDI5YL | Lutron | 50 | 103 | 95 |
| FL5GMWQOUQ | Osram | 5 | 188 | 93 |
Read your documents into your schema
Serverless API
We host the models; you call one API.
- No idle GPUs, pay for what you use
- SOC 2 Type 2, US or EU data residency
- $50 of credit to start, no card required
Self-hosted (Kubernetes)
SIE in your clusters, backed by our engineers.
- Data stays in your own cloud account
- Same models and API as Serverless
- Terraform to your cloud in minutes
Run locally
The open-source server on your own machine.
docker run --gpus all -p 8080:8080 ghcr.io/superlinked/sie-server:latest-cuda13-sglang-cu130