litellm/tests/proxy_unit_tests
Krrish Dholakia f42ffed2bd
Litellm oss staging 04 02 2026 p1 (#25055)
* fix(vertex_ai): support pluggable (executable) credential_source for WIF auth (#24700)

The WIF credential dispatch in load_auth() only handled identity_pool and
aws credential types. When credential_source.executable was present (used
for Azure Managed Identity via Workload Identity Federation), it fell
through to identity_pool.Credentials which rejected it with MalformedError.

Add dispatch to google.auth.pluggable.Credentials for executable-type
credential sources, following the same pattern as the existing identity_pool
and aws helpers.

Fixes authentication for Azure Container Apps → GCP Vertex AI via WIF
with executable credential sources.

* feat(logging): add component and logger fields to JSON logs for 3rd p… (#24447)

* feat(logging): add component and logger fields to JSON logs for 3rd party filtering

* Let user-supplied extra fields win over auto-generated component/logger, tighten test assertions

* Feat - Add organization into the metrics metadata for org_id & org_alias (#24440)

* Add org_id and org_alias label names to Prometheus metric definitions

* Add user_api_key_org_alias to StandardLoggingUserAPIKeyMetadata

* Populate user_api_key_org_alias in pre-call metadata

* Pass org_id and org_alias into per-request Prometheus metric labels

* Add test for org labels on per-request Prometheus metrics

* chore: resolve test mockdata

* Address review: populate org_alias from DB view, add feature flag, use .get() for org metadata

* Add org labels to failure path and verify flag behavior in test

* Fix test: build flag-off enum_values without org fields

* Gate org labels behind feature flag in get_labels() instead of static metric lists

* Scope org label injection to metrics that carry team context, remove orphaned budget label defs, add test teardown

* Use explicit metric allowlist for org label injection instead of team heuristic

* Fix duplicate org label guard, move _org_label_metrics to class constant

* Reset custom_prometheus_metadata_labels after duplicate label assertion

* fix: emit org labels by default, remove flag, fix missing org_alias in all metadata paths

* fix: emit org labels by default, no opt-in flag required

* fix: write org_alias to metadata unconditionally in proxy_server.py

* fix: 429s from batch creation being converted to 500 (#24703)

* add us gov models (#24660)

* add us gov models

* added max tokens

* Litellm dev 04 02 2026 p1 (#25052)

* fix: replace hardcoded url

* fix: Anthropic web search cost not tracked for Chat Completions

The ModelResponse branch in response_object_includes_web_search_call()
only checked url_citation annotations and prompt_tokens_details, missing
Anthropic's server_tool_use.web_search_requests field. This caused
_handle_web_search_cost() to never fire for Anthropic Claude models.

Also routes vertex_ai/claude-* models to the Anthropic cost calculator
instead of the Gemini one, since Claude on Vertex uses the same
server_tool_use billing structure as the direct Anthropic API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(anthropic): pass logging_obj to client.post for litellm_overhead_time_ms (#24071)

When LITELLM_DETAILED_TIMING=true, litellm_overhead_time_ms was null for
Anthropic because the handler did not pass logging_obj to client.post(),
so track_llm_api_timing could not set llm_api_duration_ms. Pass
logging_obj=logging_obj at all four post() call sites (make_call,
make_sync_call, acompletion, completion). Add test to ensure make_call
passes logging_obj to client.post.

Made-with: Cursor

* sap - add additional parameters for grounding

- additional parameter for grounding added for the sap provider

* sap - fix models

* (sap) add filtering, masking, translation SAP GEN AI Hub modules

* (sap) add tests and docs for new SAP modules

* (sap) add support of multiple modules config

* (sap) code refactoring

* (sap) rename file

* test(): add safeguard tests

* (sap) update tests

* (sap) update docs, solve merge conflict in transformation.py

* (sap) linter fix

* (sap) Align embedding request transformation with current API

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) mock commit

* (sap) run black formater

* (sap) add literals to models, add negative tests, fix test for tool transformation

* (sap) fix formating

* (sap) fix models

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) commit for rerun bot review

* (sap) minor improve

* (sap) fix after bot review

* (sap) lint fix

* docs(sap): update documentation

* fix(sap): change creds priority

* fix(sap): change creds priority

* fix(sap): fix sap creds unit test

* fix(sap): linter fix

* fix(sap): linter fix

* linter fix

* (sap) update logic of fetching creds, add additional tests

* (sap) clean up code

* (sap) fix after review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) add a possibility to put the service key by both variants

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) update test

* (sap) update service key resolve function

* (sap) run black formater

* (sap) fix validate credentials, add negative tests for credential fetching

* (sap) fix validate credentials, add negative tests for credential fetching

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) lint fix

* (sap) lint fix

* feat: support service_tier in gemini

* chore: add a service_tier field mapping from openai to gemini

* fix: use x-gemini-service-tier header in response

* docs: add service_tier to gemini docs

* chore: add defaut/standard mapping, and some tests

* chore: tidying up some case insensitivity

* chore: remove unnecessary guard

* fix: remove redundant test file

* fix: handle 'auto' case-insensitively

* fix: return service_tier on final steamed chunk

* chore: black

* feat: enable supports_service_tier to gemini models

* Fix get_standard_logging_metadata tests

* Fix test_get_model_info_bedrock_models

* Fix test_get_model_info_bedrock_models

* Fix remaining tests

* Fix mypy issues

* Fix tests

* Fix merge conflicts

* Fix code qa

* Fix code qa

* Fix code qa

* Fix greptile review

---------

Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
Co-authored-by: Josh <36064836+J-Byron@users.noreply.github.com>
Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: milan-berri <milan@berri.ai>
Co-authored-by: Alperen Kömürcü <alperen.koemuercue@sap.com>
Co-authored-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com>
Co-authored-by: Lin Xu <lin.xu03@sap.com>
Co-authored-by: Mark McDonald <macd@google.com>
Co-authored-by: Sameer Kankute <sameer@berri.ai>
2026-04-08 21:37:10 -07:00
..
example_config_yaml test: test 2026-03-28 19:17:38 -07:00
test_configs test: test 2026-03-28 19:17:38 -07:00
test_model_response_typing fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
azure_fine_tune.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
batch_job_results_furniture.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
conftest copy.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
conftest.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
data_map.txt fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
eagle.wav fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
gettysburg.wav fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
large_text.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
messages_with_counts.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
model_cost.json fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
openai_batch_completions.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
openai_batch_completions_router.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
speech_vertex.mp3 fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_aproxy_startup.py (Security fix) - Upgrade to fastapi==0.115.5 (#7447) 2024-12-28 17:08:19 -08:00
test_audit_logs_proxy.py fix(tests): skip prisma DB test and sync root schema.prisma with spec_path field 2026-02-20 12:29:53 -03:00
test_auth_checks.py Fix: Anthropic model wildcard access issue 2026-02-23 17:12:55 +05:30
test_banned_keyword_list.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_blog_posts_endpoint.py fix: log fallback warning in blog posts endpoint and tighten test 2026-02-21 17:34:08 -08:00
test_check_batch_cost.py Fix flaky e2e batch test: set batch_processed=True on completion in retrieve_batch 2026-03-15 18:18:32 -07:00
test_check_responses_cost.py fix(test): update check_responses_cost tests for _expire_stale_rows 2026-04-07 10:09:11 -07:00
test_custom_callback_input.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_custom_logger_s3_gcs.py [Feat] Allow reading custom logger python scripts from s3 (#12623) 2025-07-16 15:07:01 -07:00
test_custom_tokenizer_bug.py [Release Fix] (#22411) 2026-02-28 09:46:35 -08:00
test_db_schema_changes.py test: initial test to enforce all functions in user_api_key_auth.py h… (#7797) 2025-01-15 21:52:45 -08:00
test_db_schema_migration.py [Release Fix] (#22411) 2026-02-28 09:46:35 -08:00
test_default_end_user_budget_simple.py [AI Gateway] - End User Budgets - Allow pointing max_end_user budget to an id, so the default ID applies to all end users (#16456) 2025-11-11 08:20:13 -08:00
test_deployed_proxy_keygen.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_e2e_pod_lock_manager.py fix(tests): skip more CI tests requiring external DB/Redis connections 2026-02-20 11:49:38 -03:00
test_get_favicon.py feat(proxy): add custom favicon support\n\nAdd ability to configure a custom favicon for the litellm proxy UI.\n\n- Add favicon_url field to UIThemeConfig model\n- Add LITELLM_FAVICON_URL env var support\n- Add /get_favicon endpoint to serve custom favicons\n- Update ThemeContext to dynamically set favicon\n- Add favicon URL input to UI theme settings page\n- Add comprehensive tests\n\nCloses #8323 (#21653) 2026-02-21 00:46:51 -08:00
test_get_image.py fix: optimize logo fetching and resolve mcp import blockers (#19719) 2026-01-25 23:08:16 -08:00
test_google_endpoint_routing.py Support model names with slashes on Gemini endpoints (#17743) 2025-12-09 18:40:51 -08:00
test_google_gemini_proxy_request.py Revert "QA: improve gpt-5.4 code/bugs" 2026-03-13 10:15:47 -07:00
test_jwt.py test(auth): add regression tests for JWTHandler.is_jwt(None) 2026-03-27 16:51:08 -07:00
test_jwt_key_mapping.py fix: fix ci/cd + handle oidc jwt tokens 2026-03-30 16:12:58 -07:00
test_key_generate_dynamodb.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_key_generate_prisma.py [Fix] /key/aliases: Add pagination and search to prevent OOMs 2026-02-25 17:55:26 -08:00
test_models_fallback_endpoint.py feat: extended /v1/models endpoint, now it returns with fallbacks on demand (#12811) 2025-07-22 23:16:46 -07:00
test_prisma_client_backoff_retry.py fix(tests): mock prisma.Prisma in backoff retry tests to avoid 'prisma generate' 2026-02-17 19:29:20 -03:00
test_project_endpoints_prisma.py [Fix] Include created_at and updated_at in /project/list response 2026-02-27 15:41:03 -08:00
test_prompt_test_endpoint.py [Feat] UI - Prompt Management - Allow testing prompts with Chat UI (#16898) 2025-11-21 08:53:18 -08:00
test_proxy_config_unit_test.py fix: enable JSON logging via configuration and add regression test 2026-01-13 09:38:19 -07:00
test_proxy_custom_auth.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_custom_logger.py fix test_chat_completion 2026-02-17 20:26:28 +05:30
test_proxy_encrypt_decrypt.py test: fix test 2025-07-27 09:52:22 -07:00
test_proxy_exception_mapping.py [Perf] Embeddings: Use router's O(1) lookup and shared sessions (#16344) 2025-11-14 09:21:45 -08:00
test_proxy_gunicorn.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_pass_user_config.py test: test 2026-03-28 19:17:38 -07:00
test_proxy_reject_logging.py [Security Bug Fix] Ensure only LLM API route fails get logged on Langfuse (and other loggers) (#12308) 2025-07-04 14:42:42 -07:00
test_proxy_routes.py tests and route permissions (#21508) 2026-02-18 16:58:38 -08:00
test_proxy_server.py Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
test_proxy_server_caching.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_server_keys.py fix tests 2025-10-25 10:19:24 -07:00
test_proxy_server_langfuse.py (Security fix) - Upgrade to fastapi==0.115.5 (#7447) 2024-12-28 17:08:19 -08:00
test_proxy_server_spend.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_setting_guardrails.py fix(lakera-guardrail): use os.environ.get() to avoid KeyError on missing LAKERA_API_KEY 2026-02-17 19:30:22 -03:00
test_proxy_token_counter.py fix(tests): use unconditional skip for vertex/gemini token counting test 2026-02-20 11:36:54 -03:00
test_proxy_utils.py Litellm oss staging 04 02 2026 p1 (#25055) 2026-04-08 21:37:10 -07:00
test_realtime_cache.py [Perf] Fix bottlenecks degrading realtime endpoint performance (#16670) 2025-11-22 10:01:02 -08:00
test_response_polling_handler.py Add incomplete response error propagation test 2026-03-17 11:39:12 -07:00
test_response_polling_pre_call_checks.py fix(test): rewrite polling pre-call guard test to call responses_api() directly 2026-03-19 14:30:29 +05:30
test_search_api_logging.py fix(tests): skip test_search_api_logging_and_cost_tracking - requires Prisma DB 2026-02-20 13:19:01 -03:00
test_server_root_path.py fix: server rooth path (#19790) 2026-01-26 09:48:06 -08:00
test_skills_db.py fix(tests): skip CI tests requiring external services (DB, API keys) 2026-02-20 11:28:42 -03:00
test_ui_path_detection.py fix: Add LITELLM_UI_PATH and LITELLM_ASSETS_PATH for read-only filesystem support (#20492) 2026-02-12 19:39:04 +05:30
test_unit_test_max_model_budget_limiter.py fix: custom auth budget issue 2026-02-26 13:03:01 +05:30
test_unit_test_proxy_hooks.py [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
test_update_daily_tag_spend.py cherry-pick: tag query fix + MCP metadata support (#25145) 2026-04-04 16:44:02 -07:00
test_update_spend.py [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
test_user_api_key_auth.py CircleCI test stability (#23055) 2026-03-07 15:19:39 -08:00
test_zero_cost_model_budget_bypass.py Add support for 0 cost models 2026-02-02 13:29:37 +05:30
vertex_key.json test: update to new vertex ai keys 2026-03-28 20:19:05 -07:00