Skip to content

fix(anthropic): capture nested usage metrics and metadata#189

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi-fix-164-anthropic-usage-metrics
Apr 2, 2026
Merged

fix(anthropic): capture nested usage metrics and metadata#189
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi-fix-164-anthropic-usage-metrics

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

Normalize Anthropic usage with explicit extraction for nested cache creation and server tool fields, and attach allowlisted usage metadata to Anthropic and Claude Agent SDK spans. This preserves new usage signals while keeping compatibility across older Anthropic SDK versions whose usage payloads differ slightly in shape.

Extend the existing VCR coverage and shared Anthropic usage tests so the fix is validated across Anthropic and Claude Agent SDK integrations.

Fixes #164

Normalize Anthropic usage with explicit extraction for nested cache creation and server tool fields, and attach allowlisted usage metadata to Anthropic and Claude Agent SDK spans. This preserves new usage signals while keeping compatibility across older Anthropic SDK versions whose usage payloads differ slightly in shape.

Extend the existing VCR coverage and shared Anthropic usage tests so the fix is validated across Anthropic and Claude Agent SDK integrations.

Fixes #164
@starfolkai

This comment was marked as outdated.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit d807b7b into main Apr 2, 2026
29 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-fix-164-anthropic-usage-metrics branch April 2, 2026 16:52
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.

Anthropic: usage metrics extraction silently drops server_tool_use, cache_creation breakdown, and other new API fields

2 participants