Uh oh!
There was an error while loading. Please reload this page.
feat: allow short-term bearer tokens for opencode bedrock user - #16
Merged
Conversation
The Anthropic Messages API surface on bedrock-runtime is the only one that accepts service_tier (flex/priority) for Claude models, and it authenticates with Bedrock API keys rather than SigV4. Short-term tokens are presigned client-side from the user's credentials and inherit its permissions; the bedrock:bearerTokenType=SHORT_TERM condition keeps long-term API keys forbidden.
OpenTofu Plan |
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Flex/Priority service tiers for Claude models are only selectable via
service_tierin the Anthropic Messages API surface on bedrock-runtime (/anthropic/v1/messages). That surface authenticates with Bedrock API keys (bearer tokens), not SigV4 — InvokeModel/Converse reject non-Standard tiers for Anthropic models (verified empirically in us-west-2/us-east-1/us-east-2).This adds
bedrock:CallWithBearerTokenso theopencode-bedrockuser can use short-term (12h, client-side presigned, permission-inheriting) bearer tokens, hardened withbedrock:bearerTokenType = SHORT_TERMso long-term API keys remain forbidden.Validation
make test— all canonical pre-commit hooks passPost-merge test plan: presign a short-term token from the user's credentials and call
/anthropic/v1/messageswith\"service_tier\": \"flex\"on Opus 4.6; the response echoes the served tier.