Who it is forAn finance or operations analyst who must turn many receipts into rows for expense reports and needs every field in the right type.
The problemFree-text model output is hard to load into a spreadsheet or database because amounts, categories and yes/no answers arrive in inconsistent formats.
The outcomeEach receipt returns a dict with a string merchant, a float total, one enum expense type, and a boolean reimbursable value, ready to load.
What you need first
- Python with pip installed
- A TypeLLM API key from typellm.ai (includes $5 free credit), or a GPU server running SGLang with a compatible model such as Qwen3.8-27B
- Documents or text to process, and a list of the fields you want back
Steps
- Run
pip install -U typellm - Run
export TYPELLM_API_KEY="tl-sk-..."with your key from the API keys page - Create a TypeLLMClient with your key and call generate() with the receipt text as context
- Define questions with type string, number and boolean, and an enum of expense types such as meal, travel and equipment
- Read the typed values from response.result and write them to your expense table
Prompt for your agent
Use the Python package typellm in the repo TypeLLM/TypeLLM to extract merchant, total, expense_type and reimbursable from the receipt text at <receipt_path>. Call TypeLLMClient.generate() with an enum for expense_type and return response.result as JSON. Verify that expense_type is one of the enum values and total is a number.
Caveat. The README example uses a text receipt; for scanned receipts, the README shows image input with a vision-language model, so check that your chosen model supports images before you rely on it.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for TypeLLM/TypeLLM and "Extract typed fields from receipts into structured data"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer