--- layout: null title: openextract --- openextract - Structured Data Extraction
OE
on main | sessions, styles, and typed results

Structured Extraction

Typed output from any media.

Extract structured data from documents, images, audio, and video using LLMs and Pydantic schemas.

Read the guide View Source
Terminal install
$ uv add openextract
$ openextract report.pdf \
    --schema mypkg:Invoice \
    --model xai:grok-4.3
{ "total": 1240.00, "currency": "USD", ... }
Pydantic Any LLM

Zero Config

One function call, or a reusable session. Bring a schema, media, and a model string.

Multi-Media

Documents, images, audio, and video with smart routing.

Any LLM

OpenAI, Anthropic, Google, Bedrock, xAI, Groq, Mistral, OpenRouter, Ollama, and more via pydantic-ai.

Type Safe

Pydantic schemas ensure validated, typed output every time.

How it works

Schema in, typed data out

Define a BaseModel, call extract(), get validated output.

1

Define a schema

Describe the shape you want with a Pydantic model.

2

Point at any media

Documents, images, audio, or video via path, URL, bytes, or a session.

3

Get typed output

Validated against your schema. No parsing, no regex.

Terminal extract.py
from pydantic import BaseModel
from openextract import extract

class Report(BaseModel):
    title: str
    findings: list[str]
    severity: int

result = extract(
    schema=Report,
    model="xai:grok-4.3",
    input_file="https://example.com/report.pdf",
    instructions="Extract findings",
)

What’s new

In v0.14.0

The latest PyPI release: v0.14.0.

Full changelog
JSON

Citation.as_dict

Citation.as_dict() returns a JSON-stable {field, quote, page, bbox} payload. Boxes stay parser-backed; they are never invented.

as_dict bbox
CLI

--cite in JSON output

openextract --cite requests per-field citations via the same cite=True library path. JSON and JSONL include a citations array.

--cite JSON
Swarm

SwarmResult.citations

When cite=True, swarms keep reduced per-field spans that support output. Per-agent citations stay on each ExtractionResult.

cite=True SwarmResult

Also in v0.14.0: cite=True example (extract_with_citations.py) and citation docs (guide + agents), ExtractBench smoke notes that 0.13.1+ includes grounding, and a Metadata-Version 2.5 publish fix. v0.13.1 shipped ExtractBench page/word grounding.

Works with any media

Documents Images Audio Video

PDF, DOCX, PNG, JPG, MP3, MP4, and 20+ formats