Inspiration
Anyone who uses Claude daily runs into the same invisible tax: leaving the model picker parked on Opus or Sonnet and burning heavy compute credits on simple queries like "What is SIEM?", quick regex fixes, or basic translations. Conversely, staying on Haiku to save usage limits means hitting a wall the moment you ask for complex system architecture or deep code debugging.
I wanted an intelligent, zero-latency routing layer built right into the browser—one that evaluates a prompt's true complexity before it leaves the input box, automatically switches the UI picker to the most cost-effective model tier capable of handling it (Haiku → Sonnet → Opus → Fable), and adapts to personal usage patterns over time without requiring external API keys or backend servers.
What it does
TokenSense for Claude is a lightweight Chrome extension for claude.ai that acts as an automated client-side model router:
- Pre-Send Complexity Scoring: Intercepts
EnterandSendevents to score every prompt on a 0–100 scale in milliseconds using a pure heuristic engine. - Automatic Tier Switching: Reads your account's available models and dynamically flips the native
claude.aimodel picker to the cheapest tier that meets the difficulty threshold, gracefully falling back if your plan lacks higher tiers like Fable or Opus. - Adaptive Feedback Loop: Displays a non-intrusive bottom-right badge showing where the prompt was routed and why, complete with 👍 / 👎 rating buttons and a one-click "Retry with [Higher Tier]" escalation button.
- Interactive Popup & Sandbox: Features three routing modes (Saver, Balanced, Quality), live estimated compute savings, a built-in diagnostic tracer, and a live testing sandbox where you can paste prompts to preview their difficulty score and target model.
How we built it
I built the extension using vanilla JavaScript, HTML, and CSS under Chrome's Manifest V3 architecture, structured around three core modules:
Built With
- css3
- html5
- javascript
- manifest
Log in or sign up for Devpost to join the conversation.