litellm/tests/test_litellm/proxy
Emil Svensson 61e737e361
fix Azure AI Anthropic api-key header and passthrough cost calculation (#17656)
* refactor: remove api-key conversion logic for Azure Anthropic

Co-authored-by: Erdem Halil <erdemhalil@users.noreply.github.com>

* fix(passthrough): pass custom_llm_provider to completion_cost for Azure AI Anthropic

The passthrough logging for Anthropic was failing when using Azure AI Anthropic
because the completion_cost function was not receiving the custom_llm_provider
parameter, causing it to fail with "LLM Provider NOT provided" error.

This fix:
- Retrieves custom_llm_provider from logging_obj.model_call_details
- Prepends provider prefix to model name for cost calculation
- Passes both formatted model and custom_llm_provider to completion_cost
- Centralizes provider prefix logic in _create_anthropic_response_logging_payload

This ensures cost calculation works correctly for Azure AI Anthropic requests
with models like azure_ai/claude-sonnet-4-5_gb_20250929.

Co-authored-by: Erdem Halil <erdemhalil@users.noreply.github.com>

* test: add unit tests for Azure AI Anthropic fixes

- Add tests for custom_llm_provider cost calculation in passthrough logging
- Add tests for ProviderConfigManager returning AzureAnthropicMessagesConfig
- Update existing tests to reflect removal of api-key to x-api-key conversion

Co-authored-by: Erdem Halil <erdemhalil@users.noreply.github.com>

---------

Co-authored-by: Erdem Halil <erdemhalil@users.noreply.github.com>
2025-12-08 18:50:26 -08:00
..
_experimental/mcp_server fix: mcp test 2025-12-06 10:54:22 +09:00
agent_endpoints [Feat] Agent Access Control - Enforce Allowed agents by key, team + add agent access groups on backend (#17502) 2025-12-04 16:31:00 -08:00
anthropic_endpoints test fixes 2025-06-25 18:42:06 -07:00
auth [Fix] AI Gateway Auth - allow using wildcard patterns for public routes (#17686) 2025-12-08 17:39:53 -08:00
client [Feat] AI Gateway Auth - Allow using JWTs for signing in with Proxy CLI (#16756) 2025-11-17 19:47:29 -08:00
common_utils Working setting generic callbacks on UI 2025-12-05 14:37:48 -08:00
db Adding tests 2025-12-04 12:36:15 -08:00
discovery_endpoints Change is_sso_configured to auto_redirect_to_sso 2025-12-03 15:48:50 -08:00
experimental/mcp_server Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
google_endpoints test google endpoints 2025-10-31 20:50:31 -07:00
guardrails add onyx guardrail hooks integration (#16591) 2025-12-07 23:33:28 -08:00
health_endpoints Add Langfuse OTEL and SQS to health check (#16514) 2025-11-12 18:25:30 -08:00
hooks [Feat] Dynamic Rate Limiter - allow specifying ttl for in memory cache (#17679) 2025-12-08 17:20:52 -08:00
image_endpoints test fix 2025-10-17 10:46:42 -07:00
management_endpoints Merge remote-tracking branch 'origin' into litellm_scim_v2_fix 2025-12-06 20:01:05 -08:00
management_helpers [MCP Gateway] Litellm mcp fixes team control (#15304) 2025-10-07 16:48:00 -07:00
middleware Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
openai_files_endpoint fix issue from pr review 2025-10-01 11:57:10 +08:00
pass_through_endpoints fix Azure AI Anthropic api-key header and passthrough cost calculation (#17656) 2025-12-08 18:50:26 -08:00
prompts TestPromptVersionsEndpoint 2025-11-21 16:21:13 -08:00
public_endpoints Merge remote-tracking branch 'origin' into litellm_add_model_fix_team_admin 2025-11-27 17:32:09 -08:00
response_api_endpoints Add support for cursor BYOK with its own configuration 2025-12-05 09:34:49 +05:30
spend_tracking fix(sql): Optimize SpendLogs queries to use timestamp filtering for index usage (#17504) 2025-12-04 21:52:57 -08:00
test_configs Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
ui_crud_endpoints [Infra] Litellm Backend SSO Changes (#16029) 2025-10-30 14:32:08 -07:00
vector_store_endpoints Fix vector store configuration synchronization failure 2025-12-05 11:46:14 +05:30
__init__.py test fix 2025-10-17 10:46:42 -07:00
test_batch_metadata_none_fix.py Fix issue #13995: Handle None metadata in batch requests (#13996) 2025-08-27 14:51:09 -07:00
test_caching_routes.py [Bug Fix] Ensure /redis/info works on GCP Redis (#11732) 2025-06-14 15:35:09 -07:00
test_common_request_processing.py Revert "fix: respect guardrail mock_response during during_call to return blo…" (#17332) 2025-12-01 15:40:28 -08:00
test_custom_proxy.py fix(ui/): fix routing for custom server root path (#15701) 2025-10-23 13:59:29 -07:00
test_enforce_user_param.py Enforce support of enforce_user_param to openai post endpoints 2025-12-03 12:19:21 +05:30
test_fastapi_offline_routes.py [Bug Fix] - Get Routes (#13466) 2025-08-09 12:52:23 -07:00
test_health_check_functions.py Add background health checks to db 2025-12-05 14:27:37 +05:30
test_litellm_pre_call_utils.py Fix key model alias (#16896) 2025-11-20 16:05:49 -08:00
test_model_id_header_propagation.py (fix) propagate x-litellm-model-id in responses (#16986) 2025-11-24 20:40:43 -08:00
test_proxy_cli.py feature/add max requests env var 2025-09-28 19:18:56 +01:00
test_proxy_server.py Merge pull request #17180 from BerriAI/litellm_non_root_docker_logo_fix 2025-12-06 22:22:27 -08:00
test_proxy_types.py Litellm dev 06 06 2025 p1 (#11496) 2025-06-07 09:12:16 -07:00
test_proxy_utils.py fix(ui/): fix routing for custom server root path (#15701) 2025-10-23 13:59:29 -07:00
test_route_llm_request.py Fix create, search vector store error (#13285) 2025-08-06 11:15:17 -07:00
test_shared_health_check.py Add shared healthcheck 2025-10-09 22:18:05 +05:30
test_spend_log_cleanup.py Fix/gemini api key environment variable support (#12507) 2025-07-29 15:56:01 -07:00
test_swagger_chat_completions.py [Bug Fix] Allow using Swagger for /chat/completions (#13469) 2025-08-09 15:35:45 -07:00
test_team_member_update.py fix mapped tests (#12320) 2025-07-04 10:04:43 -07:00