Commit Graph

5310 Commits

Author SHA1 Message Date
Alexsander Hamir 5c61586e65 Add GCS mock mode for testing without API calls (#19683) 2026-01-23 16:25:32 -08:00
Alexsander Hamir 56883add3c Add Langfuse mock mode for testing without API calls (#19676) 2026-01-23 15:33:40 -08:00
milan-berri 37b7dff194 add spend-queue-troubleshooting docs (#19659)
* add spend-queue-troubleshooting docs

* adjust spend-queue-troubleshooting docs
2026-01-23 13:44:41 -08:00
Ishaan Jaffer 19141e180e docs fix 2026-01-23 11:06:02 -08:00
Ishaan Jaff c23e4b87dc [Feat] New LiteLLM Policy engine - create policies to manage guardrails, conditions - permissions per Key, Team (#19612)
* init PolicyMatcher

* TestPolicyMatcherGetMatchingPolicies

* TestPolicyMatcherGetMatchingPolicies

* feat: init PolicyResolver

* init resolver types

* init policy from config

* inint PolicyValidator

* validate policy

* init Architecture Diagram

* test_add_guardrails_from_policy_engine

* init _init_policy_engine

* test updates

* test fixws

* new attachment config

* simplify types

* TestPolicyResolverInheritance

* fix policy resolver

* fix policies

* fix applied policy

* docs fix

* docs fix

* fix linting + QA checks

* fix linting + QA fixes

* test fixes
2026-01-22 19:49:53 -08:00
milan-berri 11ee13a30e adjust opencode tutorial (#19605) 2026-01-22 16:54:46 -08:00
milan-berri c9516d68d4 add opencode tutorial (#19602) 2026-01-22 15:29:19 -08:00
yuneng-jiang ce586ec3d1 Overriding lodash-es with version 4.17.23 in docs 2026-01-22 12:13:40 -08:00
dependabot[bot] 4c3141f6a2 build(deps): bump lodash from 4.17.21 to 4.17.23 in /docs/my-website
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-22 14:16:03 +00:00
Sameer Kankute ddaf127b4a Merge pull request #19562 from BerriAI/litellm_stop_setting
feat: Limit stop sequence as per openai spec
2026-01-22 19:44:56 +05:30
Sameer Kankute 842e5b3ad6 Merge pull request #19560 from BerriAI/litellm_bedrock_invoke_structured_output
[Feat] Add support for output formatfor bedrock invoke via v1/messages
2026-01-22 19:44:48 +05:30
Sameer Kankute ad1edd38d5 Merge branch 'main' into litellm_staging_01_21_2026 2026-01-22 17:56:40 +05:30
Sameer Kankute 4d20c8fbc0 feat: Limit stop sequence as per openai spec 2026-01-22 17:52:13 +05:30
Sameer Kankute 24faca9bcf Add support for output formatfor bedrock invoke via v1/messages 2026-01-22 16:36:03 +05:30
Cesar Garcia 815e6fcf76 docs: update Claude Code integration guides (#19415)
* docs: document Claude Code default models and env var overrides

- Update config example with current Claude Code 2.1.x model names
- Add section documenting default models (sonnet/haiku) that Claude Code requests
- Document env var overrides (ANTHROPIC_DEFAULT_SONNET_MODEL, etc.)
- Show how model_name alias can route to any provider (Bedrock, Vertex, etc.)

* Update docs

Removed warning about changing model names in Claude Code versions.

* docs: add 1M context support and improve Claude Code quickstart guide

- Add comprehensive 1M context window documentation
- Document [1m] suffix usage and shell escaping requirements
- Clarify that LiteLLM config should NOT include [1m] in model names
- Add standalone claude_code_1m_context.md guide
- Improve model selection documentation with environment variables
- Add section on default models used by Claude Code v2.1.14
- Add troubleshooting for 1M context issues
- Reorganize to emphasize environment variables approach

Addresses GitHub issue #14444

* docs: reorder model selection options - prioritize --model over env vars

- Move command line/session model selection to Option 1 (most reliable)
- Move environment variables to Option 2
- Add note that env vars may be cached from previous session
- Emphasize that --model always uses exact model specified

* docs: reorganize 1M context section - separate command line from env vars

- Split 1M context examples into two clear sections
- Show command line usage first (--model and /model)
- Show environment variables as alternative approach
- Improves readability and emphasizes most reliable method

* docs: remove misleading default models section from website tutorial

- Remove 'Default Models Used by Claude Code' section (misleading)
- Remove claim that config must match exact default model names
- Update config comment to be more general
- Add claude-opus-4-5-20251101 to example config
- Keep authentication section as-is

* docs: correct model selection in website tutorial

- Remove incorrect claim that Claude Code automatically uses proxy models
- Add explicit model selection examples with --model and /model
- Show environment variables as alternative approach
- Remove misleading comment about 'multiple configured'

* docs: add 1M context section to website tutorial

- Add section on using [1m] suffix for 1 million token context
- Include warning about shell escaping (quotes required)
- Explain how Claude Code handles [1m] internally
- Add /context verification command
- Note that LiteLLM config should NOT include [1m]

* docs: add tip about using .env for API keys

- Add note that ANTHROPIC_API_KEY can be stored in .env file
- Clarifies alternative to exporting environment variables
2026-01-21 20:11:06 -08:00
Harshit Jain 746414eb9b Fix/per service ssl override v2 (#19538)
* refactor(ssl): support per-service SSL verification overrides

* add test cases for ssl
2026-01-21 20:10:04 -08:00
Ishaan Jaff ab606c9a73 [Feat] Add Structured output for /v1/messages with Anthropic API, Azure Anthropic API, Bedrock Converse (#19545)
* fix: add AnthropicMessagesRequestOptionalParams

* add _update_headers_with_anthropic_beta

* fix output format tests

* test_structured_output_e2e

* TestAnthropicAPIStructuredOutput

* test_structured_output_e2e

* fix BASE

* TestAzureAnthropicStructuredOutput

* fix: Bedrock Converse

* add nthropic Messages Pass-Through Architecture

* fix: bedrock invoke output_format

* fix: transform_anthropic_messages_request for vertex anthropic

* TestBedrockInvokeStructuredOutput

* docs anthropic vertex

* docs fix

* docs fix
2026-01-21 20:09:18 -08:00
Sameer Kankute 3794f86af0 Merge pull request #19502 from Chesars/docs/base-model-openai-dated-versions
docs(custom_pricing): add base_model usage for OpenAI dated model versions
2026-01-22 09:19:12 +05:30
Ishaan Jaff d5e912322f [Fix] VertexAI Pass through - Ensure only anthropic betas are forwarded down to LLM API (#19542)
* fix ALLOWED_VERTEX_AI_PASSTHROUGH_HEADERS

* test_vertex_passthrough_forwards_anthropic_beta_header

* fix test_vertex_passthrough_forwards_anthropic_beta_header

* test_vertex_passthrough_does_not_forward_litellm_auth_token

* fix utils

* Using Anthropic Beta Features on Vertex AI

* test_forward_headers_from_request_x_pass_prefix
2026-01-21 19:12:04 -08:00
Cesar Garcia 4106d24215 feat: add GMI Cloud provider support (#19376)
* feat: add GMI Cloud provider support

Add GMI Cloud as an OpenAI-compatible provider with:
- Provider configuration in providers.json
- Documentation page with usage examples
- Model pricing for 16 models (Claude, GPT, DeepSeek, Gemini, etc.)
- Sidebar entry for docs navigation

* Add gmi_cloud to provider_endpoints_support.json

Add provider entry to pass CI validation check that ensures all
providers in openai_like/providers.json are documented.

* Fix provider key: gmi_cloud -> gmi

Match the provider key with providers.json

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-01-21 15:48:15 -08:00
Chesars f64ff8327d docs(custom_pricing): add base_model usage for OpenAI dated model versions
Document how to use base_model to ensure custom pricing is applied when
OpenAI returns dated model names (e.g., gpt-4o-mini-audio-preview-2024-12-17)
that differ from the configured model name.
2026-01-21 11:18:51 -03:00
Sameer Kankute a1aba2ed8d Merge pull request #19491 from BerriAI/main
merge main 20 1 25
2026-01-21 16:40:48 +05:30
Ishaan Jaff a02c43d300 Litellm cc docs max (#19466)
* docs claude code max

* docs fix

* docs

* docs fix

* docs fix
2026-01-20 20:08:36 -08:00
Sampson 09941dd1d1 add search provider for brave search api (#19433)
* add search provider for brave search api

Introduces a minimal implementation of the Brave Search API as a search provider. Additionally, this PR introduces a test file to ensure the provider works properly, and numerous other smaller changes (e.g., changes to docs to mention the new option).

* Update transformation.py
2026-01-20 19:23:29 -08:00
Kamil Jopek ce722ab763 Make grpc dependency optional (#19447)
* Make grpc optional and document gRPC OTEL setup

* Add tests for missing OTLP gRPC imports
2026-01-20 19:03:52 -08:00
Ishaan Jaff ddebdd47bc [Feat] Add Support for Claude Code Max/OAuth 2 on LiteLLM AI Gateway (#19453)
* fix count_tokens_with_anthropic_api

* remove outdated file

* fix ANTHROPIC_TOKEN_COUNTING_BETA_VERSION

* refactor: get_token_counter

* init test suite for token counter

* init token counters

* fix: fix pyrightI

* fix Code QA issues

* feat: add OAUTH handling ant

* feat: Oauth handling Ant

* test anthopic common utils

* fix code QA

* docs
2026-01-20 17:21:17 -08:00
Cesar Garcia 94055741d4 docs: clarify Gemini vs Vertex AI model prefix behavior (#19443)
Add documentation explaining the difference between model formats:
- `gemini/model` → Gemini API (simple API key)
- `vertex_ai/model` → Vertex AI (GCP credentials)
- `model` (no prefix) → defaults to Vertex AI

This addresses user confusion when models without prefix require
GCP authentication instead of simple API key auth.

Ref #8424
2026-01-20 15:22:52 -08:00
Alexsander Hamir 5a06868652 Fix in-flight request termination on SIGTERM when health-check runs in a separate process (#19427) 2026-01-20 12:17:06 -08:00
Kris Xia 56bf6001e9 Supports setting media_resolution and fps parameters on each video file, when using Gemini video understanding. (#19273)
* feat: add gemini video metadata and detail support

Implement support for video_metadata and enhanced detail parameter
for Gemini 3.0+ models:

- Add video_metadata field to ChatCompletionFileObjectFile type
  - Supports fps, start_offset, and end_offset parameters
  - Properly converts snake_case to camelCase for Gemini API
- Extend detail parameter to support medium and ultra_high levels
  - Maps to MEDIA_RESOLUTION_MEDIUM and MEDIA_RESOLUTION_ULTRA_HIGH
- Update _process_gemini_image to handle video metadata transformation
- Add version gating to only apply features for Gemini 3+ models
- Add comprehensive test coverage (6 new test cases)
  - Test detail parameter with file objects
  - Test video_metadata fields (fps, start_offset, end_offset)
  - Test combined detail + video_metadata usage
  - Test new detail levels (medium, ultra_high)
  - Test version gating (Gemini 1.5 vs 3.0)

Note: video_metadata is only supported for video files but error
handling is delegated to Vertex AI for other media types.

* refactor: rename _process_gemini_image to _process_gemini_media

The function handles multiple media types (images, audio, video, PDF),
not just images. Renamed to better reflect its actual purpose.

- Update function name in transformation.py
- Update all function calls and references
- Update test names and imports to match
- Improve docstring to clarify it handles all media types

* docs: add video metadata and media resolution control documentation

Add comprehensive documentation for Gemini 3+ video processing features:
- Document media resolution control (detail parameter) for images and videos
- Add video_metadata field documentation (fps, start_offset, end_offset)
- Include usage examples with tabs for basic, combined, and proxy scenarios
- Update both Gemini and Vertex AI provider documentation
- Clarify snake_case to camelCase field conversion for Gemini API

Signed-off-by: Kris Xia <xiajiayi0506@gmail.com>

* refactor(gemini): extract metadata application into helper function

Extract duplicated Gemini 3+ media_resolution and video_metadata
application logic from _process_gemini_media into a dedicated
_apply_gemini_3_metadata helper function to improve code maintainability.

---------

Signed-off-by: Kris Xia <xiajiayi0506@gmail.com>
2026-01-20 11:36:55 -08:00
Krrish Dholakia f95f5563ea docs: document input/output/total tokens behaviour
Closes https://github.com/BerriAI/litellm/issues/17480
2026-01-20 10:45:47 -08:00
Ishaan Jaffer f6d6455cbc fix rc 2026-01-20 08:39:17 -08:00
Sameer Kankute dc3ee63359 fix: test_env_keys 2026-01-20 18:37:56 +05:30
Sameer Kankute ae414ed462 Revert "feat: add retry_delay, exponential_backoff, and jitter to completion(…"
This reverts commit 1678f621db.
2026-01-20 17:07:00 +05:30
Sameer Kankute deb9142117 Merge pull request #19400 from BerriAI/main
merge main iin 19/1 staging
2026-01-20 16:45:01 +05:30
Igal Boxerman d7ac8de832 docs: Migrate Pillar Security to Generic Guardrail API (#19364)
Update Pillar Security integration to use the generic_guardrail_api
instead of the dedicated pillar guardrail type. This aligns with
the Generic Guardrail API specification introduced in previous PRs.

Changes:
- Rewrite pillar_security.md with new generic_guardrail_api config
- Add Pillar Security example to generic_guardrail_api.md
- Add Pillar Security to quick_start.md guardrails examples

Related PRs: #17175, #18647, #18932, #19023
2026-01-19 20:35:56 -08:00
YutaSaito 00814d4d90 Merge pull request #19379 from BerriAI/litellm_feat_mcp_version_up
[feat] mcp version up
2026-01-20 13:09:29 +09:00
Ishaan Jaffer ea2e360cb5 docs 2026-01-19 19:49:51 -08:00
Ishaan Jaffer f865f92bec docs plugin marketplaces 2026-01-19 19:42:15 -08:00
Will Chen 2761077820 docs: fix vertex_region to vertex_location in Vertex AI pass-through docs (#19380)
The documentation incorrectly used `vertex_region` as the parameter name,
but the actual parameter expected by LiteLLM is `vertex_location` as defined
in VertexPassThroughCredentials and other type definitions.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-19 19:15:17 -08:00
Yuta Saito ec7bf0ff1a Merge remote-tracking branch 'upstream/main' into litellm_feat_mcp_version_up 2026-01-20 09:52:38 +09:00
Yuta Saito e5bc2d31d0 docs: mcp version up 2026-01-20 07:56:38 +09:00
0x1f99d 1cce718551 fix(bedrock): deduplicate tool calls in assistant history (#15178) (#19324)
* fix: Avoid attaching tool calls when a call_id already exists

* fix: Prevent MCP responses from reviving past tool calls via previous_response_id

* test: Parametrize MCP streaming test to cover OpenAI and Anthropic models

* test: Fail MCP streaming test when LiteLLM logs errors during follow-up calls

* test: Let MCP tool-execution mock accept new kwargs for streaming tests

* chore: fix lint error

* docs: Add Google Workload Identity Federation (WIF) documentation to Vertex AI (#19320)

- Added new section documenting WIF support for Vertex AI authentication
- Included SDK and Proxy configuration examples
- Added sample WIF credentials file format for AWS federation
- Mentioned LLM Credentials UI as an alternative for credential management
- Added link to Google Cloud WIF documentation

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* fix(bedrock): deduplicate tool calls in assistant history (#15178)

* fix(types): add missing Set import to factory.py

---------

Co-authored-by: Yuta Saito <uc4w6c@bma.biglobe.ne.jp>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: YutaSaito <36355491+uc4w6c@users.noreply.github.com>
2026-01-19 10:56:49 -08:00
Alexsander Hamir 3cdeebb5b8 fix(gcs_bucket): prevent unbounded queue growth due to slow API calls (#19297) 2026-01-19 10:47:56 -08:00
Cesar Garcia d30c25af21 feat(gemini): use responseJsonSchema for Gemini 2.0+ models (#19314)
* feat(gemini): add opt-in support for responseJsonSchema

Add support for Gemini's native responseJsonSchema parameter which uses
standard JSON Schema format instead of OpenAPI-style responseSchema.

Benefits of responseJsonSchema (Gemini 2.0+ only):
- Standard JSON Schema format (lowercase types)
- Supports additionalProperties for stricter validation
- Better compatibility with Pydantic's model_json_schema()
- No propertyOrdering required

Usage:
```python
response_format={
    "type": "json_schema",
    "json_schema": {"schema": {...}},
    "use_json_schema": True  # opt-in
}
```

This is backwards compatible - existing code continues to use
responseSchema by default.

Closes #16340

* docs: add documentation for use_json_schema parameter

Document the new use_json_schema option for Gemini 2.0+ models
in the JSON Mode documentation.

* refactor(gemini): use responseJsonSchema by default for Gemini 2.0+

Remove opt-in flag `use_json_schema` and automatically detect model version:
- Gemini 2.0+: uses responseJsonSchema (standard JSON Schema, supports additionalProperties)
- Gemini 1.5: uses responseSchema (OpenAPI format, legacy)

This follows LiteLLM's philosophy of abstracting provider differences -
users write the same code regardless of model version.

* test(vertex): update json_schema tests to accept both responseSchema formats

Gemini 2.x+ uses responseJsonSchema while Gemini 1.x uses responseSchema.
Update tests to accept both formats since litellm now auto-selects based
on model version.
2026-01-19 10:45:37 -08:00
Harshit Jain 99c4ba7adf docs: fix bad examples from sdk (#19322) 2026-01-19 10:27:25 -08:00
Harshit Jain 1678f621db feat: add retry_delay, exponential_backoff, and jitter to completion() (#19371) 2026-01-19 10:27:01 -08:00
Krish Dholakia 0862373b38 docs: add note about no limits on users/keys/teams in LiteLLM OSS (#19367)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-19 08:22:18 -08:00
Cesar Garcia 4d6a430adc docs: update UI contributing guide (#19353)
* docs: update UI contributing guide with correct commands

- Replace outdated proxy_cli.py command with poetry run litellm
- Add config.yaml example with required settings
- Clarify that UI comes pre-built in the repo
- Add two development options: Build Mode and Dev Mode (hot reload)
- Note about redirect issues in Dev Mode

* docs: add hot reload login flow and PR submission section

- Document the 3000 -> 4000 -> 3000 login flow for hot reload
- Reorder: Hot Reload as Option A, Build Mode as Option B
- Add section 4 on submitting PRs
- Add note that UI changes don't require tests

* Update login flow navigation URL in contributing.md
2026-01-19 06:18:45 -08:00
Manuel Schweigert 29adf34313 Add ChatGPT subscription support and responses bridge (#19030)
* Add ChatGPT subscription support and responses bridge

* Fix typing import for responses bridge

* Guard device code timestamp parsing

* add /v1/messages endpoint to chatgpt model
2026-01-19 05:37:45 -08:00
Sameer Kankute 0a15f1b66a Fix: stability image optional para 2026-01-19 09:05:52 +05:30