litellm/litellm/integrations
Tin Chi Lo 3d2e18f41d feat(complexity_router): multi-model prompt-cache warming for the auto-router
Provider prompt caches are per-model, so every mid-session tier switch the
complexity auto-router makes lands on a cold cache and pays the full cache write
again. Opt-in cache_warming captures each session's latest payload at the routing
decision and a leader-elected background refresher replays it with max_tokens=1
against every cacheable tier model just under the provider cache TTL, so the
switch is a pure cache read.

A replay is a request, so it is admitted through the request path's own entry
points rather than beside them. For each replay the refresher assembles a request
body, reserves budget through the same wrapper auth calls right after
common_checks, stamps identity with the proxy's own stamper, applies every
key-level, team-level and project-level control, applies the key and team scoped
dynamic logging settings, runs ProxyLogging.pre_call_hook, applies the
fully-blocked-model check, and hands the dict that hook returns to
Router.acompletion or Router.aanthropic_messages. post_call_failure_hook runs on
every rejection and every dispatch failure, so the parallel request slot, the
reserved TPM tokens and the budget reservation all come back. Warming therefore
inherits both halves of every contract it touches (the limiter's descriptors
across every scope with its own configured window, its RPM and max-parallel
check, its upfront reservation and the stash its success callback reconciles
from; the key, team, user, end-user, organization and tag budget counters; every
configured guardrail and pipeline, including the ones defined on the deployment)
instead of reimplementing them. That deletes nine functions and the admission
block they served.

Warming writes no spend logs of its own, so the replay rows are the only record
of warming cost that will exist. They carry the customer's own tags and
spend_logs_metadata with the litellm_cache_warming tag alongside rather than
instead, and they fan out to the key and team scoped loggers, so warming is
included in per-tag chargeback and filterable out of it. Two Request-free blocks
of add_litellm_data_to_request are extracted verbatim as
LiteLLMProxyRequestSetup.add_key_team_project_metadata and
apply_dynamic_logging_settings so both callers share them; the move is
statement-for-statement identical, with no behavior change on the request path.
Ordering there is load-bearing: add_key_level_controls resets data["cache"] and
refills it from key metadata, so it runs after the body is built and a key's own
cache controls override warming's response-cache bypass exactly as they override
a caller's.

Blocked and expired keys are still checked locally because common_checks
dereferences the FastAPI Request; extracting a Request-free core so its other
gates bind on a replay too is a follow-up. Sessions on a key that declares
max_iterations are skipped entirely, because that limiter counts every request on
a session_id and cannot be consulted without incrementing it.

Metadata precedence (litellm_metadata before metadata, stringified) had three
implementations; core_helpers.iter_request_metadata_dicts and
get_request_metadata_field are now the single owner and DeploymentAffinityCheck
deletes its four private copies to delegate to them.

Resolves LIT-4865
2026-07-30 15:46:04 -07:00
..
_types style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
agentops style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
arize style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
azure_sentinel fix(azure_sentinel): resolve audit stream from AZURE_SENTINEL_AUDIT_STREAM_NAME (#32010) 2026-07-03 12:09:27 -07:00
azure_storage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
bitbucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
cloudzero style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
code_interpreter_interception feat(sandbox): reuse e2b container across requests when metadata.session_id is set (#31688) 2026-06-30 18:58:09 -07:00
compression_interception feat(spend): track prompt compression saved tokens in daily spend aggregates (#33810) 2026-07-18 17:47:54 -07:00
datadog fix(datadog): split log batches proactively under intake payload limits (#32860) 2026-07-10 20:54:42 -07:00
deepeval style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
dotprompt style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_templates fix(email): apply EMAIL_SIGNATURE to budget alert emails (#31712) 2026-06-30 21:11:50 +02:00
focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_bucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_pubsub style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_api style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_prompt_management style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gitlab style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langfuse fix(langfuse): send v4 ingestion header for otel callback (#33907) 2026-07-18 20:36:51 -07:00
levo style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
litellm_agent Agent Builder - support new experimental agent builder, to ensure agents pass compliance checks (#21817) 2026-02-21 15:32:47 -08:00
mavvrik_focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
newrelic style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry_utils style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opik chore(ci): merge oss branch (#33784) 2026-07-17 23:22:13 +00:00
otel fix(otel): label retrieval and agent metrics correctly and emit gen_ai.provider.name (#35151) 2026-07-30 13:48:59 -07:00
prometheus_helpers style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
SlackAlerting style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vantage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vector_store_integrations style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weave style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
websearch_interception fix(websearch): address Responses review findings 2026-07-15 00:52:16 +00:00
__init__.py add linting 2023-08-18 11:05:05 -07:00
additional_logging_utils.py build(deps-dev): bump black to 26.3.1 and apply formatting (#28525) 2026-05-21 17:24:18 -07:00
anthropic_cache_control_hook.py feat(complexity_router): multi-model prompt-cache warming for the auto-router 2026-07-30 15:46:04 -07:00
argilla.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
athina.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_logging.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
callback_configs.json feat: litellm oss 110626 (#30202) 2026-06-11 22:30:26 -07:00
custom_batch_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_guardrail.py fix(guardrails): classify all 4xx HTTPException guardrail blocks as intervened (#33821) 2026-07-27 16:50:13 -07:00
custom_logger.py feat(guardrails): scan and mask MCP tool results via post_mcp_call (#35155) 2026-07-30 14:10:26 -07:00
custom_prompt_management.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_secret_manager.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_sso_handler.py chore(auth): require trusted proxy for header identity auth 2026-04-29 21:20:21 -07:00
dynamodb.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_alerting.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
galileo.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
greenscale.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
humanloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lago.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langsmith.py fix(proxy): sanitize per-key callback config out of logged metadata 2026-07-24 22:16:50 -07:00
langsmith_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langtrace.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
literal_ai.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
logfire_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lunary.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mlflow.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mock_client_factory.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
openmeter.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry.py fix(otel): label retrieval and agent metrics correctly and emit gen_ai.provider.name (#35151) 2026-07-30 13:48:59 -07:00
posthog.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
posthog_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prometheus.py feat(prometheus): add service_tier label to latency and spend metrics (#34966) 2026-07-28 16:18:22 -07:00
prometheus_services.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_layer.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_management_base.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
Readme.md (Feat) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery (#7976) 2025-01-24 20:57:20 -08:00
rubrik.py fix(guardrails): filter Add-Guardrail mode dropdown per provider (#32712) 2026-07-11 14:51:27 -07:00
s3.py fix(s3): sanitize slashes in response-id-derived object key file name (#33271) 2026-07-14 17:26:00 -07:00
s3_v2.py fix(s3_v2): pass usedforsecurity=False to hashlib.md5 for FIPS envs 2026-07-02 01:12:49 +00:00
sqs.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
supabase.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
test_httpx.py fix(utils.py): improved predibase exception mapping 2024-06-08 14:32:43 -07:00
traceloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weights_biases.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00

Integrations

This folder contains logging integrations for litellm

eg. logging to Datadog, Langfuse, Prometheus, s3, GCS Bucket, etc.