From ab6b99825bfc2035e0156ff527d27413c3a225a4 Mon Sep 17 00:00:00 2001 From: Daniel Edrisian Date: Wed, 1 Oct 2025 16:57:40 -0700 Subject: [PATCH 1/5] Add the word "used" --- codex-rs/tui/src/status/card.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rs index 2674fc3e07..78151b98c2 100644 --- a/codex-rs/tui/src/status/card.rs +++ b/codex-rs/tui/src/status/card.rs @@ -152,7 +152,7 @@ impl StatusHistoryCell { Span::from(format!("{percent}% left")), Span::from(" (").dim(), Span::from(used_fmt).dim(), - Span::from(" / ").dim(), + Span::from(" used / ").dim(), Span::from(window_fmt).dim(), Span::from(")").dim(), ]) From 8f26cbd27714d09ee91f0a52d518e4e54a511f70 Mon Sep 17 00:00:00 2001 From: Daniel Edrisian Date: Wed, 1 Oct 2025 17:05:00 -0700 Subject: [PATCH 2/5] Hide "Token usage" line for chatgpt users --- codex-rs/tui/src/status/card.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rs index 78151b98c2..6962fd3ca9 100644 --- a/codex-rs/tui/src/status/card.rs +++ b/codex-rs/tui/src/status/card.rs @@ -302,7 +302,10 @@ impl HistoryCell for StatusHistoryCell { } lines.push(Line::from(Vec::>::new())); - lines.push(formatter.line("Token usage", self.token_usage_spans())); + // Only show token usage when using an API key + if matches!(self.account, Some(StatusAccountDisplay::ApiKey)) { + lines.push(formatter.line("Token usage", self.token_usage_spans())); + } if let Some(spans) = self.context_window_spans() { lines.push(formatter.line("Context window", spans)); From 57e29f857c1795babf10ba6a0bf5d6a65c8d1603 Mon Sep 17 00:00:00 2001 From: Daniel Edrisian Date: Wed, 1 Oct 2025 17:11:15 -0700 Subject: [PATCH 3/5] Fix tests --- ..._status__tests__status_snapshot_includes_monthly_limit.snap | 3 +-- ...tus__tests__status_snapshot_includes_reasoning_details.snap | 3 +-- ...tus__tests__status_snapshot_shows_empty_limits_message.snap | 3 +-- ...s__tests__status_snapshot_shows_missing_limits_message.snap | 3 +-- ...s__tests__status_snapshot_truncates_in_narrow_terminal.snap | 3 +-- codex-rs/tui/src/status/tests.rs | 2 +- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap index 73767d986b..5b3fa9e896 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap @@ -13,7 +13,6 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ -│ Token usage: 1.2K total (800 input + 400 output) │ -│ Context window: 100% left (1.2K / 272K) │ +│ Context window: 100% left (1.2K used / 272K) │ │ Monthly limit: [██░░░░░░░░░░░░░░░░░░] 12% used (resets 07:08 on 7 May) │ ╰────────────────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap index 20904760cf..8b8329e945 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap @@ -13,8 +13,7 @@ expression: sanitized │ Sandbox: workspace-write │ │ Agents.md: │ │ │ -│ Token usage: 1.9K total (1K input + 900 output) │ -│ Context window: 100% left (2.1K / 272K) │ +│ Context window: 100% left (2.1K used / 272K) │ │ 5h limit: [███████████████░░░░░] 72% used (resets 03:14) │ │ Weekly limit: [█████████░░░░░░░░░░░] 45% used (resets 03:24) │ ╰─────────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap index 0ac26c5d54..cc2d4dfbc8 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap @@ -13,7 +13,6 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ -│ Token usage: 750 total (500 input + 250 output) │ -│ Context window: 100% left (750 / 272K) │ +│ Context window: 100% left (750 used / 272K) │ │ Limits: data not available yet │ ╰─────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap index d59140a355..5035b3f2a8 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap @@ -13,7 +13,6 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ -│ Token usage: 750 total (500 input + 250 output) │ -│ Context window: 100% left (750 / 272K) │ +│ Context window: 100% left (750 used / 272K) │ │ Limits: send a message to load usage data │ ╰─────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap index fd429dd940..75f6a69601 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap @@ -13,8 +13,7 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ -│ Token usage: 1.9K total (1K input + │ -│ Context window: 100% left (2.1K / 272K) │ +│ Context window: 100% left (2.1K used / │ │ 5h limit: [███████████████░░░░░] │ │ (resets 03:14) │ ╰────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/tests.rs b/codex-rs/tui/src/status/tests.rs index eff8d8f47f..395d952f41 100644 --- a/codex-rs/tui/src/status/tests.rs +++ b/codex-rs/tui/src/status/tests.rs @@ -314,7 +314,7 @@ fn status_context_window_uses_last_usage() { .expect("context line"); assert!( - context_line.contains("13.7K / 272K"), + context_line.contains("13.7K used / 272K"), "expected context line to reflect last usage tokens, got: {context_line}" ); assert!( From 971034b0928186d7210381b210ba540aa176d1e1 Mon Sep 17 00:00:00 2001 From: dedrisian-oai Date: Wed, 1 Oct 2025 17:28:29 -0700 Subject: [PATCH 4/5] Show token usage for non ChatGPT accounts --- codex-rs/tui/src/status/card.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rs index 6962fd3ca9..4832713bf9 100644 --- a/codex-rs/tui/src/status/card.rs +++ b/codex-rs/tui/src/status/card.rs @@ -302,8 +302,8 @@ impl HistoryCell for StatusHistoryCell { } lines.push(Line::from(Vec::>::new())); - // Only show token usage when using an API key - if matches!(self.account, Some(StatusAccountDisplay::ApiKey)) { + // Hide token usage only for ChatGPT subscribers + if !matches!(self.account, Some(StatusAccountDisplay::ChatGpt { .. })) { lines.push(formatter.line("Token usage", self.token_usage_spans())); } From a218f1666e5ace5b544bf5ee9c848c9f9e005c97 Mon Sep 17 00:00:00 2001 From: Daniel Edrisian Date: Wed, 1 Oct 2025 17:44:23 -0700 Subject: [PATCH 5/5] Fix tests --- ...i__status__tests__status_snapshot_includes_monthly_limit.snap | 1 + ...tatus__tests__status_snapshot_includes_reasoning_details.snap | 1 + ...tatus__tests__status_snapshot_shows_empty_limits_message.snap | 1 + ...tus__tests__status_snapshot_shows_missing_limits_message.snap | 1 + ...tus__tests__status_snapshot_truncates_in_narrow_terminal.snap | 1 + 5 files changed, 5 insertions(+) diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap index 5b3fa9e896..cf3f492eef 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_monthly_limit.snap @@ -13,6 +13,7 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ +│ Token usage: 1.2K total (800 input + 400 output) │ │ Context window: 100% left (1.2K used / 272K) │ │ Monthly limit: [██░░░░░░░░░░░░░░░░░░] 12% used (resets 07:08 on 7 May) │ ╰────────────────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap index 8b8329e945..505375eae5 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_includes_reasoning_details.snap @@ -13,6 +13,7 @@ expression: sanitized │ Sandbox: workspace-write │ │ Agents.md: │ │ │ +│ Token usage: 1.9K total (1K input + 900 output) │ │ Context window: 100% left (2.1K used / 272K) │ │ 5h limit: [███████████████░░░░░] 72% used (resets 03:14) │ │ Weekly limit: [█████████░░░░░░░░░░░] 45% used (resets 03:24) │ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap index cc2d4dfbc8..472df543d6 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_empty_limits_message.snap @@ -13,6 +13,7 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ +│ Token usage: 750 total (500 input + 250 output) │ │ Context window: 100% left (750 used / 272K) │ │ Limits: data not available yet │ ╰─────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap index 5035b3f2a8..66bcfa3e21 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_shows_missing_limits_message.snap @@ -13,6 +13,7 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ +│ Token usage: 750 total (500 input + 250 output) │ │ Context window: 100% left (750 used / 272K) │ │ Limits: send a message to load usage data │ ╰─────────────────────────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap index 75f6a69601..b7c595340d 100644 --- a/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap +++ b/codex-rs/tui/src/status/snapshots/codex_tui__status__tests__status_snapshot_truncates_in_narrow_terminal.snap @@ -13,6 +13,7 @@ expression: sanitized │ Sandbox: read-only │ │ Agents.md: │ │ │ +│ Token usage: 1.9K total (1K input + │ │ Context window: 100% left (2.1K used / │ │ 5h limit: [███████████████░░░░░] │ │ (resets 03:14) │