Claude Token Spy: ओपन-सोर्स एक्सटेंशन छिपी AI लागतों को उजागर करता है

Hacker News May 2026
Source: Hacker NewsClaude.aiopen sourceArchive: May 2026
एक नया ओपन-सोर्स ब्राउज़र एक्सटेंशन fetch() कॉल को इंटरसेप्ट करके Claude.ai की छिपी टोकन खपत को रीयल टाइम में उजागर करता है। भारी उपयोगकर्ताओं के लिए, यह अस्पष्ट AI लागतों को एक मापने योग्य संसाधन में बदल देता है, जिससे प्रॉम्प्ट ऑप्टिमाइज़ेशन और सब्सक्रिप्शन मूल्यांकन का तरीका बदल जाता है।
The article body is currently shown in English by default. You can generate the full version in this language on demand.

A developer has released a free browser extension that strips away the black box surrounding token usage on Claude.ai. By hijacking the fetch() requests between the user's browser and Anthropic's backend, the tool captures every token sent and received during a conversation — displaying cumulative counts, per-message breakdowns, and estimated dollar costs. For power users who engage in long-form reasoning, complex code generation, or multi-turn analysis, this visibility is transformative: they can now identify which prompts burn through their subscription budget, compare the efficiency of different phrasing strategies, and decide whether a Pro or Team plan delivers real value. The extension, hosted on GitHub with over 2,000 stars in its first week, represents a grassroots push toward AI cost transparency. It also raises uncomfortable questions for Anthropic: if a lone developer can build a real-time token dashboard in days, why hasn't the company shipped an official one? The tool's existence signals a broader shift — users are no longer willing to treat AI inference as an invisible utility. They demand the same granularity they get from cloud providers like AWS or Azure, where every API call is logged and billed. This extension is the first shot in a war for AI usage data, and it will likely force every major AI platform to either open up their metrics or risk losing trust.

Technical Deep Dive

The extension operates by monkey-patching the browser's native `fetch()` function before any page scripts load. When Claude.ai sends a POST request to `https://api.anthropic.com/v1/messages` — the endpoint that handles all chat completions — the extension intercepts the request body and response stream. It parses the JSON payload to extract the `max_tokens` parameter, the `messages` array (which contains the full conversation history), and the `model` field (e.g., `claude-sonnet-4-20250514`). On the response side, it reads the streaming chunks to count tokens incrementally, using Anthropic's own tokenizer logic (reverse-engineered from the Claude API documentation) to ensure accuracy within ~2% margin.

Key implementation details:
- Storage: Token counts are stored in `chrome.storage.local` with a per-conversation ID derived from the URL hash. Historical data persists across sessions.
- UI overlay: A floating panel injects a `<div>` into the DOM, styled to match Claude's dark theme, showing live token count, estimated cost (based on published API pricing: $15 per million input tokens, $75 per million output tokens for Claude Sonnet 4), and a per-message breakdown.
- Cost estimation: The extension applies a sliding scale — if the user is on a Pro plan ($20/month), it calculates the percentage of the 5 million token cap consumed; for Team plans ($25/user/month with 10 million tokens), it adjusts accordingly.

The GitHub repository (`claude-token-tracker`, ~2,300 stars as of this writing) includes a detailed README explaining the reverse-engineering process. The developer noted that early versions broke when Anthropic changed their streaming format from Server-Sent Events (SSE) to a custom chunked encoding — a cat-and-mouse game that highlights the fragility of client-side interception.

Data Table: Token Tracking Accuracy vs. Official API
| Test Scenario | Extension Count | API Count | Error |
|---|---|---|---|
| Short prompt (50 words) | 68 tokens | 67 tokens | +1.5% |
| Medium code generation (200 lines Python) | 1,842 tokens | 1,830 tokens | +0.7% |
| Long conversation (10 turns, 4k words) | 8,215 tokens | 8,190 tokens | +0.3% |
| Streaming response (500 tokens output) | 498 tokens | 500 tokens | -0.4% |

Data Takeaway: The extension achieves sub-2% error across diverse scenarios, making it reliable enough for cost optimization. The slight overcount in short prompts stems from the extension counting the system prompt tokens that Claude prepends invisibly — a hidden cost users never see in the UI.

Key Players & Case Studies

The extension's creator, a pseudonymous developer known as `token_watch`, has a history of building developer tools for AI observability. Their previous project, `llm-cost-cli`, tracked API spending across OpenAI, Anthropic, and Google — but this is the first to target a web interface rather than an API. The choice of Claude.ai over ChatGPT is telling: ChatGPT already offers a basic token counter in its Playground mode, while Claude's web interface remains a complete black box.

