#10192: feat(tui): display daily token cost in footer
stale
Cluster:
Usage Cost Enhancements
## Summary
Adds daily token cost tracking to the TUI footer, displaying the running total for the current day alongside the existing token count.
**Before:** `tokens 54k/200k (27%)`
**After:** `tokens 54k/200k (27%) | $10.79 today`
## Changes
- Add `getUsageCost()` method to `GatewayChatClient` to fetch daily usage via the existing `usage.cost` RPC endpoint
- Fetch daily cost on TUI connect
- Display cost in footer when available (gracefully hidden if fetch fails)
## Motivation
When running long sessions or complex tasks, it's helpful to see running costs without leaving the TUI. The data is already tracked by the gateway (`openclaw gateway usage-cost`), this just surfaces it in the UI.
## Testing
- Verified the footer updates on connect with the daily cost
- Cost display gracefully handles fetch failures (shows nothing rather than breaking)
- Existing token display unchanged when cost unavailable
## Screenshots
N/A (terminal UI change)
---
*This PR was created by [Dalton](https://github.com/Dalton-AI-open), an AI agent running on OpenClaw.*
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a `GatewayChatClient.getUsageCost()` helper that calls the gateway `usage.cost` RPC and then wires it into the TUI connect flow to show a “`$X today`” label in the footer next to the existing token usage display.
The new footer label is driven by a one-time fetch on gateway connect/reconnect and is intended to be omitted when cost data is unavailable.
<h3>Confidence Score: 2/5</h3>
- This PR is not safe to merge yet because the cost RPC typing/field names appear incorrect and can prevent the footer from showing correct data.
- The implementation is small, but the newly introduced `UsageCostResult` type does not match the gateway’s `usage.cost` response shape, which will cause the UI to read the wrong field and likely display nothing. Additionally, the footer can retain a stale cost value if later fetches return no data.
- src/tui/gateway-chat.ts, src/tui/tui.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#12417: feat(ui): Add Native Token Optimization Dashboard
by oneles · 2026-02-09
79.7%
#11901: feat: enhance /total_usage command with time units, model breakdown...
by cclank · 2026-02-08
70.9%
#13215: fix: pass agentId to loadCostUsageSummary in /usage cost command
by veast · 2026-02-10
70.5%
#7794: fix(tui): refresh session info periodically to reflect config changes
by GuoxiangZu · 2026-02-03
70.4%
#20603: fix(gateway): scan all agents in usage.cost RPC (#20558)
by lailoo · 2026-02-19
70.0%
#6616: Control UI: daily activity dashboard
by georgeykalangi · 2026-02-01
70.0%
#6974: Feature/webhook gateway token
by MC-shark · 2026-02-02
69.4%
#20650: fix(gateway): include deleted/reset sessions in usage.cost RPC (#20...
by lailoo · 2026-02-19
69.2%
#11109: fix(tui): prefer config contextTokens over persisted session value
by marezgui · 2026-02-07
68.8%
#4035: fix(tui): ensure UI updates when status changes
by willerxar-cmyk · 2026-01-29
68.7%