litellm/tests/unit/router_utils
devin-ai-integration[bot] 2908e228f0
fix(anthropic)!: map reasoning effort none to supported thinking modes (#55848)
* fix(anthropic): reject disabling always-on thinking unless params are dropped

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(anthropic): preserve dictionary callers in messages mapping

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(anthropic): use between-tools thinking when supported

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(anthropic): preserve between-tools thinking on tool follow-ups

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(anthropic): avoid duplicate untyped capability reads

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(cost-map): register between-tools thinking capability schema

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(s3-log): record supports_between_tools_thinking in the s3_v2 golden payloads

* fix(anthropic): keep thinking off on tool turns and treat unmapped Opus and Sonnet 5.5 ids as always thinking

With modify_params on, a tool follow-up that sent thinking disabled dropped
the param, so Haiku 5.5 thought again and billed those tokens. The replay
guard now treats disabled like between_tools.

Cost-map fallback rules mark unmapped Opus and Sonnet ids from 5.5 on as
always thinking, and Sonnet ones as supporting between_tools, so they no
longer get disabled, which those models reject. Copilot and Mantle Sonnet 5.5
rows opt out of between_tools explicitly, since it is not verified there.

The proxy no longer advertises none for always-thinking models that refuse
it, the auto-router baseline honors per-request drop_params, and the Python
refusal text now matches the Rust one.

* fix(anthropic): treat explicit disabled thinking like reasoning_effort none

An explicit thinking.type=disabled on a model that always thinks used to be
dropped silently, so the model kept thinking and billed it. It now follows the
same rule as reasoning_effort none: between_tools where the model supports it,
otherwise a 400 unless drop_params is set, on chat, /v1/messages and Bedrock.

The model listing only stops offering none on routes where LiteLLM maps it to
Anthropic's thinking param, so gateways that forward the level keep it.

Databricks Sonnet 5.5 accepts images, so its cost map row sets supports_vision.

* fix(anthropic): keep leaving out disabled thinking where between_tools is missing

Opus 5.5, Fable and Mythos go back to the #37510 behavior for
thinking={"type": "disabled"}. LiteLLM leaves it out with a warning and the
request answers 200, so routers that send one request to several model
generations keep working. Sonnet 5.5 still gets between_tools.

The Rust /v1/messages path maps disabled thinking the same way, and Databricks
Claude chat now maps it too instead of forwarding a value Databricks rejects.

* fix(anthropic): send between_tools to Copilot and Mantle Sonnet 5.5 and keep none in Copilot listings

---------

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-12-02 23:33:35 +00:00
..
pre_call_checks fix(router): let latency-routed sessions leave exhausted deployments (#54998) 2026-11-30 15:20:25 -08:00
__init__.py
test_access_windows.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_add_retry_fallback_headers.py fix(responses): accept a string or tuple allowed_openai_params on Responses models instead of answering 500 (#51751) 2026-11-14 04:32:38 -05:00
test_client_initalization_utils.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_cooldown_cache.py feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
test_cooldown_handlers.py fix(ocr): report an unreachable document URL as a 400, not a provider 500 (#54215) 2026-11-26 07:56:58 +00:00
test_deployment_pricing.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_dynamic_queue.py feat(router): add bounded congestion queue controller (#51883) 2026-11-17 17:15:24 -08:00
test_dynamic_queue_redis.py feat(router): coordinate congestion queues through Redis (#52367) 2026-11-17 19:29:39 -08:00
test_dynamic_queue_router.py fix(router): preserve destination bearer credentials on Anthropic fallbacks (#54271) 2026-11-24 17:12:02 -08:00
test_embedding_batch_size_check.py feat(embeddings): enforce per-request input batch limit (#44574) 2026-10-20 11:35:18 +00:00
test_endpoint_eligibility.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_fallback_event_handlers.py test: stop proxy_server reloads from breaking the realtime and live session tests (#55317) 2026-12-01 01:53:28 +00:00
test_fallback_event_v2_dispatch.py feat(custom-logger-v2): add types, dispatcher and route callback call sites (step 0) (#51214) 2026-11-13 22:08:05 +00:00
test_get_retry_from_policy.py fix(ocr): report an unreachable document URL as a 400, not a provider 500 (#54215) 2026-11-26 07:56:58 +00:00
test_handle_error.py test: stop proxy_server reloads from breaking the realtime and live session tests (#55317) 2026-12-01 01:53:28 +00:00
test_health_check_allowed_fails_integration.py feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
test_health_state_cache.py refactor(rust): rename the compiled module _native to _rust (#55198) 2026-12-01 07:08:38 -08:00
test_kubernetes_pod_discovery.py refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09:00
test_pattern_match_deployments.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
test_prompt_caching_cache.py fix(logging): log Anthropic base64 sources on /v1/messages and pass-through routes as a size placeholder (#54161) 2026-11-24 12:13:09 -08:00
test_ptu_shares.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_reasoning_effort_capability.py fix(anthropic)!: map reasoning effort none to supported thinking modes (#55848) 2026-12-02 23:33:35 +00:00
test_request_priority.py fix(openai): relay provider error codes, types, and Responses params from OpenAI-compatible backends (#51809) 2026-11-24 02:23:00 +00:00
test_router_health_check_routing.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_router_interactions_endpoints.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_router_utils_common_utils.py fix(responses): accept a string or tuple allowed_openai_params on Responses models instead of answering 500 (#51751) 2026-11-14 04:32:38 -05:00
test_routing_read_batch.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00