Repository navigation
model quota: refuse an over-quota request with no usable fallback - #150
Merged
Merged
Conversation
A per-model daily quota used to only trigger the tenant fallback_model: with none configured, one whose protocol cannot serve the surface, a request that already names the fallback, or a reasoning request pinned to its model, the request was served on the requested model and the quota never bound. Those cases now answer 400 service_quota_exceeded_exception, the refusal the realtime admission already gives; a fallback_models chain hop over its quota ends the chain with it.
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.
Problem
A per-model daily quota (
tenants[].model_quotas/access_keys[].model_quotas) only ever triggered the tenantfallback_model. In these cases there was no usable fallback, the request was served on the requested model, and the quota never bound:Change
ModelQuotaGate: over quota, the request continues only when the tenant fallback is actually swapped in. Every other case answers400 service_quota_exceeded_exceptionwith "model quota exhausted for<model>", the same refusal realtime admission already gives.fallback_modelschain hop over its quota ends the chain with that refusal, because the chain only continues on upstream faults. In a batch the refusal is a failed item; the offline retry loop retries throttles only.Hot-path cost
Zero under quota: the path is unchanged, with the same single
quota_checkand no new allocation. Prod −11 lines.Evidence
model_quota_without_a_usable_fallback_denies(no fallback, and a request that already names the fallback)./v1/chat/completionsand/v1/messagesservice_quota_exceeded_exception