litellm/tests/unit/llms/azure_ai
Jc X 748b06dcf3
fix(proxy): size budget reservation from route output cap fields (#51752)
* fix(proxy): size budget reservation from route output cap fields

* fix(proxy): respect provider max_output_tokens on chat completions

* fix(proxy): include chat cap fields for bridged responses reservations

* fix(proxy): match deployment provider precedence for responses reservations

* fix(proxy): preserve explicit null bridge overrides in responses budget reservation

* fix(proxy): resolve budget hold providers without login and pin inferenceConfig scope

Adds a regression test that inferenceConfig.maxTokens leaves the hold unchanged on /v1/chat/completions, /v1/messages, and /v1/responses while it still bounds the hold on Bedrock converse routes

Provider lookups for the hold now use the metadata resolver, so a github_copilot or chatgpt deployment never starts a device login at auth time

Removes the unused default path for the output field mode and the branches that the route and provider lookups already cover, and adds tests for an Infinity cap and a priced model the provider resolver rejects

* fix(proxy): count every output cap in budget holds and include configured max_tokens

The hold now takes the largest valid cap across every cap field the request
sets, fills missing caps from router defaults and each deployment's
litellm_params, and keeps the default fallback unless the route's own cap
field is present. This drops the per-provider lookups.

* fix(proxy): only let request caps lower budget holds

Configured caps in default_litellm_params or a deployment's litellm_params
are no longer read for the hold. A configured cap the provider drops could
shrink the hold, and reading them made each estimate about 2.5x slower

* fix(proxy): keep the uncapped hold when a deployment drops max_completion_tokens

A chat call that sends only max_completion_tokens now lowers the hold only when every deployment in the group lists it in supported_openai_params. Providers like Replicate and watsonx drop it under drop_params and generate uncapped, so their groups keep the 16384-token default. The deployment model info is read once per estimate and shared with the tiered pricing lookup

* fix(proxy): trust a budget hold cap only when every deployment receives it

A cap field lowers the in-flight hold only when every deployment in the group forwards it to the provider, read from supported_openai_params or the provider's native cap name. Routes outside the call-type map (Cursor, the Claude Code gateway, Interactions) read only the cap of the shape they forward, and a responses max_output_tokens below 16 holds the forwarded minimum

* fix(proxy): ignore budget hold caps named in additional_drop_params

* fix(proxy): read the drop list the router sends when sizing budget holds

* fix(proxy): keep the uncapped budget hold when a provider rejects the cap probe

A ScaleDown chat call that carried max_output_tokens, maxTokens, or inferenceConfig.maxTokens failed auth with a 401, since the hold's per-provider cap lookup raised a provider config error it did not catch. The lookup now reads that error as a cap the provider does not receive

* fix(proxy): multiply the budget hold by a configured n or best_of

A deployment or router default that sets n or best_of returns that many choices per call, so the hold now reserves for them when the request sets neither

* fix(budgets): hold the default output cap on generateContent routes

---------

Co-authored-by: xinglan163 <250816997+xinglan163@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-20 16:25:09 -08:00
..
agents refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
anthropic feat(messages): serve azure ai foundry messages on rust only (#51721) 2026-11-14 13:40:38 -08:00
chat fix(azure_ai): use the v1 chat path for Azure OpenAI resource bases (#52759) 2026-11-19 20:12:55 -08:00
claude fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -08:00
embed fix(azure_ai): use the v1 chat path for Azure OpenAI resource bases (#52759) 2026-11-19 20:12:55 -08:00
image_edit feat(azure_ai): support gpt-image edits on Azure AI Foundry (#49650) 2026-11-12 00:52:55 +00:00
image_generation refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
passthrough fix(cohere): price native Cohere embed calls on Foundry relays and the Cohere passthrough (#48978) 2026-10-29 05:17:11 -07:00
rerank chore(cost-map): remove the 52 rows whose provider retired them before 2026 (#49974) 2026-11-03 16:23:06 -08:00
responses fix(proxy): size budget reservation from route output cap fields (#51752) 2026-11-20 16:25:09 -08:00
vector_stores refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
__init__.py test(unit): add package markers to migrated unit test directories 2026-09-20 11:53:14 +00:00
test_azure_ai_agents_handler.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_azure_ai_cost_calculator.py fix(azure_ai)!: call Responses natively for a model router on a Foundry project or resource base (#52474) 2026-11-18 16:36:46 +00:00
test_azure_ai_entra_auth.py fix(azure)!: answer 401 when Entra rejects the deployment's credential (#49863) 2026-11-04 20:44:55 +00:00
test_azure_ai_foundry_catalog_model_metadata.py feat(cost-map): rolling registry update (claude-mythos-5-2, Azure Mythos 5.2, Friendli GLM-5.1 date, GovCloud Fable 5.2 token counting) (#50777) 2026-11-10 13:31:56 +00:00
test_azure_ai_fw_models_metadata.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_azure_ai_kimi_k26_metadata.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00