Anthropic itself has been slow to address this. The company's official stance, communicated via support forums, is that token counts are "approximate" and "subject to change" — a non-answer that frustrates power users. Meanwhile, OpenAI has shipped a usage dashboard for ChatGPT Plus subscribers (showing monthly token consumption) and offers per-conversation token counts in the API console. Google's Gemini also provides a token counter in its web UI. This puts Anthropic in an awkward position: the most technically sophisticated model on the market (Claude 4 Sonnet) lacks the most basic usage transparency.

Data Table: AI Platform Transparency Comparison
| Platform | Web UI Token Counter | API Token Logs | Real-Time Cost Display | Official Dashboard |
|---|---|---|---|---|
| OpenAI ChatGPT | Yes (Playground only) | Yes | No | Yes (monthly) |
| Google Gemini | Yes | Yes | No | No |
| Anthropic Claude | No | Yes (API only) | No | No |
| Meta AI (Llama) | No | No | No | No |
| Mistral AI | No | Yes | No | No |

Data Takeaway: Anthropic is the only major player offering a premium web subscription without any token visibility. This gap is precisely what the open-source extension exploits — and it's a competitive vulnerability that could drive users to rivals who offer more transparency.

Industry Impact & Market Dynamics

The extension's rapid adoption (2,300 stars, 50,000+ downloads in one week) signals a pent-up demand for AI cost transparency. This is not a niche concern: Claude's Pro tier costs $20/month for 5 million tokens, and Team plans run $25/user/month for 10 million. Heavy users — writers generating 50,000-word drafts, developers debugging complex codebases, researchers analyzing multi-document contexts — can burn through that quota in days. Without visibility, they have no way to optimize.

This tool could accelerate a shift from subscription-based pricing to usage-based models. If users can see that a single long conversation costs $3.50 in tokens, they may demand pay-per-use options rather than flat monthly fees. Anthropic already offers API pricing ($15/$75 per million tokens for Sonnet 4), but the web subscription is deliberately opaque to encourage higher consumption. The extension breaks that strategy.

From a market perspective, expect copycats: similar extensions for ChatGPT, Gemini, and even open-source models running on Hugging Face Spaces are likely within weeks. The developer has already released a companion tool for Perplexity AI. This could spawn a new category of "AI cost observability" tools, similar to how cloud cost management (e.g., CloudHealth, Vantage) emerged as AWS and Azure grew.

Data Table: Estimated Cost Savings from Token Optimization
| User Type | Monthly Token Usage (M) | Current Cost ($) | Optimized Usage (M) | Savings ($) |
|---|---|---|---|---|
| Casual writer | 2 | 20 (Pro plan) | 1.5 | 5 |
| Developer (code gen) | 8 | 40 (two Pro plans) | 5 | 20 |
| Researcher (long docs) | 15 | 75 (Team plan) | 10 | 25 |
| Power user (multi-turn) | 25 | 125 (multiple plans) | 18 | 47 |

Data Takeaway: Even modest optimization — trimming verbose prompts, avoiding redundant context, using shorter system instructions — can save heavy users 30-40% on token costs. The extension makes these savings tangible, creating a strong incentive for adoption.

Risks, Limitations & Open Questions

Legal risks: The extension violates Anthropic's Terms of Service, which prohibit reverse engineering or interfering with the service. While enforcement against a browser extension is unlikely, Anthropic could deploy technical countermeasures — such as encrypting the fetch payload, switching to WebSocket-based streaming, or adding request signatures that break the interception.

Accuracy limits: The extension cannot account for server-side tokenization differences. Anthropic may use a different tokenizer for internal caching or batching, meaning the extension's counts could diverge from the actual billing. Users who rely on it for budget planning may be unpleasantly surprised.

Privacy concerns: The extension has access to all data sent to Claude, including sensitive conversations. While the code is open-source and auditable, the average user cannot verify that no data is exfiltrated. A malicious fork could easily steal prompts.

Sustainability: The developer maintains the extension in their spare time. If Anthropic changes their API format again, the tool could break indefinitely. Long-term, this is a cat-and-mouse game that favors the platform.

Ethical question: Should users have the right to know exactly how many tokens they consume? Or does this knowledge create anxiety and reduce the "magic" of AI interaction? The extension's popularity suggests users overwhelmingly prefer transparency, but platforms may argue that complexity is a feature, not a bug.

AINews Verdict & Predictions

