Commit graph

5266 commits

Author SHA1 Message Date
Alexsander Hamir
dadadf777d add 1 million request memory leak tests for extreme scale validation
- Add test_memory_baseline_1m for router (1,000,000 requests)
- Add test_proxy_memory_baseline_1m for proxy (1,000,000 requests)
- Add clarifying comment: high-volume tests verify memory limit strictness
- These extreme scale tests help detect very gradual leaks (~1-2 KB per 1000 requests)
- Estimated runtime: router ~15-20 min, proxy ~50-60 min
- For manual execution only, not included in CI
- Run with: pytest tests/load_tests/test_*_memory_growth.py::test_*_1m -v
2026-01-10 17:43:53 -08:00
Alexsander Hamir
d0444c7287 reduce memory limits to 45 MB for more accurate CI testing
- Router: 60 MB -> 45 MB
- Proxy: 170 MB -> 45 MB
- CI environment provides cleaner memory measurements without:
  - IDE/debugger overhead holding references
  - Development tool memory fragmentation
  - Local process competition
- 45 MB limit reflects true router/proxy memory usage
- Stricter CI limits help catch real memory leaks more reliably
2026-01-10 17:36:30 -08:00
Alexsander Hamir
e868a5702e add 500k memory leak tests for comprehensive analysis
- Add test_memory_baseline_500k for router (500,000 requests)
- Add test_proxy_memory_baseline_500k for proxy (500,000 requests)
- These high-volume tests are designed for manual execution and deep memory leak analysis
- Not included in CI due to long runtime (~15-30 minutes each)
- Useful for detecting very gradual memory accumulation patterns
- Run individually with: pytest tests/load_tests/test_*_memory_growth.py::test_*_500k -v
2026-01-10 17:23:49 -08:00
Alexsander Hamir
f0d5c0b1d1 Merge branch 'main' into litellm_oom_tests_002 2026-01-10 17:16:06 -08:00
Alexsander Hamir
1cce3822c5 reduce max memory tests from 100k/250k to 50k for faster CI
- Rename test_memory_baseline_100k to test_memory_baseline_50k (router)
- Rename test_proxy_memory_baseline_250k to test_proxy_memory_baseline_50k (proxy)
- Update CI configuration to use new 50k test names
- Reduces test time while still providing comprehensive scale testing
- Router 50k test: ~90 seconds vs 3-4 minutes for 100k
- Proxy 50k test: ~2.5 minutes vs 16 minutes for 250k
2026-01-10 17:05:00 -08:00
Alexsander Hamir
a56f1c0e48 add aggressive cleanup routine to router memory tests
- Add multi-generation garbage collection (3 generations)
- Add 5 full GC passes to catch circular references
- Check for uncollectable objects (memory leak detection)
- Add 0.5s wait for OS memory stabilization
- Add final GC pass after wait
- Add detailed logging of cleanup results
- Match cleanup routine used in proxy tests
- Reports actual memory usage vs test artifacts separately
2026-01-10 16:52:10 -08:00
Alexsander Hamir
d5a35efe50 add 100k router memory test and increase memory limit to 60 MB
- Add test_memory_baseline_100k for testing at scale (100,000 requests)
- Increase MEMORY_LIMIT from 50 MB to 60 MB for all router tests
- Memory limit adjustment accounts for observed usage patterns in 30k test
2026-01-10 16:36:11 -08:00
Alexsander Hamir
02c4d009b3 optimize router memory tests for 5x speed improvement
- Increase batch size from 20 to 100 requests (matches proxy test pattern)
- Add memory tracking and detailed logging throughout test execution
- Add periodic memory checks every 10 batches
- Direct task creation without intermediate validation for maximum speed
- Explicit cleanup of responses after each batch
- Average 300-400 req/s (was ~50-100 req/s before)
- Increase memory limit from 40 MB to 50 MB to account for larger batch size
- 1k test now completes in ~6.5 seconds (was ~20+ seconds)
2026-01-10 16:30:49 -08:00
Alexsander Hamir
ff94e23cb3 improve memory leak detection tests with diagnostics and parallel support
- Rename test_linear_memory_growth.py to test_router_acompletion_memory_growth.py for clarity
- Add new test_proxy_chat_completions_memory_growth.py to test full proxy server memory usage
- Implement dynamic port allocation (18888-18919) in mock_server fixture for parallel test execution
- Add httpx client diagnostics to differentiate test artifacts from actual proxy memory growth
- Increase MEMORY_LIMIT to 170 MB based on empirical testing showing ~174 MB stable usage at scale
- Add aggressive cleanup routines with detailed logging to ensure accurate memory measurements
- Fix Windows Unicode compatibility by removing emoji characters from test output
- Tests now properly detect slow memory accumulation (~170 KB per 1000 requests) in proxy server
2026-01-10 16:11:11 -08:00
Ishaan Jaffer
6a9041e67d Revert "aws fix base"
This reverts commit 225f411abc.
2026-01-10 14:08:11 -08:00
Ishaan Jaffer
69aaad5e69 Revert "added extraction of top level metadata for custom lables in prometheus callbacks (#18087)"
This reverts commit 14a4a9c031.
2026-01-10 14:00:54 -08:00
Ishaan Jaffer
6b7f114847 test_lists_with_sensitive_keys_are_masked 2026-01-10 13:55:11 -08:00
Ishaan Jaffer
35c636ba97 test_health_check_not_called_when_disabled 2026-01-10 13:55:11 -08:00
Ishaan Jaffer
ff8e9aeb5c Revert "Add support for Vertex AI API keys"
This reverts commit ad501048f3.
2026-01-10 13:39:49 -08:00
Ishaan Jaff
c0cf8bc27d
[Feat] Manus FILES API - Add File upload, get, delete, list (#18904)
* add MANUS get response

* init TwoStepFileUploadRequest

* init TwoStepFileUploadConfig

* add async_create_file to handle 2 step uploads

* init ManusFilesConfig

* add add get_provider_files_config MANUS

* fix validate_environment

* test_manus_files_api_e2e_all_methods

* aws fix base

* init files API MANUS

* test_manus_responses_api_with_file_upload

* mypy lint fixes

* fix BedrockFilesConfig

* manus docs

* docs manus

* mypy lint

* add add fix resposne api utils MANUS
2026-01-10 13:27:54 -08:00
Ishaan Jaffer
3c3ed3bcfb fix resposne api utils 2026-01-10 13:25:31 -08:00
Ishaan Jaffer
e3fe02148d _mask_sequence 2026-01-10 13:20:43 -08:00
Ishaan Jaff
f19cce950c
add MANUS get response (#18900) 2026-01-10 12:21:45 -08:00
Ishaan Jaff
ab50fea663
[Fix] turn_off_message_logging Does Not Redact Request Messages in proxy_server_request Field When Stored to Database (#18897)
* update _get_proxy_server_request_for_spend_logs_payload

* test_spend_logs_redacts_request_and_response_when_turn_off_message_logging_enabled
2026-01-10 11:28:21 -08:00
Sameer Kankute
cb03e5a6dd
Merge pull request #18852 from BerriAI/litellm_add_ssl_verify_bedrock
[Bug]: Add Custom CA certificates to boto3 clients
2026-01-10 11:41:32 +05:30
Alexsander Hamir
578abd4465
Add memory leak detection tests with CI integration (#18881) 2026-01-09 17:36:10 -08:00
yuneng-jiang
dfb298792c New endpoint for router fields + react query 2026-01-09 16:49:22 -08:00
YutaSaito
07db8fe656
Merge pull request #18855 from BerriAI/litellm_fix_mcp-error-in-multiple-server
[fix] mcp error in multiple servers
2026-01-10 07:26:16 +09:00
yuneng-jiang
c29d042df4 Case insensitive email login 2026-01-09 12:51:00 -08:00
Sameer Kankute
0c7db97ad5
Merge pull request #18871 from BerriAI/litellm_fix_test_count_tokens_caching
Fix :test_count_tokens_caching
2026-01-10 01:20:55 +05:30
Harshit Jain
8a683d9a6a
Add fix for bedrock_cache, metadata and max_model_budget (#18872) 2026-01-10 01:09:00 +05:30
Sameer Kankute
777ae4f530 Fix :test_count_tokens_caching 2026-01-10 00:57:11 +05:30
Shivam Rawat
43dd0e6ef5
remove model before casting it in the transformation (#18810) 2026-01-10 00:43:38 +05:30
Cesar Garcia
c19c97591e
fix: align max_tokens with max_output_tokens for consistency (#18820)
* fix: align max_tokens with max_output_tokens for consistency

Fixed inconsistent max_tokens definitions in model_prices_and_context_window.json.
According to LiteLLM convention, max_tokens should equal max_output_tokens when available.

Models fixed:
- deepseek-chat: 131072 → 8192 (now equals max_output_tokens)
- dashscope/qwen-flash: 1000000 → 32768 (now equals max_output_tokens)
- databricks/databricks-gemma-3-12b: 128000 → 32000 (now equals max_output_tokens)

This ensures consistency across all providers where max_tokens represents
the maximum number of tokens that can be generated in the output.

* fix: align max_tokens with max_output_tokens for 244 models

- Fix 244 models where max_tokens != max_output_tokens
- Add test to validate max_tokens consistency and prevent regressions

According to model_prices_and_context_window.json spec:
- max_tokens is a LEGACY parameter
- Should always equal max_output_tokens when both are present

This ensures consistency across all model definitions.
2026-01-10 00:37:45 +05:30
Martin Gauthier
dd087c8cca
🐛 fix: propagate headers in router embedding calls (#18844)
Fix router embedding methods to properly propagate proxy model
configuration headers to LLM API calls by calling
_update_kwargs_before_fallbacks() just like completion() does.

Previously, router.embedding() and router.aembedding() manually
set num_retries and metadata but didn't call
_update_kwargs_before_fallbacks(), which meant default_litellm_params
(including headers) were not propagated correctly.

Changes:
- Replace manual kwargs setup with _update_kwargs_before_fallbacks()
  in _embedding method (litellm/router.py:3318)
- Apply Black formatting to router.py for consistency
- Add comprehensive unit tests for header propagation
- Add integration tests for various router configurations

Tests verify:
- Headers from default_litellm_params are included in embedding calls
- Metadata (model_group) is properly set
- Consistency between completion() and embedding() behavior
- Support for deployment-specific headers, fallbacks, and retries
2026-01-09 23:57:18 +05:30
Sameer Kankute
8dac83e093
Merge pull request #18859 from BerriAI/litellm_azure_image_gen_fix
Fix: response_format leaking into extra_body
2026-01-09 23:09:27 +05:30
Andrés
9768eca33e
fix(azure): add logprobs support for Azure OpenAI GPT-5.2 model (#18856)
* fix(azure): add logprobs support for Azure OpenAI GPT-5 models

Azure OpenAI GPT-5 models (including gpt-5.2) support logprobs
parameters, unlike OpenAI's GPT-5 reasoning models. This fix
overrides the parent class restriction to enable logprobs for Azure.

Changes:
- Override get_supported_openai_params() in AzureOpenAIGPT5Config
- Add "logprobs" and "top_logprobs" to supported params
- Add comprehensive tests for logprobs functionality

Testing:
- Verified with direct Azure API calls to gpt-5.2
- API version: 2025-01-01-preview
- Successfully returns logprobs data

Related: #7974, #4022

* refactor: restrict logprobs support to gpt-5.2 only

Only gpt-5.2 has been verified to support logprobs on Azure.
Other gpt-5 variants (gpt-5, gpt-5.1) have not been tested.

Changes:
- Add conditional check for is_model_gpt_5_2_model()
- Update tests to be specific to gpt-5.2
- Add negative tests for gpt-5 and gpt-5.1
- Update documentation to reflect gpt-5.2 specificity
2026-01-09 22:57:50 +05:30
Harshit Jain
819468554f
fix(security): prevent expired key plaintext leak in error response (#18860) 2026-01-09 22:27:39 +05:30
Sameer Kankute
c0b05fc47a
Merge pull request #18250 from sjmatta/claude/fix-issue-17910-QBgDq
[Fix] Nova model detection for Bedrock provider (#17910)
2026-01-09 17:30:51 +05:30
Sameer Kankute
be28fcd463
Merge pull request #18858 from raghav-stripe/raghav-add-bedrock-tokencounter
feat: add Bedrock as a backend API for token counting
2026-01-09 17:10:52 +05:30
Sameer Kankute
e7efd51bd7
Merge branch 'main' into litellm_staging_01_06_2026 2026-01-09 17:06:17 +05:30
Sameer Kankute
bb9347207b
Merge pull request #18833 from BerriAI/litellm_staging_01_08_2026
Litellm staging 01 08 2026
2026-01-09 17:04:29 +05:30
Sameer Kankute
844c766c65
Merge pull request #18763 from BerriAI/litellm_staging_01_07_2026
Staging - 01/07/2026
2026-01-09 17:01:58 +05:30
Sameer Kankute
ffa0d6706c Fix: response_format leaking into extra_body 2026-01-09 16:53:35 +05:30
Raghav Jhavar
ba78194ff1 add support for bedrock in token counting api 2026-01-09 17:08:07 +07:00
Yuta Saito
5927a557fb tests: add test 2026-01-09 17:25:21 +09:00
Justas Brazauskas
c0ee5da444
Fix: Add thought_signatures to VertexGeminiConfig and test 2026-01-09 10:03:45 +02:00
Sameer Kankute
c6101ef977 [Bug]: Add Custom CA certificates to boto3 clients 2026-01-09 12:30:36 +05:30
Yuta Saito
022db6c9ed feat: add mcp registry 2026-01-09 15:07:39 +09:00
Sameer Kankute
d9b275e62a
Merge pull request #18806 from BerriAI/litellm_vertex_ai_api_key_support
[FEAT]: Add support for Vertex AI API keys
2026-01-09 09:44:36 +05:30
Yuta Saito
48bc5ccb4f fix: test 2026-01-09 11:23:47 +09:00
Yuta Saito
f129f598a0 fix: how to execute cloudzero sql 2026-01-09 10:52:48 +09:00
YutaSaito
661f03058c
Merge pull request #18802 from BerriAI/litellm_feat_focus_backend
[feat] Focus export support
2026-01-09 07:21:04 +09:00
yuneng-jiang
1b9c7deec6 Merge remote-tracking branch 'origin' into litellm_key_team_routing_3 2026-01-08 10:39:12 -08:00
yuneng-jiang
864e8c6543
Merge pull request #18775 from BerriAI/litellm_fs_callback_fix
[Fix] Normalize Proxy Config Callback
2026-01-08 10:37:21 -08:00