Commit graph

46529 commits

Author SHA1 Message Date
davida-ps
9f67a58198
fix(guardrails): configure Prompt Security file timeout policy (#38083)
* fix(guardrails): fail open on Prompt Security file timeouts

* fix(guardrails): configure Prompt Security timeout policy
2026-08-31 12:05:57 -07:00
mateo-berri
c7c382402a feat(proxy): add /v1/responses/input_tokens token counting endpoint 2026-08-31 12:04:44 -07:00
Devin AI
7667e9e0db Merge remote-tracking branch 'origin/litellm_internal_staging' into devin_ai_1788201394-veo31-pricing-tiers 2026-08-31 19:03:17 +00:00
mateo-berri
ae945f4fa3 feat(openai): support workload identity federation (OIDC token exchange) 2026-08-31 11:54:04 -07:00
mateo-berri
cf1b431d58 fix(bedrock): stop duplicating Converse config blocks inside inferenceConfig 2026-08-31 11:50:45 -07:00
mateo-berri
6b2ada2a78 fix(bedrock): per-response realtime usage deltas, spend-log event filter, single transcript completed 2026-08-31 11:49:09 -07:00
Mateo Wang
c09fa5b712
Merge pull request #38883 from BerriAI/litellm_docs_user_spend_endpoint_semantics
docs(proxy): clarify spend semantics on /v2/user/info and /user/daily/activity
2026-08-31 11:47:41 -07:00
milan
ade21da9d0 refactor(responses): simplify tool call argument serializer
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 18:43:36 +00:00
milan
9125a5b7a0 fix(responses): json-encode object tool call arguments in the chat completions bridge
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 18:43:36 +00:00
Mateo Wang
3905c9d9df
Merge pull request #38381 from mubashir1osmani/litellm_close_unacknowledged_duplicate_issues
feat(ci): close duplicate issues after a 3-day grace period
2026-08-31 11:38:12 -07:00
Devin AI
7b4b92f54f fix(registry): update veo 3.1 pricing with resolution tiers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 18:37:26 +00:00
mateo-berri
e938e89d13 docs(proxy): account for budget rollover and daily upserts in spend wording 2026-08-31 11:19:11 -07:00
mateo-berri
797848dd82 fix(cost): bill OCR annotation pages via annotation_cost_per_page 2026-08-31 11:18:59 -07:00
mateo-berri
219b4ebe46 Merge branch 'litellm_bedrock_messages_disconnect_billing' of https://github.com/nuernber/litellm into litellm_pr36008_head
# Conflicts:
#	basedpyright-code-budget.json
#	type-discipline-budget.json
2026-08-31 11:16:20 -07:00
mateo-berri
11a7471902 refactor(proxy): resolve supported_openai_params aliases via Router.resolved_litellm_models 2026-08-31 11:08:31 -07:00
mateo-berri
0e78c5bff7 fix(anthropic_messages): dispatch deferred spend logging when the client disconnects mid-relay
When the pump finishes draining while the client is still connected,
billing is deferred to the proxy's post-response hook, which only fires
on a normally completed response. A client disconnect before the relay
consumed the queued tail tore the generator down past that hook, so the
request logged no spend at all. The relay teardown now dispatches the
stored deferred billing whenever it never reached the end-of-stream
sentinel.

Also drops the live pass_through_tests script: that CI job runs against
a fixed config with no Bedrock model or AWS credentials, so it could
only fail there. The scenario is covered by unit tests on the
relay/pump seam.
2026-08-31 10:17:27 -07:00
mateo-berri
8a6f47a6d4 merge: litellm_internal_staging into litellm_fix_nova_sonic_realtime_user_asr_usage 2026-08-31 10:17:12 -07:00
Mateo Wang
c03a38d501
Merge pull request #38801 from BerriAI/devin_ai_1788036971-stale-cost-map-sources
fix: update stale source URLs and deprecation dates in model cost map
2026-08-31 10:04:25 -07:00
yucheng-berri
30f3228510
test(newrelic): cover static default_team_settings per-team routing (#38857)
* test(newrelic): cover static default_team_settings per-team routing

The dynamic POST /team/{team_id}/callback path for New Relic is tested, but
the static default_team_settings twin had no regression coverage. Add a test
that drives default_team_settings -> add_team_based_callbacks_from_config and
asserts the resolved trusted vars dispatch to BOTH the per-team metrics logger
(cost/usage) and the trace logger (LLM/agent spans), so a config-file customer
gets the same per-team routing as the API customer.

Also correct the /team/callback docstring: callback_name is a str validated
against the credential-capable callbacks, not a fixed langfuse/langsmith/gcs
Literal, and document the newrelic_api_key / newrelic_region vars.

* chore(ui): sync schema.d.ts with the /team/callback docstring

Regenerate the dashboard OpenAPI types for the add_team_callbacks description
change: callback_name is a validated str (not a langfuse/langsmith/gcs
Literal) and the newrelic_api_key / newrelic_region vars are documented.

* docs(newrelic): note LITELLM_OTEL_V2 prerequisite, trim test comments

Address review: team-scoped New Relic config is rejected with a 400 unless the
proxy runs with LITELLM_OTEL_V2=true, so document that in the /team/callback
endpoint and sync schema.d.ts. Drop the narrative setup comments in the new
test per the repo comment convention; the test name and docstring already say why.
2026-08-31 16:58:35 +00:00
mateo-berri
39473745dd fix(docker): bump wolfi-base for glibc 2.44 and pin apk python to 3.13 in migrations image 2026-08-31 09:53:01 -07:00
mateo-berri
6e59ce1773 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_pr36008_head
# Conflicts:
#	basedpyright-code-budget.json
#	type-discipline-budget.json
2026-08-31 09:41:15 -07:00
Mateo Wang
d6cce13308
Merge pull request #38772 from BerriAI/litellm_claude_md_test_behavior_not_structure
docs(claude.md): require tests to check behavior, not code structure
2026-08-31 09:32:48 -07:00
nuernber
2f50988fed fix(anthropic): resolve TRY300 lint violation and ratchet budgets after litellm_internal_staging merge 2026-08-31 09:30:29 -07:00
devin-ai-integration[bot]
f079e4061b
fix(proxy): deliver budget alerts on webhook-only alerting and accept ALERTING_WEBHOOK_URL (#38441)
* fix(proxy): deliver budget alerts on webhook-only alerting and accept ALERTING_WEBHOOK_URL

ProxyLogging.budget_alerts forwarded to the alerting pipeline only when
'slack' was in general_settings.alerting, so alerting: ['webhook'] plus
WEBHOOK_URL silently never delivered a budget alert (the config
/health/services?service=webhook exists to test). Forward when 'webhook'
is present too; SlackAlerting.send_alert already fans out per channel.

Also accept a provider-neutral ALERTING_WEBHOOK_URL env fallback for the
Slack-format channel (any Slack-compatible receiver works), mark it as a
sensitive var, and de-brand the admin UI alerting copy.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(ui): format settings.tsx with prettier

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore(ui): regenerate schema.d.ts for updated alerting description

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* ci: retrigger checks after ALERTING_WEBHOOK_URL docs merged

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 09:22:36 -07:00
nuernber
b5affa63aa Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_bedrock_messages_disconnect_billing
# Conflicts:
#	basedpyright-code-budget.json
#	type-discipline-budget.json
2026-08-31 09:22:00 -07:00
nuernber
8e92f98905 docs(constants): clarify which env var the cap=0 fallback note applies to 2026-08-31 09:18:12 -07:00
nuernber
79fd2f4872 test(anthropic): cover ANTHROPIC_MESSAGES_MAX_DETACHED_STREAM_DRAINS=0 fallback to partial billing 2026-08-31 09:15:36 -07:00
nuernber
e1fece511a test(anthropic): fix PT012 lint violation in upstream-error regression test 2026-08-31 09:11:51 -07:00
nuernber
b2df72f980 chore: ratchet down lint/type budgets after disconnect-billing merge fix 2026-08-31 09:05:37 -07:00
Mateo Wang
32291c9ad2
Merge pull request #38942 from BerriAI/litellm_lite_claude_enable_tool_search-8eee
feat(cli): set ENABLE_TOOL_SEARCH=true for lite claude
2026-08-31 09:02:48 -07:00
nuernber
95a2586228 Merge remote-tracking branch 'origin/main' into litellm_bedrock_messages_disconnect_billing
# Conflicts:
#	basedpyright-code-budget.json
#	litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py
#	tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py
#	type-discipline-budget.json
2026-08-31 08:58:37 -07:00
Emerson Gomes
f7b1cc1f41
fix(router): copy kwargs instead of popping target order
Lint required a specific exception on the empty-order-2 regression.
Provider calls now omit _target_order by constructing a new kwargs dict.
2026-08-31 10:35:10 -05:00
Srivatsa03
cc3ea1fb08 docs(cost): state that a naive off-peak current_time is read as UTC
An aware value is converted, a naive one is taken to already be UTC rather
than localised. Nothing signals the difference, so a caller passing
datetime.now() instead of datetime.now(timezone.utc) shifts every window by
the host's offset and bills silently wrong. Say so where a caller will read it.

Reported by @xyzs996 in review.
2026-08-31 10:29:10 -05:00
Srivatsa03
27aefade5f fix(cost): treat an equal-ended off-peak window as the whole day
A window whose start equals its end is the natural way to spell off-peak all
day, and the docstring's promise that a window may wrap past midnight invites
it. It took the non-wrap branch instead, where start <= now < end can never
hold, so it matched nothing. It parses cleanly, so it never reached the branch
that ignores malformed windows: no exception, no log, and the model billed at
standard rates around the clock while the config said otherwise. Let equality
fall through to the wrap branch, which covers every instant, and say so in the
docstring.

Reported by @xyzs996 in review.
2026-08-31 10:29:10 -05:00
Srivatsa03
4f174ffdd1 fix(cost): apply off-peak rates on the tiered-pricing path
Tiered pricing resolves its own base rates and returns early, before the
off-peak swap ran, so a model carrying both tiered_pricing and off_peak_pricing
billed the tier rate around the clock. Route every base-cost path through one
helper so the window applies wherever the rates came from, and say plainly in
the docstring that an off-peak rate replaces the rate it lands on rather than
discounting it
2026-08-31 10:29:10 -05:00
Srivatsa03
d302301a4e test(cost): move off-peak tests beside the related cost tests
They sat at the end of the file, which is where everyone else appends
too, so this branch picked up a conflict there on nearly every rebase.
Grouping them with the other _get_token_base_cost test keeps them clear
of that churn and next to the code they cover. Pure move, no test changes
2026-08-31 10:29:09 -05:00
Srivatsa03
c813386bb2 refactor(cost): conform off-peak pricing to current lint budgets
Rebasing onto litellm_internal_staging picked up stricter ceilings than this
branch was written against. Bind the off-peak results to fresh names instead
of reassigning the base costs, mark the new locals Final, avoid rebinding the
current_time parameter, and make the window parse explicit about UTC so
DTZ007, LIT010 and LIT011 all stay within budget
2026-08-31 10:27:56 -05:00
Srivatsa03
f2c663515c fix(cost): evaluate off-peak windows in UTC for timezone-aware inputs
_is_within_off_peak_window used current_time.time(), which drops tzinfo, so a caller passing a non-UTC aware datetime had the window compared against local wall-clock instead of UTC. That silently mispriced off-peak requests. Normalize aware datetimes to UTC before comparing; naive datetimes stay as-is per the documented UTC contract. Added a regression test with a UTC+8 datetime that fails without the fix
2026-08-31 10:27:30 -05:00
Srivatsa03
9fc77f1222 feat(cost): support time-based off-peak pricing in cost calculation
Some providers charge different per-token rates depending on the time of
day. DeepSeek, for example, has historically discounted its chat and
reasoner models during an off-peak window (16:30-00:30 UTC). LiteLLM's
cost map only modeled static per-token pricing, so cost tracking could
not stay accurate for these providers.

This adds optional off-peak pricing to a model entry: input_cost_per_token_off_peak,
output_cost_per_token_off_peak, cache_read_input_token_cost_off_peak, and an
off_peak_hours_utc window expressed as "HH:MM-HH:MM" in UTC (the window may
wrap past midnight). When the current UTC time falls inside the window, the
cost calculator uses the off-peak rates and otherwise falls back to the
standard rates, so existing models are unaffected. The fields are also
accepted as custom pricing on a deployment, so they can be set from the
proxy config or the SDK.

The window check is a pure function that takes the current time as an
argument, which keeps the regression tests deterministic without patching
the clock.
2026-08-31 10:27:29 -05:00
Emerson Gomes
bd0b9c78bd
fix(router): keep order fallback on the requested order level
When a pre-call filter left no order-2 deployments, target_order matching
fell through to the remaining healthy list and reselected the failed
primary. Prompt-cache and deployment affinity also pinned that hop back
to order 1. Match the requested order strictly, skip those pins while
target_order is set, and keep target_order across retries of that hop.
2026-08-31 10:21:22 -05:00
Devin AI
2d01397e4d test: pin llm_router in supported_openai_params tests
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 15:03:52 +00:00
Devin AI
ba817aa9bb fix(proxy): avoid NotRequired access on litellm_params model
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 14:54:50 +00:00
Devin AI
1bf3ab5388 fix(proxy): resolve router model aliases in /utils/supported_openai_params
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 14:45:31 +00:00
Devin AI
4291afbfa5 fix(registry): correct OpenAI preview shutdown dates, add whisper/transcribe and Bedrock/Vertex deprecation dates
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 13:08:06 +00:00
Devin AI
f111262e54 Merge remote-tracking branch 'origin/litellm_internal_staging' into devin_ai_1788036971-stale-cost-map-sources 2026-08-31 13:03:35 +00:00
Devin AI
dd031f1036 fix(ci): parse paginated gh api output without splitting on unicode line breaks
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 09:42:07 +00:00
Devin AI
b81bca2696 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_deflake_20260830 2026-08-31 09:18:31 +00:00
Devin AI
69fc449666 chore(techdebt): drop restating comments from the 2026-08-30 window
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 07:54:31 +00:00
Devin AI
f3d0da10d1 chore: merge litellm_internal_staging into litellm_techdebt_20260830
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-31 07:46:09 +00:00
Cursor Agent
43c64e2471
fix(cli): keep an existing ENABLE_TOOL_SEARCH value
Default remains true so lite claude turns tool search back on through
a proxy. An explicit false or auto in the env or settings is left alone

Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
2026-08-31 06:00:45 +00:00