Skip to content

feat(tui): drop the live rate, report tokens per second when the turn ends - #422

Merged
mohitranka merged 1 commit into
mainfrom
feat/turn-rate
Aug 22, 2026
Merged

mohitranka merged 1 commit into
mainfrom
feat/turn-rate

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Moves the throughput figure off the live turn line and onto the turn summary,
where it can be a measurement rather than a proxy.

Why the live rate went

Characters per second measured the wrong thing. It moved with how verbose the
model was being rather than how fast it was going, so the number swung between
a paragraph and a code block with nothing having actually changed — and it was
the one figure on the live line a reader might reasonably try to compare
between runs.

The live line keeps its character count, which stays honest for the reason it
was chosen in the first place: no provider reports token usage while the
stream is still open, so a token count there would be an estimate presented
as a measurement.

◓  Writing the answer…   4.3s · ↓ 363 chars          esc to interrupt

What the summary gained

Once the turn is over the provider's own usage figures are in hand, so the
rate can be real: this turn's completion tokens, taken as the difference
between cumulative session usage and what it stood at when the turn began.

✓  Answered in 6s  ·  1.0k chars  ·  28 tok/s

Three deliberate choices, each of which will show up in the numbers:

  • Completion tokens only. Prompt tokens are not produced over the turn's
    duration, so counting them would inflate a generation rate with work that
    took no time.
  • Wall time, not model time. A turn that spent nine of its ten seconds
    running tools did not generate at the rate the model alone managed, and the
    reader is timing the turn they waited through. A tool-heavy turn will show a
    low tok/s, which is intended — but it does mean the figure is not a clean
    model-speed benchmark.
  • Silence over a bad number. Nothing is reported when the provider sent no
    usage, when it reported zero, or when the turn ran under a second, where a
    rounding error can double the rate.

Verification

Driven in a real tmux PTY at 150x40 against a live provider: the streaming
line shows 4.3s · ↓ 363 chars with no rate, and the turn closes
✓ Answered in 6s · 1.0k chars · 28 tok/s. Tests cover the rate arithmetic,
each of the three silence cases, and the fact that tool time counts toward the
denominator. cargo fmt, cargo clippy --all-targets (zero warnings) and
cargo test --workspace (zero failures) are green.

https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM

… ends

Characters per second measured the wrong thing. It moved with how verbose the
model was being rather than how fast it was going, so the number swung between
a paragraph and a code block with nothing having actually changed — and it was
the one figure on the live line a reader might try to compare between runs.

The rate moves to the turn summary, where it can be a measurement instead of
a proxy: the provider's own completion-token count for this turn, taken as the
difference between cumulative session usage and what it stood at when the turn
began.

    ✓  Answered in 6s  ·  1.0k chars  ·  28 tok/s

Completion tokens only — prompt tokens are not produced over the turn's
duration, so counting them would inflate a generation rate with work that took
no time. Wall time, not model time: a turn that spent nine of its ten seconds
running tools did not generate at the rate the model alone managed, and the
reader is timing the turn they waited through.

Nothing is reported when the provider sent no usage, when it reported zero, or
when the turn ran under a second — a rounding error can double a rate at that
scale. The live line keeps its character count, which stays honest: no
provider reports token usage while the stream is open.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
@mohitranka
mohitranka merged commit 15d4242 into main Aug 22, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Sep 11, 2026
… ends (#422)

Characters per second measured the wrong thing. It moved with how verbose the
model was being rather than how fast it was going, so the number swung between
a paragraph and a code block with nothing having actually changed — and it was
the one figure on the live line a reader might try to compare between runs.

The rate moves to the turn summary, where it can be a measurement instead of
a proxy: the provider's own completion-token count for this turn, taken as the
difference between cumulative session usage and what it stood at when the turn
began.

    ✓  Answered in 6s  ·  1.0k chars  ·  28 tok/s

Completion tokens only — prompt tokens are not produced over the turn's
duration, so counting them would inflate a generation rate with work that took
no time. Wall time, not model time: a turn that spent nine of its ten seconds
running tools did not generate at the rate the model alone managed, and the
reader is timing the turn they waited through.

Nothing is reported when the provider sent no usage, when it reported zero, or
when the turn ran under a second — a rounding error can double a rate at that
scale. The live line keeps its character count, which stays honest: no
provider reports token usage while the stream is open.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
mohitranka added a commit that referenced this pull request Sep 11, 2026
… ends (#422)

Characters per second measured the wrong thing. It moved with how verbose the
model was being rather than how fast it was going, so the number swung between
a paragraph and a code block with nothing having actually changed — and it was
the one figure on the live line a reader might try to compare between runs.

The rate moves to the turn summary, where it can be a measurement instead of
a proxy: the provider's own completion-token count for this turn, taken as the
difference between cumulative session usage and what it stood at when the turn
began.

    ✓  Answered in 6s  ·  1.0k chars  ·  28 tok/s

Completion tokens only — prompt tokens are not produced over the turn's
duration, so counting them would inflate a generation rate with work that took
no time. Wall time, not model time: a turn that spent nine of its ten seconds
running tools did not generate at the rate the model alone managed, and the
reader is timing the turn they waited through.

Nothing is reported when the provider sent no usage, when it reported zero, or
when the turn ran under a second — a rounding error can double a rate at that
scale. The live line keeps its character count, which stays honest: no
provider reports token usage while the stream is open.

Claude-Session: https://claude.ai/code/session_01PRJa3oW3o66f48FynE3MoM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant