# Token Usage Indicator

Personal-desk firmware showing Claude+Codex token usage on ESP8266 SSD1306 OLED and TTGO T-Display ESP32 color TFT

屏幕上四根进度条报告 Claude 与 Codex 的额度用到了哪：五小时会话一条、七天周期一条，两家各两行。

- id: pa0l0s-token-usage-indicator
- author: pa0l0s
- repository: https://github.com/pa0l0s/token-usage-indicator
- license: MIT
- shape: square
- scenes: art, home, ai
- boards: TTGO T-Display
- browser_playable: no
- preview: Project screenshots
- html: https://esp32gallery.com/projects/pa0l0s-token-usage-indicator/
- html_zh: https://esp32gallery.com/zh/projects/pa0l0s-token-usage-indicator/
- json: https://esp32gallery.com/data/catalog/projects/pa0l0s-token-usage-indicator.json

## Hardware

Supported hardware: TTGO T-Display. Confirm the exact board revision and pin map in the upstream repository.

支持硬件：TTGO T-Display。烧录前请在上游仓库核对板卡版本与引脚定义。

## English

```
Four bars report how close you are to the Claude and Codex limits: the five-hour session and the seven-day window, one pair per provider. Two builds share one codebase, an ESP8266 with a 128x64 SSD1306 and a TTGO T-Display with a 240x135 colour panel, with parsing, caching, timers and battery maths kept hardware-agnostic and unit-tested on a computer. Anthropic is queried directly with an OAuth bearer token pasted at the setup portal; Codex needs a LAN proxy, because chatgpt.com rejects anything that is not the Codex CLI at the TLS layer. Polls run every 300 seconds, a 401 triggers one refresh attempt, and eight failed fetches in a row reboot the board to clear heap fragmentation. Only one client can hold the rotating refresh token.
```

## 中文

```
屏幕上四根进度条报告 Claude 与 Codex 的额度用到了哪：五小时会话一条、七天周期一条，两家各两行。同一套代码出两个硬件版本，ESP8266 配 128x64 的 SSD1306，TTGO T-Display 配 240x135 彩屏；解析、缓存、计时、电量估算这些逻辑与硬件无关，在电脑上跑单元测试。Anthropic 直连 OAuth Bearer 接口，凭证在 setup 门户里粘贴；Codex 必须自建局域网代理，因为 chatgpt.com 在 Cloudflare 层拒绝非 Codex CLI 的 TLS 指纹。默认 300 秒轮询一次，401 只触发一次刷新重试，连续 8 次取数失败就重启清堆。刷新令牌每次使用都会轮换，电脑和板子只能有一个持有。
```
