* * * PENNYOCR × PYDANTIC AI * * *
PennyOCR with Pydantic AI.
Pydantic AI is about typed, validated agent IO — and our SDK speaks the same language: dataclass results, deterministic errors, exact costs. Register one tool function and your agent reads any PDF or image with a schema it can trust.
START FREE — 100 PAGES
$0.75 / 1,000 PAGES
1,333 PAGES PER DOLLAR · NO CREDIT CARD
01 / TRY IT
ONE ENDPOINT.
POST a file, get JSON back — the extracted text, per page and joined. PDF, PNG, JPEG, WebP or TIFF.
curl https://api.pennyocr.com/v1/ocr \
-H "Authorization: Bearer $PENNYOCR_API_KEY" \
-F "file=@invoice.pdf"
# $0.75 per 1,000 pages, first 100 free02 / USE CASES
THE TYPED TOOL.
THE CODE
@agent.tool_plain · def read_document(path: str) -> str: return PennyOCR().ocr(path, format="markdown").text — result objects are dataclasses (id, pages, text, page_results, cost_usd).
TYPED FAILURES
PennyOCRError carries status_code: 402 means buy credits, 413 means split the document, 422 means the file's unreadable. Agents can branch on it cleanly.
COST IN THE LOOP
Return cost_usd alongside content and let the agent track its own budget across a run.
VIA MCP INSTEAD
Pydantic AI speaks MCP: add https://mcp.pennyocr.com as a tool server and skip the wrapper entirely.
03 / PRICE CHECK
HALF THE PRICE OF THE BIG CLOUDS.
Per 1,000 pages, public list prices, first tier.
PENNYOCR$0.75
AWS TEXTRACT$1.50
GOOGLE CLOUD VISION$1.50
AZURE DOC INTELLIGENCE$1.50
YOU KEEP50%
ASYNC SUPPORT?
The REST endpoint works with httpx.AsyncClient today (one multipart POST); an async SDK method is on the roadmap.
STRUCTURED EXTRACTION INTO PYDANTIC MODELS?
Today: markdown in, your model's structured-output pass out — works well. A native /v1/extract that takes a JSON schema is on the roadmap.
HOW DO I TEST WITHOUT SPENDING?
100 free pages/month per account, and estimate_cost (free) for URL documents. Enough to build and test the whole tool path.
ALSO ON THE MENU