Skip to content

Commit 937620a

Browse files
committed
docs: add local build and AWS Bedrock setup instructions
Covers cloning, building with bun, AWS SSO profile config, opencode.json Bedrock provider setup, and the opencode-work shell alias. Notes the tool_call fix included in this branch.
1 parent 8fc831e commit 937620a

1 file changed

Lines changed: 154 additions & 0 deletions

File tree

LOCAL_AWS_SETUP.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Local Build & AWS Bedrock Setup
2+
3+
Instructions for cloning, building, and running this fork of opencode with AWS Bedrock.
4+
5+
## Prerequisites
6+
7+
- [Bun](https://bun.sh) v1.3+
8+
- [AWS CLI](https://aws.amazon.com/cli/) v2
9+
- Git + SSH key configured for GitHub
10+
11+
## Clone & Build
12+
13+
```bash
14+
git clone git@github.com:lgarceau768/opencode.git
15+
cd opencode
16+
17+
# Install dependencies (--ignore-scripts avoids native build failures)
18+
bun install --ignore-scripts
19+
20+
# Build for your current platform only
21+
bun run --bun --cwd packages/opencode build --single --skip-embed-web-ui
22+
```
23+
24+
The binary will be at:
25+
- macOS ARM64: `packages/opencode/dist/opencode-darwin-arm64/bin/opencode`
26+
- macOS x64: `packages/opencode/dist/opencode-darwin-x64/bin/opencode`
27+
- Linux ARM64: `packages/opencode/dist/opencode-linux-arm64/bin/opencode`
28+
- Linux x64: `packages/opencode/dist/opencode-linux-x64/bin/opencode`
29+
30+
Verify the build:
31+
32+
```bash
33+
./packages/opencode/dist/opencode-darwin-arm64/bin/opencode --version
34+
```
35+
36+
## AWS Bedrock Setup
37+
38+
### 1. Configure AWS SSO profile
39+
40+
Add to `~/.aws/config`:
41+
42+
```ini
43+
[profile AdministratorAccess]
44+
sso_start_url = <your-sso-start-url>
45+
sso_region = <your-sso-region>
46+
sso_account_id = <your-account-id>
47+
sso_role_name = AdministratorAccess
48+
region = <your-preferred-region>
49+
```
50+
51+
### 2. Configure opencode for Bedrock
52+
53+
Create `~/.config/opencode/opencode.json`:
54+
55+
```json
56+
{
57+
"$schema": "https://opencode.ai/config.json",
58+
"model": "amazon-bedrock/us.anthropic.claude-sonnet-4-6",
59+
"enabled_providers": ["amazon-bedrock"],
60+
"plugin": [],
61+
"provider": {
62+
"amazon-bedrock": {
63+
"options": {
64+
"region": "<your-preferred-region>"
65+
},
66+
"models": {
67+
"writer.palmyra-x4": {
68+
"id": "us.writer.palmyra-x4-v1:0",
69+
"name": "Writer Palmyra X4",
70+
"tool_call": false,
71+
"limit": { "context": 128000, "output": 8192 }
72+
},
73+
"writer.palmyra-x5": {
74+
"id": "us.writer.palmyra-x5-v1:0",
75+
"name": "Writer Palmyra X5",
76+
"tool_call": false,
77+
"limit": { "context": 1000000, "output": 8192 }
78+
},
79+
"deepseek.r1": {
80+
"id": "us.deepseek.r1-v1:0",
81+
"name": "DeepSeek R1",
82+
"tool_call": false,
83+
"limit": { "context": 64000, "output": 32768 }
84+
},
85+
"mistral.pixtral-large-2502": {
86+
"id": "us.mistral.pixtral-large-2502-v1:0",
87+
"name": "Mistral Pixtral Large",
88+
"tool_call": false,
89+
"limit": { "context": 128000, "output": 8192 }
90+
},
91+
"meta.llama4-maverick-17b-instruct": {
92+
"id": "us.meta.llama4-maverick-17b-instruct-v1:0",
93+
"name": "Meta Llama 4 Maverick 17B",
94+
"tool_call": false,
95+
"limit": { "context": 1000000, "output": 8192 }
96+
},
97+
"meta.llama4-scout-17b-instruct": {
98+
"id": "us.meta.llama4-scout-17b-instruct-v1:0",
99+
"name": "Meta Llama 4 Scout 17B",
100+
"tool_call": false,
101+
"limit": { "context": 10000000, "output": 8192 }
102+
},
103+
"amazon.nova-2-lite": {
104+
"id": "us.amazon.nova-2-lite-v1:0",
105+
"name": "Amazon Nova 2 Lite",
106+
"limit": { "context": 300000, "output": 5120 }
107+
}
108+
}
109+
}
110+
}
111+
}
112+
```
113+
114+
> **Note on `tool_call: false`:** Models marked with `tool_call: false` do not support
115+
> tool use in streaming mode on Bedrock. This config prevents opencode from sending
116+
> tool definitions to those models. This fork includes a fix (cherry-picked from
117+
> [anomalyco/opencode#20040](https://github.com/anomalyco/opencode/pull/20040)) that
118+
> makes `tool_call: false` actually respected at runtime.
119+
120+
### 3. Shell alias
121+
122+
Add to `~/.zshrc` or `~/.bashrc`:
123+
124+
```bash
125+
opencode-work() {
126+
local profile="AdministratorAccess"
127+
echo "Logging in to AWS SSO ($profile)..."
128+
aws sso login --profile "$profile" || return 1
129+
eval "$(aws configure export-credentials --profile "$profile" --format env)"
130+
/path/to/opencode/packages/opencode/dist/opencode-darwin-arm64/bin/opencode "$@"
131+
}
132+
```
133+
134+
Replace `/path/to/opencode` with where you cloned the repo.
135+
136+
### 4. Usage
137+
138+
```bash
139+
# Login and launch
140+
opencode-work
141+
142+
# Re-running after SSO session expires — just run again, it will re-authenticate
143+
opencode-work
144+
```
145+
146+
## What's Different in This Fork
147+
148+
- **`tool_call: false` fix** — upstream opencode parses this config field but the
149+
binary does not enforce it, causing failures on Bedrock models that don't support
150+
streaming + tool use together. This fork includes the fix from
151+
[anomalyco/opencode#20040](https://github.com/anomalyco/opencode/pull/20040)
152+
until it lands in the official release.
153+
154+
Tracked upstream in: [sst/opencode#19966](https://github.com/sst/opencode/issues/19966)

0 commit comments

Comments
 (0)