Commit Graph

26934 Commits

Author SHA1 Message Date
Boxuan Li
297c2a0bf4
prompt_caching.md: Fix wrong prompt_tokens definition (#16044) 2025-10-30 20:13:13 -07:00
Nicholas Couture
f747a4a38a
fix: Handle multiple rate limit types per descriptor and prevent IndexError (#16039)
* improve descriptor_key handling for multiple and missing rate limit descriptors in parallel request limiter v3

* Add tests for parallel request limiter v3 in proxy hooks
2025-10-30 20:12:54 -07:00
Sameer Kankute
c1369a07ba
Add Add per model group header forwarding for Bedrock Invoke API (#16042) 2025-10-30 20:10:17 -07:00
tanvithakur
bb79a75a89
Changes to fix frequency_penalty and presence_penalty issue for gemini-2.5-pro model (#16041)
* Update vertex_and_google_ai_studio_gemini.py

* Fix logic

* Fix mypy error

* Fix lgic

---------

Co-authored-by: tanvi thakur <tanvi_thakur@intuit.com>
2025-10-30 20:02:58 -07:00
John Lathouwers
a6f740f28b
Add OCI Signer Authentication. Closes #16048, Closes #15654 (#16064)
* Add OCI Signer Authentication. Closes #16048,  Closes #15654

* Fix linting error

* Remove Recommended, Catch None, Trim Whitespace

* Make method clear re Proxy vs SDK
2025-10-30 19:59:01 -07:00
pale-aura
0d84c11bbe
Fix vercel_ai_gateway entry for glm-4.6 (#16084)
* Fix vercel_ai_gateway entry for glm-4.6

* Fix: add unit test for vercel_ai_gateway/zai/glm-4.6

* Fix:

Add fix for unit test on vercel_ai_gateway/zai/glm-4.6

* Remove print statements in test_vercel_ai_gateway_glm46_cost_math
2025-10-30 19:40:35 -07:00
Geoffray Viossat
b29ba9e3be
feat: handle Deepgram detected language when available (#16093) 2025-10-30 19:19:34 -07:00
Daniel Dimenshtein
cde9ba5f93
Update model_prices_and_context_window.json, qwen-vl models (#16106)
Add supports vision, to qwen vl models
2025-10-30 19:18:35 -07:00
Ishaan Jaffer
4d88f21393 docs fix 2025-10-30 18:25:51 -07:00
Seongbin Lim
18e7eaaddb
Add gemini/gemini-embedding-001 pricing entry for Google GenAI API (#16078)
* Add gemini/gemini-embedding-001 pricing entry for Google GenAI API

Add pricing and configuration entry for "gemini/gemini-embedding-001"
model when called via Google GenAI API (google-genai provider). This
mirrors the existing Vertex AI entry ("gemini-embedding-001") but uses
the 'gemini' provider instead.

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

* Update tpm and rpm for gemini/gemini-embedding-001

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-30 17:39:19 -07:00
Ishaan Jaff
0428229032
[Docs] readme fixes add supported providers (#16109)
* add provider test

* docs readme.md

* docs providers

* order providers

* test_providers_alphabetically_ordered

* docs endpoint

* fix config

* add ENDPOINT_COLUMNS

* add provider endpoints

* docs fix
2025-10-30 17:23:20 -07:00
Krrish Dholakia
30f343c3cb docs(deploy.md): document new terraform module 2025-10-30 17:11:55 -07:00
Ishaan Jaff
fd073ee682
Litellm docs readme fixes (#16107)
* add provider test

* docs readme.md

* docs providers

* order providers

* test_providers_alphabetically_ordered

* docs endpoint

* fix config
2025-10-30 17:05:32 -07:00
Ishaan Jaffer
40c663439a fix readme.md 2025-10-30 15:54:50 -07:00
yuneng-jiang
720ba865fb
[Infra] Litellm Backend SSO Changes (#16029)
* SSO Backend changes

* Encrypt and Decrypt, load into os env

* Linting and addressing comments
2025-10-30 14:32:08 -07:00
Sameer Kankute
eed3ad0bdb
Fix: Moderations endpoint now respects api_base configuration parameter (#16087)
* Update moderation to use api base

* Update moderation to use api base

* Fix mypy error
2025-10-30 11:01:26 -07:00
yuneng-jiang
b9850accaa
Circle CI e2e test fix (#16100) 2025-10-30 09:54:46 -07:00
Thomas Mildner
6fc33add9a
Opik user auth key metadata Documentation (#16004)
* fix(opik): enhance requester metadata retrieval from API key auth

* docs(opik): add automatic metadata association from API keys in documentation
2025-10-29 19:13:19 -07:00
Sameer Kankute
192935120d
Add OpenAI-compatible annotations support for Cohere v2 citations 2025-10-29 19:12:17 -07:00
Talal
5e10ea4136
Improve(mcp): respect X-Forwarded- headers in OAuth endpoints (#16036)
* fix(mcp): respect X-Forwarded-Proto header in OAuth endpoints

When LiteLLM proxy is deployed behind a reverse proxy (like nginx or a load balancer) that terminates SSL/TLS, the proxy receives HTTP requests internally but should expose HTTPS URLs externally. This change detects the X-Forwarded-Proto header and uses it to construct correct redirect URIs and endpoint URLs.

Changes:
- Added X-Forwarded-Proto detection to authorize, token, oauth_protected_resource_mcp, oauth_authorization_server_mcp, and register_client endpoints
- Added comprehensive tests for X-Forwarded-Proto header support across all affected endpoints
- Fixed existing tests to properly mock request.headers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix formatting

* feat(mcp): support X-Forwarded-Host for proxy base URL reconstruction

Extended X-Forwarded-Proto support to also handle X-Forwarded-Host and X-Forwarded-Port headers. This allows LiteLLM to correctly construct redirect URIs and endpoint URLs when deployed behind a reverse proxy that changes the host/port.

Example scenario:
- Internal URL: http://localhost:8888/github/mcp
- External URL: https://proxy.abc.com/github/mcp
- Proxy sets: X-Forwarded-Proto: https, X-Forwarded-Host: proxy.abc.com

Changes:
- Added get_request_base_url() helper function to centralize X-Forwarded-* header handling
- Replaced all inline X-Forwarded-Proto checks with calls to the helper function
- Helper handles X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port
- Added tests for X-Forwarded-Host scenarios in authorize and token endpoints

Fixes issue where protected resource URL mismatch occurred:
  Error: Protected resource http://proxy.abc.com:8888/github/mcp
  does not match expected https://proxy.abc.com/github/mcp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* chore: replace Yelp-specific hostnames with generic examples

Changed all references from chatproxy.yelpcorp.com to proxy.example.com in:
- test_proxy_forwarding.py (default host parameter)
- TEST_PROXY_FORWARDING.md (documentation examples)
- discoverable_endpoints.py (docstring example)
- test_discoverable_endpoints.py (test mock data)

This makes the code more generic and suitable for open source.
All 13 tests still passing.

* remove accidentally added files

* fix formatting

* add new test for get_base_url

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-29 19:11:32 -07:00
Timothée Lecomte
eb0e4f34dc
docs: use custom-llm-provider header in examples (#16055) 2025-10-29 19:06:48 -07:00
Jason Roberts
6672250769
feat(guardrails): Add per-request profile overrides to PANW Prisma AIRS (#16069)
- Per-request metadata: profile_name, profile_id, user_ip, app_name
- Full litellm_call_id for traceability
- Optional profile_name (supports API keys with linked profiles)
- Backward compatible
2025-10-29 19:05:59 -07:00
yuneng-jiang
1b234108c0
[Feature] UI - Add Key Type Select in Key Settings (#16034)
* Add Key Type Select in Key Settings

* Frontend changes to fully support editing key type in key settings
2025-10-29 18:41:44 -07:00
yuneng-jiang
cd6d6cfdb5
Test Key UI Embeddings (#16065) 2025-10-29 18:40:19 -07:00
yuneng-jiang
5c71455d22
Validation for Proxy Base URL in SSO Settings (#16082) 2025-10-29 18:39:59 -07:00
Ishaan Jaffer
044e26081d test_get_request_body_nova_canvas_inference_profile_arn 2025-10-29 18:30:59 -07:00
Ishaan Jaff
aea78b8d1a
[Feat] Add support for Batch API Rate limiting - PR1 adds support for input based rate limits (#16075)
* add count_input_file_usage

* add count_input_file_usage

* fix count_input_file_usage

* _get_batch_job_input_file_usage

* fixes imports

* use _get_batch_job_input_file_usage

* test_batch_rate_limits

* add _check_and_increment_batch_counters

* add get_rate_limiter_for_call_type

* test_batch_rate_limit_multiple_requests

* fixes for batch limits

* fix linting

* fix MYPY linting
2025-10-29 18:28:52 -07:00
Ishaan Jaffer
8a7f39daa4 tes numeric constants 2025-10-29 18:23:38 -07:00
Ishaan Jaffer
f538caaa01 fix proxy_build_from_pip_tests 2025-10-29 18:22:55 -07:00
Ishaan Jaffer
a3e70b8885 fix model by provider test 2025-10-29 18:21:06 -07:00
OrionCodeDev
5f52533294
Fix spend tracking for OCR/aOCR requests (log pages_processed + recognize OCRResponse) (#16070)
* fix-ocr-cost

* fix1
2025-10-29 18:11:21 -07:00
Ishaan Jaffer
a10b0b829e docs fix rbac improvements 2025-10-29 17:42:24 -07:00
Ishaan Jaffer
06449df9d3 fix codestral-embed 2025-10-29 13:15:32 -07:00
Ishaan Jaff
abbb1476ee
feat: add codestral-embed-2505 (#16071) 2025-10-29 13:13:55 -07:00
Ishaan Jaff
99feefd614
[Feat] Add FAL AI Image Generations on LiteLLM (#16067)
* add fal-ai provider

* fix image_generation_handler

* init FalAIImageGenerationConfig

* init cost_calculator

* init FAL AI

* TestFAL_AI_ImageGeneration

* fix load_custom_provider_entrypoints

* TestFAL_AI_ImageGeneration

* add imagen4 transform FAL AI

* add FAL AI imagen 4 transform

* BaseImageGenTest

* test_fal_ai_image_generation_basic

* add BRIA + Recraft img gen

* add recraft + BRIA

* test_fal_ai_image_generation_basic

* tests for flux PRO v11

* Add FAL AI SD

* test FAL AI SD

* docs FAL AI

* docs fal ai

* Using Model-Specific Parameters

* add fal ai model prices

* add fall_ai JPG logo

* ui fixes FAL AI

* fix linting

* fix linting

* fix bedrock test_get_request_body_stability3

* test_custom_llm_provider_entrypoint
2025-10-29 13:10:51 -07:00
Alexsander Hamir
4939793ade
fix: prevent httpx DeprecationWarning memory leak in AsyncHTTPHandler (#16024)
* fix: prevent httpx DeprecationWarning memory leak in AsyncHTTPHandler

Route bytes/str to content= parameter instead of data= to avoid deprecation warning that causes memory leak

* refactor: extract data/content preparation into helper function

Create _prepare_request_data_and_content() helper to DRY up the logic
for routing data/content parameters correctly in httpx requests.

This helper prevents httpx DeprecationWarnings (which cause memory leaks)
by moving bytes/str from data= to content= parameter while keeping
dict/Mapping in data= parameter.

Applied the helper consistently across all HTTP methods in both
AsyncHTTPHandler and HTTPHandler classes:
- post(), put(), patch(), delete()
- single_connection_post_request()

Related to: b850ed1188aced4e8c3cd7ef8b1a065fbc43edbb

* fix: Python 3.8 compatibility - use Tuple instead of tuple in type hints

Replace lowercase tuple[...] with typing.Tuple[...] in http_handler.py
to fix 'TypeError: type object is not subscriptable' on Python 3.8
2025-10-29 12:57:41 -07:00
langping
5bba1e8405
Added fallback logic for detecting file content-type when S3 returns generic (#15635)
* enhance image processing fallback logic

* Extract to comment utils
2025-10-29 08:24:20 -07:00
Dmitrii Komarov
1dfdcb0762
Allow using ARNs when generation images via Bedrock (#15789)
* Use model_id in Bedrock's image_handler

* Fix MyPy for converse_handler and invoke_hanlder
2025-10-28 19:41:35 -07:00
Albert DeFusco
559ae96e38
Python entry-point for CustomLLM subclasses (#15881)
* load entrypoints

* mock loading entry-point in pyproject.toml

* simpler group name

* create CustomLLM subclass instance after load
2025-10-28 19:39:14 -07:00
Javier de la Torre
e6a7cae7e1
fix(apscheduler): prevent memory leaks from jitter and frequent job intervals (#15846)
* fix(apscheduler): prevent memory leaks from jitter and frequent job intervals

Fixes critical memory leak in APScheduler that causes 35GB+ memory allocations
during proxy startup and operation. The leak was identified through Memray
analysis showing massive allocations in normalize() and _apply_jitter()
functions.

Key changes:
1. Remove jitter parameters from all scheduled jobs - jitter was causing
   expensive normalize() calculations leading to memory explosion
2. Configure AsyncIOScheduler with optimized job_defaults:
   - misfire_grace_time: 3600s (increased from 120s) to prevent backlog
     calculations that trigger memory leaks
   - coalesce: true to collapse missed runs
   - max_instances: 1 to prevent concurrent job execution
   - replace_existing: true to avoid duplicate jobs on restart
3. Increase minimum job intervals:
   - PROXY_BATCH_WRITE_AT: 30s (was 10s)
   - add_deployment/get_credentials jobs: 30s (was 10s)
4. Use fixed intervals with small random offsets instead of jitter for
   job distribution across workers
5. Explicitly configure jobstores and executors to minimize overhead
6. Disable timezone awareness to reduce computation

Memory impact:
- Before: 35GB with 483M allocations during startup
- After: <1GB with normal allocation patterns

Performance notes:
- Minimum job intervals increased from 10s to 30s (configurable via env vars)
- Jobs can still be distributed across workers using random start offsets
- No functional changes to job behavior, only timing and memory optimization

Testing:
- Added comprehensive test suite for scheduler configuration
- Verified no job execution backlog on startup
- Tested duplicate job prevention with replace_existing

Related issue: Memory leak in production proxy servers with APScheduler

\ud83e\udd16 Generated with [Claude Code](https://claude.ai/code)

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

* docs: update PROXY_BATCH_WRITE_AT default value from 10s to 30s

Update documentation to reflect the new default value for PROXY_BATCH_WRITE_AT
changed in PR #15846. The default was increased from 10 seconds to 30 seconds
to prevent memory leaks in APScheduler.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* refactor: Move APScheduler config to constants.py

Address code review feedback from ishaan-jaff:
- Move scheduler configuration variables (coalesce, misfire_grace_time,
  max_instances, replace_existing) to litellm/constants.py
- Update all references in proxy_server.py to use the constants
- Improves maintainability and makes configuration values centralized

Requested-by: @ishaan-jaff
Related: #15846

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-28 19:30:17 -07:00
Teddy Amkie
e8e91ac707
docs: improve Grayswan guardrail documentation (#15875)
Co-authored-by: berri-teddy <teddy@berri.ai>
2025-10-28 19:29:40 -07:00
dependabot[bot]
3319bbf277
chore(deps): bump hono from 4.9.7 to 4.10.3 in /litellm-js/spend-logs (#15915)
Bumps [hono](https://github.com/honojs/hono) from 4.9.7 to 4.10.3.
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](https://github.com/honojs/hono/compare/v4.9.7...v4.10.3)

---
updated-dependencies:
- dependency-name: hono
  dependency-version: 4.10.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-28 19:28:10 -07:00
Andrew Bernat
d89990e0c5
Add license metadata to health/readiness endpoint. (#15997)
* health: expose license metadata (available & expiration) in /health/readiness endpoint

* test: add health readiness license metadata coverage

* test: ensure /health/readiness response includes license metadata

* chore: remove standalone license metadata test as requested; existing test covers codepath

---------

Co-authored-by: Plan42.ai <robot@plan42.ai>
2025-10-28 19:21:54 -07:00
Ishaan Jaffer
a5b725917c fix merge 2025-10-28 19:20:07 -07:00
Ishaan Jaffer
f28e6fcbdd ui new build 2025-10-28 19:20:07 -07:00
Daniele Scasciafratte
36f0ee6ff9
Remove unnecessary model variable assignment (#16008)
* Remove unnecessary model variable assignment

Remove redundant assignment of model variable.

* Remove redundant model assignment in image generation
2025-10-28 19:19:25 -07:00
Ishaan Jaffer
33371d18f4 test fix claude-sonnet-4-5-20250929 2025-10-28 19:05:13 -07:00
Rodolfo Nobrega de Resende
29f0ed223a
fix: Support text.format parameter in Responses API for providers without native ResponsesAPIConfig (#16023)
Fixes #15995

When using the Responses API with providers that don't have a native
ResponsesAPIConfig implementation (like Gemini, Anthropic, Cohere, etc.),
the text.format parameter was being ignored. This happened because these
providers fall back to using the LiteLLMCompletionTransformationHandler,
which converts Responses API requests to Chat Completion API requests.

Changes:
- Added 'text' to the list of supported parameters in
  LiteLLMCompletionResponsesConfig.get_supported_openai_params()
- Added transformation logic to convert text.format (Responses API format)
  to response_format (Chat Completion API format) in
  transform_responses_api_request_to_chat_completion_request()
- Created _transform_text_format_to_response_format() method to handle
  the conversion between the two format structures

The transformation supports:
- json_schema: Converts to Chat Completion's json_schema format with
  proper nested structure
- json_object: Converts to Chat Completion's json_object mode
- text: Returns None (default text format)

This fix benefits all providers that use the fallback transformation
handler, ensuring consistent behavior with OpenAI's native Responses API
implementation.
2025-10-28 18:06:48 -07:00
Ishaan Jaffer
b0a2e08a60 fixes test 2025-10-28 17:43:04 -07:00
Ishaan Jaffer
d32890ba55 fix _redact_base64 2025-10-28 17:38:16 -07:00