litellm/litellm/integrations
Priyansh Nandwana 7c7b0ea85b
fix(bedrock_mantle): send OpenAI explicit prompt cache breakpoints for GPT-5.6 and newer (#38729)
* fix(cache_control): let a hosted deployment opt into the OpenAI cache dialect

_targets_openai_prompt_cache_breakpoint gated on custom_llm_provider == "openai"
unconditionally, so an OpenAI-shaped model served by another provider could never
qualify, even with supports_prompt_cache_breakpoint set explicitly on its own
cost-map entry. bedrock_mantle honours prompt_cache_breakpoint end to end, and
had no way to say so.

model_cost is keyed per exact deployment string, so a flag on the deployment's own
entry states the dialect more precisely than a provider name can. Consult it
before the provider check, and require the entry's litellm_provider to match the
serving provider so an openai entry cannot license another provider. Entries for
the openai provider keep their api_base check, so an OpenAI-compatible third-party
host is still not assumed to speak the dialect.

Fixes #38666

* test: drop a laziness assertion the existing suite already makes

test_provider_lookup_skipped_for_models_below_gpt_5_6 already pins that
_resolve_provider is not called for an unflagged model, and it covers the new
flag lookup unchanged. The duplicate patched a litellm internal for no added
coverage, which the test-quality gate counts against TQ008.

* fix(bedrock_mantle): flag GPT-5.6 and newer rows for OpenAI explicit prompt cache breakpoints

* fix(responses): predict the chat-completions bridge with the model name the dispatch resolves

* fix(cache_control): read a region-prefixed Mantle GPT deployment through its region-free price-map row

* fix(cache_control): let a bare hosted deployment name read its own provider's price-map row

* fix(responses): hand the hook the provider the router resolved for a Foundry GPT deployment

* fix(cache_control): read the deployment breakpoint flag strictly and default a null prompt_cache_options

A cost-map or deployment `supports_prompt_cache_breakpoint` that is not the boolean `true` (the string "true",
the integer 1, "false", 0, a long string) no longer opts a deployment into the OpenAI prompt cache dialect; only
`true` does, the same reading Bedrock Converse applies to its own flag.

A client that sends `"prompt_cache_options": null` on `/v1/chat/completions` or `/v1/messages` now gets the
implicit default the hook already applied on `/v1/responses` when it placed a breakpoint; before, the null
suppressed the default and the request left with a breakpoint and no options.

* test(integration): audit cells for the Mantle GPT prompt cache breakpoint dialect

Deterministic cells for the configured-breakpoint path on Bedrock Mantle GPT and Azure AI Foundry GPT-6
deployments: every endpoint, streaming and not, sync and async SDKs and raw httpx, the hostile option shapes,
flag precedence, the response cache twin, a two-worker burst, a worker kill and a graceful restart.

* fix(cache_control): ignore a malformed cache_control_injection_points value instead of failing the request

A deployment or client `cache_control_injection_points` that is not a list of points (a string, an
integer, a bare point dict, a list of strings) raised inside the prompt hook (`'str' object has no
attribute 'get'`, `'int' object is not iterable`) and turned every request to that deployment into a
500 on `/v1/chat/completions`, `/v1/messages` and `/v1/responses`. Every entry point now reads such a
value as no configured points, the way a `null` already read, and the request leaves without a
breakpoint; entries of a list that are not points are dropped and the point entries kept.

* test(integration): cover int, dict and string-list injection point shapes in the Mantle audit cells

The D9 cell now also sends an integer, a bare point dict and a list of strings as the deployment's
`cache_control_injection_points`, which the merge base answered with a 500 on every request.

* fix(cache_control): stamp the OpenAI dialect for a bare deployment name served by a flagged provider

A deployment written as `model: openai.gpt-5.6-sol` with `custom_llm_provider: bedrock_mantle` has no cost-map row
of its own and no openai row of the same name, so the dialect stamp's cheap gate (`supports_openai_prompt_cache_breakpoint`)
returned early and the configured point was never stamped. On `/v1/responses` and on the chat seeding path the hook
sees no provider, so it fell back to the Anthropic `cache_control` marker, which Bedrock Mantle strips.

The gate now also passes a model whose serving provider is already known and whose provider-keyed row carries the
flag, which is the same row the dialect resolution reads and costs no provider lookup. A bare name without a provider
is still left alone, so models below GPT-5.6 keep their points untouched and resolve nothing.

* test(integration): cover a bare Mantle deployment name with its provider in the audit cells

A deployment configured as `model: openai.gpt-5.6-sol` plus `custom_llm_provider: bedrock_mantle` sends the
breakpoint and the implicit options on all three endpoints; the merge base leaves it on the Anthropic dialect.

* fix(cache_control): keep a configured point that sits beside junk entries on every chat seed path

`configured_injection_points` kept the point dicts of a mixed `cache_control_injection_points` list as a tuple,
but only read a `list` back. The chat seed and the `/v1/responses` dialect stamp write the normalized value back
onto the request, and on a deployment the OpenAI dialect does not stamp (an Anthropic model, Claude on Bedrock
Mantle) that value is the tuple itself, so the hook then read it as no configured points and the valid point was
silently dropped. The stamped OpenAI dialect and the `/v1/messages` path kept it only because they build a new list.

The normalizer now reads back the tuple it wrote, so the point reaches the wire on every path; an all-dict list
still passes through as the same object.

* test(integration): cover a configured point beside junk entries on a Claude Mantle deployment

A deployment configured with `cache_control_injection_points: ["system", {system point}, 3]` marks the system
block on the Anthropic dialect on all three endpoints; the merge base answers 500 on the junk entry.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-08 02:07:22 -07:00
..
_types style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
agentops refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
arize refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
azure_sentinel chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
azure_storage fix(azure_storage): keep client call ids from sharing one Data Lake file (#44099) 2026-10-01 23:23:37 -07:00
bitbucket refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
clickhouse feat(lens): isolate ingestion and investigations in a Rust service (#45148) 2026-10-07 17:18:58 -07:00
cloudzero refactor(types): replace Any with proven types in 157 files (#44798) 2026-10-06 15:31:54 +00:00
code_interpreter_interception Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_daily_any_cleanup_08_04_2026 2026-08-05 12:13:11 -07:00
compression_interception fix(proxy): run the remaining inline token counts off the event loop 2026-09-08 18:42:38 +00:00
datadog refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
deepeval perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
dotprompt refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
email_templates feat(proxy): email alerts at configured percentages of a team member budget (#42665) 2026-09-26 02:42:45 +00:00
focus refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
gcs_bucket refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
gcs_pubsub refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
generic_api chore(typing): clear 1.6k basedpyright Any errors across 56 files 2026-08-11 06:47:39 -07:00
generic_prompt_management refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
gitlab refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
langfuse refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
levo test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
litellm_agent feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
mavvrik_focus refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
newrelic chore(lint): remove the LIT002 mutable-construction rule (#43971) 2026-10-01 12:24:02 -07:00
opentelemetry_utils fix(otel): drop None attributes before they reach the OTLP encoder 2026-09-16 12:52:14 -07:00
opik refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
otel feat(lens): isolate ingestion and investigations in a Rust service (#45148) 2026-10-07 17:18:58 -07:00
pointfive perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
prometheus_helpers refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
SlackAlerting refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
vantage refactor(types): replace Any with proven types in 34 files 2026-09-20 10:16:48 +00:00
vector_store_integrations refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
weave refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
websearch_interception feat(auth): deny search tools by default when search_tool_deny_by_default is set (#44490) 2026-10-06 12:50:26 -07:00
zerobus perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
__init__.py add linting 2023-08-18 11:05:05 -07:00
adaptive_concurrency.py fix(s3_v2): upload fresh events first, drop terminal failures and hour-old retries by default, opt-in adaptive concurrency (#43022) 2026-09-26 14:58:28 -07:00
additional_logging_utils.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
anthropic_cache_control_hook.py fix(bedrock_mantle): send OpenAI explicit prompt cache breakpoints for GPT-5.6 and newer (#38729) 2026-10-08 02:07:22 -07:00
argilla.py refactor(types): replace Any with real types across 54 more backend files 2026-09-08 12:41:07 +00:00
athina.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
batch_utils.py fix(azure_sentinel): split batches under the 1MB ingestion cap (#39880) 2026-09-05 17:15:36 -07:00
braintrust_logging.py refactor: replace Any with precise types across 54 modules 2026-09-14 11:13:39 +00:00
braintrust_mock_client.py chore(typing): clear 1.6k basedpyright Any errors across 56 files 2026-08-11 06:47:39 -07:00
callback_configs.json feat(s3_v2): add s3_partition_granularity option for hourly S3 folders (#43748) 2026-10-01 11:00:21 -07:00
custom_batch_logger.py feat(tracing): add OTLP trace ingestion and reads (#43915) 2026-09-30 21:12:29 +00:00
custom_guardrail.py feat(guardrails): add logging_only_scope to observe input, output, or both (#43695) 2026-10-07 14:03:33 -07:00
custom_logger.py fix(router): preserve native baseline identity and accounting (#44960) 2026-10-07 11:00:31 -07:00
custom_prompt_management.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
custom_secret_manager.py perf: build log messages lazily so filtered-out log records cost nothing (#35703) 2026-08-04 04:34:52 +00:00
custom_sso_handler.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
dynamodb.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
email_alerting.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
galileo.py perf(types): defer pydantic schema builds via shared LiteLLMBaseModel (#44720) 2026-10-05 22:10:08 -07:00
greenscale.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
helicone.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
helicone_mock_client.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
humanloop.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
lago.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
langsmith.py fix(langsmith): json.dumps with default=str so non-serializable metadata does not crash batch flush (#42424) 2026-09-22 12:21:11 -07:00
langsmith_mock_client.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
langtrace.py refactor(types): move SpanAttributes, SpecialHeaders and AllowedModelRegion out of proxy._types (#44717) 2026-10-05 21:40:13 -07:00
literal_ai.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
logfire_logger.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
lunary.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
mlflow.py fix(mlflow): prevent _stream_id_to_span leak and mlflow 2.x end_trace TypeError (#39049) 2026-09-08 16:18:06 -07:00
mock_client_factory.py chore(typing): clear 1.6k basedpyright Any errors across 56 files 2026-08-11 06:47:39 -07:00
openmeter.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
opentelemetry.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
posthog.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
posthog_mock_client.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
prometheus.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
prometheus_metrics_endpoint.py perf(prometheus): render /metrics off the event loop and coalesce concurrent scrapes (#37702) 2026-08-20 16:08:22 -07:00
prometheus_services.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
prompt_layer.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
prompt_management_base.py fix(prompts): apply prompt templates before routing on /v1/responses and honor ignore_prompt_manager_model 2026-08-26 14:12:28 -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 feat(guardrails): honor litellm_params.timeout in every HTTP guardrail (#43134) 2026-09-30 21:18:47 -07:00
s3.py feat(s3_v2): add s3_partition_granularity option for hourly S3 folders (#43748) 2026-10-01 11:00:21 -07:00
s3_v2.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
shadow_eval_logger.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
sqs.py fix(bedrock): sign on a dedicated executor instead of the shared default one 2026-09-09 18:52:00 -07:00
supabase.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
test_httpx.py fix(utils.py): improved predibase exception mapping 2024-06-08 14:32:43 -07:00
traceloop.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
weights_biases.py refactor(types): replace Any with proven types in 32 files 2026-09-21 10:51:46 +00:00

Integrations

This folder contains logging integrations for litellm

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