Skip to content
Back to Blog

OCR vs AI Field Extraction: Text Out or Fields Out?

![Same receipt processed by OCR into text and by Clairic into fields](TODO-IMG: Cover. One receipt splitting into two paths: OCR (a block of text) and Clairic (field cards). Designed.)

What OCR outputs

OCR outputs the characters and lines it finds in an image. It doesn't decide what a string means, and it doesn't turn "12.50" into a number or "Oct 3" into a date.

So after OCR, you still have to work out which line is the order number and which number is the tax.

What Clairic outputs

Clairic returns one typed value per field you define. Scalar fields can carry confidence and pNull, and a value the input can't support comes back as null. When you send text as state, text answers can include a span pointing back into it. Clairic doesn't generate text.

Same receipt, two outputs (illustrative):

OCRClairic
OutputSeveral lines of raw text{ order_number, purchase_time, subtotal, tax, tip, discount: null }

![OCR raw text next to Clairic typed JSON for one receipt](TODO-IMG: Left: raw text from an OCR run on a mock receipt. Right: real Clairic JSON output for the same receipt. Real run screenshots, API key masked.)

See invoice & receipt extraction

Pipeline comparison

A typical OCR pipeline is image → OCR → regex, rules or templates → fields. Those rules are tied to a layout, so they need upkeep whenever a layout changes.

With Clairic, the rules step becomes one extract() call with field definitions and instructions.

![OCR plus rules pipeline compared with a single Clairic extract call](TODO-IMG: Flow diagram: image → OCR → rules → fields, versus image/text → extract() → fields. Designed.)

OCR + rulesClairic extract()
OutputTextTyped fields
Finding fieldsWrite your own rules or templatesField definitions + instructions
Missing valuesHandle it yourself when a rule doesn't matchnull when pNull is above the threshold
Confidence signalDepends on the engineField-level confidence and pNull (scalar fields)
Computed values (e.g. due date)Write them yourselfCan be worked out via instructions
BillingDepends on your setupOnce per request, by input size

Combine them

If you already run OCR, pass its text to Clairic as state. Keeping the source text means text answers can carry a span you can highlight. You can also send text and images together: non-empty state plus up to 4 images.

tsimport {
  createSystemOne, defineFields, textField, numberField, dateTimeField,
} from '@system-one-ai/core';
import { systemOneAdapter } from '@system-one-ai/adapter-system-one';
import { createFetchTransport } from '@system-one-ai/transport-fetch';

const apiKey = process.env.SYSTEM_ONE_API_KEY;
if (!apiKey) throw new Error('Set SYSTEM_ONE_API_KEY.');

const client = createSystemOne({
  adapter: systemOneAdapter,
  transport: createFetchTransport(),
  apiKey,
  timeoutMs: 30_000,
  maxRetries: 0,
});

const ocrText = `<text returned by your OCR step>`;

const result = await client.extract({
  model: 'clairic',
  state: ocrText,
  fields: defineFields({
    order_number: textField(),
    purchase_time: dateTimeField(),
    subtotal: numberField({ decimals: 2 }),
    tax: numberField({ decimals: 2 }),
    discount: numberField({ decimals: 2, instructions: 'Only if the receipt shows a discount.' }),
  }),
  options: { returnStateText: true },
});

const order = result.answers.order_number;
console.log(order.value, order.span); // span = [start, end] character positions in ocrText

Install with npm install @system-one-ai/core@0.8.0 @system-one-ai/adapter-system-one@0.7.0 @system-one-ai/transport-fetch@0.8.0, set SYSTEM_ONE_API_KEY in .env, and run with node --env-file=.env. Every run creates a new billable request. options.returnStateText returns the text that spans index into, which makes highlighting easy.

To see Clairic on invoice text without writing code, try the invoice extraction demo (sign-in required).

When OCR alone is enough

If you need full-text search or a full-text archive, and you don't need specific fields, OCR alone does the job.

If you do need fields, see LLM extraction vs Clairic and screenshot to JSON, or check rates on the Clairic model page.

Read the Clairic SDK docs

Last verified: 2026-10-22

Frequently asked questions

Is Clairic an OCR engine?

No. It returns typed values for the fields you define, not a transcript of the image.

Can I send OCR text to Clairic?

Yes. Pass it as state; text answers can then include a span pointing back into that text.

Do I still need OCR if I use Clairic?

Not for field extraction from PNG, JPEG or WebP images, since Clairic accepts up to 4 images directly. Keep OCR if you also need the full text.

How is Clairic billed?

Once per request, by input size (2 credits per 4KB block), not per field.