Skip to content

Incorrect Tiered Pricing Calculation (Incremental vs Threshold) #241

@hilikpaz

Description

@hilikpaz

Both Python and TypeScript implementations are incorrectly calculating tiered pricing using an incremental model instead of the threshold (cliff) model that is the industry standard used by major providers.

When a request crosses a tier boundary, ALL tokens in that request are charged at the higher tier rate, not just the tokens above the threshold.

See for example Anthropic and Google's docs:
https://cloud.google.com/vertex-ai/generative-ai/pricing#:~:text=Grounding%20with%20your%20data,equivalent%20to%20%240.134%2Fimage%20generated.

https://platform.claude.com/docs/en/about-claude/pricing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions