How I Use Haiku As A Gatekeeper Before Sonnet To Save ~80% On Api Costs
Wanted to share a pattern I've been using that's been working really well for anyone processing large volumes of unstructured text through Claude.
I built a platform called PainSignal (painsignal.net, free to use) that pulls in thousands of real comments from workers and business owners across different industries, then classifies them into structured app ideas. The problem is most of the input is garbage — someone saying "great video" or "first" or just random noise. Sending all of that to Sonnet would be insanely expensive.
So I set up a two-stage pipeline:
Stage 1 — Haiku as a gate. Every comment hits Haiku first with a simple prompt: "Does this comment contain a real frustration, complaint, or unmet need related to someone's work?" It returns a yes/no and a confidence score. Takes fractions of a cent per call and filters out like 85% of the input.
Stage 2 — Sonnet for the real work. Only the comments that pass the gate go to Sonnet. This is where the expensive stuff happens — it extracts the core pain point, classifies it into an industry and category (no predefined list, it builds the taxonomy dynamically), assigns a severity score, and generates app concepts with features and revenue models.
The result is I'm running Sonnet on maybe 15% of my total input instead of 100%. The cost difference is massive when you're processing thousands of comments.
A few things I learned along the way:
- Haiku is surprisingly good at the gate job. I expected more false negatives but it catches real complaints consistently. The occasional miss isn't worth worrying about at scale.
- The dynamic taxonomy thing was an accident that turned out great. I originally planned to define industries and categories upfront but just letting Sonnet decide has been more interesting — it's found categories I never would have thought of.
- Batching helps a lot on the Sonnet side. I queue everything through BullMQ and process in controlled batches so I'm not slamming the API.
Built the whole thing with Claude Code — Next.js, Postgres with pgvector, the works. Happy to answer questions about the pipeline if anyone's doing something similar.
[link] [comments]
Popular Products
-
Devil Horn Headband$25.99$11.78 -
WiFi Smart Video Doorbell Camera with...$61.56$30.78 -
Smart GPS Waterproof Mini Pet Tracker$59.56$29.78 -
Unisex Adjustable Back Posture Corrector$71.56$35.78 -
Smart Bluetooth Aroma Diffuser$585.56$292.87