fix(bedrock): support region and bearer token configuration #6332
+260
−9
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.
Fixes #5812
Add support for configuring Amazon Bedrock provider region and bearer token through opencode.json and auth.json.
Region Configuration
The amazon-bedrock provider now respects the
regionoption from config (opencode.json) with proper precedence:options.regionfrom opencode.json (highest priority)AWS_REGIONenvironment variableus-east-1fallbackUsers can now configure:
{ "provider": { "amazon-bedrock": { "options": { "region": "eu-west-1" } } } }Bearer Token from Auth
The provider now checks
~/.local/share/opencode/auth.jsonfor bearer tokens with precedence:AWS_BEARER_TOKEN_BEDROCKenvironment variable (if set)This allows users to configure their Bedrock bearer token once and have it automatically used by OpenCode.
Changes
Promise.all()from env var retrieval and addAuth.get()check for bearer tokensregiontodefaultRegionto clarify it's the default used when no config override existsregionvariable ingetModel()for resolved region with config precedencegetModel()parameter from_optionstooptions(was previously ignored)