---
title: "OCR vs AI Field Extraction: Text Out or Fields Out?"
description: "OCR gives you text; Clairic gives you typed fields with confidence. Compare outputs, pipelines and when to combine them."
canonical: "https://system-one.dev/en/blog/clairic-vs-ocr"
language: "en"
---

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

**Key points**\n\n1. OCR turns an image into text; Clairic turns text or images into the specific typed fields you ask for.
2. An OCR pipeline needs rules after it to find the total or the date; with Clairic that step is one `extract()` call with field definitions.
3. They combine well: pass OCR text as `state`, or send the image directly, up to 4 per request.

OCR gives you the text in an image, but it doesn't know which number is the total. Clairic gives you named, typed fields; scalar fields can carry a confidence, and anything missing comes back as null.

![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):

| | OCR | Clairic |
|---|---|---|
| Output | Several 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](https://system-one.dev/en/use-cases/invoice-receipt-extraction) *(CTA button)*

## 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 + rules | Clairic `extract()` |
|---|---|---|
| Output | Text | Typed fields |
| Finding fields | Write your own rules or templates | Field definitions + instructions |
| Missing values | Handle it yourself when a rule doesn't match | null when pNull is above the threshold |
| Confidence signal | Depends on the engine | Field-level confidence and pNull (scalar fields) |
| Computed values (e.g. due date) | Write them yourself | Can be worked out via instructions |
| Billing | Depends on your setup | Once 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.

```ts
import {
  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](https://system-one.dev/en/demo/invoice-extraction) (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](https://system-one.dev/en/blog/clairic-vs-llm-extraction) and [screenshot to JSON](https://system-one.dev/en/use-cases/screenshot-to-json), or check rates on the [Clairic model page](https://system-one.dev/en/models/clairic).

[Read the Clairic SDK docs](https://docs.system-one.dev/en/docs/sdk/clairic) *(CTA button)*

## Related reading

- [Invoice & receipt extraction API](https://system-one.dev/en/use-cases/invoice-receipt-extraction)
- [LLM extraction vs Clairic](https://system-one.dev/en/blog/clairic-vs-llm-extraction)
- [Screenshot to JSON for AI agents](https://system-one.dev/en/use-cases/screenshot-to-json)
- [Clairic model page](https://system-one.dev/en/models/clairic)

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.
