Skip to content

fix(bedrock): honor ttl for tool_config cache injection points - #31929

Merged
mateo-berri merged 12 commits into
litellm_internal_stagingfrom
litellm_bedrock_cache_control_default
Jul 2, 2026
Merged

fix(bedrock): honor ttl for tool_config cache injection points#31929
mateo-berri merged 12 commits into
litellm_internal_stagingfrom
litellm_bedrock_cache_control_default

Conversation

@shivamrawat1

@shivamrawat1 shivamrawat1 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Resolves LIT-3892

Issue
Bedrock Converse cache_control_injection_points with location: tool_config did not honor control.ttl. Callers could request ttl: 1h on tool definitions, but LiteLLM always emitted a bare {"cachePoint": {"type": "default"}} in toolConfig.tools, so Bedrock silently fell back to the 5-minute default. Message and system cache points already respected ttl via _get_cache_point_block; the tool_config path skipped that logic entirely

Separately, is_claude_4_5_on_bedrock used a hardcoded model-name pattern list to decide whether 5m/1h TTL was allowed. That list needed manual updates for every new Claude release and already missed models like Sonnet 5 and Fable 5 that have 1h TTL pricing in model_prices_and_context_window.json

Two Claude 3.5 Sonnet entries in the pricing JSON incorrectly carried cache_creation_input_token_cost_above_1hr, which would have made a JSON-driven check wrongly grant them 1h TTL support (their own us./eu./apac. regional variants did not have the field)

Cause
In converse_transformation.py, the tool_config branch hardcoded the cache point and never read point["control"]:

bedrock_tools.append({"cachePoint": {"type": "default"}})
The message/system path already went through _get_cache_point_block, which mapped cache_control.ttl onto the Bedrock cachePoint when the model was eligible. The type for tool_config injection points also lacked a control field, so ttl was not even modeled for that location

For model eligibility, is_claude_4_5_on_bedrock matched substring patterns like sonnet-4-5 and opus-4-7 instead of reading capability data from the pricing JSON. New models only worked after someone updated the regex list, and the JSON already had a better signal: cache_creation_input_token_cost_above_1hr is present only on models AWS bills for 1-hour cache writes

Fix
Pass ttl through for tool_config cache injection

Extracted shared _build_cache_point_block(control, model) and wired both message/system and tool_config paths through it. Added control: Optional[ChatCompletionCachedContent] to CacheControlToolConfigInjectionPoint. Added regression tests asserting ttl: 1h survives for Claude Sonnet 4.5 and is dropped for unsupported models

Drive 1h TTL eligibility from pricing JSON

Replaced the hardcoded pattern list in is_claude_4_5_on_bedrock with a lookup against cache_creation_input_token_cost_above_1hr in litellm.model_cost (with get_bedrock_base_model fallback). New Claude releases pick up 1h TTL support automatically when their pricing entry ships

Fix bad pricing data

Removed cache_creation_input_token_cost_above_1hr (and its above-200k variant) from anthropic.claude-3-5-sonnet-20240620-v1:0 and anthropic.claude-3-5-sonnet-20241022-v2:0 in both model_prices_and_context_window.json and the bundled backup, matching their regional variants and AWS's documented 1h-TTL model set

SCRIPT:

from litellm.llms.bedrock.chat.converse_transformation import AmazonConverseConfig

config = AmazonConverseConfig()
messages = [
    {"role": "system", "content": "You are a helpful assistant.", "cache_control": {"type": "ephemeral", "ttl": "1h"}},
    {"role": "user", "content": "What's the weather in SF?"},
]
optional_params = {
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get weather for a location",
                "parameters": {
                    "type": "object",
                    "properties": {"location": {"type": "string"}},
                    "required": ["location"],
                },
            },
        }
    ],
    "cache_control_injection_points": [
        {"location": "tool_config", "control": {"type": "ephemeral", "ttl": "1h"}},
    ],
}

result = config._transform_request(
    model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",  # claude-4.5, supports ttl
    messages=messages,
    optional_params=optional_params,
    litellm_params={},
)

print(result["system"]) # -> cachePoint DOES carry {'ttl': '1h'} (message path works)
print(result["toolConfig"]) # -> {'cachePoint': {'type': 'default'}} <-- ttl silently dropped

Before:
Screenshot 2026-07-01 at 7 27 56 PM

After:
Screenshot 2026-07-01 at 7 22 49 PM


Note

Medium Risk
Changes Bedrock request shaping for prompt caching and parallel tools; wrong pricing flags could omit TTL or parallel config for some model IDs, but scope is limited to capability gating and cache metadata.

Overview
Fixes LIT-3892: Bedrock Converse cache_control_injection_points with location: tool_config now forward control.ttl (e.g. 1h) into toolConfig.tools cache points, using the same _build_cache_point_block path as message/system blocks. CacheControlToolConfigInjectionPoint gains an optional control field.

Model capability checks no longer rely on hardcoded Claude name patterns. is_claude_4_5_on_bedrock (extended cache TTL) keys off cache_creation_input_token_cost_above_1hr in pricing data, with regional → base-model lookup. bedrock_converse_supports_parallel_tool_use_config is a separate JSON flag so parallel-tool config is not tied to TTL eligibility.

Pricing updates: supports_parallel_tool_use_config on eligible Bedrock Anthropic models; removed erroneous cache_creation_input_token_cost_above_1hr from two Claude 3.5 Sonnet base entries so they are not treated as 1h-TTL models.

Reviewed by Cursor Bugbot for commit 4e53edc. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added broader support for Bedrock/Anthropic model capabilities, including parallel tool use and improved cache control handling.
    • Expanded model metadata so more variants can use the right request settings automatically.
  • Bug Fixes

    • Improved cache TTL behavior for supported models, including regional variants.
    • Fixed fallback behavior so capability detection works even when a regional entry is missing fields.
  • Chores

    • Updated model pricing and capability data formatting for consistency.

Pass cache_control_injection_points control.ttl through to Bedrock
toolConfig cachePoint blocks, matching message/system cache behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

CLAassistant commented Jul 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 3 committers have signed the CLA.

✅ mateo-berri
❌ Shivam Rawat
❌ cursoragent


Shivam Rawat seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Bedrock Converse cache_control_injection_points with location: "tool_config" so they correctly honor control.ttl, matching the existing behavior for message and system cache points. It also decouples 1h-TTL eligibility and parallel-tool-use config eligibility from hardcoded model-name pattern lists, instead reading cache_creation_input_token_cost_above_1hr and supports_parallel_tool_use_config directly from the pricing JSON.

  • Shared _build_cache_point_block helper now handles both message/system and tool-config paths, eliminating the bare {"cachePoint": {"type": "default"}} that silently dropped TTL for tool-config injection points.
  • is_claude_4_5_on_bedrock is rewritten to read cache_creation_input_token_cost_above_1hr from litellm.model_cost (with get_bedrock_base_model fallback) instead of matching a hardcoded substring list; bedrock_converse_supports_parallel_tool_use_config is added as a separate, data-driven gate for disable_parallel_tool_use.
  • Incorrect cache_creation_input_token_cost_above_1hr fields were removed from the two Claude 3.5 Sonnet Bedrock entries that previously caused those models to be incorrectly treated as 1h-TTL-capable.

Confidence Score: 5/5

Safe to merge. The core transformation logic change is narrow and correct, the pricing JSON edits are verified by tests that assert on specific model entries, and all new tests use local cost maps or monkeypatch to avoid network calls.

The tool-config TTL fix routes through the same helper already trusted for message/system cache points. Model-eligibility checks now read from the pricing JSON, which is the established pattern. The only noteworthy item is a TypedDict annotation precision issue with NotRequired that has no runtime impact. No behavioral regressions were found.

No files require special attention. The pricing JSON changes are symmetric across the main and backup files, and the models that lost cache_creation_input_token_cost_above_1hr match their regional variants and AWS documentation.

Important Files Changed

Filename Overview
litellm/llms/bedrock/chat/converse_transformation.py Extracted shared _build_cache_point_block helper and wired both message/system and tool_config injection paths through it, fixing the TTL drop. Parallel tool use guard now uses bedrock_converse_supports_parallel_tool_use_config instead of is_claude_4_5_on_bedrock.
litellm/llms/bedrock/common_utils.py Replaced the hardcoded Claude-4.5 pattern list in is_claude_4_5_on_bedrock with a lookup against cache_creation_input_token_cost_above_1hr in litellm.model_cost. Added bedrock_converse_supports_parallel_tool_use_config using a separate supports_parallel_tool_use_config flag.
litellm/types/integrations/anthropic_cache_control_hook.py Added control: Optional[ChatCompletionCachedContent] to CacheControlToolConfigInjectionPoint. The field is technically required (TypedDict default total=True) but callers that omit it still work at runtime via .get("control"); NotRequired would be more accurate.
litellm/model_prices_and_context_window_backup.json Removed incorrect cache_creation_input_token_cost_above_1hr from Claude 3.5 Sonnet Bedrock entries; added supports_parallel_tool_use_config: true to haiku-4.5, opus-4.6 variants, opus-4.7 variants, and claude-sonnet-5 entries.
model_prices_and_context_window.json Mirrors backup JSON changes: removes erroneous 1h-TTL pricing from Claude 3.5 Sonnet Bedrock entries and adds supports_parallel_tool_use_config to relevant Claude 4.5+/4.6/4.7 model entries.
tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py Adds regression tests for TTL honoring on tool_config injection points (supported model, regional fallback, unsupported model) and for decoupled parallel tool use vs TTL eligibility. All tests use monkeypatch or LITELLM_LOCAL_MODEL_COST_MAP to avoid network calls.
tests/test_litellm/llms/bedrock/test_bedrock_common_utils.py Adds a regression test confirming that a regional model entry lacking a capability field correctly falls back to the base model entry via the any() pattern.

Reviews (9): Last reviewed commit: "fix(bedrock): fall back to base model en..." | Re-trigger Greptile

Comment thread litellm/llms/bedrock/chat/converse_transformation.py
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ot regex

is_claude_4_5_on_bedrock hardcoded a model-name pattern list that needed a
manual update for every new Claude release (it already silently missed
Sonnet 5 and Fable 5). Replace it with a lookup against
cache_creation_input_token_cost_above_1hr in model_prices_and_context_window.json,
which AWS docs confirm tracks the same 1h-TTL-capable model set.

