How do I feed PDFs from URLs to Claude?
Feed PDFs from URLs to Claude by calling AgentFetch's fetch_url on the PDF URL — it auto-detects application/pdf content type, extracts text locally with pypdf, and returns clean markdown the model can read directly. Example: fetch_url("https://arxiv.org/pdf/2401.12345.pdf") returns the paper's text as ~10-30KB of markdown. Without this preprocessing, Claude Desktop and Cursor can't read PDFs at URLs — Claude's native document content block requires base64 upload, not URL fetch, and even then it counts as a vision input (more expensive). Pipeline cost: a typical 20-page PDF is ~80KB binary → ~40KB text → ~10k tokens at $3/M Sonnet input = $0.03 to read. AgentFetch caches fetches for six hours by default, so re-fetches inside that window are cache hits (~$0.0001). For arXiv specifically, prefer the HTML version when available (/abs/ instead of /pdf/) — same content, 30-50% smaller markdown. Scanned or image-only PDFs are the known gap: pypdf reads the embedded text layer, so a PDF with no text layer returns little or nothing and needs an OCR step of your own before the model sees it. For form-fillable PDFs and tables, call fetch_url(url, format="json") instead of taking the raw text.