litellm/tests/test_litellm
Mateo Wang b60d4677cd
fix(vertex_gemma): strip context_management from request body (#28438)
Vertex AI Gemma's chatCompletions wrapper does not understand the
context_management parameter (an Anthropic / OpenAI Responses API
concept). When callers route this field to a Gemma deployment (e.g.
through allowed_openai_params or proxy passthrough), the upstream
endpoint would reject the request with an unknown-field error.

Drop context_management in VertexGemmaConfig.transform_request,
matching the existing pattern used for stream and stream_options.

Adds a direct transform_request unit test plus an acompletion-level
test that exercises the realistic allowed_openai_params path.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
2026-05-21 23:10:33 +05:30
..
a2a_protocol
anthropic_interface/exceptions
caching fix(caching): replay openai/responses bridge cache hits as chat streams (#28158) 2026-05-18 16:27:06 -07:00
completion_extras Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
containers fix(router): use forwarded model_id for native Azure container IDs (#27921) 2026-05-20 12:32:34 -07:00
enterprise fix(proxy): normalize batch file IDs before ManagedObjectTable write (#28339) 2026-05-20 12:13:56 -07:00
expected_fine_tuning_api
expected_responses_api_request
experimental_mcp_client
google_genai fix(gemini): normalize response_schema on native generateContent (#27775) 2026-05-12 23:26:34 -07:00
images
integrations Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
interactions fix(interactions): never drop streamed text deltas; always emit terminal completion (#28394) 2026-05-20 16:41:40 -07:00
litellm_core_utils fix(tests): replace shut-down gpt-4o-audio-preview with gpt-audio-1.5 (#28281) 2026-05-19 14:48:30 -07:00
llms fix(vertex_gemma): strip context_management from request body (#28438) 2026-05-21 23:10:33 +05:30
ocr chore: reject bare str at file-input sinks to prevent local-file read (#27762) 2026-05-12 16:40:07 -07:00
passthrough refactor: trim explanatory comments from streaming-flush fix 2026-04-30 02:39:28 +00:00
proxy fix: end user logs (#27758) (#28290) 2026-05-20 23:37:19 -07:00
responses Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
router_strategy feat: selectively apply routing strategy according to model name 2026-05-04 13:27:32 -07:00
router_utils Gemini managed agents support (#28270) 2026-05-19 16:02:03 -07:00
secret_managers Implement normalize_nonempty_secret_str function to trim whitespace from secrets and treat empty values as unset. Update proxy_server to use this function for Grafana credentials. Enhance tests to validate the new normalization behavior. 2026-05-04 18:17:31 +00:00
test_router
types
vector_stores
__init__.py
conftest.py
log.txt
readme.md
test_a2a_registry_lookup.py
test_acompletion_session_reuse_e2e.py
test_add_deployment_no_master_key.py
test_aembedding_session_reuse_e2e.py
test_anthropic_beta_headers_filtering.py
test_anthropic_skills_transformation.py fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
test_azure_video_router.py
test_bedrock_anthropic_1hr_cache_pricing.py fix(bedrock): add 1-hour cache write tier for Claude 4.5/4.6/4.7 (Global, US) 2026-04-29 19:21:57 +00:00
test_chat_ui_responses_session.py
test_claude_haiku_4_5_config.py
test_claude_opus_4_6_config.py
test_claude_sonnet_4_6_config.py fix(bedrock-mantle): use /anthropic/v1/messages path for Mantle endpo… (#27976) 2026-05-15 13:31:59 -07:00
test_completion_timeout_resolution.py
test_compression.py
test_constants.py
test_container_router.py
test_cost_calculation_log_level.py
test_cost_calculator.py Litellm oss staging 1 (#28337) 2026-05-20 17:27:03 -07:00
test_count_tokens_public_api.py
test_dashscope_image_generation.py
test_deepseek_model_metadata.py Revert "Merge pull request #16590 from Chesars/refactor/remove-backup-file-dry-principle" 2026-04-25 17:10:41 -03:00
test_dockerfile_non_root.py
test_eager_tiktoken_load.py
test_exception_exports.py
test_exception_header_preservation.py
test_exception_mapping_request_attribute.py
test_filter_out_litellm_params.py
test_get_blog_posts.py
test_gpt_image_cost_calculator.py Add gpt-image-2 support (#26644) (#26705) 2026-04-28 20:10:42 -07:00
test_groq_streaming_encoding.py
test_guardrail_exception_status_codes.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
test_lazy_imports.py
test_litellm_params_reserved_keys.py
test_logging.py
test_lowest_latency_zero_tokens.py
test_main_module_header.py Add main module header comment 2026-05-06 00:26:17 +00:00
test_main.py Match litellm.completion supported model parameters with proxy model info (#27720) 2026-05-12 08:25:01 -07:00
test_model_cost_aliases.py
test_model_param_helper.py
test_model_response_normalization.py
test_nested_drop_params.py
test_openai_embedding_encoding_format_default.py fix(embeddings): allow omitting encoding_format via env sentinel none 2026-05-01 23:03:13 +05:30
test_project_alias_tracking.py
test_project_tags_pydantic.py
test_redact_string_in_error_paths.py
test_redis.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
test_register_model_custom_pricing.py
test_responses_api_bridge_non_stream.py
test_responses_id_security.py
test_retrieve_batch_bedrock_dispatch.py feat(batch-job): bedrock batch model invocation job retrieval (#26834) 2026-05-11 13:22:26 -07:00
test_router_google_genai.py
test_router_model_cost_isolation.py Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
test_router_order_fallback.py
test_router_per_deployment_num_retries.py
test_router_redis_init.py
test_router_retry_non_retryable_errors.py
test_router_silent_experiment.py
test_router_weighted_failover.py feat: add weighted-routing failover (#27980) 2026-05-15 17:28:54 +00:00
test_router.py Litellm oss staging 1 (#28337) 2026-05-20 17:27:03 -07:00
test_secret_redaction.py Unify secret redaction patterns 2026-05-01 17:24:21 +00:00
test_service_logger.py
test_setup_wizard.py
test_shared_session_integration.py
test_ssl_verify_unit.py
test_stream_chunk_builder_annotations.py
test_streaming_connection_cleanup.py
test_system_message_format_bug.py
test_utils_module_docstring.py Add utils module docstring 2026-05-06 00:42:49 +00:00
test_utils.py Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
test_uuid_helper.py
test_vcr_safe_body_matcher.py test: add 24hr Redis-backed VCR cache to additional test suites (#27159) 2026-05-05 15:13:31 -07:00
test_video_generation.py
test_xai_grok_4_3_model_metadata.py feat(xai): add grok-4.3 and grok-4.3-latest to model_prices_and_conte… (#27154) 2026-05-07 09:06:56 -07:00
test_xai_responses_auto_routing.py

Testing for litellm/

This directory 1:1 maps the the litellm/ directory, and can only contain mocked tests.

The point of this is to:

  1. Increase test coverage of litellm/
  2. Make it easy for contributors to add tests for the litellm/ package and easily run tests without needing LLM API keys.

File name conventions

  • litellm/proxy/test_caching_routes.py maps to litellm/proxy/caching_routes.py
  • test_<filename>.py maps to litellm/<filename>.py