{"course":{"slug":"building-with-ai","title":"Building with AI","url":"https://addaly.com/learn/building-with-ai","level":"intermediate","track":"build"},"lesson":{"slug":"images-files-and-audio-in","title":"Sending images, PDFs and audio, and what they cost","url":"https://addaly.com/learn/building-with-ai/images-files-and-audio-in","position":10,"of":80,"minutes":9,"answer":"Use input-type and model-specific cost rules, retain original media and source locations, and measure extraction accuracy against labeled evidence.","keyIdea":"Use input-type and model-specific cost rules, retain original media and source locations, and measure extraction accuracy against labeled evidence."},"body":{"format":"markdown","text":"## Budget for the actual input type\n\nImage, PDF and audio handling depends on the chosen model and API. Their input units, preprocessing and prices can differ from plain text. Check the documentation and count or measure representative requests before estimating a feature's cost.\n\nFor images, resolution, resizing, tiling and the number of images can affect usage. Use the selected model's rules rather than applying one pixel-to-token formula across providers. Compare crops and resolutions against the details the task must preserve. [Claude image processing and costs](https://platform.claude.com/docs/en/build-with-claude/vision).\n\nA smaller image can lose a date or decimal point that the task needs. Keep an accessible original and evaluate the actual transformed image you send.\n\n## PDFs need content and layout checks\n\nThere are several ways to process a PDF. Choose according to the source and the model's supported inputs.\n\n**Extract the text layer.** Tools such as PyMuPDF and pdftotext can recover text from many PDFs. A software-generated PDF may still contain missing text, unusual character mappings or an unexpected reading order. A scan may already have an OCR text layer, which needs checking too. Compare extraction with the page image, especially for columns and tables. [PyMuPDF text extraction](https://pymupdf.readthedocs.io/en/latest/recipes-text.html).\n\n**Use supported PDF or image input.** A provider may process page text and page images together. Token usage can depend on both, so apply its PDF rules and count a representative document. Page count alone does not determine the bill. [Claude PDF support](https://platform.claude.com/docs/en/build-with-claude/pdf-support).\n\n**Use an OCR pipeline.** OCR can return text and positions on the page. Those positions help connect an extracted field back to the original image. OCR and layout reconstruction can still misread characters or associate a value with the wrong label.\n\nRetain the original document, extracted text, page references and relevant coordinates. Detect empty extraction, but also sample apparently successful extraction for missing or misordered content. Decide when OCR, image processing or manual review is needed.\n\nHandwriting, faded receipts, rotation and overlapping stamps can produce plausible errors. Arithmetic and format checks catch some mistakes. They do not establish that every field matches the source. Compare important values with the original page and record unresolved fields explicitly.\n\n## Audio needs its own evaluation\n\nOne route is to transcribe audio and process the resulting text. Open-weight speech-recognition tools can run locally, but speed and accuracy depend on the model, hardware, language and recording. Benchmark a representative sample before planning throughput.\n\nAnother route uses a model that accepts audio directly. Check which audio features it supports, its pricing and what inspectable evidence it returns. Keep the original audio available when an answer needs verification against what was spoken.\n\nTest names, numbers, code-switching, overlapping speakers, noise and silence. Speech recognizers can produce words that were not spoken. Voice-activity detection may help with silence, but it also needs evaluation so quiet speech is retained.\n\n## Verify extracted claims against their source\n\nRecognition and generation can produce a well-formed value that the source does not support. Use a workflow that makes the evidence visible.\n\n- Request a source quote or page and region reference for extracted values, then inspect the corresponding source.\n- Treat an unmatched quote or unclear image region as unverified. Investigate extraction and OCR errors before drawing conclusions about how the value was produced.\n- Allow an explicit unknown or unreadable result, and check that the system uses it appropriately.\n- Apply arithmetic and format checks alongside source checks. For tax or other regulated fields, use the applicable rules for the document's jurisdiction and date.\n- Route unresolved cases for review. Measure field accuracy on a labeled sample, including errors the automatic checks missed. Track the review rate separately.\n\nThis keeps the extraction result connected to evidence and makes uncertainty visible to the next person or process that uses it."},"check":{"question":"An invoice reader passes most automatic checks, but finance finds occasional incorrect fields. Which workflow best addresses missed extraction errors?","options":[{"text":"Send the pages at higher resolution so the model can read small print.","correct":false,"tempting":"Improves recognition on some pages while doing nothing about the cases where the model fills an unreadable field with a plausible value."},{"text":"Link fields to source pages or regions, inspect unclear evidence, run arithmetic checks and measure missed errors against a labeled sample.","correct":true},{"text":"Use a larger model, since accuracy scales with capability.","correct":false,"tempting":"Raises the rate of correct reads without adding any way to detect the incorrect ones, which is the part finance actually needs."},{"text":"Lower the temperature to zero so extraction is deterministic.","correct":false,"tempting":"A supported sampling setting does not establish that an extracted field matches the source."}]},"prev":{"slug":"a-model-on-your-own-machine","title":"Running a model on a laptop with no GPU","url":"https://addaly.com/learn/building-with-ai/a-model-on-your-own-machine"},"next":{"slug":"the-prompt-is-an-interface","title":"A prompt is an interface, not a paragraph","url":"https://addaly.com/learn/building-with-ai/the-prompt-is-an-interface"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Sending images, PDFs and audio, and what they cost', in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/images-files-and-audio-in (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Sending images, PDFs and audio, and what they cost","courseTitle":"Building with AI","module":{"index":1,"slug":"the-call-underneath-everything","title":"The call underneath everything"},"answer":null,"keyIdea":"Use input-type and model-specific cost rules, retain original media and source locations, and measure extraction accuracy against labeled evidence.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"budget-for-the-actual-input-type","runs":[{"text":"Budget for the actual input type"}]},{"t":"p","runs":[{"text":"Image, PDF and audio handling depends on the chosen model and API. Their input units, preprocessing and prices can differ from plain text. Check the documentation and count or measure representative requests before estimating a feature’s cost."}]},{"t":"p","runs":[{"text":"For images, resolution, resizing, tiling and the number of images can affect usage. Use the selected model’s rules rather than applying one pixel-to-token formula across providers. Compare crops and resolutions against the details the task must preserve. "},{"text":"Claude image processing and costs","href":"https://platform.claude.com/docs/en/build-with-claude/vision"},{"text":"."}]},{"t":"p","runs":[{"text":"A smaller image can lose a date or decimal point that the task needs. Keep an accessible original and evaluate the actual transformed image you send."}]},{"t":"h2","id":"pdfs-need-content-and-layout-checks","runs":[{"text":"PDFs need content and layout checks"}]},{"t":"p","runs":[{"text":"There are several ways to process a PDF. Choose according to the source and the model’s supported inputs."}]},{"t":"p","runs":[{"text":"Extract the text layer.","b":true},{"text":" Tools such as PyMuPDF and pdftotext can recover text from many PDFs. A software-generated PDF may still contain missing text, unusual character mappings or an unexpected reading order. A scan may already have an OCR text layer, which needs checking too. Compare extraction with the page image, especially for columns and tables. "},{"text":"PyMuPDF text extraction","href":"https://pymupdf.readthedocs.io/en/latest/recipes-text.html"},{"text":"."}]},{"t":"p","runs":[{"text":"Use supported PDF or image input.","b":true},{"text":" A provider may process page text and page images together. Token usage can depend on both, so apply its PDF rules and count a representative document. Page count alone does not determine the bill. "},{"text":"Claude PDF support","href":"https://platform.claude.com/docs/en/build-with-claude/pdf-support"},{"text":"."}]},{"t":"p","runs":[{"text":"Use an OCR pipeline.","b":true},{"text":" OCR can return text and positions on the page. Those positions help connect an extracted field back to the original image. OCR and layout reconstruction can still misread characters or associate a value with the wrong label."}]},{"t":"p","runs":[{"text":"Retain the original document, extracted text, page references and relevant coordinates. Detect empty extraction, but also sample apparently successful extraction for missing or misordered content. Decide when OCR, image processing or manual review is needed."}]},{"t":"p","runs":[{"text":"Handwriting, faded receipts, rotation and overlapping stamps can produce plausible errors. Arithmetic and format checks catch some mistakes. They do not establish that every field matches the source. Compare important values with the original page and record unresolved fields explicitly."}]},{"t":"h2","id":"audio-needs-its-own-evaluation","runs":[{"text":"Audio needs its own evaluation"}]},{"t":"p","runs":[{"text":"One route is to transcribe audio and process the resulting text. Open-weight speech-recognition tools can run locally, but speed and accuracy depend on the model, hardware, language and recording. Benchmark a representative sample before planning throughput."}]},{"t":"p","runs":[{"text":"Another route uses a model that accepts audio directly. Check which audio features it supports, its pricing and what inspectable evidence it returns. Keep the original audio available when an answer needs verification against what was spoken."}]},{"t":"p","runs":[{"text":"Test names, numbers, code-switching, overlapping speakers, noise and silence. Speech recognizers can produce words that were not spoken. Voice-activity detection may help with silence, but it also needs evaluation so quiet speech is retained."}]},{"t":"h2","id":"verify-extracted-claims-against-their-source","runs":[{"text":"Verify extracted claims against their source"}]},{"t":"p","runs":[{"text":"Recognition and generation can produce a well-formed value that the source does not support. Use a workflow that makes the evidence visible."}]},{"t":"ul","items":[[{"text":"Request a source quote or page and region reference for extracted values, then inspect the corresponding source."}],[{"text":"Treat an unmatched quote or unclear image region as unverified. Investigate extraction and OCR errors before drawing conclusions about how the value was produced."}],[{"text":"Allow an explicit unknown or unreadable result, and check that the system uses it appropriately."}],[{"text":"Apply arithmetic and format checks alongside source checks. For tax or other regulated fields, use the applicable rules for the document’s jurisdiction and date."}],[{"text":"Route unresolved cases for review. Measure field accuracy on a labeled sample, including errors the automatic checks missed. Track the review rate separately."}]]},{"t":"p","runs":[{"text":"This keeps the extraction result connected to evidence and makes uncertainty visible to the next person or process that uses it."}]}],"check":{"question":[{"text":"An invoice reader passes most automatic checks, but finance finds occasional incorrect fields. Which workflow best addresses missed extraction errors?"}],"options":[{"text":[{"text":"Send the pages at higher resolution so the model can read small print."}],"correct":false,"tempting":[{"text":"Improves recognition on some pages while doing nothing about the cases where the model fills an unreadable field with a plausible value."}]},{"text":[{"text":"Link fields to source pages or regions, inspect unclear evidence, run arithmetic checks and measure missed errors against a labeled sample."}],"correct":true,"tempting":null},{"text":[{"text":"Use a larger model, since accuracy scales with capability."}],"correct":false,"tempting":[{"text":"Raises the rate of correct reads without adding any way to detect the incorrect ones, which is the part finance actually needs."}]},{"text":[{"text":"Lower the temperature to zero so extraction is deterministic."}],"correct":false,"tempting":[{"text":"A supported sampling setting does not establish that an extracted field matches the source."}]}],"order":[3,1,0,2],"why":null},"prev":{"slug":"a-model-on-your-own-machine","title":"Running a model on a laptop with no GPU","minutes":10},"next":{"slug":"the-prompt-is-an-interface","title":"A prompt is an interface, not a paragraph","minutes":9}}}