Skip to content

feat(anthropic): Add raw usage object to Anthropic provider metadata#7591

Merged
lgrammel merged 11 commits intomainfrom
lg/UOuWo5Gy
Jul 28, 2025
Merged

feat(anthropic): Add raw usage object to Anthropic provider metadata#7591
lgrammel merged 11 commits intomainfrom
lg/UOuWo5Gy

Conversation

@lgrammel
Copy link
Collaborator

Background

Anthropic supports several different flavors of prompt caching in beta. These are priced differently. It would be lovely to give tracing providers a way to accurately track this.

Summary

Adds the raw returned Anthropic usage object to provider metadata. A subset of this is returned as providerMetadata.anthropic.cache_creation_input_tokens, but this is not enough granularity to tell whether it was a 5 minute cache or a 1 hr cache.

Verification

See added example.

Related Issues

Continues #7566

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants