Commit graph

36594 commits

Author SHA1 Message Date
Yuneng Jiang
f475278bd1
chore: fixes
Some checks failed
Unit Tests: Caching (Redis) / caching-redis (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
2026-04-05 00:01:40 -07:00
Sameer Kankute
4a470aec6a
fix: resolve CodeQL module-level cyclic import errors
Made-with: Cursor
2026-04-02 21:43:16 +05:30
Sameer Kankute
6633a18efe
Fix mypy errors 2026-04-02 20:49:24 +05:30
Sameer Kankute
1169fbffd0
fix(proxy): sanitize debug request payload to prevent log injection
Strip CR/LF from JSON payload strings before verbose_proxy_logger.debug
in _debug_log_request_payload. Add _sanitize_for_log helper and unit tests.

Made-with: Cursor
2026-04-02 19:49:51 +05:30
Sameer Kankute
8e4df63046
fix code qa 2026-04-02 19:44:02 +05:30
Sameer Kankute
a33a3d29b3
fix: address Greptile P2 review (MCP allowlist strip, types, docs)
Made-with: Cursor
2026-04-02 19:29:04 +05:30
Sameer Kankute
f7c24ae395
ran black 2026-04-02 19:24:51 +05:30
Sameer Kankute
9fe534aff2
fix(responses): map reasoning dict to reasoning_effort string by default
Extract effort from reasoning payloads without a summary key so chat
completion providers receive a string. Preserve the full dict when
summary is present for the Responses API bridge in main.py.

Made-with: Cursor
2026-04-02 19:23:37 +05:30
Sameer Kankute
890c927c82
test: allow output_cost_per_second_1080p in model_prices schema
Made-with: Cursor
2026-04-02 19:23:28 +05:30
Sameer Kankute
acc17f2884
test: allow output_cost_per_second_1080p in model_prices schema
Made-with: Cursor
2026-04-02 19:23:23 +05:30
Sameer Kankute
34eff472a7
Merge pull request #24964 from BerriAI/litellm_google_generate_content_response_headers
feat(proxy): LiteLLM headers on Google native generateContent routes
2026-04-02 18:34:36 +05:30
Sameer Kankute
edb42fc107
Merge pull request #24963 from BerriAI/litellm_vertex_request_metadata_labels
feat(vertex_ai): propagate metadata labels to embedding, Imagen, rerank
2026-04-02 18:33:21 +05:30
Sameer Kankute
f4f094e955
Merge pull request #24918 from Sameerlite/Sameerlite/openai-chat-to-responses
feat(openai): add route_all_chat_openai_to_responses global flag
2026-04-02 18:31:57 +05:30
Sameer Kankute
c2f0788541
Merge pull request #24912 from Sameerlite/litellm_fix-refusal-status-streaming
fix(responses): map refusal stop_reason to incomplete status in streaming
2026-04-02 18:30:54 +05:30
Sameer Kankute
48981b5d4e
Merge pull request #24903 from Sameerlite/litellm_baseten-model-api-pricing
feat(cost): add baseten model api pricing entries
2026-04-02 18:29:27 +05:30
Sameer Kankute
7b8493025a
Merge pull request #24897 from Sameerlite/litellm_bedrock-embedded-region-model-path
feat(bedrock): parse embedded region from invoke model path
2026-04-02 18:28:31 +05:30
Sameer Kankute
1acdf912fb
Merge pull request #24899 from Sameerlite/litellm_gemini-veo-video-resolution-pricing
feat(gemini): Veo Lite pricing, video resolution usage and tiered cost
2026-04-02 18:27:51 +05:30
Sameer Kankute
8fffa7dd8e
Merge pull request #24853 from Sameerlite/Sameerlite/fix-tag-route-affinity
fix(router): tag-based routing broken when encrypted_content_affinity is enabled
2026-04-02 18:26:14 +05:30
Sameer Kankute
8394167711
Merge pull request #24783 from Sameerlite/Sameerlite/responses-bridge-optin
feat(responses): add use_responses_api_bridge flag for openai/ models with custom api_base
2026-04-02 18:25:29 +05:30
Sameer Kankute
63eacb57d0
Merge pull request #24778 from Sameerlite/litellm_triton_embedding_usage_tracking
feat(triton): add embedding usage tracking fallback
2026-04-02 18:24:31 +05:30
Sameer Kankute
09cb4b28a6
Merge pull request #24773 from Sameerlite/Sameerlite/healthcheck-max-tokens
feat(health-check): add BACKGROUND_HEALTH_CHECK_MAX_TOKENS env var
2026-04-02 18:23:44 +05:30
Sameer Kankute
9c826d25a0
Merge pull request #24625 from Sameerlite/litellm_fix-mcp-stdio-rce
fix(mcp): block arbitrary command execution via stdio transport
2026-04-02 18:23:04 +05:30
Sameer Kankute
c8cb49fdfb
Merge pull request #24572 from Sameerlite/litellm_callback_failure_metrics_clean
fix(callbacks): unify callback failure metrics across integrations
2026-04-02 18:22:23 +05:30
Sameer Kankute
4d2baa7726
fix(proxy): prefill Google GenAI stream _hidden_params for proxy headers
- Pass model_id, api_base, and process_response_headers output into streaming
  iterators so streamGenerateContent gets the same x-litellm-* headers as
  non-streaming paths.
- Drop request_data deployment mutation from build_litellm_proxy_success_headers_from_llm_response.
- Avoid logging raw request key names in oversized debug payload (code scanning).
- Extend tests for streaming iterator shape, metadata fallback, and helper.

Made-with: Cursor
2026-04-02 10:48:37 +05:30
Sameer Kankute
3ae14bd9ff
feat(proxy): return LiteLLM headers on Google native generateContent routes
Wire build_litellm_proxy_success_headers_from_llm_response for :generateContent
and :streamGenerateContent so x-litellm-*, rate limit, and provider headers
match the OpenAI-style proxy path. Add unit test.

Annotate httpx.HTTPStatusError branch so pyright accepts .response after optional
exception transform. Remove unused variable in streaming tracer test (Ruff F841).

Made-with: Cursor
2026-04-02 10:21:43 +05:30
Sameer Kankute
ec004a54e9
feat(vertex_ai): propagate metadata labels to embedding, Imagen, rerank
- Add pop_vertex_request_labels / vertex_request_labels_from_litellm_params in common_utils
- Vertex embeddings: pass litellm_params, set predict body labels; Gemini uses shared helper
- Imagen: top-level labels from metadata; rerank: userLabels for Discovery Engine Rank API
- Thread litellm_params through rerank handler and all BaseRerankConfig implementations

Made-with: Cursor
2026-04-02 09:56:56 +05:30
Sameer Kankute
f77ee939de
Fix test 2026-04-02 09:18:12 +05:30
David Chen
d1df4e838b
Litellm fix update bedrock models (#24947)
* update bedrock models in tests

* updated more tests and model_prices_and_context_window

* fix model id and pricing

* replace more sonnet models

* update tests

* git push

* update pricing

* flaky total cost

* monkey patch

* relax the cost change

* fix and revert some changes

* revert the pricing

* chore: move cost/pricing changes to bedrock-cost-fixes branch

* chore: split Bedrock file-api beta stripping to separate branch

Removes strip_unsupported_file_api_betas_for_bedrock_invoke from this branch;
see litellm_bedrock_invoke_strip_file_api_betas for that fix.

Made-with: Cursor
2026-04-01 19:22:54 -07:00
michelligabriele
adedae2cfa
fix(auth): enforce budget for models not in cost map (#24949)
* fix(auth): enforce budget for models not in cost map

* fix log injection in debug messages + isolate test global state
2026-04-01 19:10:30 -07:00
yuneng-jiang
7250cba3db
Merge pull request #24905 from BerriAI/litellm_pin_pip_2
[Infra] Pin All Docker Build Dependencies
2026-04-01 15:05:25 -07:00
Yuneng Jiang
d038093562
add poetry lock 2026-04-01 14:28:15 -07:00
Yuneng Jiang
0fb5ab515d
[Fix] Revert cryptography to 43.0.3 in pyproject.toml for Python 3.9.0/3.9.1 compat
cryptography 46.0.5 excludes Python 3.9.0 and 3.9.1, which conflicts
with pyproject.toml's python = ">=3.9,<4.0" range. Docker still uses
46.0.5 via requirements.txt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:27:51 -07:00
Yuneng Jiang
85f72c9d24
[Fix] Remove unused aioboto3 dependency and botocore conflict workarounds
aioboto3 was listed as a dependency for async sagemaker calls but is not
imported anywhere in the codebase — async calls use httpx + botocore SigV4
instead. Removing it eliminates the unresolvable botocore version conflict
between boto3 and aiobotocore, along with all grep -v / --no-deps workarounds
across Dockerfiles and CI.

Also addresses Greptile review feedback: collapse redundant grpcio
python-version markers, bump pyproject.toml cryptography to 46.0.5 to
match Docker (GHSA-r6ph-v2qm-q3c2), and fix misleading .npmrc comment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 14:25:44 -07:00
Yuneng Jiang
9c6d5f2b60
[Fix] Add aioitertools and wrapt to authorized licenses
Both are transitive deps of aiobotocore, added to requirements.txt in
the previous commit. aioitertools is MIT, wrapt is BSD.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:01:10 -07:00
Yuneng Jiang
821a634d25
[Fix] Handle boto3/aioboto3 botocore conflict across CI and Docker builds
boto3==1.42.80 and aioboto3==15.5.0 have incompatible botocore version
ranges. No aioboto3 release supports botocore 1.42.x yet. Both uv and
pip 26.0.1 reject the resolution.

Fix: filter aioboto3 out of requirements.txt at install time, then
install aioboto3+aiobotocore with --no-deps to bypass resolution.
Added wrapt and aioitertools to requirements.txt as pinned transitive
deps of aiobotocore (skipped by --no-deps). Fixed pip stdin handling
(/dev/stdin). Applied to all 5 Dockerfiles and all CircleCI install
paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 12:27:21 -07:00
Yuneng Jiang
fc8eb81549
[Fix] Filter aioboto3 from resolver to fix boto3/aioboto3 conflict
boto3==1.42.80 and aioboto3==15.5.0 have incompatible botocore ranges.
Both uv and pip 26.0.1 reject the resolution. Fix: filter aioboto3 out
of requirements.txt at install time, then install aioboto3+aiobotocore
separately with --no-deps to bypass resolution. Removes uv-overrides.txt
which only partially addressed the conflict.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:57:07 -07:00
Yuneng Jiang
b7849bff56
[Fix] Add boto3 override alongside botocore in uv-overrides.txt
aiobotocore[boto3] pins both boto3<1.40.62 and botocore<1.40.62.
The previous commit only overrode botocore. Added boto3 override too.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:49:25 -07:00
Yuneng Jiang
467abd1909
[Fix] Add uv override for boto3/aioboto3 botocore conflict
boto3==1.42.80 requires botocore>=1.42.80 but aioboto3==15.5.0 (via
aiobotocore==2.25.1) requires botocore<1.40.62. No aioboto3 release
supports botocore 1.42.x yet. pip's lenient resolver handles this for
Docker builds, but uv's strict resolver rejects it in CI. Added
uv-overrides.txt to force botocore to match boto3 during uv installs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:34:19 -07:00
Yuneng Jiang
43077af378
[Fix] Sync CircleCI dependency pins with requirements.txt
CircleCI had stale version pins (e.g. boto3==1.36.0, aioboto3==13.4.0) that
conflict with requirements.txt (boto3==1.42.80, aioboto3==15.5.0), causing
uv resolution failures. Updated all mismatched pins across config.yml and
.circleci/requirements.txt to match requirements.txt as the source of truth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:27:44 -07:00
ishaan-berri
e4442a4d98
test fix us.anthropic.claude-haiku-4-5-20251001-v1:0 (#24931)
* test fix us.anthropic.claude-haiku-4-5-20251001-v1:0

* ignore mypy cache files

---------

Co-authored-by: Ishaan Jaffer <ishaanjaffer0324@gmail.com>
Co-authored-by: David Chen <clfhhc@gmail.com>
2026-04-01 11:01:03 -07:00
David Chen
c987bdba84
fix lint problem (#24932) 2026-04-01 10:24:37 -07:00
Yuneng Jiang
0d637b1a76
[Fix] Align requirements.txt versions with pyproject.toml after merge
After merging main, pyproject.toml had updated dependency versions but
requirements.txt still had the old pins. The Dockerfile builds litellm
from source (using pyproject.toml) then installs deps from
requirements.txt, so version mismatches cause pip resolution failures.

Updated 21 packages to match: openai, fastuuid, tiktoken,
importlib-metadata, tokenizers, click, jsonschema, fastapi, pyyaml,
uvicorn, boto3, mcp, orjson, polars, apscheduler, fastapi-sso, pyjwt,
python-multipart, azure-identity, rich, aiohttp.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:06:18 -07:00
Yuneng Jiang
6a2b03a850
[Infra] Merge main and resolve dependency pin conflicts
Resolve conflicts between pinned versions and main's caret ranges,
keeping exact pins. Add pytest-cov==5.0.0 from main. Regenerate
poetry.lock.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 09:55:13 -07:00
Yuneng Jiang
7bd6fa8509
[Fix] Add hf-xet to authorized packages in license check
hf-xet is Apache 2.0 licensed but PyPI metadata doesn't expose the
license string, so the automated checker can't determine it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 09:51:29 -07:00
yuneng-jiang
0f88968da9
Merge pull request #24804 from joereyna/feat/add-codecov-to-ci
Re-add Codecov coverage reporting to GHA matrix workflow
2026-04-01 09:46:55 -07:00
Yuneng Jiang
7b277d36cd
[Fix] Fix test failures and Docker build from pinned dependency upgrade
pytest-asyncio 1.x no longer provides an implicit event loop in sync
fixtures/tests. Make async-dependent fixtures and tests async, and
replace deprecated asyncio.get_event_loop() in tests. Switch
Dockerfile.build_from_pip from Alpine to Debian slim since
pyroscope-io 0.8.x has no musl wheels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 09:43:33 -07:00
michelligabriele
283375f4d6
fix(proxy): eliminate race condition in streaming guardrail_information logging (#24592)
asyncio.create_task in CSW.__anext__ scheduled the deferred logging
callback as an independent task that raced with unified_guardrail's
end-of-stream block. For short-stream providers (Vertex AI, Azure,
Anthropic), the logging fired before guardrail_information was written,
causing post_call guardrail entries to be missing from
StandardLoggingPayload.

Move the deferred callback trigger from CSW.__anext__ to
ProxyLogging.async_post_call_streaming_iterator_hook (after the full
streaming pipeline completes). CSW now stores the assembled response
args; the outer consumer fires the callback after all guardrail
end-of-stream blocks finish. Also skip apply_guardrail guardrails in
_run_deferred_stream_guardrails to eliminate duplicate API calls.
2026-04-01 08:06:56 -07:00
Sameer Kankute
aabb543f58
docs(openai): move chat-to-responses flag docs to openai.md completions section
- Add route_all_chat_openai_to_responses global flag docs under
  'Getting Reasoning Content in /chat/completions' in openai.md
  with SDK and proxy examples using gpt-5.4
- Remove the section from responses_api.md (wrong location)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 17:50:48 +05:30
Sameer Kankute
bbcfabe08a
fix(openai): fix env var bool parsing and add responses API docs
- Use .lower() == "true" for LITELLM_ROUTE_ALL_CHAT_OPENAI_TO_RESPONSES to avoid bool("False") == True bug
- Add clarifying comment on early return in responses_api_bridge_check
- Document route_all_chat_openai_to_responses flag in openai/responses_api.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 17:47:44 +05:30
Sameer Kankute
724ad7cbeb
feat(openai): add route_all_chat_openai_to_responses global flag
Adds `litellm.route_all_chat_openai_to_responses` (env: `LITELLM_ROUTE_ALL_CHAT_OPENAI_TO_RESPONSES`) to route all OpenAI /chat/completions requests through the Responses API bridge. Also fixes reasoning param dict passthrough in completion transformation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 17:31:19 +05:30