[Feature][Bug Fix] Decouple Azure OpenAI Deployment ID from model name via base_model to fix gpt5 model routing#28490
Conversation
Azure OpenAI deployments have arbitrary names (deployment IDs) that may
not match the underlying model. Previously, model-type detection
(o-series, gpt-5, etc.) relied on substring matching against the
deployment name, causing misrouted configs and rejected params when
deployment names were non-standard (e.g. 'my-deployment-id' for gpt-5.2).
This change extends the existing base_model field to drive model-type
detection, config selection, supported param resolution, and param
mapping throughout the Azure call path:
- _get_azure_config() uses base_model for is_o_series/is_gpt_5 checks
- get_provider_chat_config() threads base_model for Azure
- get_supported_openai_params() accepts and uses base_model
- get_optional_params() accepts base_model and passes it to all Azure
config method calls (get_supported_openai_params, map_openai_params)
- azure.py completion handler uses base_model for GPT-5 detection
- Config internal methods (e.g. is_model_gpt_5_2_model) now receive
base_model so features like logprobs are correctly enabled
Fully backward compatible - when base_model is unset, behavior is
identical. Existing o_series/ and gpt5_series/ prefix workarounds
continue to work.
Usage in proxy config:
model_list:
- model_name: my-gpt5
litellm_params:
model: azure/my-deployment-id
model_info:
base_model: azure/gpt-5.2
Fixes: non-standard deployment names like 'prefix-gpt-5.2' rejecting
logprobs/top_logprobs despite the underlying model supporting them.
…enai-base-model-name
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR introduces a
Confidence Score: 5/5Safe to merge — the change is additive and fully backward-compatible; callers that don't pass The No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/utils.py | Adds base_model to get_optional_params, _get_azure_config, and get_provider_chat_config; moves Azure to a special-case path before the provider config map so the parameter can be threaded through for model-type detection. The base_model is correctly popped from passed_params before _check_valid_arg runs so it is never forwarded to the Azure API. |
| litellm/litellm_core_utils/get_supported_openai_params.py | Adds base_model parameter; passes it through get_provider_chat_config and uses base_model or model for the get_supported_openai_params call on the provider config. The pre-existing Azure-specific fallback at lines 142-157 is now dead code for chat completions (Azure is in LlmProvidersSet and always returns a non-None config), but this was acknowledged in a prior thread. |
| litellm/llms/azure/azure.py | Uses litellm_params.get("base_model") or model for the GPT-5 detection check before building request data. O-series routing is handled upstream in main.py so only the GPT-5 vs. default split needs to happen here. |
| litellm/main.py | Passes base_model to get_provider_chat_config, adds it to optional_param_args (so it flows into get_optional_params), and uses _azure_detection_model = base_model or model for the o-series routing check. base_model is also forwarded to get_litellm_params so it is available in litellm_params for downstream handlers in azure.py. |
| tests/test_litellm/llms/azure/chat/test_azure_base_model_routing.py | New test file with comprehensive unit tests covering config routing, supported-params detection, and optional-param mapping for custom deployment names with base_model. All tests are pure unit tests with no real network calls. |
Reviews (2): Last reviewed commit: "Addressing Greptile comments." | Re-trigger Greptile
|
🤖 litellm-agent: This PR is currently BLOCKED from merge. Score: 3/5 ❌ Why blocked:
Details: Score docked for: 1 PR-related CI failure (Size gate: tests (+274) exceed code (+80) by more than 3× — over-specified or feature too thin. Add the Fix the issues above and push an update — the bot will re-review automatically.
|
* fix(anthropic): handle empty streaming tool calls (#28549) Co-authored-by: shin-berri <[email protected]> Co-authored-by: yuneng-jiang <[email protected]> * [Feature][Bug Fix] Decouple Azure OpenAI Deployment ID from model name via base_model to fix gpt5 model routing (#28490) * feat(azure): decouple deployment ID from model name via base_model Azure OpenAI deployments have arbitrary names (deployment IDs) that may not match the underlying model. Previously, model-type detection (o-series, gpt-5, etc.) relied on substring matching against the deployment name, causing misrouted configs and rejected params when deployment names were non-standard (e.g. 'my-deployment-id' for gpt-5.2). This change extends the existing base_model field to drive model-type detection, config selection, supported param resolution, and param mapping throughout the Azure call path: - _get_azure_config() uses base_model for is_o_series/is_gpt_5 checks - get_provider_chat_config() threads base_model for Azure - get_supported_openai_params() accepts and uses base_model - get_optional_params() accepts base_model and passes it to all Azure config method calls (get_supported_openai_params, map_openai_params) - azure.py completion handler uses base_model for GPT-5 detection - Config internal methods (e.g. is_model_gpt_5_2_model) now receive base_model so features like logprobs are correctly enabled Fully backward compatible - when base_model is unset, behavior is identical. Existing o_series/ and gpt5_series/ prefix workarounds continue to work. Usage in proxy config: model_list: - model_name: my-gpt5 litellm_params: model: azure/my-deployment-id model_info: base_model: azure/gpt-5.2 Fixes: non-standard deployment names like 'prefix-gpt-5.2' rejecting logprobs/top_logprobs despite the underlying model supporting them. * Addressing Greptile comments. * gemini-3.1-flash-lite pricing (#27933) * feat(model_prices): add gemini-3.1-flash-lite pricing with standard/batch/flex/priority tiers * fix pricing * add service tier --------- Co-authored-by: shin-berri <[email protected]> * fix(openai-responses): strip Anthropic cache_control from Responses API requests (#28431) Squash-merged by litellm-agent from cwang-otto's PR. * Treat None litellm_provider as wildcard in _check_provider_match (#28523) Squash-merged by litellm-agent from adityasingh2400's PR. * fix greptile * fix: use _azure_detection_model in default Azure branch of get_supported_openai_params Co-authored-by: Yassin Kortam <[email protected]> * fix(openai-responses): strip cache_control on compact endpoint as well Co-authored-by: Yassin Kortam <[email protected]> --------- Co-authored-by: Felipe Garé <[email protected]> Co-authored-by: shin-berri <[email protected]> Co-authored-by: yuneng-jiang <[email protected]> Co-authored-by: withomasmicrosoft <[email protected]> Co-authored-by: mubashir1osmani <[email protected]> Co-authored-by: cwang-otto <[email protected]> Co-authored-by: Aditya Singh <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Yassin Kortam <[email protected]>
* fix(anthropic): handle empty streaming tool calls (BerriAI#28549) Co-authored-by: shin-berri <[email protected]> Co-authored-by: yuneng-jiang <[email protected]> * [Feature][Bug Fix] Decouple Azure OpenAI Deployment ID from model name via base_model to fix gpt5 model routing (BerriAI#28490) * feat(azure): decouple deployment ID from model name via base_model Azure OpenAI deployments have arbitrary names (deployment IDs) that may not match the underlying model. Previously, model-type detection (o-series, gpt-5, etc.) relied on substring matching against the deployment name, causing misrouted configs and rejected params when deployment names were non-standard (e.g. 'my-deployment-id' for gpt-5.2). This change extends the existing base_model field to drive model-type detection, config selection, supported param resolution, and param mapping throughout the Azure call path: - _get_azure_config() uses base_model for is_o_series/is_gpt_5 checks - get_provider_chat_config() threads base_model for Azure - get_supported_openai_params() accepts and uses base_model - get_optional_params() accepts base_model and passes it to all Azure config method calls (get_supported_openai_params, map_openai_params) - azure.py completion handler uses base_model for GPT-5 detection - Config internal methods (e.g. is_model_gpt_5_2_model) now receive base_model so features like logprobs are correctly enabled Fully backward compatible - when base_model is unset, behavior is identical. Existing o_series/ and gpt5_series/ prefix workarounds continue to work. Usage in proxy config: model_list: - model_name: my-gpt5 litellm_params: model: azure/my-deployment-id model_info: base_model: azure/gpt-5.2 Fixes: non-standard deployment names like 'prefix-gpt-5.2' rejecting logprobs/top_logprobs despite the underlying model supporting them. * Addressing Greptile comments. * gemini-3.1-flash-lite pricing (BerriAI#27933) * feat(model_prices): add gemini-3.1-flash-lite pricing with standard/batch/flex/priority tiers * fix pricing * add service tier --------- Co-authored-by: shin-berri <[email protected]> * fix(openai-responses): strip Anthropic cache_control from Responses API requests (BerriAI#28431) Squash-merged by litellm-agent from cwang-otto's PR. * Treat None litellm_provider as wildcard in _check_provider_match (BerriAI#28523) Squash-merged by litellm-agent from adityasingh2400's PR. * fix greptile * fix: use _azure_detection_model in default Azure branch of get_supported_openai_params Co-authored-by: Yassin Kortam <[email protected]> * fix(openai-responses): strip cache_control on compact endpoint as well Co-authored-by: Yassin Kortam <[email protected]> --------- Co-authored-by: Felipe Garé <[email protected]> Co-authored-by: shin-berri <[email protected]> Co-authored-by: yuneng-jiang <[email protected]> Co-authored-by: withomasmicrosoft <[email protected]> Co-authored-by: mubashir1osmani <[email protected]> Co-authored-by: cwang-otto <[email protected]> Co-authored-by: Aditya Singh <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Yassin Kortam <[email protected]>
Relevant issues
[Feature]: Azure OpenAI decouple deployment ID from model name via base_model #28482
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer review.Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🆕 New Feature
Changes
feat(azure): decouple deployment ID from model name via base_model