SchemaLens Docs

A microservice that turns printed documents into structured data

SchemaLens is an open-source, stateless HTTP service: send a document and the fields you need, get validated JSON, CSV or XLSX back - every value with a confidence and the line it came from. Run it on your server or deploy the AWS template, with the LLM of your choice.

  • Python
  • FastAPI
Document received
FieldValueConfidence
SellerExample Ltd
Seller VAT ID1234563218
Issue date2026-10-14
Due date2026-10-28
Gross total1230.00 USD
Cost categoryIT services
.xlsx .csv .json

Try it on your own document

A small, rate-limited public instance of the service: pick a document, add a file or take a sample.

What kind of document is it?

Architecture

A stateless microservice: a document in, validated fields out, nothing kept in between.

Your system

Your backend, ETL job or AI agent, with an API key.

POST /api/v1/extract

SchemaLens

Read

OCR into numbered lines

Extract

LLM fills your fields

Check

Code validates each value

JSON · CSV · XLSX

Result

Each value with a confidence and its source line.

Your LLM

Ollama, OpenAI-compatible or Groq - it sees only the text

Built with

  • Python
  • FastAPI
  • EasyOCR
  • Any LLM
  • Docker
  • GitHub Actions
  • AWS SAM
  • MCP

Run it yourself

The whole stack is open source under Apache 2.0. Run it on your laptop, on your server or on AWS, with the language model you choose.

Docker

The whole API in one container, with the OCR models baked in: no GPU, no model downloads at start. Point it at a language model in .env and call it over HTTP.

  • Built from the Dockerfile, nothing to pull
  • Interactive docs at /docs, OpenAPI at /openapi.json
  • Port, limits and the LLM from .env
  • Optional Ollama container next to it: fully offline
# 1. get the code and a config
git clone https://github.com/maszjan/schemalens && cd schemalens
cp .env.example .env                              # pick the LLM profile (next tab)

# 2. an API key: every call needs one
uv run schemalens-api keys new --env-file .env    # adds it to API_KEYS

# 3. start it
docker compose up --build                         # API on :8000 (API_PORT in .env)
open http://localhost:8000/docs                   # interactive docs

# Ollama in a container too
docker compose --profile local-llm up