Commit graph

491 commits

Author SHA1 Message Date
Christopher Baer
589c6cdad0
fix(gemini-embeddings): convert task_type to camelCase taskType for Gemini API (#24191)
The Gemini REST API documents the embedding task type parameter as
camelCase `taskType`. The existing transformation functions convert
`dimensions` to `outputDimensionality` but miss the parallel
`task_type` to `taskType` conversion. This adds that conversion to
both `transform_openai_input_gemini_content` (batchEmbedContents path)
and `transform_openai_input_gemini_embed_content` (embedContent path).

Fixes #24190
2026-03-20 22:32:22 +05:30
Shivam Rawat
f5ffc59309
fix(proxy): Windows compatibility for Prisma engine watchdog (#23494)
Guard os.waitpid and os.WNOHANG usage with sys.platform check.
These APIs are Unix-only; on Windows they cause AttributeError
and prevent proxy startup.

- _try_waitpid_watch: return False on Windows, fall back to
  os.kill polling
- _reap_all_zombies: return empty set on Windows (no zombies)

Add unit tests for Windows path.

Made-with: Cursor
2026-03-12 16:02:37 -07:00
Sameer Kankute
2a9bcf2530 Fix greptile reviews 2026-03-11 11:41:29 +05:30
Sameer Kankute
d25b8e6d00 Add support for gcs url for vertex ai embeddings 2026-03-11 10:58:04 +05:30
Sameer Kankute
b108c02fd7 Add support for gemini multimodal embedings 2026-03-11 10:08:17 +05:30
yuneng-jiang
79817ff796 [Fix] Constrain feature_name to Literal, deduplicate runtime flags, fix silent test swallowing
- rbac_utils.py: change feature_name from str to Literal["agents", "vector_stores"]
  so typos are caught by type checkers at import time
- proxy_setting_endpoints.py: extract _RUNTIME_GENERAL_SETTINGS_FLAGS as a module-level
  constant, replacing duplicated inline lists in get_ui_settings and update_ui_settings
- test_vector_store_rbac.py: remove try/except pattern that silently swallowed non-403
  HTTPExceptions; tests now let any unexpected exception propagate as a test failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 15:42:17 -08:00
yuneng-jiang
b3c092f489 [Fix] Address code review: delegate team admin check to shared helper, fix sidebar team admin exemption
- rbac_utils.py: remove duplicated _check_if_team_admin/_is_user_team_admin_for_any_team;
  delegate to _user_has_admin_privileges from management_endpoints/common_utils with the
  shared user_api_key_cache (fixes no-op DualCache and missing org admin coverage)
- test_rbac_utils.py: update patch target to match new delegation path
- SidebarProvider.tsx: pass allowAgentsForTeamAdmins and allowVectorStoresForTeamAdmins
  props to Sidebar
- leftnav.tsx: add useTeams hook + isTeamAdmin memo; exempt team admins from sidebar
  filtering when allow_*_for_team_admins is enabled (fixes frontend/backend inconsistency)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 15:04:33 -08:00
yuneng-jiang
96b75be03d [Feature] RBAC for Vector Stores and Agents
Add proxy-admin-configurable toggles to restrict internal users (and optionally
team admins) from accessing agent and vector store management features.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 20:13:14 -08:00
Cesar Garcia
d384f7c320
Merge pull request #21233 from Chesars/feat/per-request-json-schema-validation
feat: support per-request enable_json_schema_validation for thread safety
2026-03-03 15:29:54 -03:00
Cesar Garcia
bca1964f70
Merge pull request #22603 from BerriAI/fix/helicone-vertex-gemini-provider-url
fix(helicone): correct provider URL for Vertex AI Gemini models
2026-03-03 15:23:51 -03:00
Chesars
4a88d85446 test: add provider_url routing test for vertex_ai/gemini models
Verifies that vertex_ai gemini models route to
aiplatform.googleapis.com instead of
generativelanguage.googleapis.com, preventing
regressions if the branch ordering changes.
2026-03-03 15:20:51 -03:00
Chesars
909e3ce6c9 test: create fresh ModelResponse per test to avoid shared mutable state 2026-03-03 14:54:11 -03:00
Chesars
9463de0c66 fix: correct indentation from commit suggestions and add missing Optional import 2026-03-03 10:51:48 -03:00
Cesar Garcia
7d664f0c09
Update tests/litellm/proxy/test_batch_x_litellm_model_encoding.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-03 10:45:00 -03:00
Cesar Garcia
3426b905ce
Update tests/litellm/proxy/test_batch_x_litellm_model_encoding.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-03 10:44:47 -03:00
Chesars
5ad0d03671 fix(proxy): encode batch IDs with model info when x-litellm-model header is used
When create_batch routes via x-litellm-model header, the response batch_id
was returned raw without model routing info. This meant retrieve_batch could
not determine which provider/credentials to use, defaulting to "openai"
instead of the correct provider (e.g., VLLM).

Now encodes batch_id, output_file_id, and error_file_id with model info
(same pattern as the model-embedded file_id flow in Scenario 1), so
retrieve_batch can decode and route back to the correct provider.
2026-03-03 10:26:03 -03:00
Chesars
ec16bd3509 merge: resolve conflict with upstream/main in presidio.py
Take upstream's refactored PII handling with _unmask_pii_text and
_process_response_for_pii helpers. Add missing StreamingChoices import.
2026-03-02 17:40:22 -03:00
Cesar Garcia
0da565f023
Revert "fix(adapter): double-stripping of model names with provider-matching prefixes" 2026-03-02 17:12:48 -03:00
Darien Kindlund
fca08e8acc fix: escalate to heavy Prisma reconnect after consecutive lightweight failures (#22211)
When the Prisma query engine process is alive but not accepting
connections (e.g., startup race condition in containerized
deployments), lightweight reconnects (disconnect + connect) will
never succeed. The health watchdog retries indefinitely without
escalating to a full Prisma client recreation.

Adds a consecutive failure counter that triggers a heavy reconnect
(full Prisma client and engine recreation) after 3 consecutive
lightweight reconnect failures (configurable via
PRISMA_RECONNECT_ESCALATION_THRESHOLD env var).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 19:21:11 +05:30
Julio Quinteros Pro
ce0753243b
Merge pull request #22193 from BerriAI/test/secret-scan-ci
test(ci): add secret scan test and CI job
2026-02-28 14:05:55 -03:00
Chesars
8a85a2cf82 Merge branch 'litellm_oss_staging_02_27_2026' of https://github.com/BerriAI/litellm into litellm_oss_staging_02_27_2026 2026-02-28 09:54:56 -03:00
Dylan Duan
af6fe184fb
docs: update AssemblyAI docs with Universal-3 Pro, Speech Understanding, and LLM Gateway (#21130)
* docs: update AssemblyAI docs with Universal-3 Pro, Speech Understanding, and LLM Gateway provider config

* feat: add AssemblyAI LLM Gateway as OpenAI-compatible provider
2026-02-27 17:24:48 -08:00
Rahul Dhanawade
64c85dbc9f
Fix/claude code plugin schema (#22271)
* fix: add missing LiteLLM_ClaudeCodePluginTable to schema.prisma

- Claude Code Plugin Marketplace endpoints (/claude-code/marketplace.json,
  /claude-code/plugins) were returning 500 errors because
  LiteLLM_ClaudeCodePluginTable model was missing from both schema.prisma files
- Prisma client was generated without this table causing AttributeError:
  'Prisma' object has no attribute 'litellm_claudecodeplugintable'
- Added missing model definition to root schema.prisma and
  litellm/proxy/schema.prisma

Fixes #21310

* test: add regression test for LiteLLM_ClaudeCodePluginTable schema

* fix: address greptile review - add @updatedAt, clean up test imports
2026-02-27 15:59:37 -08:00
Cesar Garcia
6430173bde
Merge pull request #20516 from Chesars/fix/openrouter-native-model-double-strip
fix(adapter): double-stripping of model names with provider-matching prefixes
2026-02-27 18:58:37 -03:00
Cesar Garcia
1e68b17a14
Merge pull request #19288 from Chesars/fix/helicone-gemini-support
fix(helicone): add Gemini and Vertex AI support to HeliconeLogger
2026-02-27 18:33:15 -03:00
Cesar Garcia
fc7bc9147f
Merge pull request #21629 from Chesars/fix/pydantic-serialization-warnings
fix(types): remove StreamingChoices from ModelResponse, use ModelResponseStream
2026-02-27 17:48:33 -03:00
Julio Quinteros Pro
2fce35a162 test(ci): add secret scan test and CI job to prevent hardcoded credentials
- Add unit test that scans Python source for Base64 Basic Auth patterns
  that would be flagged by secret scanners like GitGuardian/ggshield
- Add secret-scan job to the linting CI workflow that runs the test on
  every PR and optionally runs ggshield if GITGUARDIAN_API_KEY is set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 12:46:42 -03:00
Harshit28j
e50b4486d0 fix Unauthenticated RCE and Sandbox Escape in Custom Code Guardrail 2026-02-25 17:57:32 +05:30
Henrique Cavarsan
7ae157198b
fix(proxy): recover from prisma-query-engine zombie process (#21899)
* fix(proxy): recover from prisma-query-engine zombie process

* fix(proxy): remove unused imports and extract helper to fix PLR0915 in utils.py
2026-02-23 08:57:01 -08:00
yuneng-jiang
8c5be4cb62
Revert "fix(proxy): recover from prisma-query-engine zombie process (#21707)"
This reverts commit 977ad015ca.
2026-02-21 14:20:06 -08:00
Henrique Cavarsan
977ad015ca
fix(proxy): recover from prisma-query-engine zombie process (#21707) 2026-02-21 09:31:44 -08:00
Sameer Kankute
36fd14357c FIx: replace deprecated claude-3-7-sonnet-20250219 with claude-4-sonnet-20250514 2026-02-20 17:27:59 -08:00
Chesars
0f20976efa fix(types): remove StreamingChoices from ModelResponse, use ModelResponseStream
ModelResponse.choices was typed as List[Union[Choices, StreamingChoices]] which
caused Pydantic serialization warnings and false linting errors. Now that
ModelResponseStream exists for streaming, narrow ModelResponse.choices to
List[Choices] and migrate all ModelResponse(stream=True) call sites to use
ModelResponseStream() instead.
2026-02-20 17:47:42 -03:00
michelligabriele
8fdd330835
fix(proxy): use batch_ prefix for Vertex AI batch IDs in encode_file_id_with_model (#21624)
Vertex AI batch IDs are plain numeric strings (e.g., "3814889423749775360")
unlike OpenAI's "batch_"-prefixed IDs. encode_file_id_with_model() was
defaulting to "file-" prefix for unrecognized ID formats, causing Vertex AI
batch responses to return IDs like "file-bGl0ZWxsbTox..." instead of the
expected "batch_..." prefix per the OpenAI Batch API contract.

Add an optional id_type parameter to encode_file_id_with_model() so the
batch creation endpoint can specify id_type="batch" when encoding batch
response IDs. Default remains "file" for backward compatibility.

Closes #18192
2026-02-20 08:32:46 -08:00
Chesars
3aea9c81c9 fix(openrouter): prevent double-stripping of native model names in get_llm_provider
Move the fix to the OpenRouter level: define native OpenRouter models
(openrouter/auto, openrouter/free, openrouter/bodybuilder) and check
them in get_llm_provider() before the provider_list stripping logic.
This prevents the second strip across all bridges without modifying
each adapter/handler individually.

Fixes #16353
2026-02-19 15:50:39 -03:00
Sameer Kankute
aa255c7e63
Merge pull request #21361 from BerriAI/litellm_oss_staging_02_17_2026
Litellm oss staging 02 17 2026
2026-02-18 17:48:15 +05:30
ryanh-ai
8e8511a2a3
feat(bedrock): support nova/ and nova-2/ spec prefixes for custom imported models (#21359)
Add routing prefixes bedrock/nova/<ARN> and bedrock/nova-2/<ARN> so
LiteLLM can identify the base model family for custom/imported Nova
models and enable the correct supported params (tools, web_search,
reasoning_effort).

Changes:
- Route nova/ and nova-2/ prefixed models to converse API
- Strip spec prefix before sending ARN to Bedrock
- Return sentinel base models (amazon.nova-custom, amazon.nova-2-custom)
  so downstream Nova checks work
- Recognize nova-2/ prefix in _is_nova_2_model() for reasoning support
- Handle nova/nova-2 in get_bedrock_model_id() for proper ARN encoding
- Add unit tests for all new behavior
2026-02-17 23:00:37 -08:00
Shivam Rawat
d448682291
fix: prevent double-counting of litellm_proxy_total_requests_metric (#21159)
* fixed double counting

* Update litellm/proxy/utils.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* reverse prev commit

* Update litellm/proxy/utils.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* removed else branch

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-16 09:10:49 -08:00
Chesars
f5e46f621a feat: support per-request enable_json_schema_validation for thread safety
Allow passing enable_json_schema_validation as a parameter to completion()
and acompletion() instead of only relying on the global
litellm.enable_json_schema_validation flag. The per-request value takes
priority when provided; otherwise falls back to the global (backward
compatible). This makes JSON schema validation safe for concurrent usage
in FastAPI and other multi-threaded environments.
2026-02-14 21:51:08 -03:00
shin-bot-litellm
84934a7258
fix(anthropic): filter unsupported JSON schema constraints for structured outputs (#20813)
* fix(anthropic): filter unsupported JSON schema constraints for structured outputs

Fixes 400 error when using Anthropic models with structured outputs that have
min/max constraints.

The Anthropic API doesn't support these JSON schema constraints:
- minimum/maximum (numeric)
- exclusiveMinimum/exclusiveMaximum (numeric)
- minLength/maxLength (string)
- minItems/maxItems (array)

This mirrors the transformation done by the official Anthropic Python SDK.
See: https://platform.claude.com/docs/en/build-with-claude/structured-outputs#how-sdk-transformation-works

Adds tests for the schema filtering function.

* fix: update descriptions with removed constraint info in filter_anthropic_output_schema

Address review feedback: the function now appends removed constraint
information to the description field (matching Anthropic SDK behavior),
rather than silently dropping constraints.

---------

Co-authored-by: OpenClaw <openclaw@users.noreply.github.com>
2026-02-14 09:07:40 -08:00
Sameer Kankute
8a2bc265af feat(bedrock): add support for 4 new beta models (#20974)
* feat(bedrock): add DeepSeek V3.2 pricing and region support

* feat(bedrock): add minimax.minimax-m2.1  pricing and region support

* feat(bedrock): add moonshotai.kimi-k2.5  pricing and region support

* feat(bedrock): add qwen.qwen3-coder-next
  pricing and region support

* add some sanity unit tests for the bedrock beta models added

* --amend

* resolve greptileai comments and suggestions
2026-02-13 18:32:12 +05:30
yuneng-jiang
df15456bcc
Merge pull request #20598 from muraliavarma/fix/team-update-empty-premium-fields-403
fix(proxy): skip premium check for empty metadata fields on team/key update
2026-02-12 10:10:27 -08:00
Sameer Kankute
59d6ab8a00
Merge branch 'main' into litellm_oss_staging_02_11_2026 2026-02-12 20:04:46 +05:30
Emerson Gomes
8f242c42a1 fix(batch_completion): submit all model futures before waiting (#20705)
* fix(batch_completion): submit all model futures before waiting

* test: add batch_completion all responses concurrency regression

* fix(batch_completion): continue collecting responses on per-model failures

* fix(batch_completion): handle empty and string models in all responses

* test(batch_completion): avoid blocking wait in concurrency regression
2026-02-11 15:44:37 +05:30
Cesar Garcia
6fc78d4132
fix: reasoning_effort=None and "none" should return None for Opus 4.6 (#20800)
* fix: reasoning_effort=None returns None for Opus 4.6

Previously, _map_reasoning_effort would return adaptive thinking
for Opus 4.6 even when reasoning_effort was None, which breaks the
expected contract where None means no thinking is sent.

* fix: handle reasoning_effort="none" string for Opus 4.6

The string "none" is a valid OpenAI reasoning_effort value meaning
"disable thinking". Previously it was mapped to adaptive for Opus 4.6.

* Update tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-10 22:45:18 -08:00
Emerson Gomes
ad4b2dc820
fix(router): use current retry exception for retry backoff (#20725)
* fix(router): use current retry exception for backoff

* test(router): clarify retry backoff invocation count
2026-02-10 22:44:25 -08:00
Murali
52c9cf6058 fix(proxy): skip premium check for empty metadata fields on team/key update
Fixes #20534

The UI sends the full form on every team update, including premium
metadata fields like `policies: []` and `team_member_key_duration: ""`.
The backend's `_update_metadata_fields` treated any non-None value as
premium feature usage and returned 403 for non-enterprise users — even
when the fields were empty and the user was just updating basic settings
like team name or budget.

Added `_has_non_empty_value` helper and use it in the premium field gate
in `_update_metadata_fields` so empty lists, blank strings, and None
values skip the premium check entirely. Non-empty values still enforce
the enterprise requirement as before.
2026-02-06 14:50:24 -05:00
Cesar Garcia
b33e1e8019
feat(sdk): add proxy_auth for auto OAuth2/JWT token management (#20238)
Adds litellm.proxy_auth to automatically obtain and refresh OAuth2/JWT
tokens when connecting to LiteLLM Proxy or any OAuth2-protected endpoint.

- Add ProxyAuthHandler for token lifecycle (obtain, cache, refresh)
- Add AzureADCredential wrapper for azure-identity credentials
- Add GenericOAuth2Credential for any OAuth2 provider (Okta, Auth0, etc)
- Auto-inject Authorization headers in completion() and embedding()

Closes #19834
2026-02-02 22:04:08 -08:00
Cesar Garcia
c7453c01f9
Fix stream_chunk_builder to preserve images from streaming chunks (#19654)
Fixes #19478

The stream_chunk_builder function was not handling image chunks from
models like gemini-2.5-flash-image. When streaming responses were
reconstructed (e.g., for caching), images in delta.images were lost.

This adds handling for image_chunks similar to how audio, annotations,
and other delta fields are handled.
2026-01-28 21:31:06 -08:00
Sameer Kankute
4f7425df0c
Merge pull request #19661 from Chesars/fix/oci-image-url-format
fix(oci): serialize imageUrl as object for OCI GenAI API
2026-01-28 15:26:50 +05:30