Back to feed
Dev.to
Dev.to
7/9/2026
Reducing Claude API costs 84% by routing OCR to Haiku and extraction to Sonnet

Reducing Claude API costs 84% by routing OCR to Haiku and extraction to Sonnet

Original: Cut Claude API Costs 80% by Splitting Vision and Reasoning Tasks

Short summary

A developer reduced Claude API costs by 84% by splitting vision OCR and concept extraction into separate model calls. OCR runs on claude-haiku-4-5 at $1/M input tokens while extraction uses claude-sonnet-4-6, cutting a 26-page PDF from ~$1.10 to ~$0.18. The post includes pricing tables, code examples, and a debugging session showing why you should measure rather than guess.

  • Route OCR to Haiku ($1/M) and extraction to Sonnet ($3/M) for 84% cost savings
  • 26-page image-only PDF drops from ~$1.10 to ~$0.18 per document
  • Includes code for ClaudeOCREngine and LLMProvider abstraction with env-based model routing

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more