GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(bedrock): add prompt caching support for custom ARNs and inferen… by marcelloceschia · Pull Request #16504 · anomalyco/opencode

Conversation

@marcelloceschia

@marcelloceschia marcelloceschia commented Mar 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

…ce profiles

  • Enable prompt caching for Bedrock models that support it (Claude, Nova)
  • Add 'caching' option for custom ARNs/inference profiles without claude in name
  • Disable caching for Llama, Mistral, Cohere models (not supported)
  • Add comprehensive tests for all caching scenarios

Fixes: Prompt cache not supported for custom ARN models
Fixes: 1M context window not configurable

Users can now configure custom ARNs like:

{
  "provider": {
    "amazon-bedrock": {
      "models": {
        "arn:aws:bedrock:...:application-inference-profile/xxx": {
          "options": { "caching": true },
          "limit": { "context": 1000000, "output": 32000 }
        }
      }
    }
  }
}

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

I run the code locally and verified with our grafana dashboard, the the chaching is now used

Screenshots / recordings

image

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 7, 2026
@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found 2 potentially related PRs (excluding the current PR #16504):

  1. PR feat(provider): add provider-specific cache configuration system (significant token usage reduction) #5422: feat(provider): add provider-specific cache configuration system (significant token usage reduction)

    • feat(provider): add provider-specific cache configuration system (significant token usage reduction) #5422
    • Why it's related: Addresses provider-specific cache configuration, which overlaps with PR feat(bedrock): add prompt caching support for custom ARNs and inferen… #16504's goal of enabling caching options for Bedrock models.
  2. PR fix(metadata): Some providers use requestbody(body.metadata.user_id) to enable cache features Fixes #8195 #11276: fix(metadata): Some providers use requestbody(body.metadata.user_id) to enable cache features Fixes fix(telemetry): restore userId and sessionId metadata in experimental_telemetry #8195

    • fix(metadata): Some providers use requestbody(body.metadata.user_id) to enable cache features Fixes #8195 #11276
    • Why it's related: Deals with cache feature enablement across providers, potentially addressing similar caching infrastructure.

Check these PRs to see if they've already addressed Bedrock prompt caching or if there's overlap in the implementation approach.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 7, 2026
@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcelloceschia
feat(bedrock): add prompt caching support for custom ARNs and inferen…
e349074
…ce profiles

- Enable prompt caching for Bedrock models that support it (Claude, Nova)
- Add 'caching' option for custom ARNs/inference profiles without claude in name
- Disable caching for Llama, Mistral, Cohere models (not supported)
- Add comprehensive tests for all caching scenarios

Fixes #1: Prompt cache not supported for custom ARN models
Fixes #2: 1M context window not configurable

Users can now configure custom ARNs like:
```json
{
  "provider": {
    "amazon-bedrock": {
      "models": {
        "arn:aws:bedrock:...:application-inference-profile/xxx": {
          "options": { "caching": true },
          "limit": { "context": 1000000, "output": 32000 }
        }
      }
    }
  }
}
```
@marcelloceschia
marcelloceschia force-pushed the fix/bedrock-prompt-caching-custom-arn branch from 2ed846f to e349074 Compare March 7, 2026 17:53
marcelloceschia and others added 11 commits March 7, 2026 18:57
@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
e998ee6
@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
8e6fdc1
@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
9d56df5
@rekram1-node
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
3013032
@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
2a82170
@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
96fbf63
@marcelloceschia
feat(provider): add explicit caching configuration for prompt caching
68fd00d
- Add 'caching' field to Model schema with support for:
  - Boolean (true/false to enable/disable)
  - Object with 'format' and 'positions' options
- No auto-detection - caching is opt-in via model config
- Cache formats: anthropic, openrouter, bedrock, openaiCompatible
- Configurable cache positions: system, first, last

Example configuration:
```json
{
  "provider": {
    "kiro": {
      "models": {
        "claude-sonnet-4-5": {
          "caching": true
        }
      }
    }
  }
}
```

This enables prompt caching for models through kiro-gateway and
other OpenAI-compatible providers.
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
4138895
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
8426f2b
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
3cc08de
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
1c93aa6
@bbartels

bbartels commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

@marcelloceschia seems like there is a fair few tests failing that assert prompt caching

marcelloceschia reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 24, 2026
feat(bedrock): Add token caching for any amazon-bedrock provider #18959
Merged
3 of 6 tasks
@marcelloceschia

marcelloceschia commented Mar 25, 2026

Copy link
Copy Markdown
Author

@bbartels yes, I have seen that but was a bit busy the last days. I will fix it until Friday.
But the big question, would that fix be accepted when it's green again?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

marcelloceschia added 3 commits March 25, 2026 21:27
@marcelloceschia
fix(bedrock): restore auto-detection for Claude/Nova and add options.…
68406c1
…caching support

- Re-add copilot to providerOptions (was accidentally removed)
- Add auto-detection for Bedrock Claude/Nova models (unless options.caching=false)
- Support explicit options.caching=true for custom ARNs
- Respect options.caching=false to disable caching on Anthropic models
- Fixes test failures from PR anomalyco#16504
@marcelloceschia
Merge upstream/dev into fix/bedrock-prompt-caching-custom-arn
7a09b5f
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
0a71da2
@marcelloceschia

marcelloceschia commented Mar 27, 2026

Copy link
Copy Markdown
Author

@marcelloceschia seems like there is a fair few tests failing that assert prompt caching

Please have a look again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcelloceschia
Merge branch 'dev' into fix/bedrock-prompt-caching-custom-arn
81e0072
@marcelloceschia marcelloceschia mentioned this pull request Apr 8, 2026
feat(bedrock): add prompt caching support for custom ARNs and inference profiles marcelloceschia/opencode#2
Closed
1 task done
Marcello Ceschia and others added 2 commits April 10, 2026 14:52
Marcello Ceschia
Merge remote-tracking branch 'upstream/dev' into fix/bedrock-prompt-c…
8040ce7
…aching-custom-arn
@marcelloceschia
Merge branch 'anomalyco:dev' into fix/bedrock-prompt-caching-custom-arn
fd17f90
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions github-actions Bot mentioned this pull request Apr 24, 2026
docs: clarify bedrock inference profile setup #24193
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request May 11, 2026
chore(cache): rebase prompt caching updates for #14743 #26875
Closed
3 of 6 tasks
@rekram1-node

rekram1-node commented May 15, 2026

Copy link
Copy Markdown
Member

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node rekram1-node closed this May 15, 2026
@marcelloceschia

marcelloceschia commented Jun 27, 2026

Copy link
Copy Markdown
Author

@rekram1-node Thanks for the feedback.

The PR was created more than 1 month ago

yes, and no reaction for the team. Its difficult to keep effort on something where you don't get any feedback, only close notification

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@marcelloceschia @bbartels @rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.