opencode-crs-bedrock 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -98
- package/index.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,54 +25,33 @@ This plugin transforms the CRS response stream to match what the Anthropic SDK e
|
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g opencode-crs-bedrock
|
|
30
|
+
```
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
Or add to your OpenCode config to auto-install:
|
|
31
33
|
|
|
32
34
|
```json
|
|
33
35
|
{
|
|
34
|
-
"plugin": [
|
|
35
|
-
"file:///path/to/opencode-crs-bedrock"
|
|
36
|
-
]
|
|
36
|
+
"plugin": ["opencode-crs-bedrock@latest"]
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm install -g opencode-crs-bedrock
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Configuration
|
|
47
|
-
|
|
48
|
-
> **Note**: Both `apiKey` and `baseURL` are optional. You can configure them via environment variables, use `opencode auth login crs` for interactive setup, or configure them directly in the config file.
|
|
49
|
-
|
|
50
|
-
### Option 1: Using Environment Variables (Recommended)
|
|
51
|
-
|
|
52
|
-
Set environment variables for automatic configuration:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
export ANTHROPIC_BASE_URL=https://your-crs-endpoint.com/api
|
|
56
|
-
export ANTHROPIC_AUTH_TOKEN=cr_your_api_key_here
|
|
57
|
-
```
|
|
40
|
+
## Quick Start
|
|
58
41
|
|
|
59
|
-
|
|
42
|
+
### Step 1: Configure OpenCode
|
|
60
43
|
|
|
61
|
-
|
|
44
|
+
Create or edit `opencode.json` in your project root or `~/.config/opencode/opencode.json`:
|
|
62
45
|
|
|
63
46
|
```json
|
|
64
47
|
{
|
|
65
48
|
"$schema": "https://opencode.ai/config.json",
|
|
66
49
|
"plugin": [
|
|
67
|
-
"opencode-crs-bedrock"
|
|
50
|
+
"opencode-crs-bedrock@latest"
|
|
68
51
|
],
|
|
69
52
|
"provider": {
|
|
70
53
|
"crs": {
|
|
71
54
|
"npm": "@ai-sdk/anthropic",
|
|
72
|
-
"options": {
|
|
73
|
-
"baseURL": "{env:ANTHROPIC_BASE_URL}",
|
|
74
|
-
"apiKey": "{env:ANTHROPIC_AUTH_TOKEN}"
|
|
75
|
-
},
|
|
76
55
|
"models": {
|
|
77
56
|
"claude-opus-4-5": {
|
|
78
57
|
"name": "Opus 4.5 [CRS]",
|
|
@@ -97,64 +76,28 @@ Then create `opencode.json` in your project or `~/.config/opencode/opencode.json
|
|
|
97
76
|
}
|
|
98
77
|
```
|
|
99
78
|
|
|
100
|
-
###
|
|
79
|
+
### Step 2: Authenticate
|
|
101
80
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"$schema": "https://opencode.ai/config.json",
|
|
107
|
-
"plugin": [
|
|
108
|
-
"opencode-crs-bedrock"
|
|
109
|
-
],
|
|
110
|
-
"provider": {
|
|
111
|
-
"crs": {
|
|
112
|
-
"npm": "@ai-sdk/anthropic",
|
|
113
|
-
"models": {
|
|
114
|
-
"claude-sonnet-4-5": {
|
|
115
|
-
"name": "Sonnet 4.5 [CRS]",
|
|
116
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Then run the auth login command to store your credentials:
|
|
81
|
+
Run the OpenCode auth login command:
|
|
125
82
|
|
|
126
83
|
```bash
|
|
127
|
-
opencode auth login
|
|
84
|
+
opencode auth login
|
|
128
85
|
```
|
|
129
86
|
|
|
130
|
-
|
|
87
|
+
When prompted:
|
|
88
|
+
1. Select **Other provider**
|
|
89
|
+
2. Enter provider id: **`crs`**
|
|
90
|
+
3. Enter your CRS API key (starts with `cr_`)
|
|
131
91
|
|
|
132
|
-
|
|
92
|
+
Your credentials will be securely stored and the plugin will automatically configure the custom fetch handler for CRS/Bedrock compatibility
|
|
133
93
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```json
|
|
137
|
-
{
|
|
138
|
-
"provider": {
|
|
139
|
-
"crs": {
|
|
140
|
-
"npm": "@ai-sdk/anthropic",
|
|
141
|
-
"options": {
|
|
142
|
-
"baseURL": "https://your-crs-endpoint.com/api",
|
|
143
|
-
"apiKey": "cr_your_api_key_here"
|
|
144
|
-
},
|
|
145
|
-
"models": { /* ... */ }
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Using the Model
|
|
94
|
+
## Usage
|
|
152
95
|
|
|
153
96
|
```bash
|
|
154
97
|
# Interactive mode
|
|
155
98
|
opencode
|
|
156
99
|
|
|
157
|
-
# Or direct run with
|
|
100
|
+
# Or direct run with a specific model
|
|
158
101
|
opencode run -m crs/claude-sonnet-4-5 "Hello, world!"
|
|
159
102
|
|
|
160
103
|
# Use with thinking budget variants
|
|
@@ -192,6 +135,9 @@ Models available through CRS/Bedrock:
|
|
|
192
135
|
|----------|------------|
|
|
193
136
|
| `claude-sonnet-4-20250514` | `us.anthropic.claude-sonnet-4-20250514-v1:0` |
|
|
194
137
|
| `claude-opus-4-20250514` | `us.anthropic.claude-opus-4-20250514-v1:0` |
|
|
138
|
+
| `claude-opus-4-5-20251101` | `us.anthropic.claude-opus-4-5-20251101-v1:0` |
|
|
139
|
+
| `claude-haiku-4-5-20251001` | `us.anthropic.claude-haiku-4-5-20251001-v1:0` |
|
|
140
|
+
| `claude-sonnet-4-5-20250929` | `us.anthropic.claude-sonnet-4-5-20250929-v1:0` |
|
|
195
141
|
| `claude-3-5-sonnet-20241022` | `us.anthropic.claude-3-5-sonnet-20241022-v2:0` |
|
|
196
142
|
| `claude-3-5-haiku-20241022` | `us.anthropic.claude-3-5-haiku-20241022-v1:0` |
|
|
197
143
|
| `claude-3-opus-20240229` | `us.anthropic.claude-3-opus-20240229-v1:0` |
|
|
@@ -228,44 +174,58 @@ The inference scores each tool by:
|
|
|
228
174
|
|
|
229
175
|
## Troubleshooting
|
|
230
176
|
|
|
231
|
-
###
|
|
177
|
+
### Authentication Issues
|
|
232
178
|
|
|
233
|
-
|
|
179
|
+
**Check stored credentials:**
|
|
180
|
+
```bash
|
|
181
|
+
opencode auth list
|
|
182
|
+
```
|
|
234
183
|
|
|
235
|
-
|
|
184
|
+
If your CRS credentials aren't listed, run the authentication step again:
|
|
185
|
+
```bash
|
|
186
|
+
opencode auth login
|
|
187
|
+
```
|
|
236
188
|
|
|
237
|
-
|
|
189
|
+
Make sure to:
|
|
190
|
+
- Select **Other provider**
|
|
191
|
+
- Enter provider id: **`crs`**
|
|
192
|
+
- Enter your CRS API key (starts with `cr_`)
|
|
238
193
|
|
|
239
|
-
###
|
|
194
|
+
### "Invalid input: expected array, received undefined"
|
|
195
|
+
|
|
196
|
+
This error means tool name inference failed. Enable debug logging to see which tool was inferred:
|
|
240
197
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
- **OpenCode auth**: Run `opencode auth list` to see stored credentials
|
|
248
|
-
- **Direct config**: Check your `opencode.json` has correct values
|
|
198
|
+
```bash
|
|
199
|
+
CRS_DEBUG_SSE=true opencode run -m crs/claude-sonnet-4-5 "test"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Connection Issues
|
|
249
203
|
|
|
250
|
-
|
|
204
|
+
1. Verify your credentials are stored:
|
|
251
205
|
```bash
|
|
252
|
-
|
|
206
|
+
opencode auth list
|
|
253
207
|
```
|
|
254
208
|
|
|
255
|
-
|
|
209
|
+
2. Check your `opencode.json` has the correct provider configuration (see Quick Start above)
|
|
210
|
+
|
|
211
|
+
3. Enable debug logging to see request details:
|
|
256
212
|
```bash
|
|
257
213
|
CRS_DEBUG_SSE=true opencode run -m crs/claude-sonnet-4-5 "test"
|
|
258
214
|
```
|
|
259
215
|
|
|
260
|
-
|
|
216
|
+
## Local Development
|
|
261
217
|
|
|
262
|
-
|
|
218
|
+
For contributors working on the plugin itself:
|
|
263
219
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"plugin": [
|
|
223
|
+
"file:///path/to/opencode-crs-bedrock"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
```
|
|
267
227
|
|
|
268
|
-
|
|
228
|
+
Reference the local directory in your OpenCode config for live development.
|
|
269
229
|
|
|
270
230
|
## License
|
|
271
231
|
|
package/index.ts
CHANGED
|
@@ -335,6 +335,9 @@ const BEDROCK_MODEL_MAPPINGS: Record<string, string> = {
|
|
|
335
335
|
"us.anthropic.claude-3-5-sonnet-20241022-v2:0": "claude-3-5-sonnet-20241022",
|
|
336
336
|
"us.anthropic.claude-3-5-haiku-20241022-v1:0": "claude-3-5-haiku-20241022",
|
|
337
337
|
"us.anthropic.claude-3-opus-20240229-v1:0": "claude-3-opus-20240229",
|
|
338
|
+
"us.anthropic.claude-opus-4-5-20251101-v1:0": "claude-opus-4-5-20251101",
|
|
339
|
+
"us.anthropic.claude-haiku-4-5-20251001-v1:0": "claude-haiku-4-5-20251001",
|
|
340
|
+
"us.anthropic.claude-sonnet-4-5-20250929-v1:0": "claude-sonnet-4-5-20250929",
|
|
338
341
|
};
|
|
339
342
|
|
|
340
343
|
/**
|