Skip to content

Conversation

vgrozdanic
Copy link
Member

@vgrozdanic vgrozdanic commented Jul 8, 2025

This PR fixes 2 situations that were misunderstood:

  • cached tokens are a subset of input tokens, so they should be subtracted from input tokens when doing cost calculation
  • reasoning tokens are a subset of output tokens, but they are more often than not priced the same as output tokens (for now they rarely have a separate pricing)

@vgrozdanic vgrozdanic force-pushed the vg/fix-pricing-calculation branch from b0bb0ea to 4521717 Compare July 8, 2025 14:55
Copy link
Member Author

Choose a reason for hiding this comment

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

Had to rearrange the token costs and amounts to have have a realistic scenarios (e.g. gen_ai.usage.output_tokens.reasoning is subset of gen_ai.usage.output_tokens)

@vgrozdanic vgrozdanic force-pushed the vg/fix-pricing-calculation branch from 4521717 to 8f109ac Compare July 9, 2025 06:17
@vgrozdanic vgrozdanic marked this pull request as ready for review July 9, 2025 06:17
@vgrozdanic vgrozdanic requested a review from a team as a code owner July 9, 2025 06:17
@vgrozdanic vgrozdanic added this pull request to the merge queue Jul 9, 2025
Merged via the queue into master with commit 6acf25a Jul 9, 2025
29 checks passed
@vgrozdanic vgrozdanic deleted the vg/fix-pricing-calculation branch July 9, 2025 09:36
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.

2 participants