This extension is a watershed moment for AI consumer rights. It proves that the technical barriers to transparency are low — what's missing is platform will. Our verdict: Anthropic will ship an official token dashboard within 90 days, likely as part of a broader "Claude Insights" feature. The competitive pressure from OpenAI and Google, combined with user backlash, leaves them no choice.

Predictions:
1. By Q3 2026, every major AI web interface will include a real-time token counter and cost estimator. The extension will become obsolete, but its legacy will be forcing this change.
2. Usage-based pricing will expand: Anthropic will introduce a pay-per-use option for the web interface (e.g., $0.01 per 1,000 tokens), competing directly with API pricing. This will cannibalize subscription revenue but attract price-sensitive users.
3. Token optimization will become a profession: Just as SEO experts optimize for search engines, "prompt efficiency consultants" will emerge, charging fees to audit and compress prompts for maximum token economy.
4. Regulatory attention: As AI costs become visible, consumer protection agencies may investigate whether opaque token billing constitutes deceptive pricing. The EU's Digital Services Act could be a vehicle for such scrutiny.

What to watch: The extension's GitHub issues page. If Anthropic issues a takedown notice or the developer receives a cease-and-desist, it will escalate into a high-profile free speech and fair use debate. If instead Anthropic hires the developer (as they did with the creator of the "Claude Artifacts" reverse-engineering project), it signals a mature approach to community innovation.

The era of invisible AI costs is ending. This tiny extension is the canary in the coal mine — and it's chirping loudly.

More from Hacker News

GPT-5.5 IQ संकोचन: क्यों उन्नत AI अब सरल निर्देशों का पालन नहीं कर सकताAINews has uncovered a growing pattern of capability regression in GPT-5.5, OpenAI's most advanced reasoning model. Multएक ट्वीट की कीमत $200,000: सामाजिक संकेतों पर AI एजेंटों का घातक भरोसाIn early 2026, an autonomous AI Agent managing a cryptocurrency portfolio on the Solana blockchain was tricked into tranUnsloth और NVIDIA की साझेदारी उपभोक्ता GPU पर LLM प्रशिक्षण को 25% बढ़ाती हैUnsloth, a startup specializing in efficient LLM fine-tuning, has partnered with NVIDIA to deliver a 25% training speed Open source hub3035 indexed articles from Hacker News

Related topics

Claude.ai33 related articlesopen source31 related articles

Archive

May 2026785 published articles

Further Reading

Appctl दस्तावेज़ों को LLM टूल में बदलता है: AI एजेंटों के लिए लापता कड़ीAppctl एक ओपन-सोर्स टूल है जो मौजूदा दस्तावेज़ीकरण या डेटाबेस को स्वचालित रूप से निष्पादन योग्य MCP (मॉडल कॉन्टेक्स्ट प्एंथ्रोपिक-ब्लेंडर डील: क्यों किचन डेटा AI की नई सोने की दौड़ हैएंथ्रोपिक ने किचन उपकरण दिग्गज ब्लेंडर के साथ एक वित्तपोषण सौदा किया है, जिसमें अपने क्लॉड मॉडल को स्मार्ट ब्लेंडर और कुArden Runtime Policy Engine: एंटरप्राइज AI एजेंटों के लिए गायब गार्डरेलArden, एक नया ओपन-सोर्स रनटाइम पॉलिसी इंजन, AI एजेंटों की कार्रवाइयों को रीयल-टाइम में इंटरसेप्ट और मूल्यांकन करता है, नContextWizard v1.2.0: अनडू बटन जो AI वर्कफ़्लो को हमेशा के लिए बदल देता हैContextWizard v1.2.0 ड्रैग-एंड-ड्रॉप बुकमार्क प्रबंधन और Ctrl+Z अनडू सपोर्ट शुरू करके AI मॉडल को संदर्भ देने के तरीके को

常见问题

GitHub 热点“Claude Token Spy: Open-Source Extension Exposes Hidden AI Costs”主要讲了什么?

A developer has released a free browser extension that strips away the black box surrounding token usage on Claude.ai. By hijacking the fetch() requests between the user's browser…

这个 GitHub 项目在“Claude token tracker extension GitHub repository”上为什么会引发关注?

The extension operates by monkey-patching the browser's native fetch() function before any page scripts load. When Claude.ai sends a POST request to https://api.anthropic.com/v1/messages — the endpoint that handles all c…

从“how to install Claude token counter browser extension”看,这个 GitHub 项目的热度表现如何?

当前相关 GitHub 项目总星标约为 0,近一日增长约为 0,这说明它在开源社区具有较强讨论度和扩散能力。