phuocnguyen90/gpt-worth-it
title: GPT Worth It emoji: 💸 colorFrom: indigo colorTo: green sdk: gradio app_file: app.py pinned: false license: mit ---
GPT Worth It?
Is your \$20/mo ChatGPT plan actually paying for itself?
This little web app crunches your ChatGPT chat export and shows you what you really “spent” in model usage. You’ll see monthly cost vs the \$20 line, daily token trends (with smoothing), and which models you actually use—so you can decide:
- keep ChatGPT Plus,
- switch to API pay-as-you-go,
- or do something in between.
Everything can run locally. No keys, no uploads, no tracking.
What you get
- At-a-glance verdict: Monthly total vs the \$20 reference line.
- Daily tokens chart with 7-day/30-day averages and a scale toggle (linear / √ / log2 / log10).
- Model mix (stacked bars by month).
- Data tables (daily + monthly).
- Settings to tweak pricing tiers, timezone, cache %, and aliases before/after you run.
⚠️ Numbers are estimates for your own insight, not official billing.
Quick start
Requirements
- Python 3.10+ (3.11 works great)
git clone <this-repo>
cd <this-repo>
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
pip install -r requirements.txt
# or: pip install gradio pandas numpy plotly matplotlib tiktoken tzdata
python app.pyOpen the link in your terminal (usually http://127.0.0.1:7860).
Get your ChatGPT history (Export)
- Open ChatGPT (web).
- Click your name / profile menu (bottom-left) → Settings.
- Go to Data controls → Export (or Export data) → Request export.
- Check your email from OpenAI, download the
.zip. - Unzip it and find
conversations.json(sometimesconversations.jsonl). - In the app’s Analyze tab: Upload → Scan → Run.
Tip: If you have multiple exports, you can run them one at a time and compare.
How to use the app
Analyze tab (default)
- Upload your export → Scan → Run.
- Results show immediately: Cost charts, Tokens chart, Model usage, and Tables.
- A small status chip at the top tells you what’s happening.
Settings tab (optional)
- Pick a pricing tier (editable grid with per-1M token prices).
- Timezone for daily/monthly rollups.
- Cached Input % if you use caching in your workflow.
- Image pricing (quality/size).
- Aliases to normalize model slugs (e.g., versioned → base model).
Example analysis
Tokens chart scale (live toggle)
Click the radio above the Tokens chart to switch linear / √ / log2 / log10. On √/log2 scales we keep hover & ticks in raw token counts so it’s readable.
What’s under the hood
analyzer.py— loads messages, infers models, counts tokens (tiktokenwith fallback), applies pricing, and builds Plotly figures.utils.py— file loading & scanning.pricing.py— default prices & aliases (you can edit in the UI).app.py— Gradio UI (two tabs, sticky sidebar). Uses generator updates so you see “Running…” and then the results in place.
Plotting sanity: we convert all dates to Python datetime and all values to plain floats before sending to Plotly. This avoids the classic “0..N straight line” bug from accidental categorical axes.
Modular by design (Claude-ready)
The app is intentionally modular. To adapt it for Claude (Anthropic) or another platform:
- Write a small loader/adapter that reads their export format into the same internal schema (date, role, content, model slug).
- Add a pricing table for that vendor (per-1M input/output, cache if applicable).
- Reuse the analyzer & plots unchanged.
PRs welcome when you’re ready to drop in a claude_loader.py + claude_pricing.py. 🙂
Notes & limitations
- Estimates only. Real bills may differ (rounding, free credits, promos, images, tools, browsing, etc.).
- Image costs can be under-detected if exports don’t mark attachments clearly.
- Versioned models fall back to base pricing if an exact match isn’t found.
- Timezone defaults to what you pick in Settings; change it if your export spans multiple zones.
FAQ
Do I need an API key? No. You’re analyzing a file you exported; the app doesn’t call any API.
Where does my data go? Nowhere. It stays on your machine.
Can I export charts/tables? Use your browser’s “Save as…” or copy tables out of Gradio. CSV/PNG buttons are on the roadmap.
Roadmap
- Make the charts look nicer?
- One-click PNG/CSV export
- Budget goals & alerts
- Per-conversation filters
- Claude & Gemini adapters
License
MIT — use it, remix it, ship it.
