Skip to content

Token report: price Sonnet 5.5 and use the lead's real output tokens #425

Description

@sv-tmueller

Part of batch #423

What to build

The per-batch token report gets two figures wrong.

Sonnet 5.5 is unpriced. The price table has claude-sonnet-5 but not claude-sonnet-5-5, so Sonnet 5.5 usage shows up as "unpriced" and is left out of the total. PR #419 had to price it by hand (batch #417 Decision 6). Add a claude-sonnet-5-5 entry with all five rates, read from the pricing page named in the table's source on the day of the change, and update retrieved to that date.

Output tokens are estimated for everyone. The report estimates each agent's output as visible characters divided by 4. That leaves out thinking tokens and undercounts. The lead's own transcript carries the real usage.output_tokens (values in the hundreds to thousands per turn). Subagent transcripts carry only streaming placeholders (single digits to low tens), as batch #417 Decision 3 found. Use the real count for the lead's rows and keep the estimate for subagent rows. Each row, and the report notes, say which figure is measured and which is estimated.

Acceptance criteria

  • The price table has a claude-sonnet-5-5 entry with all five rates, taken from the source URL, and retrieved is set to the check date.
  • A fixture test shows a Sonnet 5.5 record is priced and counted in the total.
  • Lead rows use the transcript's output_tokens, subagent rows keep the characters-divided-by-4 estimate, and a fixture test covers both.
  • The column header and notes say which figures are measured and which are estimated. The current line that says all output is estimated is replaced.
  • npm test passes, and the version in .claude/.claude-plugin/plugin.json is bumped.

Non-goals

  • Re-pricing past batch reports.
  • Changing how wall-clock time is worked out.
  • Adding prices for models the policy doesn't pin.
  • Any other way of recovering subagent thinking tokens.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    size:SUnder 1 hour. One focused change.type:fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions