Commit Graph
23641 Commits
Author SHA1 Message Date
Better than breakfast.andGitHub f8c09e44f6 fix: Set user from token user_id for OpenMeter integration (#13029) 2025-07-29 15:41:50 -07:00
Marvin HuetterandGitHub d23a6e3ea4 fix: best practices suggest this to set to true (#12809)
The order of the specification is important here, k8s will take the last value as truth. Push down to be sure schema update is done by migration job
2025-07-29 15:40:12 -07:00
Pathikrit BhowmickandGitHub 52f097eb9d BUGFIX: Jitter should be added not multiplied (#12877) (#12901)
* Jitter should be added not multiplied

This fixes a bug mentioned in https://github.com/BerriAI/litellm/issues/12877

`JITTER=0.75` is multiplied by `random.random()` so `sleep_seconds*jitter` is a tiny number that is always less than `min_timeout`.

jitter should be added not multiplied

* Add jitter to min_timeout case also

* Cleanup jitter logic

* Always apply jitter
2025-07-29 15:38:08 -07:00
MaksimandGitHub f3b1b416d1 fix: always use choice index=0 for Anthropic streaming responses (#12666)
- Fixed 'missing finish_reason for choice 1' error with reasoning_effort
- Anthropic sends multiple content blocks with different indices
- OpenAI expects all content in a single choice at index=0
- Added comprehensive tests for text-only, text+tool, and multiple tools
2025-07-29 14:42:01 -07:00
Ishaan JaffandGitHub c44e6017c0 fix mcp dep for litellm (#13102) 2025-07-29 14:25:22 -07:00
Ishaan Jaff b5048e2b2a docs AZURE_CERTIFICATE_PASSWORD 2025-07-29 14:25:14 -07:00
Jugal D. BhattandGitHub 8352680363 add openrouter grok4 (#13018) 2025-07-29 14:24:33 -07:00
Ishaan JaffandGitHub a6f7c70185 [Feat] Allow using query_params for setting API Key for generateContent routes (#13100)
* fix is_generate_content_route

* fix route checks

* fix get_api_key
2025-07-29 14:11:06 -07:00
Shao-Kan ChuandGitHub c2f6937455 set default value for mcp namespace tool name to prevent duplicate entry in table (#12894) 2025-07-29 13:47:16 -07:00
Ishaan JaffandGitHub 4878bc6275 [Bug Fix] Gemini-CLI - The Gemini Custom API request has an incorrect authorization format (#13098)
* fix GoogleGenAIConfig

* fix validate_environment

* test_agenerate_content_x_goog_api_key_header
2025-07-29 13:46:43 -07:00
Cole McIntoshandGitHub 8a4a40844e fix: improve MCP server URL validation to support internal/Kubernetes URLs (#13099)
* fix: improve MCP server URL validation to support internal/Kubernetes URLs

- Replace strict Ant Design URL validator with flexible custom validator
- Allow URLs like http://service-name.domain.svc.cluster.:1234/mcp
- Update both create and edit MCP server forms for consistency

* refactor: extract MCP server validation into reusable utilities

- Move URL validation logic to utils.tsx to follow DRY principles
- Add validateMCPServerUrl function for flexible URL validation
- Add validateMCPServerName function for hyphen validation
- Update both create and edit components to use shared utilities
- Reduces code duplication and improves maintainability
2025-07-29 13:36:19 -07:00
Jugal D. BhattandGitHub ae9a02d7d5 [MCP gateway] add pre and during call hooks init (#13067)
* add hook init

* add during hook

* added logging
2025-07-29 11:06:58 -07:00
4639be0c64 Fix list team v2 security check (#13094)
* Fix security vulnerability in list_team_v2 endpoint

- Add missing allowed_route_check_inside_route security check to list_team_v2
- Add @management_endpoint_wrapper decorator for consistency with list_team
- Add comprehensive tests to verify security checks work correctly
- Ensure non-admin users can only query their own teams
- Ensure admin users can query all teams

This fixes a security bug where non-admin users could potentially access
team information they shouldn't have access to through the list_team_v2
endpoint, which was missing the authorization check present in list_team.

* Fix test

* Test fixes

* Fixed test

* Restored invalid delete

* Revert

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2025-07-29 10:29:40 -07:00
Max RabinandGitHub 918e46d025 Remove extraneous s in docs (#13079) 2025-07-29 08:39:42 -07:00
039c8a922c Azure api_version="preview" support + Bedrock cost tracking via Anthropic /v1/messages (#13072)
* fix(azure/chat/gpt_transformation.py): support api_version="preview"

Fixes https://github.com/BerriAI/litellm/issues/12945

* Fix anthropic passthrough logging handler model fallback for streaming requests (#13022)

* fix: anthropic passthrough logging handler model fallback for streaming requests

- Add fallback logic to retrieve model from logging_obj.model_call_details when request_body.model is empty
- Fixes issue #12933 where streaming requests to anthropic passthrough endpoints would crash due to missing model field
- Ensures downstream logging and cost calculation work correctly for all streaming scenarios
- Maintains backwards compatibility with existing non-streaming requests

* test: add minimal tests for anthropic passthrough logging handler model fallback

- Add unit tests for the model fallback logic in _handle_logging_anthropic_collected_chunks
- Test existing behavior when request_body.model is present
- Test fallback logic when request_body.model is empty but logging_obj.model_call_details has model
- Test edge cases where both sources are empty or missing
- Ensure backwards compatibility and graceful degradation

* fix(anthropic_passthrough_logging_handler.py): add provider to model name (accurate cost tracking)

* fix(anthropic_passthrough_logging_handler.py): don't reset custom llm provider, if already set

* fix: fix check

---------

Co-authored-by: Haggai Shachar <haggai.shachar@backline.ai>
2025-07-29 08:13:55 -07:00
Ishaan Jaff 33510120fd docs 2025-07-28 22:02:35 -07:00
Cole McIntoshandGitHub 3a347922c8 docs: add Qwen Code CLI tutorial (#12915)
- Add new tutorial for integrating Qwen Code CLI with LiteLLM Proxy
- Update sidebar to include Qwen Code CLI in both AI Tools and main Tutorials sections
- Document environment variables for OpenAI-compatible configuration
- Include examples for routing to various providers (Anthropic, OpenAI, Bedrock)
2025-07-28 21:39:02 -07:00
Felix BurmesterandGitHub 51bbd12116 Added handling for pwd protected cert files in AOAI CertificateCredential auth (#12995) 2025-07-28 21:34:54 -07:00
tanjiroandGitHub ec2c5b3d07 default to 7 days (#12917) 2025-07-28 21:27:43 -07:00
Ishaan JaffandGitHub a8371d2cb1 [Feat] Add Google AI Studio Imagen4 model family (#13065)
* add gemini

* add init files

* add get_gemini_image_generation_config

* refactor transform

* TestGoogleImageGen

* fix transform

* fix transform

* add gemini_image_cost_calculator

* add cost tracking for gemini/imagen models

* docs image gen

* docs image gen

* test_get_model_info_gemini
2025-07-28 21:25:40 -07:00
Krrish Dholakia 2ffc781864 bump: version 1.74.9 → 1.74.10 2025-07-28 17:52:20 -07:00
Krrish Dholakia 378db1b62d test: remove o1-preview 2025-07-28 17:47:57 -07:00
Ishaan JaffandGitHub 078096247b [Bug Fix] The model gemini-2.5-flash with the merge_reasoning_content_in_choices parameter does not work (#13066)
* _optional_combine_thinking_block_in_choices

* test_optional_combine_thinking_block_with_none_content
2025-07-28 17:42:28 -07:00
Krrish Dholakia 16af2d9a50 test: skip dbrx claude 3-7 sonnet test - rate limit errors 2025-07-28 17:34:42 -07:00
Jugal D. BhattandGitHub ba95541571 [MCP gateway] add url namespacing docs (#13063)
* added the url docs

* Added url change
2025-07-28 17:28:55 -07:00
Jugal D. BhattandGitHub 33c012a49d fix scrolling issue (#13015) 2025-07-28 17:28:10 -07:00
75ae43e667 feat(langfuse-otel): Add comprehensive metadata support to Langfuse OpenTelemetry integration (#12956)
* feat(langfuse-otel): Add comprehensive metadata support to Langfuse OpenTelemetry integration

This commit brings the langfuse_otel integration to feature parity with the vanilla Langfuse integration by adding support for all metadata fields.

Changes:
- Extended LangfuseSpanAttributes enum with all supported metadata fields:
  - Generation-level: generation_name, generation_id, parent_observation_id, version, mask_input/output
  - Trace-level: trace_user_id, session_id, tags, trace_name, trace_id, trace_metadata, trace_version, trace_release, existing_trace_id, update_trace_keys
  - Debug: debug_langfuse

- Implemented metadata extraction and mapping in langfuse_otel.py:
  - Added _extract_langfuse_metadata() helper to extract metadata from kwargs
  - Support for header-based metadata (langfuse_* headers) via proxy
  - Enhanced _set_langfuse_specific_attributes() to map all metadata to OTEL attributes
  - JSON serialization for complex types (lists, dicts) for OTEL compatibility

- Updated documentation:
  - Added 'Metadata Support' section explaining all fields are now supported
  - Provided usage example showing how to pass metadata
  - Clarified that traces are viewed in Langfuse UI (not generic OTEL backends)
  - Added opentelemetry-exporter-otlp to required dependencies

This allows users to pass metadata like:
metadata={
    'generation_name': 'my-generation',
    'trace_id': 'trace-123',
    'session_id': 'session-456',
    'tags': ['prod', 'v1'],
    'trace_metadata': {'user_type': 'premium'}
}

All metadata is exported as OpenTelemetry span attributes with 'langfuse.*' prefix for easy filtering and analysis in the Langfuse UI.

* Fix ruff linting error

* test(langfuse-otel): Fix failing test and add comprehensive metadata tests

- Fix test_set_langfuse_environment_attribute to use positional arguments
  instead of keyword arguments when asserting safe_set_attribute calls
- Add test_extract_langfuse_metadata_basic to verify metadata extraction
  from litellm_params
- Add test_extract_langfuse_metadata_with_header_enrichment to test
  integration with header-based metadata using a stubbed LangFuseLogger
- Add test_set_langfuse_specific_attributes_full_mapping to comprehensively
  test all metadata field mappings and JSON serialization of complex types

These tests ensure full coverage of the langfuse_otel metadata features
added in commit ab1dbe355 and fix the CI test failure.

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-28 16:53:36 -07:00
Richard TweedandGitHub 3abf7cc871 chore: Improve docs for cost tracking (#12976) 2025-07-28 16:49:14 -07:00
direcisionandGitHub 31d8edb1bf fix: correct CompletionRequest messages type to match OpenAI API spec (#12980)
* fix: correct CompletionRequest messages type to match OpenAI API spec

- Changed messages field type from List[str] to List[ChatCompletionMessageParam]
- This ensures proper OpenAI API compatibility where messages should be objects with role and content fields
- Fixes type inconsistency in completion request handling

* feat(tests): Add comprehensive tests for CompletionRequest model

- Add test_completion.py for litellm.types.completion module
- Test ChatCompletionMessageParam type validation
- Test tool message format compatibility
- Test function message format (deprecated)
- Test multimodal content (text + image)
- Test default empty messages list
- Test all optional parameters
- Validate OpenAI ChatCompletion API message format compatibility
2025-07-28 16:47:20 -07:00
stellasecandGitHub 47f6984dce Properly parse json options for key generation in the UI (#12989) 2025-07-28 16:43:51 -07:00
Emmanuel FerdmanandGitHub 9459d72096 Remove duplicate test case verifying field filtering logic (#13023)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-07-28 16:40:06 -07:00
Ishaan JaffandGitHub deb1efa8ce [Bug Fix] Pass through logging handler VertexAI - ensure multimodal embedding responses are logged (#13050)
* fix _is_multimodal_embedding_response

* test_vertex_passthrough_handler_multimodal_embedding_response
2025-07-28 16:30:19 -07:00
Krrish Dholakia 2d697ca476 build: bump pip v1.74.9-stable v1.74.9.rc.1 2025-07-28 16:10:19 -07:00
Ishaan JaffandGitHub d5c61cc526 docs - openweb show how to include reasoning content (#13060) 2025-07-28 15:25:47 -07:00
Christoph KoehlerandGitHub 8f7d896e26 fix: add X-Initiator header for GitHub Copilot to reduce premium requests (#13016)
- Implement X-Initiator header logic in GithubCopilotConfig.validate_environment()
- Set header to "agent" when messages contain agent or tool roles, "user" otherwise
- Reduces unnecessary premium Copilot API usage for non-user calls

Fixes #12859
2025-07-28 09:55:24 -07:00
Krrish Dholakia 2da6d457ef test: update logic to fix for unit tests 2025-07-28 07:38:58 -07:00
Krrish Dholakia 8d49dd66cb build: update ui build 2025-07-27 11:50:56 -07:00
Krrish Dholakia 39b7ce5388 refactor(create_key_button.tsx): cleanup read only option (confusing) 2025-07-27 11:49:56 -07:00
Krrish Dholakia 3359464624 fix(proxy_settings_endpoints.py): fix clearing SSO settings 2025-07-27 11:13:40 -07:00
Krrish Dholakia 1b7f7ba643 build: build new ui 2025-07-27 11:08:27 -07:00
Krish DholakiaandGitHub 94aa6b0b5d Bulk User Edit - additional improvements - edit all users + set 'no-default-models' on all users (#12925)
* feat(bulk_user_update/): support updating all users on proxy

* fix(bulk_edit_user.tsx): persist user settings when 'add to team' clicked

* fix(team_endpoints.py): bulk add all proxy users to team

supports flow from UI to add all existing users to a team

* fix: minor fixes

* feat(user_edit_view.tsx): support setting no default model on user edit

allows preventing users from calling models outside team scope

* fix(user_edit_view.tsx): prevent triggering submit when 'cancel' is clicked

* refactor(internal_user_endpoints.py): refactor to reduce function size
2025-07-27 10:12:30 -07:00
Krish DholakiaandGitHub 1737cf4257 VertexAI - camelcase optional params for image generation + Anthropic - streaming, always ensure assistant role set on only first chunk (#12889)
* fix(vertex_ai/image_generation): transform `_` param to camelcase

Fixes https://github.com/BerriAI/litellm/issues/12690

* test(test_vertex_image_generation.py): add unit tests

* fix(streaming_handler.py): assert only 1 assistant chunk in stream

Fixes https://github.com/BerriAI/litellm/issues/12616

* fix(streaming_handler.py): fix check
2025-07-27 10:09:43 -07:00
Krrish Dholakia ff0b40a22b test: fix test 2025-07-27 09:52:22 -07:00
Krish DholakiaandGitHub e8a374fc47 Litellm release notes 07 27 2025 p1 (#13027)
* docs(index.md): initial commit for v1.74.9-stable release note

* docs(index.md): add more cost tracking models

* docs(index.md): add new llm api endpoints + mcp gateway features

* docs: add logging/guardrail improvements

* docs(index.md): complete initial draft

* build(model_prices_and_context_window.json): fix or pricing

* build(model_prices_and_context_window.json): fix or pricing
2025-07-27 09:46:25 -07:00
Ishaan Jaff 2c38dc0de7 test_router_auto_router 2025-07-26 13:33:53 -07:00
Jugal D. BhattandGitHub b921e22594 [MCP Gateway] Litellm mcp multi header propagation (#13003)
* change alias-> server_name

* add server alias uses

* add tests

* schema

* ruff fix

* fix alias for config

* fix tests

* add alias

* fix tests

* add multi server header support

* add and fix tests

* fix tests

* fix tests

* add a common util

* ruff fix

* fix ruff

* fix tests

* fix migration

* mypy fix

* change server py
v1.74.9.rc-draft
2025-07-26 11:45:14 -07:00
Krish DholakiaandGitHub eed0cf2ee9 UI SSO - fix reset env var when ui_access_mode is updated (#13011)
* fix(ui_sso.py): fix form action on login when sso is enabled

* fix: multiple fixes - fix resetting env var in proxy config + add key to exception message on key decryption

fixes issue where env vars would be reset

* refactor(proxy_server.py): cleanup redundant decryption line

* fix(proxy_setting_endpoints.py): show saved ui access mode

allows admin to know what they'd previously stored in db
2025-07-26 11:42:41 -07:00
Krish DholakiaandGitHub 4b50566d6d [FEAT] Model-Guardrails: Add on UI (#13006)
* feat(proxy_server.py): working guardrails on streaming output

ensures guardrail actually raises an error if flagged during streaming output

* test: add unit tests

* feat(advanced_settings.tsx): add guardrails option as ui component on model add

enables setting guardrails on model add

* feat(add_model_tab.tsx): fix add model form

* feat(model_info_view.tsx): support adding guardrails on model update

* fix(add_model_tab.tsx/): working health check when guardrails selected

* fix(proxy_server.py): fix yield
2025-07-26 11:42:03 -07:00
Jugal D. BhattandGitHub 586b1ec8b4 [Vector Store] make vector store permission management OSS (#12990)
* add vector store on ui behind enterprise in vector store

* remove enterprise
2025-07-26 11:13:49 -07:00
Matthias DittrichandGitHub 9211158e73 Fixup ollama model listing (again) (#13008) 2025-07-26 11:07:49 -07:00