Skip to main content
Glama
927242768-dotcom

chatgpt-daily-token-tracker

ChatGPT Daily Token Tracker

A daily token tracking tool for ChatGPT web usage, featuring:

  • MCP Server: Ask directly in ChatGPT, "How many tokens did I use today";

  • Edge / Chrome browser extension: Automatically captures visible user messages and assistant replies on chatgpt.com pages and estimates tokens locally;

  • Windows auto-run: Can use a fixed ngrok development domain to provide a long-lived MCP address, and auto-start on boot via a scheduled task;

  • Local data storage: Statistics are stored locally; full chat text is not written to the statistics files;

  • Deduplication mechanism: Page refreshes and repeated scans won't accumulate the same message more than once.

[!IMPORTANT] What is counted here is the estimated token count of text visible on the web page, not the official OpenAI / ChatGPT account-level token bill. Hidden system prompts, internal reasoning, invisible context, etc. cannot be obtained from an ordinary web extension or MCP.

Features

MCP Tools

Tool

Purpose

today_usage

View token usage for today or a specified date

usage_range

View cumulative usage over a date range

record_usage

Record an exact API usage that has already been obtained

estimate_and_record

Estimate specified input/output text and record it

estimate_tokens

Only estimate text tokens without saving

tracker_info

View capabilities, version, and limitations

Browser Auto-Tracking

After installing the extension, newly generated visible ChatGPT messages are automatically sent to:

http://127.0.0.1:8787/api/track-message

The local service uses the o200k_base tokenizer to estimate tokens, and only saves statistics such as token count, role, time, and message deduplication ID.

The extension also provides a "Backfill current conversation" feature, which can add the currently loaded conversation to the day's totals on demand; identical messages are automatically deduplicated.

Related MCP server: mcpstat

Requirements

Recommended environment:

  • Windows 10 / 11

  • Node.js 22+

  • Microsoft Edge or Google Chrome

  • A free ngrok account (needed only for a fixed public MCP address)

  • A ChatGPT account that supports custom MCP / App

Quick Start

1. Install Dependencies

npm install

2. Start the Local Service

On Windows, double-click:

启动Token统计插件.bat

You can also run:

npm start

Default addresses:

  • MCP: http://127.0.0.1:8787/mcp

  • Health check: http://127.0.0.1:8787/health

  • Local dashboard: http://127.0.0.1:8787/dashboard

3. Install the Edge / Chrome Auto-Tracking Extension

On Windows, double-click:

安装浏览器自动统计扩展.bat

Or do it manually:

  1. Open edge://extensions in Edge, or chrome://extensions in Chrome;

  2. Enable "Developer mode";

  3. Click "Load unpacked";

  4. Select the browser-extension folder in the repository;

  5. Go back to chatgpt.com and refresh the page.

The extension popup shows today's input, output, total tokens, and record count.

Fixed MCP Address + Windows Auto-Start on Boot

If you want ChatGPT to maintain a long-term connection to the local MCP, you need a public HTTPS address. The project provides a Windows auto-configuration script based on a fixed ngrok development domain.

Double-click:

安装长期固定地址并开机自启.bat

The script will:

  1. Check Node.js and ngrok;

  2. Open the ngrok authtoken page in the browser;

  3. Ask you to enter the authtoken in local PowerShell;

  4. Retrieve the fixed ngrok development domain assigned to your account;

  5. Generate local config/ngrok.yml;

  6. Place an executable ngrok copy in local bin/;

  7. Create the Windows scheduled task ChatGPT-Token-Tracker-Fixed;

  8. Automatically start and supervise Node MCP + ngrok;

  9. Output the final fixed MCP URL.

If an existing configuration needs repair, run:

修复固定地址自启动.bat

Adding MCP in ChatGPT

In ChatGPT's custom App / MCP page:

  • Server URL: Enter the https://xxxxx.ngrok-free.dev/mcp output by the script at the end;

  • Authentication: Select None / No authentication;

  • Scan tools and save.

After that, you can call today_usage in chat to query.

Data and Privacy

The following items will not be pushed to GitHub:

  • data/: local token statistics, logs, runtime URLs;

  • config/: ngrok authtoken and runtime configuration;

  • bin/: local ngrok executable;

  • .env;

  • node_modules/.

The browser extension will not send full chat text to the project's public ngrok address; the auto-tracking write endpoint is limited to local 127.0.0.1.

[!WARNING] The current MCP connection example uses "no authentication". The fixed public URL should not be actively shared publicly. Any public service should add authentication, access control, and auditing according to your risk needs.

Token Counting Method

  • exact: actual usage numbers returned by the OpenAI API;

  • estimated: tokenizer-based estimate for visible text;

  • Browser auto-tracking records are marked as chatgpt-browser-auto + estimated.

The project does not pass off estimated values as official billing data.

Testing

npm test

Current tests cover:

  • Chinese and English token estimation;

  • Exact and estimated values aggregated separately;

  • Daily segmentation in Asia/Shanghai;

  • Deduplication by the same eventId;

  • HTTP API writes and deduplication for browser auto-recording.

Project Structure

browser-extension/      Edge / Chrome Manifest V3 扩展
src/server.js           MCP + HTTP 服务
src/store.js            本地统计存储与去重
src/tokenizer.js        Token 估算
setup-fixed-ngrok.ps1   固定 ngrok 地址与开机任务安装
run-fixed-supervisor.ps1 Windows 后台守护
repair-fixed-autostart.ps1 固定地址/自启动修复
test/                   自动测试

Development and Upgrades

Recommended after each upgrade:

npm install
npm test

If you modified src/server.js, Windows fixed-deployment users can run:

修复固定地址自启动.bat

to make the background SYSTEM service reload the new code.

License

MIT License. See LICENSE for details.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Token usage tracker for OpenAI and Claude APIs with MCP (Model Context Protocol) support.
    6
    149
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A Python utility for adding usage tracking, analytics, and audit trails to MCP servers using SQLite-backed persistence. It enables developers to monitor tool, prompt, and resource activity and expose these statistics directly to LLM clients.
    4
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables token counting, usage tracking, and cost calculation for LLM APIs, with a proxy server mode to automatically intercept and monitor API requests from clients like Cursor and Windsurf.
    173
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.

  • Agent Token Budget MCP — hard per-session token + spend cap with signed budget-exhausted

  • A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/927242768-dotcom/chatgpt-daily-token-tracker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server