Add support for priority tiers & better long-context surcharge#172
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds service-tier support to model pricing and cost calculation. It introduces new ChangesService-Tier Cost Model
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
This PR fixes and extends OpenAI GPT pricing support in Splitrail, with Piebald now using service-tier-aware pricing when its database records a service tier.
Changes
gpt-5.4,gpt-5.4-pro, andgpt-5.5.ServiceTiersupport to the model pricing layer:StandardPriorityFlexBatchModelInfo.calculate_input_cost_for_service_tiercalculate_output_cost_for_service_tiercalculate_cache_cost_for_service_tiercalculate_total_cost_for_service_tiergpt-5.5gpt-5.4gpt-5.4-minigpt-5.5gpt-5.5-progpt-5.4gpt-5.4-minigpt-5.4-nanogpt-5.4-prooverride_gen_cfg_data_openai_responses.service_tieroverride_gen_cfg_data_openai_completions.service_tierpriority→ServiceTier::Priorityflex→ServiceTier::Flexbatch→ServiceTier::BatchServiceTier::Standardcalculate_total_cost_for_service_tier(...).Why
OpenAI’s long-context GPT pricing says prompts above the
272kinput-token threshold are priced at the long-context rate for the full session. Splitrail previously represented some of these prices as progressive tiers, which undercounted long-context sessions.Additionally, OpenAI exposes different pricing for service tiers such as Priority, Flex, and Batch. Splitrail now has a pricing model that can represent these tiers, and Piebald can use that information when it is present in its database.
Notes
scalewithout inventing pricing behavior.Verification
Ran:
Summary by CodeRabbit