Skip to content

🤖 fix: budget accounting ignores OpenAI service-tier (priority) pricing #4352

Description

@ThomasK33

Summary

Cost accounting and budget enforcement price every OpenAI request at the model's base rates, regardless of the effective service tier. createDisplayUsage(usage, model, providerMetadata, metadataModelOverride) has no tier input and models-extra.ts carries base-tier rates only, so a goal run with --service-tier priority (a higher-cost tier that the app labels as such) and --budget is admitted and metered as if it ran on the default tier. The represented dollar cap therefore under-counts real spend on priority runs.

Scope

Proposed fix (either)

  1. Carry the effective tier into usage accounting: extend createDisplayUsage (or its caller) with the pinned serviceTier and apply per-tier rate multipliers/rates from the catalog.
  2. Or fail closed: reject budgeted runs when the effective tier is non-default until tier pricing exists.

Follow-up trigger

Next change to usage accounting or the OpenAI pricing catalog; owner: whoever next touches displayUsage.ts / models-extra.ts.


Generated with xum • Model: coder:anthropic/claude-fable-5-1 • Thinking: xhigh • Cost: $174.60

Activity

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

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