Repository navigation
fix: price OpenAI requests by actual service tier - #4625
Merged
Merged
Conversation
Remove the model allowlist and instead derive the Fast tier premium from matching catalogue entries, falling back to the documented multiplier when metadata is missing or inconsistent. Endpoint and cost-override guards, tests, and docs are preserved. Signed-off-by: David Gageot <david.gageot@docker.com>
aheritier
approved these changes
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
OpenAI's
fast/priority/ultrafastservice tiers charge a premium overthe base model rate, but that premium wasn't tracked per-model: it was a
hardcoded list of model names that would silently stop applying once a model
rolled off the allowlist, and never covered models with a different premium
than 2x/6x.
What
Cost.ForServiceTierwith afastMultiplierderived per-model from the catalogue (withFastPricinginpkg/modelsdev/service_tier.go), looked up once inStore.GetModel.own and the premium is uniform across input/output/cache rates and all
context tiers; otherwise it falls back to the previous flat estimates
(
fast= 2x,ultrafast= 6x), as before.-2025-01-01suffix) still fall back to thealias's premium, but no longer assume the alias's base rates apply to them.
examples/openai-service-tier.yamlexample, andextended tests in
pkg/modelsdevandpkg/runtime.Validation
CI=true task build,task test,task lint-raceruns for themodelsdev/runtimeservice-tier tests andthe catalogue boundary tests
gpt-6.1-solultrafast pricing