diff options
| author | Grégoire Morpain <[email protected]> | 2026-01-05 19:51:43 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-05 12:51:43 -0600 |
| commit | e3b4d4ad49fcb34919b0cda4a9a9b4e6f1bc4f2b (patch) | |
| tree | 36527bffac598dec189d6410d6d190a9b2a31474 /packages/web/src/content/docs | |
| parent | 6b207b09d6a19aec70c7e312016779721f64a377 (diff) | |
| download | opencode-e3b4d4ad49fcb34919b0cda4a9a9b4e6f1bc4f2b.tar.gz opencode-e3b4d4ad49fcb34919b0cda4a9a9b4e6f1bc4f2b.zip | |
feat(bedrock): config options and authentication precedence (#6377)
Diffstat (limited to 'packages/web/src/content/docs')
| -rw-r--r-- | packages/web/src/content/docs/config.mdx | 35 | ||||
| -rw-r--r-- | packages/web/src/content/docs/providers.mdx | 93 |
2 files changed, 116 insertions, 12 deletions
diff --git a/packages/web/src/content/docs/config.mdx b/packages/web/src/content/docs/config.mdx index 24b822cc4..d9076e13a 100644 --- a/packages/web/src/content/docs/config.mdx +++ b/packages/web/src/content/docs/config.mdx @@ -205,6 +205,41 @@ You can also configure [local models](/docs/models#local). [Learn more](/docs/mo --- +#### Provider-Specific Options + +Some providers support additional configuration options beyond the generic `timeout` and `apiKey` settings. + +##### Amazon Bedrock + +Amazon Bedrock supports AWS-specific configuration: + +```json title="opencode.json" +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "amazon-bedrock": { + "options": { + "region": "us-east-1", + "profile": "my-aws-profile", + "endpoint": "https://bedrock-runtime.us-east-1.vpce-xxxxx.amazonaws.com" + } + } + } +} +``` + +- `region` - AWS region for Bedrock (defaults to `AWS_REGION` env var or `us-east-1`) +- `profile` - AWS named profile from `~/.aws/credentials` (defaults to `AWS_PROFILE` env var) +- `endpoint` - Custom endpoint URL for VPC endpoints. This is an alias for the generic `baseURL` option using AWS-specific terminology. If both are specified, `endpoint` takes precedence. + +:::note +Bearer tokens (`AWS_BEARER_TOKEN_BEDROCK` or `/connect`) take precedence over profile-based authentication. See [authentication precedence](/docs/providers#authentication-precedence) for details. +::: + +[Learn more about Amazon Bedrock configuration](/docs/providers#amazon-bedrock). + +--- + ### Themes You can configure the theme you want to use in your OpenCode config through the `theme` option. diff --git a/packages/web/src/content/docs/providers.mdx b/packages/web/src/content/docs/providers.mdx index e59fbc819..0e4539e12 100644 --- a/packages/web/src/content/docs/providers.mdx +++ b/packages/web/src/content/docs/providers.mdx @@ -107,27 +107,96 @@ To use Amazon Bedrock with OpenCode: You need to have access to the model you want in Amazon Bedrock. ::: -1. You'll need either to set one of the following environment variables: - - `AWS_ACCESS_KEY_ID`: You can get this by creating an IAM user and generating - an access key for it. - - `AWS_PROFILE`: First login through AWS IAM Identity Center (or AWS SSO) using - `aws sso login`. Then get the name of the profile you want to use. - - `AWS_BEARER_TOKEN_BEDROCK`: You can generate a long-term API key from the - Amazon Bedrock console. +2. **Configure authentication** using one of the following methods: - Once you have one of the above, set it while running opencode. + #### Environment Variables (Quick Start) + + Set one of these environment variables while running opencode: ```bash - AWS_ACCESS_KEY_ID=XXX opencode + # Option 1: Using AWS access keys + AWS_ACCESS_KEY_ID=XXX AWS_SECRET_ACCESS_KEY=YYY opencode + + # Option 2: Using named AWS profile + AWS_PROFILE=my-profile opencode + + # Option 3: Using Bedrock bearer token + AWS_BEARER_TOKEN_BEDROCK=XXX opencode ``` - Or add it to your bash profile. + Or add them to your bash profile: ```bash title="~/.bash_profile" - export AWS_ACCESS_KEY_ID=XXX + export AWS_PROFILE=my-dev-profile + export AWS_REGION=us-east-1 + ``` + + #### Configuration File (Recommended) + + For project-specific or persistent configuration, use `opencode.json`: + + ```json title="opencode.json" + { + "$schema": "https://opencode.ai/config.json", + "provider": { + "amazon-bedrock": { + "options": { + "region": "us-east-1", + "profile": "my-aws-profile" + } + } + } + } ``` -1. Run the `/models` command to select the model you want. + **Available options:** + - `region` - AWS region (e.g., `us-east-1`, `eu-west-1`) + - `profile` - AWS named profile from `~/.aws/credentials` + - `endpoint` - Custom endpoint URL for VPC endpoints (alias for generic `baseURL` option) + + :::tip + Configuration file options take precedence over environment variables. + ::: + + #### Advanced: VPC Endpoints + + If you're using VPC endpoints for Bedrock: + + ```json title="opencode.json" + { + "$schema": "https://opencode.ai/config.json", + "provider": { + "amazon-bedrock": { + "options": { + "region": "us-east-1", + "profile": "production", + "endpoint": "https://bedrock-runtime.us-east-1.vpce-xxxxx.amazonaws.com" + } + } + } + } + ``` + + :::note + The `endpoint` option is an alias for the generic `baseURL` option, using AWS-specific terminology. If both `endpoint` and `baseURL` are specified, `endpoint` takes precedence. + ::: + + #### Authentication Methods + - **`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`**: Create an IAM user and generate access keys in the AWS Console + - **`AWS_PROFILE`**: Use named profiles from `~/.aws/credentials`. First configure with `aws configure --profile my-profile` or `aws sso login` + - **`AWS_BEARER_TOKEN_BEDROCK`**: Generate long-term API keys from the Amazon Bedrock console + + #### Authentication Precedence + + Amazon Bedrock uses the following authentication priority: + 1. **Bearer Token** - `AWS_BEARER_TOKEN_BEDROCK` environment variable or token from `/connect` command + 2. **AWS Credential Chain** - Profile, access keys, shared credentials, IAM roles, instance metadata + + :::note + When a bearer token is set (via `/connect` or `AWS_BEARER_TOKEN_BEDROCK`), it takes precedence over all AWS credential methods including configured profiles. + ::: + +3. Run the `/models` command to select the model you want. ```txt /models |
