Commit graph

8197 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Sameer Kankute
115a1e2e23
fix(responses): map refusal stop_reason to incomplete status in streaming
Fixes streaming responses API translation where Anthropic's stop_reason="refusal"
was incorrectly translated to status="completed" instead of "incomplete".

Root cause: build_base_response was unconditionally overwriting finish_reason
with None from later chunks, losing the terminal content_filter value.

Changes:
- streaming_chunk_builder_utils: skip None finish_reason values in build_base_response
- streaming_iterator: snapshot chunks before returning pending events (sync path)
- streaming_handler: treat usage-only chunks as meaningful content
- transformation: map finish_reason=refusal to status=incomplete
- tests: add regression tests for refusal handling

Made-with: Cursor
2026-04-01 16:28:20 +05:30
Sameer Kankute
e743c00dcb
feat(cost): add baseten model api pricing entries
Add Baseten Model API pricing entries for Nemotron, GLM, Kimi, GPT OSS, and DeepSeek models with validated model slugs. Include a focused regression test to assert provider and per-token pricing values.

Made-with: Cursor
2026-04-01 12:12:36 +05:30
Sameer Kankute
54e6b25ddb
feat(gemini): Veo Lite pricing, size→resolution, usage video_resolution for cost tiers
Made-with: Cursor
2026-04-01 11:33:49 +05:30
Sameer Kankute
416ee25658
Merge branch 'main' into litellm_bedrock-embedded-region-model-path 2026-04-01 10:45:22 +05:30
Sameer Kankute
7c7c814656
feat(bedrock): parse embedded region from invoke model path
Made-with: Cursor
2026-04-01 10:41:07 +05:30
ryan-crabbe-berri
2f1cfb0548
Merge pull request #24751 from BerriAI/litellm_ryan-march-28
litellm ryan march 28
2026-03-31 17:25:30 -07:00
ishaan-berri
94e0f44798
Merge pull request #24882 from BerriAI/worktree-piped-exploring-patterson
docs: JWT → Virtual Key Mapping guide
2026-03-31 16:34:47 -07:00
stuxf
7066c895f6
chore: harden npm supply chain — pin overrides, enforce npm ci, add ignore-scripts (#24838)
* chore: harden npm supply chain — pin overrides, enforce npm ci, add ignore-scripts

Replace open-ended >= version overrides with exact pins matching lockfile
versions across all 6 package.json files. Remove dead overrides for packages
not present in lockfiles. Switch CI and devcontainer from npm install to
npm ci for deterministic lockfile-based installs.

Add .npmrc to all 7 JS project directories with ignore-scripts=true (blocks
postinstall RAT vectors like the axios@1.14.1 supply chain attack) and
min-release-age=3d (refuses packages published <3 days ago, requires npm
>=11.10). Remove Yarn-only resolutions field from docs/my-website.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: bump sharp to 0.33.5 in docs, add docs .npmrc

sharp 0.32.x uses postinstall to download native binaries, which breaks
with ignore-scripts=true. sharp 0.33+ distributes via optionalDependencies
instead, making it compatible with the new .npmrc hardening.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove docs .npmrc to fix Vercel deploy

Vercel's build for docs/my-website uses npm install which needs
sharp 0.32.6's postinstall script. Since we don't control Vercel's
build process, remove the .npmrc from docs rather than fight it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: Dockerfile npm ci + nvm checksum verification

- Replace npm install with npm ci in Dockerfile.non_root,
  Dockerfile.custom_ui, and spend-logs/Dockerfile for deterministic
  lockfile-based installs
- Replace curl-pipe-bash nvm install with download-then-verify pattern
  in build_admin_ui.sh, build_ui.sh, and build_ui_custom_path.sh
- Update nvm from v0.38.0 (2021) to v0.40.4 (Jan 2026) with SHA256
  checksum verification before execution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: macOS sha256sum compat + clarify min-release-age scope

- Use shasum -a 256 fallback on macOS where sha256sum is unavailable
- Clarify in .npmrc comments that min-release-age only protects local
  npm install, not npm ci (used in CI)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:41:37 -07:00
Ishaan Jaffer
4b5ca49cd2 fix: map file_url -> file_id in Responses->Completions translation 2026-03-31 12:59:01 -07:00
Sameer Kankute
40f50868a0
fix(router): don't create litellm_metadata for non-Responses API calls in encrypted_content_affinity_check
Using setdefault('litellm_metadata', {}) unconditionally created an empty
litellm_metadata key for chat completions and embeddings. This caused
_get_metadata_variable_name_from_kwargs to return 'litellm_metadata' instead
of 'metadata', so tag-based routing looked for tags in the wrong dict and
ignored all tag filters.

Fix: only set the encrypted_content_affinity_enabled flag when litellm_metadata
already exists (Responses API path). Chat completions and embeddings never have
this key, so nothing is created and tag routing works correctly.
2026-03-31 15:31:17 +05:30
Ishaan Jaffer
0ea05469bc test_completion_azure 2026-03-30 21:54:27 -07:00
ishaan-berri
77e6546e55
Merge pull request #24837 from BerriAI/lllm_build_and_test_fail
[Test] Move test_add_and_delete_model to Mock Test
2026-03-30 21:41:28 -07:00
Yuneng Jiang
e014dfb8e0
fix: mock encrypt_value_helper in lifecycle test
CI fails because LITELLM_MASTER_KEY is not set, causing
encrypt_value_helper to error on NoneType.encode(). Patch it
to pass through values unencrypted in the test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:36:40 -07:00
Ishaan Jaffer
823e7b2a9d test_completion_azure 2026-03-30 21:36:35 -07:00
Ishaan Jaffer
3034ac26f7 fix 2026-03-30 21:33:47 -07:00
Yuneng Jiang
b48c037712
test: replace test_add_and_delete_models integration test with mock
Skip the integration test that requires a live proxy and OPENAI_API_KEY
(removed from CI/CD). Add deterministic mock test covering the same
add → delete → double-delete-fails lifecycle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 21:30:57 -07:00
Ishaan Jaffer
669d2a6d8b test_router_init_azure_service_principal_with_secret_with_environment_variables 2026-03-30 21:15:53 -07:00
Ishaan Jaffer
8c6a67dae1 test_bedrock_embedding_cohere 2026-03-30 21:08:51 -07:00
Ishaan Jaffer
a7bfe0c540 test_completion_azure 2026-03-30 21:07:49 -07:00
Ishaan Jaffer
9b46d88371 test_completion_azure 2026-03-30 21:07:41 -07:00