Also fixes two bedrock Claude 3.5 Sonnet entries that incorrectly carried
that pricing field (their own regional variants didn't have it), which
would have made the JSON-driven check wrongly grant them 1h TTL support.

Co-authored-by: Cursor <cursoragent@cursor.com>
@shivamrawat1

Copy link
Copy Markdown
Collaborator Author

@greptile review again with new commit that resolves the p2 issue

…tests

test_add_cache_point_tool_block_passes_ttl_for_claude_4_5 and
test_bedrock_tools_pt_passes_ttl_for_claude_4_5 used a fabricated model id
(...-20250514-v1:0) that never shipped. This passed under the old regex-based
is_claude_4_5_on_bedrock, which matched on substring alone, but fails now
that it looks up cache_creation_input_token_cost_above_1hr in
litellm.model_cost, since the fake id has no pricing entry.

Also force the bundled local cost map in both tests so ttl eligibility reads
this branch's pricing data instead of the network-fetched main copy, which
lacks the fix until merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: ToolBlock constructor on Python 3.10
    • Replaced the tool-config cachePoint TypedDict keyword constructor with a plain dict append so the path works on Python 3.10.
  • ✅ Fixed: Parallel tools use TTL gate
    • Separated the Bedrock parallel-tool capability check from the extended-cache TTL pricing predicate and covered unpriced Claude 4.7-style model IDs with a regression test.

You can send follow-ups to the cloud agent here.

Comment thread litellm/llms/bedrock/chat/converse_transformation.py
Comment thread litellm/llms/bedrock/chat/converse_transformation.py
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

Comment thread litellm/llms/bedrock/common_utils.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Parallel tools gate drops Sonnet 5
    • The parallel tool-use gate now also accepts Bedrock models that qualify through the pricing JSON, with a regression test for Sonnet 5 request transformation.

You can send follow-ups to the cloud agent here.

Comment thread litellm/llms/bedrock/common_utils.py Outdated
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: TTL gate enables parallel tools
    • Removed the extended-cache TTL pricing helper from the parallel-tool capability gate and added a regression covering TTL-only Bedrock models.

You can send follow-ups to the cloud agent here.

Comment thread litellm/llms/bedrock/common_utils.py
cursoragent and others added 2 commits July 2, 2026 06:22
…coded patterns

Replace the hardcoded _CLAUDE_BEDROCK_PARALLEL_TOOL_USE_PATTERNS tuple and
bedrock_converse_supports_strict_tool_schemas (dead code) with a
supports_parallel_tool_use_config key in model_prices_and_context_window.json,
matching how is_claude_4_5_on_bedrock already reads
cache_creation_input_token_cost_above_1hr from the pricing JSON.

New models pick up parallel tool use support automatically when their
pricing entry ships with the key set, with no code change required

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py Outdated
…g test

anthropic.claude-opus-4-7-unlisted-v1:0 has no entry in
model_prices_and_context_window.json, so
bedrock_converse_supports_parallel_tool_use_config returned False and the
test died with KeyError on additionalModelRequestFields. Use
jp.anthropic.claude-opus-4-7, a real entry that carries
supports_parallel_tool_use_config without 1h-TTL cache pricing, which is
exactly the decoupling this test exists to cover
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai


Generated by Claude Code

The misc unit test job validates model_prices_and_context_window.json
against the INTENDED_SCHEMA allowlist in test_utils.py, which rejects
unknown keys. Add the supports_parallel_tool_use_config key this PR
introduced so test_aaamodel_prices_and_context_window_json_is_valid
passes again
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai


Generated by Claude Code

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Regional cost map blocks TTL
    • Updated the Bedrock TTL eligibility check to fall back to the stripped base model when a regional cost entry lacks 1-hour cache pricing, with JP Opus 4.7 regression coverage.

You can send follow-ups to the cloud agent here.

Comment thread litellm/llms/bedrock/common_utils.py
…ks capability fields

Regional model_cost entries like jp.anthropic.claude-opus-4-7 that omit
cache_creation_input_token_cost_above_1hr shadowed the base entry that has it,
so is_claude_4_5_on_bedrock returned False and requested cache ttl values were
dropped for those deployments. Both capability lookups now consult the full
model id and the region-stripped base entry, matching the coverage of the old
name-pattern list. Also restores ToolBlock keyword construction for the
tool_config cachePoint; PEP 589 TypedDict keyword instantiation works on every
supported Python version
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai


Generated by Claude Code

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks!

@mateo-berri
mateo-berri merged commit 1543725 into litellm_internal_staging Jul 2, 2026
123 checks passed
@mateo-berri
mateo-berri deleted the litellm_bedrock_cache_control_default branch July 2, 2026 23:30
yuneng-berri added a commit that referenced this pull request Jul 3, 2026
chore(release): backport #31923, #31929, #31393 to stable/1.90.x and cut 1.90.3
yuneng-berri added a commit that referenced this pull request Jul 4, 2026
chore(release): backport #31912/#31920/#31921 (+#31923/#31929 parity, #31635 prereq) onto patch-1.91.0rc1
eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Jul 4, 2026
….3) (#1400)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.90.2` → `v1.90.3` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary>

### [`v1.90.3`](https://github.com/BerriAI/litellm/releases/tag/v1.90.3)

[Compare Source](BerriAI/litellm@v1.90.3...v1.90.3)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.3/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;31923](BerriAI/litellm#31923), [#&#8203;31929](BerriAI/litellm#31929), [#&#8203;31393](BerriAI/litellm#31393) to stable/1.90.x and cut 1.90.3 by [@&#8203;mateo-berri](https://github.com/mateo-berri) in [#&#8203;32025](BerriAI/litellm#32025)

**Full Changelog**: <BerriAI/litellm@v1.90.2...v1.90.3>

### [`v1.90.3`](https://github.com/BerriAI/litellm/releases/tag/v1.90.3)

[Compare Source](BerriAI/litellm@v1.90.2...v1.90.3)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.3/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;31923](BerriAI/litellm#31923), [#&#8203;31929](BerriAI/litellm#31929), [#&#8203;31393](BerriAI/litellm#31393) to stable/1.90.x and cut 1.90.3 by [@&#8203;mateo-berri](https://github.com/mateo-berri) in [#&#8203;32025](BerriAI/litellm#32025)

**Full Changelog**: <BerriAI/litellm@v1.90.2...v1.90.3>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/1400
blake-hamm added a commit to blake-hamm/bhamm-lab that referenced this pull request Jul 4, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | final | patch | `v1.90.2` → `v1.90.3` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary>

### [`v1.90.3`](https://github.com/BerriAI/litellm/releases/tag/v1.90.3)

[Compare Source](BerriAI/litellm@v1.90.3...v1.90.3)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.3/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;31923](BerriAI/litellm#31923), [#&#8203;31929](BerriAI/litellm#31929), [#&#8203;31393](BerriAI/litellm#31393) to stable/1.90.x and cut 1.90.3 by [@&#8203;mateo-berri](https://github.com/mateo-berri) in [#&#8203;32025](BerriAI/litellm#32025)

**Full Changelog**: <BerriAI/litellm@v1.90.2...v1.90.3>

### [`v1.90.3`](https://github.com/BerriAI/litellm/releases/tag/v1.90.3)

[Compare Source](BerriAI/litellm@v1.90.2...v1.90.3)

##### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.3/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

##### What's Changed

- chore(release): backport [#&#8203;31923](BerriAI/litellm#31923), [#&#8203;31929](BerriAI/litellm#31929), [#&#8203;31393](BerriAI/litellm#31393) to stable/1.90.x and cut 1.90.3 by [@&#8203;mateo-berri](https://github.com/mateo-berri) in [#&#8203;32025](BerriAI/litellm#32025)

**Full Changelog**: <BerriAI/litellm@v1.90.2...v1.90.3>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDkuNSIsInVwZGF0ZWRJblZlciI6IjQzLjI0OS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: Renovate Bot <renovate@bhamm-lab.com>
Reviewed-on: https://codeberg.org/blake-hamm/bhamm-lab/pulls/258
blake-hamm added a commit to blake-hamm/bhamm-lab that referenced this pull request Jul 4, 2026
…to v1.90.3 (#257)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [https://github.com/BerriAI/litellm.git](https://github.com/BerriAI/litellm) | patch | `v1.90.0` → `v1.90.3` |

---

### Release Notes

<details>
<summary>BerriAI/litellm (https://github.com/BerriAI/litellm.git)</summary>

### [`v1.90.3`](https://github.com/BerriAI/litellm/releases/tag/v1.90.3)

[Compare Source](BerriAI/litellm@v1.90.2...v1.90.3)

#### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.3/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.3
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

#### What's Changed

- chore(release): backport [#&#8203;31923](BerriAI/litellm#31923), [#&#8203;31929](BerriAI/litellm#31929), [#&#8203;31393](BerriAI/litellm#31393) to stable/1.90.x and cut 1.90.3 by [@&#8203;mateo-berri](https://github.com/mateo-berri) in [#&#8203;32025](BerriAI/litellm#32025)

**Full Changelog**: <BerriAI/litellm@v1.90.2...v1.90.3>

### [`v1.90.2`](https://github.com/BerriAI/litellm/releases/tag/v1.90.2)

[Compare Source](BerriAI/litellm@v1.90.1...v1.90.2)

#### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.2
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.2/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.2
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

#### What's Changed

- chore(release): backport [#&#8203;31519](BerriAI/litellm#31519), [#&#8203;31733](BerriAI/litellm#31733) to stable/1.90.x and cut 1.90.2 by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;31782](BerriAI/litellm#31782)

**Full Changelog**: <BerriAI/litellm@v1.90.1...v1.90.2>

### [`v1.90.1`](https://github.com/BerriAI/litellm/releases/tag/v1.90.1)

[Compare Source](BerriAI/litellm@v1.90.0-rc.1...v1.90.1)

#### Verify Docker Image Signature

All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53).

**Verify using the pinned commit hash (recommended):**

A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.1
```

**Verify using the release tag (convenience):**

Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules:

```bash
cosign verify \
  --key https://raw.githubusercontent.com/BerriAI/litellm/v1.90.1/cosign.pub \
  ghcr.io/berriai/litellm:v1.90.1
```

Expected output:

```
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
```

***

#### What's Changed

- chore(release): backport [#&#8203;31036](BerriAI/litellm#31036), [#&#8203;31342](BerriAI/litellm#31342), [#&#8203;31653](BerriAI/litellm#31653) to stable/1.90.x and cut 1.90.1 (litellm-enterprise 0.1.43.post1) by [@&#8203;yuneng-berri](https://github.com/yuneng-berri) in [#&#8203;31667](BerriAI/litellm#31667)

**Full Changelog**: <BerriAI/litellm@v1.90.0...v1.90.1>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDkuNSIsInVwZGF0ZWRJblZlciI6IjQzLjI0OS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: Renovate Bot <renovate@bhamm-lab.com>
Reviewed-on: https://codeberg.org/blake-hamm/bhamm-lab/pulls/257
ap-anton-r-susilo pushed a commit to ap-anton-r-susilo/litellm that referenced this pull request Jul 6, 2026
…AI#31929)

* fix(bedrock): honor ttl for tool_config cache injection points

Pass cache_control_injection_points control.ttl through to Bedrock
toolConfig cachePoint blocks, matching message/system cache behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(bedrock): drive Claude 4.5+ ttl support from pricing JSON, not regex

is_claude_4_5_on_bedrock hardcoded a model-name pattern list that needed a
manual update for every new Claude release (it already silently missed
Sonnet 5 and Fable 5). Replace it with a lookup against
cache_creation_input_token_cost_above_1hr in model_prices_and_context_window.json,
which AWS docs confirm tracks the same 1h-TTL-capable model set.

Also fixes two bedrock Claude 3.5 Sonnet entries that incorrectly carried
that pricing field (their own regional variants didn't have it), which
would have made the JSON-driven check wrongly grant them 1h TTL support.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(tests): use real Claude Sonnet 4.5 release id in ttl cache-point tests

test_add_cache_point_tool_block_passes_ttl_for_claude_4_5 and
test_bedrock_tools_pt_passes_ttl_for_claude_4_5 used a fabricated model id
(...-20250514-v1:0) that never shipped. This passed under the old regex-based
is_claude_4_5_on_bedrock, which matched on substring alone, but fails now
that it looks up cache_creation_input_token_cost_above_1hr in
litellm.model_cost, since the fake id has no pricing entry.

Also force the bundled local cost map in both tests so ttl eligibility reads
this branch's pricing data instead of the network-fetched main copy, which
lacks the fix until merge.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bedrock): restore cache and tool config compatibility

* fix(bedrock): preserve Sonnet 5 parallel tool config

* fix(bedrock): decouple parallel tool support from cache ttl

* refactor(bedrock): drive parallel tool use config from JSON, not hardcoded patterns

Replace the hardcoded _CLAUDE_BEDROCK_PARALLEL_TOOL_USE_PATTERNS tuple and
bedrock_converse_supports_strict_tool_schemas (dead code) with a
supports_parallel_tool_use_config key in model_prices_and_context_window.json,
matching how is_claude_4_5_on_bedrock already reads
cache_creation_input_token_cost_above_1hr from the pricing JSON.

New models pick up parallel tool use support automatically when their
pricing entry ships with the key set, with no code change required

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

* fix(tests): use real model id in parallel-tool-use-without-ttl-pricing test

anthropic.claude-opus-4-7-unlisted-v1:0 has no entry in
model_prices_and_context_window.json, so
bedrock_converse_supports_parallel_tool_use_config returned False and the
test died with KeyError on additionalModelRequestFields. Use
jp.anthropic.claude-opus-4-7, a real entry that carries
supports_parallel_tool_use_config without 1h-TTL cache pricing, which is
exactly the decoupling this test exists to cover

* test(utils): allow supports_parallel_tool_use_config in pricing schema

The misc unit test job validates model_prices_and_context_window.json
against the INTENDED_SCHEMA allowlist in test_utils.py, which rejects
unknown keys. Add the supports_parallel_tool_use_config key this PR
introduced so test_aaamodel_prices_and_context_window_json_is_valid
passes again

* fix(bedrock): preserve ttl for regional claude models

* fix(bedrock): fall back to base model entry when regional pricing lacks capability fields

Regional model_cost entries like jp.anthropic.claude-opus-4-7 that omit
cache_creation_input_token_cost_above_1hr shadowed the base entry that has it,
so is_claude_4_5_on_bedrock returned False and requested cache ttl values were
dropped for those deployments. Both capability lookups now consult the full
model id and the region-stripped base entry, matching the coverage of the old
name-pattern list. Also restores ToolBlock keyword construction for the
tool_config cachePoint; PEP 589 TypedDict keyword instantiation works on every
supported Python version

---------

Co-authored-by: Shivam Rawat <shivamrawat@Shivams-MacBook-Pro.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: mateo <mateo@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
(cherry picked from commit 1543725)
@mateo-berri
mateo-berri restored the litellm_bedrock_cache_control_default branch July 8, 2026 19:23
@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@mateo-berri

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4e53edc. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 50b4c18d-0f3a-4500-b8fa-81e7620e2f48

📥 Commits

Reviewing files that changed from the base of the PR and between bea8c93 and 4e53edc.

📒 Files selected for processing (11)
  • litellm/llms/bedrock/chat/converse_transformation.py
  • litellm/llms/bedrock/common_utils.py
  • litellm/model_prices_and_context_window_backup.json
  • litellm/types/integrations/anthropic_cache_control_hook.py
  • model_prices_and_context_window.json
  • ruff-strict-budget.json
  • tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py
  • tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py
  • tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py
  • tests/test_litellm/llms/bedrock/test_bedrock_common_utils.py
  • tests/test_litellm/test_utils.py

📝 Walkthrough

Walkthrough

Bedrock Converse gating for parallel tool-use and extended cache TTL support switches from hardcoded Claude 4.5 name matching to data-driven lookups against litellm.model_cost, with base-model fallback. cachePoint construction is refactored into a shared helper, and pricing JSON files gain a new capability flag alongside formatting normalization.

Changes

Capability-driven parallel tool-use and cache TTL gating

Layer / File(s) Summary
Capability helper functions
litellm/llms/bedrock/common_utils.py, tests/test_litellm/llms/bedrock/test_bedrock_common_utils.py
Adds bedrock_converse_supports_parallel_tool_use_config and rewrites is_claude_4_5_on_bedrock to check litellm.model_cost fields (with base-model fallback) instead of hardcoded name/version matching; adds a fallback regression test.
Converse transformation wiring and cachePoint refactor
litellm/llms/bedrock/chat/converse_transformation.py, litellm/types/integrations/anthropic_cache_control_hook.py
Imports and uses the new capability helper to gate parallel tool-use config, factors cachePoint TTL logic into _build_cache_point_block, uses it in tool_config cache injection, and adds an optional control field to the cache injection point type.
Regression tests for gating and TTL behavior
tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py, tests/test_litellm/litellm_core_utils/prompt_templates/*, tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py
Adds tests for parallel tool-use gating decoupled from TTL pricing, TTL injection/fallback in tool_config cachePoints, and TTL stripping/preservation for tool cache_control, forcing local model cost maps for determinism.

Pricing/context window JSON data updates

Layer / File(s) Summary
Capability flags and pricing normalization
litellm/model_prices_and_context_window_backup.json, model_prices_and_context_window.json, tests/test_litellm/test_utils.py, ruff-strict-budget.json
Adds supports_parallel_tool_use_config capability flag across many Anthropic/Bedrock model entries, normalizes numeric formatting to scientific notation, reformats arrays, adjusts regional uplift multipliers, inserts/reorganizes Snowflake and pinstripes entries, extends the JSON schema test, and lowers the ruff SIM101 budget limit.

Estimated code review effort: 3 (Moderate) | ~30 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch litellm_bedrock_cache_control_default
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch litellm_bedrock_cache_control_default

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants