The Hook
When an enterprise AI gateway dynamically resolves model aliases or rejects requests at the usage-quota middleware layer, reading the model identifier after route execution means your access logs either record the post-resolution fallback model or log None on every 429/403 quota denial—blinding capacity planners to what models users actually requested.
The Deep Dive
GitLab's AI Gateway ( ai-assist ) powers Code Suggestions and GitLab Duo across cloud and self-hosted model deployments using FastAPI and Starlette. In the /v2/code/completions pipeline, incoming SuggestionsRequest payloads specify a client-requested model ( model_provider , model_name ), which the route handler may subsequently overwrite during model resolution or reject upfront if has_sufficient_usage_quota fails.…