schmidt.florian 0a08b508a2 core: plan the daily budget per day, start forecasts at 2 % and follow the limit week (#15)
The developer's feedback of 2026-10-18 named four problems at the top
of the panel: late forecasts, a daily budget that shrank with every use,
unequal Claude and Codex tiles, and an unclear "This week".

- Core: forecasts start at 2 % of a window (D7). Each day of a long
  instance has a share, an even pace and a budget. Today's budget starts
  from the use at the start of the day and stays put while today is
  spent. An estimated start-of-day use counts only the whole hours before
  the first sample's hour, so later samples and tokens do not move it.
  Week token totals follow the provider's limit week, with the calendar
  week as the named fallback; the snapshot carries `weekStart` and
  `weekWindow` (D9).
- App: tiles of one window kind show the same rows, with muted
  placeholders that say why (D8). The stale warning sits in the Used row.
  Week charts draw even pace and budget as steps per day, mark the
  instance start and reset, and label full-day rates. Token tiles say
  since when.
- CLI: prints which week it uses and since when.

Closes #13
2026-10-18 10:53:00 +02:00

FinalToken

FinalToken is a tray app for Claude Code and Codex usage. It shows token history, provider limits, and pace, warns when usage runs ahead of or behind a limit, and puts selected stats on Stream Deck keys. Starting the app opens the stats panel; closing it keeps the tray app running by default.

FinalToken does not sign in to a provider, handle API keys or OAuth tokens, or read credential files. It reads the installed CLIs' usage files and runs their local commands. It never calls a provider's HTTP API itself. Missing or logged-out CLIs show as unavailable.

Requirements

  • Claude Code and/or Codex CLI installed and logged in through the CLI. Their paths can be overridden in Settings.
  • Windows 11, or Linux with X11 or XWayland. CachyOS with KDE Plasma uses XWayland.
  • For keys: Stream Deck 7 on Windows, or OpenDeck on Linux. These are optional.

Install and use

Extract the published ZIP to a folder and run FinalToken.exe on Windows or FinalToken on Linux. Keep the streamdeck folder beside the app. Open, Refresh, Settings and Quit are in the tray menu. Start with the OS is opt-in.

Data lives in %LOCALAPPDATA%\FinalToken on Windows and ~/.local/share/FinalToken on Linux. FINALTOKEN_DATA_DIR overrides it. FinalToken keeps its own history after the CLIs remove their files. A fresh install imports Claude entries from the last 60 days. snapshot.json is the shared output for the plugin and CLI.

Settings has three Stream Deck install modes: Off, Ask (default), and Automatic. Ask offers Install or Update and Not now. Automatic installs or updates the shipped plugin when a host is found; it stops and restarts a running host. Off installs nothing. Add the plugin's Stat action to a key, then select a provider and metric in its inspector. Pressing the key opens the app's panel; missing or stale data shows offline.

CLI

Run finaltoken-cli status [--json] [--no-probe]. Use ./finaltoken-cli on Linux or .\finaltoken-cli.exe in PowerShell when running from the extracted folder. It scans, probes limits and prints a snapshot. --no-probe reads usage files only. When the app holds the store lock, the CLI reads its existing snapshot without refreshing. Exit codes are 0 for success, 1 for failure and 2 for bad arguments.

Build from source

Use .NET SDK 10.0.100 or newer within .NET 10, Python 3, and the target OS's NativeAOT C++ toolchain. Run from the repository root, as described in AGENTS.md:

dotnet build FinalToken.slnx -c Release
dotnet test --solution FinalToken.slnx -c Release
python -B tools/docs/check_docs.py
python -B tools/publish.py win-x64 --out artifacts/package-win-x64

The publish directory must be empty. The tool bundles all three executables and plugin assets, then creates a ZIP beside the directory. Publish win-x64 on Windows and linux-x64 on Linux.

S
Description
No description provided
Readme MIT
865 KiB
Languages
C# 82.1%
Python 16.6%
Shell 0.6%
HTML 0.5%
JavaScript 0.2%