Suppress noisy error log fired every cron tick when spend log cleanup
is simply not configured. _should_delete_spend_logs already logs the
specific reason at the right level (info for None, warning for
invalid value), so the redundant blanket error log in
cleanup_old_spend_logs is removed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies that vertex_ai gemini models route to
aiplatform.googleapis.com instead of
generativelanguage.googleapis.com, preventing
regressions if the branch ordering changes.
- Only release distributed lock in finally if it was actually acquired;
prevents spurious Redis release_lock calls on early returns
- Treat bare integer maximum_spend_logs_retention_period as days (e.g. 3 → "3d")
instead of silently failing with a ValueError
- Elevate "Skipping cleanup" log from info to error so misconfigured
retention settings are visible without verbose logging
- Add tests for all three fixes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move get_openai_credentials() to litellm/llms/openai/common_utils.py
and get_azure_credentials() to litellm/llms/azure/common_utils.py
so they can be reused by batches/main.py and other modules.
Signatures now take individual params instead of GenericLiteLLMParams.
Extract repeated OpenAI and Azure credential resolution logic into
_get_openai_credentials() and _get_azure_credentials() helper functions,
reducing ~270 lines of duplicated code across 5 file operations.
Also removes dead Vertex AI code path in create_file that was unreachable
since ProviderConfigManager.get_provider_files_config() handles it first.
Add OpenRouter image edit docs to both the provider page and the
main image_edits reference page, including supported models, parameter
mappings (size→aspect_ratio, quality→image_size), usage examples,
proxy configuration, and a note about 4K quality model support.
- Add created_at field to MCPServer type (was missing)
- Map created_at from LiteLLM_MCPServerTable in build_mcp_server_from_table()
- Use server.created_at and server.updated_at instead of datetime.now() in _build_mcp_server_table() and health check table builder
- Add regression tests to verify timestamps are preserved through round-trip conversions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The parameter was declared in completion() signature but not passed
to acompletion_with_mcp, causing per-request JSON schema validation
to silently fall back to the global default when MCP tools are present.
Replaces the skip_route_check approach from PR #22662 with a configurable
opt-in flag. By default, common_checks() is not run for custom auth flows,
preserving backwards compatibility with pre-#22164 behavior.
Users who want budget/team/route enforcement on custom auth can enable it:
general_settings:
custom_auth_run_common_checks: true
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Custom user-added routes (e.g. /ldap/ngs/ready) used with Depends(user_api_key_auth) were being rejected as admin-only after _run_post_custom_auth_checks was introduced in commit 14badde13c.
The route authorization check in common_checks is designed for LiteLLM's own management routes. Custom auth flows that add their own routes should be trusted since the custom auth function already validated the request. Budget and expiry checks still run.
Add skip_route_check parameter to common_checks() and pass skip_route_check=True from _run_post_custom_auth_checks() to skip route authorization while preserving budget/team/model checks.
Regression test added: test_common_checks_skip_route_check_for_custom_auth
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Extract duplicated batch ID encoding logic into a shared helper
encode_batch_response_ids() in common_utils.py. Use it in create_batch,
retrieve_batch, and cancel_batch. Also add encoding to list_batches
when x-litellm-model is used.
The provider returns raw IDs in the retrieve response (output_file_id,
error_file_id). These need to be encoded with model info so the client
can use them for subsequent file download calls through the proxy.