bug: aws bedrock prompt caching doesn't work correctly #8250

Closed
opened 2026-02-16 18:09:31 -05:00 by yindo · 3 comments
Owner

Originally created by @rgodha24 on GitHub (Feb 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

prompt caching on aws bedrock doesnt work

this makes running opencode thru Opus on AWS Bedrock like 10x more expensive than running it on Anthropic API.

AI diagnosis:

Evidence

Before fix:

Turn Input Cache Read Cache Write
1 ~11k ~13k ~11k
2 ~11k ~13k 0

Plugins

n/a

OpenCode version

1.1.48

Steps to reproduce

use any claude model on aws bedrock in opencode

only the system prompt (e.g. the first ~13k tokens) is read from cache

this means that its like 10x more expensive than running opencode thru official anthropic API

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @rgodha24 on GitHub (Feb 1, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description prompt caching on aws bedrock doesnt work this makes running opencode thru Opus on AWS Bedrock like 10x more expensive than running it on Anthropic API. AI diagnosis: Evidence Before fix: | Turn | Input | Cache Read | Cache Write | |------|-------|------------|-------------| | 1 | ~11k | ~13k | ~11k | | 2 | ~11k | ~13k | 0 | ### Plugins n/a ### OpenCode version 1.1.48 ### Steps to reproduce use any claude model on aws bedrock in opencode only the system prompt (e.g. the first ~13k tokens) is read from cache this means that its like 10x more expensive than running opencode thru official anthropic API ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 18:09:31 -05:00
yindo closed this issue 2026-02-16 18:09:31 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 1, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10066: Excessive input token usage with Sonnet on AWS Bedrock (describes the same 10x cost increase and indicates tool outputs are being repeatedly included)
  • #9803: Claude w/ bedrock custom inference profile - no caching (directly addresses bedrock prompt caching detection issues)
  • #8623: Due to the lack of userId and sessionId, some models will not hit the cache (related to cache metadata)
  • #11083: The Claude model cannot properly enable the caching function (related to caching detection with Claude)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 1, 2026): This issue might be a duplicate of existing issues. Please check: - #10066: Excessive input token usage with Sonnet on AWS Bedrock (describes the same 10x cost increase and indicates tool outputs are being repeatedly included) - #9803: Claude w/ bedrock custom inference profile - no caching (directly addresses bedrock prompt caching detection issues) - #8623: Due to the lack of userId and sessionId, some models will not hit the cache (related to cache metadata) - #11083: The Claude model cannot properly enable the caching function (related to caching detection with Claude) Feel free to ignore if none of these address your specific case.
Author
Owner

@thevinchi commented on GitHub (Feb 6, 2026):

This has been working great, but the same behavior is back when attempting to use Opus 4.6 on bedrock. I assume I should open a new issue?

@thevinchi commented on GitHub (Feb 6, 2026): This has been working great, but the same behavior is back when attempting to use Opus 4.6 on bedrock. I assume I should open a new issue?
Author
Owner

@thevinchi commented on GitHub (Feb 6, 2026):

Nevermind, I had not updated opencode to the latest version in the environment where we were testing Opus 4.6. 🤦‍♂️

@thevinchi commented on GitHub (Feb 6, 2026): Nevermind, I had not updated opencode to the latest version in the environment where we were testing Opus 4.6. 🤦‍♂️
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8250