Skip to content

Conversation

@narengogi
Copy link
Collaborator

Description: (required)

  • The anthropic usage object is not compliant with the openai format, this PR fixes it

Type of Change:

  • Bug fix (non-breaking change which fixes an issue)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Anthropic usage object structure to align with OpenAI's format. The primary issue was incorrect token calculation where cache tokens were being added to total_tokens instead of being included in prompt_tokens.

Key Changes:

  • Corrected token calculation logic to include cache tokens in prompt_tokens rather than total_tokens
  • Simplified streaming usage handling by removing redundant state management
  • Improved code maintainability by extracting token calculations into separate variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@narengogi narengogi marked this pull request as draft December 24, 2025 13:37
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