fix(claude-code): show model thinking and cache reads, price cache reads in agent configs

Closed
SI
1mo ago
+303-41

Closes #99.

Claude Code now shows the model's thinking and reports cache reads in its usage. OpenCode, OpenClaw and Prime Agent now get the cache-read price, so a cached prompt costs what it should in their cost display.

Tested manually on prod: Claude Code over two turns (thinking shown, cache reads reported), and OpenCode's cost display.


Summary by cubic

Fixes Claude Code translation so model reasoning surfaces as thinking blocks and cache reads are reported, priced, and not double-counted.

  • Streams reasoning as an unsigned thinking block; text closes it and vice versa.
  • Cache reads move from input_tokens to cache_read_input_tokens, keeping the total unchanged.
  • OpenCode, OpenClaw, and Prime Agent configs now use the catalog's cached-input price.

Summary by CodeRabbit

  • New Features
    • Reasoning content now appears as thinking blocks in Anthropic responses, including streamed responses.
    • OpenCode, OpenClaw, and Prime Agent cost displays now include catalog-provided cache-read pricing when available.
  • Bug Fixes
    • Anthropic usage reporting now accounts for cached input tokens without double-counting them as regular input.
    • Claude Code documentation clarifies unsigned thinking blocks and cache-token reporting.