Skip to content

Add Anthropic prompt caching, cost tracking, and shared handler optimizations#126

Open
iam-dev wants to merge 2 commits intoalexzhang13:mainfrom
iam-dev:feat/anthropic-caching-and-cost-tracking
Open

Add Anthropic prompt caching, cost tracking, and shared handler optimizations#126
iam-dev wants to merge 2 commits intoalexzhang13:mainfrom
iam-dev:feat/anthropic-caching-and-cost-tracking

Conversation

@iam-dev
Copy link

@iam-dev iam-dev commented Feb 25, 2026

Summary

  • Add prefix caching support with cache_control annotations for Anthropic API (enable_prefix_cache option)
  • Add per-model USD cost tracking using built-in pricing table with cache-aware billing
  • Track cache creation/read tokens in usage summaries
  • Add shared LM handler for child RLMs to reduce per-subcall overhead
  • Update local_repl and test_rlm_query for new features
  • Sync uv.lock version to 0.1.1

Test plan

  • Existing test suite passes (281 passed, 10 skipped)
  • Verify Anthropic prompt caching with real API calls — both calls returned CACHE_TEST_OK with correct cache_control annotations sent
  • Validate cost calculations against Anthropic billing — haiku pricing $0.25/$1.25 per 1M tokens: 17 input + 9 output = $0.0000155, exact match confirmed

Add ClaudeCodeCLI backend that shells out to `claude --print` for
API-key-free usage. Includes 27 unit tests covering init, command
building, prompt preparation, sync/async completion, usage tracking,
and get_client integration.
…izations

- Add prefix caching support with cache_control annotations for Anthropic API
- Add per-model USD cost tracking using built-in pricing table
- Track cache creation/read tokens in usage summaries
- Add shared LM handler for child RLMs to reduce per-subcall overhead
- Update local_repl and test_rlm_query for new features
- Sync uv.lock version to 0.1.1
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