{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "typellm-typellm--extract-receipt-fields-as-typed-data",
 "repo": "TypeLLM/TypeLLM",
 "repo_url": "https://github.com/TypeLLM/TypeLLM",
 "repo_slug": "typellm-typellm",
 "title": "Extract typed fields from receipts into structured data",
 "page_title": "How to extract typed fields from receipts into structured data with Type LLM",
 "summary": "Turn receipt text or images into merchant, total, expense type and reimbursable flags as typed values.",
 "who": "An finance or operations analyst who must turn many receipts into rows for expense reports and needs every field in the right type.",
 "problem": "Free-text model output is hard to load into a spreadsheet or database because amounts, categories and yes/no answers arrive in inconsistent formats.",
 "outcome": "Each receipt returns a dict with a string merchant, a float total, one enum expense type, and a boolean reimbursable value, ready to load.",
 "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"
 ],
 "agent_prompt": "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.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "15 minutes",
 "basis": "readme",
 "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.",
 "category": "Work and operations",
 "tags": [
  "Work and operations"
 ],
 "lang": "python",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/typellm-typellm/extract-receipt-fields-as-typed-data/",
 "md": "https://dedupedai.com/use-cases/typellm-typellm/extract-receipt-fields-as-typed-data/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/typellm-typellm--extract-receipt-fields-as-typed-data.json",
 "api_version": "v1"
}
