openai / openai/codex

Feature request: show latest prompt-cache hit rate in the CLI status line

Open
#43,615 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

CLI enhancement rate-limits TUI
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

Please add an optional TUI status-line item that shows the prompt-cache hit rate for the most recent model request.

For example:

Cache 99%
Image

The value should be calculated from the latest request usage:

last_token_usage.cached_input_tokens
------------------------------------- × 100
    last_token_usage.input_tokens

The item should:

  • Use last_token_usage, rather than cumulative total_token_usage.
  • Render an integer percentage.
  • Omit itself when there is no valid latest usage or when input_tokens == 0.
  • Never divide by zero or display a fabricated Cache 0% before the first request.
  • Be available through the existing status_line configuration and the /statusline picker.
Additional information

Prompt-cache visibility is particularly important for people who use the Codex CLI for long-running development sessions, automation, and agent loops. Cache behavior directly affects latency and input-token cost, but currently users have no immediate way to tell whether the latest request reused the prompt prefix successfully.

Reproduction and validation:

  • Codex CLI version: 0.153.4
  • The CLI already receives last_token_usage.input_tokens and last_token_usage.cached_input_tokens.
  • A local minimal implementation using those existing fields worked without changing the request or token accounting path.
  • In a normal CLI session, the status line displayed a real cache hit rate of Cache 99%.
  • The implementation also correctly handled Cache 0% and hid the item when input_tokens == 0.

This is valuable as an official feature because patching the installed binary is overwritten by every official upgrade. The Codex CLI still has an active user base, and exposing practical diagnostics like this would make it easier to understand cost, performance, prompt stability, and cache behavior.

Claude’s CLI provides stronger visibility into usage and session behavior in this area. Codex would benefit from continuing to develop and open up similarly useful diagnostics for CLI users, especially when the underlying usage data is already available internally.

Related discussion: #35925.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing status_line configuration and the /statusline picker, then trace how last_token_usage reaches the TUI. Done means an optional integer Cache percentage uses the latest request, hides when usage is invalid or input_tokens is zero, and never divides by zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.