- Remove risky __dict__ fallback for non-BaseModel objects
- Only convert BaseModel objects to dicts using model_dump() (consistent with line 4745-4746)
- Keep other objects unchanged to maintain backward compatibility
- Follows existing codebase patterns for Pydantic model serialization
- Convert Pydantic BaseModel objects (TextContent, ImageContent, etc.) to dicts in get_final_response_obj
- Fixes TypeError: Object of type TextContent is not JSON serializable
- Resolves test failures in test_mcp_tool_call_hook and test_mcp_cost_tracking
- Fix type incompatibility in vertex_ai/videos/transformation.py by casting litellm_params to Dict[str, Any]
- Add await to async add_update_server call in mcp_server_manager.py
- Resolves 4 type checking errors across 2 files
- Remove excessive comments and simplify documentation
- Remove @overload decorators (type stubs are sufficient)
- Remove Logging type stub to avoid redefinition errors
- Keep only essential type stubs for cost_per_token and completion_cost
- Fixes type checking errors without using type: ignore comments
- Add type stubs and @overload decorators for cost_per_token and completion_cost
- Refactor lazy loading system with centralized registry for better maintainability
- Add comprehensive documentation for adding new lazy-loaded functions
- Fixes 'Any? not callable' errors at lines 111, 139, and 146 in budget_manager.py
- Replace Logging type annotations with LiteLLMLoggingObj in main.py (lines 1157, 4097, 5811)
- Fixes NameError: name 'Logging' is not defined errors
- Maintains lazy loading benefits - Logging only loaded when accessed via litellm.Logging
- Add error handling to lazy import functions for better debugging
* add claude opus 4.5
* Apply suggestion from @Chesars
Co-authored-by: Cesar Garcia <128240629+Chesars@users.noreply.github.com>
---------
Co-authored-by: Cesar Garcia <128240629+Chesars@users.noreply.github.com>
* add prompt security guardrails provider
* cosmetic
* small
* add file sanitization and update context window
* add pdf and OOXML files support
* add system prompt support
* add tests and documentation
* remove print
* fix PLR0915 Too many statements (96 > 50)
* cosmetic
* fix mypy error
* Fix failed tests due to naming conflict of responses directory with same-named pip package
* Fix mypy error: use 'aembedding' instead of 'embeddings' for async embedding call type
* Fix: Install enterprise package into Poetry virtualenv for tests
The GitHub Actions workflow was installing litellm-enterprise to system Python
using 'python -m pip install -e .', but tests run in Poetry's virtualenv using
'poetry run pytest'. This caused ImportError for enterprise package types.
Changed to 'poetry run pip install -e .' so the package is available in the
same virtualenv where pytest executes.
Fixes enterprise test collection errors in GitHub Actions CI.
* Move Prompt Security guardrail tests to tests/test_litellm/
Per reviewer feedback, move test_prompt_security_guardrails.py from
tests/guardrails_tests/ to tests/test_litellm/proxy/guardrails/ so
it will be executed by GitHub Actions workflow test-litellm.yml.
This ensures the Prompt Security integration tests run in CI.
---------
Co-authored-by: Ori Tabac <oritabac@prompt.security>
Co-authored-by: Vitaly Neyman <vitaly@prompt.security>
* Add doc for adding model pricing and context window
Co-authored-by: krrishdholakia <krrishdholakia@gmail.com>
* Refactor model pricing documentation to include sample spec and examples
Co-authored-by: krrishdholakia <krrishdholakia@gmail.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* Add fallback in sort to prevent NoneType and str comparison
* Hide Default Team Settings from Proxy Admin Viewers
---------
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
* fix: prevent duplicate spend logs in Responses API for non-OpenAI providers
Fixes#15740
This fixes a logging duplication bug where using kwargs.pop() removed
the litellm_logging_obj before passing kwargs to internal acompletion()
calls, causing duplicate spend log entries for providers without native
Responses API support (Anthropic, Gemini, etc).
By changing from pop() to get(), the logging object is preserved and
reused across the internal completion call, preventing duplicate entries
and maintaining correct cost tracking.
* test: add test for logging object preservation in responses API
Verify that litellm_logging_obj is preserved in kwargs when calling
responses(), ensuring no duplicate spend log entries are created.
- Add conditional check for 'global' vertex_location
- Use aiplatform.googleapis.com (no prefix) for global endpoint
- Apply fix to both v1 and v1beta1 APIs
- Matches existing behavior in regular completion calls
Fixes context caching 404 errors when using global location.
Regular completion already handles global correctly, this brings
context caching in line with that behavior.
Related: #11190, #9234
Co-authored-by: prawaan-singh <prawaan.singh@thoughtspot.com>
- Update Hosted Proxy links to point to enterprise docs
- Remove "(Preview)" label from Hosted Proxy
- Fix "Supported LLM Providers" link to point to docs instead of GitHub anchor
Fixes cross-platform Docker build issue where `prisma generate` fails
when building for amd64 platform from macOS. The Prisma CLI requires
Node.js and npm to be available in the runtime environment.
The Python prisma package (v0.11.0) uses nodeenv to bootstrap Node.js
if not found. However, the downloaded npm v10 fails with a
"sizeCalculation" error in minimal Chainguard environments during
cross-platform builds. Providing system nodejs/npm resolves this.
Changes:
- Added nodejs and npm to runtime dependencies (Dockerfile:51)
- This enables prisma generate to run successfully during the build
Error without fix:
npm error cannot set sizeCalculation without setting maxSize or maxEntrySize
subprocess.CalledProcessError: Command '[...nodeenv/bin/npm', 'install',
'prisma@5.4.2']' returned non-zero exit status 1.
Testing:
docker buildx build --platform linux/amd64 -t litellm:test .
Co-authored-by: Claude <noreply@anthropic.com>
* fix: fix getting mcp servers
* fix(litellm_logging.py): handle list objects for final response in standard logging payload
Fixes issue where mcp tool call response wouldn't show up
* fix(litellm_responses_transformation/): remove invalid item error for unmapped objects - breaks stream and there's no real value to this as outside of a few of them, not all can be mapped to chat completions
resolves error for web search calls via chat completions to responses api