Structured Extraction
Typed output from any media.
Extract structured data from documents, images, audio, and video using LLMs and Pydantic schemas.
$ uv add openextract
$ openextract report.pdf \
--schema mypkg:Invoice \
--model xai:grok-4.3
{ "total": 1240.00, "currency": "USD", ... }
Zero Config
One function call. Bring a schema, a URL, and an LLM model string.
Multi-Media
Documents, images, audio, and video with smart routing.
Any LLM
11 providers wired in: OpenAI, Anthropic, Google, AWS Bedrock, xAI, Cohere, Hugging Face, Groq, Mistral, OpenRouter, and Ollama.
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.
Define a schema
Describe the shape you want with a Pydantic model.
Point at any media
Documents, images, audio, or video via URL.
Get typed output
Validated against your schema. No parsing, no regex.
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
v0.10.0
Non-blocking media and resilient retries
Async APIs now offload disk, DNS, and file-like reads while reusing HTTP clients. Retries reuse prepared inputs and agents, retry only transient failures, and honor bounded Retry-After values.
Works with any media
PDF, DOCX, PNG, JPG, MP3, MP4, and 20+ formats