All guides
Live pricing researchLatest listed-channel verification Nov 30, 2026

How to Cut LLM Document Token Costs: Parsing APIs vs Markdown Preprocessing

Published Updated

When an application ingests PDFs, DOCX files, slide decks, or web pages into an LLM, two costs stack together: the extraction/parsing step (OCR, layout parsing, or multimodal page tokens) and the downstream LLM input tokens billed on every summarization or RAG call. Comparing both layers side by side shows why normalizing documents to clean Markdown before prompting often beats switching to a cheaper model alone.

Current API price snapshot

Up to 12 tracked language models are shown. Channels are selected by lowest input rate normalized to USD, not lowest total cost. Examples use 1M input plus 250K output tokens, without additional cache, batch or context-tier adjustments or tool fees. Processing-mode variants are not interchangeable; no total is shown when output pricing is unknown.

ModelLowest-input-rate channelInput / 1MOutput / 1MExample cost (USD)ChannelsSelected price verified
Gemini 4 Carbon (batch)OpenRouter$1.00$5.00$2.251Nov 30, 2026
Gemini 4 CarbonXycAi¥8.28¥41.40$2.705Nov 30, 2026
DeepSeek V4.1 FlashOpenRouter$0.15$0.60$0.301Nov 30, 2026
DeepSeek V4.1 Flash 1017词元所¥0.80¥3.20$0.23191Nov 12, 2026
Gemini 4 ArgonXycAi¥8.28¥41.40$2.705Nov 30, 2026
Gemini 4 Argon BatchOpenRouter$1.00$5.00$2.251Nov 30, 2026
Claude Sonnet 5.5 BatchOpenRouter$1.00$5.00$2.251Nov 30, 2026
Claude Sonnet 5.5XiuRouter$0.60$3.00$1.353Nov 30, 2026
DeepSeek ProOpenRouter$0.10$5.00$1.34991Nov 30, 2026
DeepSeek FlashOpenRouter$0.04$0.50$0.1611Nov 30, 2026
DeepSeek V4.1 Flash (1017)OpenCode Zen$0.00$0.00$0.00007Oct 15, 2026
DeepSeek V4.1 Flash BatchOpenRouter$0.05$0.15$0.08751Nov 30, 2026

Where document token bloat actually comes from

Raw HTML pages carry navigation bars, script snippets, inline styles, and deeply nested tags that easily double or triple token counts compared to the readable article body. Similarly, raw DOCX XML dumps and uncleaned PDF text extractions keep repeated headers, footers, page numbers, broken hyphenation, and scattered whitespace.

If you instead send PDF pages as images to a multimodal model, each page consumes hundreds to over a thousand image tokens depending on resolution and vendor tiling rules—even when the PDF already contains clean selectable text. Stripping files down to semantic Markdown preserves headings, lists, and tables while cutting noise before tokens are counted.

Paid file-parsing APIs versus local / Markdown preprocessing

Dedicated OCR and layout-parsing APIs (such as cloud document-intelligence endpoints or specialized OCR models like DeepSeek OCR) are genuinely needed for scanned PDFs, handwritten forms, dense multi-column financial tables, and complex mathematical formulas. Those APIs charge per page, per image, or per million vision tokens—check official rate cards before committing high volume.

For born-digital PDFs, Word documents (.docx), spreadsheets, and web articles, converting to clean Markdown locally or via a dedicated converter like toolkit.fun/document-to-markdown avoids per-page API fees altogether and feeds significantly fewer tokens into downstream LLM calls.

Reproducible cost formula: Markdown cleanup + caching + batch

Let I, C, and O be a model’s live ordinary-input, cached-input, and output rates per 1M tokens from the table above. Suppose a batch summarization pipeline processes 15,000 documents per month averaging 25,000 raw input tokens and 1,500 output tokens (375M input and 22.5M output tokens total). Without preprocessing or batching, monthly cost = 375 × I + 22.5 × O.

If converting to clean Markdown reduces input tokens by 45% (within the typical 35%–60% range), input drops from 375M to 206.25M tokens, cutting the input bill to 206.25 × I. Add an eligible asynchronous Batch API (50% discount where offered by the provider), and the total becomes 0.5 × (206.25 × I + 22.5 × O). Plug your exact numbers into the PDF Summarization or RAG Document Q&A calculator presets to test live channel rates.

Easy-to-miss costs: long-context tiers and chunk overlap

Several flagship models jump to a higher price tier when a single prompt crosses 128K, 200K, or 272K tokens. Cleaning bloated documents into concise Markdown often keeps prompts below that threshold, preventing a sudden 2× rate jump.

In RAG pipelines, aggressive chunk overlap (for example, 25%–30% overlap across 10 retrieved chunks) also silently inflates input tokens on every query. Structure-aware Markdown splitting by heading boundaries reduces redundant overlap while improving retrieval precision.

How to use this data

  • Recalculate with your real input/output token mix.
  • Check region, rate limits, and payment method.
  • Recheck official sources before purchasing or switching.

Frequently asked questions

How much can converting PDFs or web pages to Markdown really save on LLM bills?

For HTML, DOCX, and layout-heavy PDFs, clean Markdown conversion typically removes 35%–60% of redundant input tokens. Because input accounts for 85%–95% of tokens in RAG and summarization workloads, total monthly API spend usually drops by a similar proportion before even changing models.

When should I pay for an OCR or document-parsing API instead of plain Markdown extraction?

Use dedicated OCR or vision-parsing APIs when files are image-only scans, photographed receipts, handwritten notes, or dense multi-column financial/academic layouts where embedded text extraction breaks reading order. For standard digital PDFs, Office files, and HTML, clean Markdown conversion is faster and far lower cost.

Does Markdown preprocessing still help if I already enable Prompt Caching?

Yes. Prompt caching lowers the rate per repeated token, while Markdown cleanup reduces the total number of tokens written to cache, read from cache, and sent as uncached dynamic chunks. Both savings multiply together.

How can I estimate my exact monthly savings for a RAG or PDF workflow?

Open the RAG Document Q&A or PDF Summarization preset in the aiplans.dev cost calculator, enter your daily request count and average document token length, and inspect both the multi-channel monthly table and the dynamic Markdown savings estimate card.

Official sources and review date

Billing guidance reviewed: . Price verification dates are listed separately in the table.