Skip to content

rebixpl/opencode_stats_plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenCode Stats Plus

"Człowiek jest drogi, bo jest obrazem Boga"Jan Paweł II

Narzędzie do analizy statystyk użycia OpenCode, stworzone z myślą o transparentności i świadomym korzystaniu z AI. Zobacz swoją historię sesji, zużycie tokenów, wywołania narzędzi i ile kosztowałyby Twoje modele wg stawek API.

Patron: Jan Paweł II — Wielki Polak, który uczył nas, że prawdziwa wartość technologii polega na służbie człowiekowi.

Demo

OpenCode Stats Plus

          Overall Summary
+----------------------------------+
| Metric                 | Value   |
|------------------------+---------|
| Total Sessions         | 7       |
| Total Messages         | 435     |
| Total Parts            | 1730    |
| Actual Cost (OpenCode) | $5.0678 |
| Hypothetical API Cost  | $3.4688 |
| Total Tokens           | 34.30M  |
+----------------------------------+


                    Usage by Project
+-------------------------------------------------------+
| Project             | Sessions | Messages | Est. Cost |
|---------------------+----------+----------+-----------|
| my-project          |        6 |      387 |   $5.0678 |
| another-project     |        1 |       48 |   $0.0000 |
+-------------------------------------------------------+


                                         Usage by Model
+-----------------------------------------------------------------------------------------------+
| Model                         | Msgs |  Input | Output | Reason |  Cache |  Actual | API Cost |
|-------------------------------+------+--------+--------+--------+--------+---------+----------|
| google/gemini-3.1-pro-preview |   39 | 708.3K |  11.6K |  15.1K |  3.62M | $2.4612 |  $1.4595 |
| google/gemini-3-flash-preview |  160 |  2.89M |  38.0K |  48.8K | 18.04M | $2.6066 |  $1.2766 |
| opencode/mimo-v2-pro-free     |  172 | 892.6K |  58.0K |  15.1K |  7.82M | $0.0000 |  $0.7298 |
| opencode/minimax-m2.5-free    |    3 |   2.7K |   2.4K |      0 |  12.0K | $0.0000 |  $0.0029 |
+-----------------------------------------------------------------------------------------------+


   Top Tools Used
+-------------------+
| Tool      | Calls |
|-----------+-------|
| read      |   155 |
| edit      |   106 |
| bash      |    65 |
| grep      |    31 |
| glob      |    22 |
+-------------------+


                     Activity Highlights
+-----------------------------------------------------------+
| Category        | Details                                 |
|-----------------+-----------------------------------------|
| Most Active Day | 2026-03-20 (3 sessions)                 |
| Longest Session | 2026-03-15 - 4.8h                       |
| Session Title   | Building a feature step-by-step         |
+-----------------------------------------------------------+

Features

  • Overall Summary — Total sessions, messages, parts, actual cost, and hypothetical API cost
  • Usage by Project — Sessions, messages, and cost per project
  • Usage by Model — Token breakdown (Input, Output, Reasoning, Cache) with actual vs API pricing
  • Top Tools Used — Most frequently called tools (read, edit, bash, etc.)
  • Activity Highlights — Most active day, longest session

Hypothetical API Pricing

Even if your models are free through OpenCode, this tool calculates what they would cost at standard API rates. This shows the value you're getting and lets you compare across models.

Model Input / 1M Output / 1M Cached / 1M
Google Gemini 3 Flash Preview $0.50 $3.00 $0.05
Google Gemini 3.1 Pro Preview $2.00 $12.00 $0.20
MiniMax M2.5 $0.30 $1.20 $0.03
Xiaomi MiMo-V2-Pro $1.00 $3.00 $0.10

Installation

pip install rich

Usage

python opencode_stats.py

By default, it reads from ~/.local/share/opencode/opencode.db. Use --path to specify a custom database:

python opencode_stats.py --path /path/to/opencode.db

Programmatic Usage

import opencode_stats

stats = opencode_stats.analyze(db_path="~/.local/share/opencode/opencode.db", silent=True)

if stats:
    print(f"Sessions: {stats['total_sessions']}")
    print(f"Messages: {stats['total_messages']}")
    print(f"Actual cost: ${stats['total_cost']:.4f}")
    print(f"API cost: ${stats['total_api_cost']:.4f}")

Security

This tool only reads local session metadata from the SQLite database. No API keys, secrets, or code are accessed. Safe to use and share.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages