@link-assistant/agent 0.0.8 → 0.0.11
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/EXAMPLES.md +80 -1
- package/MODELS.md +72 -24
- package/README.md +95 -2
- package/TOOLS.md +20 -0
- package/package.json +36 -2
- package/src/agent/agent.ts +68 -54
- package/src/auth/claude-oauth.ts +426 -0
- package/src/auth/index.ts +28 -26
- package/src/auth/plugins.ts +876 -0
- package/src/bun/index.ts +53 -43
- package/src/bus/global.ts +5 -5
- package/src/bus/index.ts +59 -53
- package/src/cli/bootstrap.js +12 -12
- package/src/cli/bootstrap.ts +6 -6
- package/src/cli/cmd/agent.ts +97 -92
- package/src/cli/cmd/auth.ts +468 -0
- package/src/cli/cmd/cmd.ts +2 -2
- package/src/cli/cmd/export.ts +41 -41
- package/src/cli/cmd/mcp.ts +210 -53
- package/src/cli/cmd/models.ts +30 -29
- package/src/cli/cmd/run.ts +269 -213
- package/src/cli/cmd/stats.ts +185 -146
- package/src/cli/error.ts +17 -13
- package/src/cli/ui.ts +78 -0
- package/src/command/index.ts +26 -26
- package/src/config/config.ts +528 -288
- package/src/config/markdown.ts +15 -15
- package/src/file/ripgrep.ts +201 -169
- package/src/file/time.ts +21 -18
- package/src/file/watcher.ts +51 -42
- package/src/file.ts +1 -1
- package/src/flag/flag.ts +26 -11
- package/src/format/formatter.ts +206 -162
- package/src/format/index.ts +61 -61
- package/src/global/index.ts +21 -21
- package/src/id/id.ts +47 -33
- package/src/index.js +554 -332
- package/src/json-standard/index.ts +173 -0
- package/src/mcp/index.ts +135 -128
- package/src/patch/index.ts +336 -267
- package/src/project/bootstrap.ts +15 -15
- package/src/project/instance.ts +43 -36
- package/src/project/project.ts +47 -47
- package/src/project/state.ts +37 -33
- package/src/provider/models-macro.ts +5 -5
- package/src/provider/models.ts +32 -32
- package/src/provider/opencode.js +19 -19
- package/src/provider/provider.ts +518 -277
- package/src/provider/transform.ts +143 -102
- package/src/server/project.ts +21 -21
- package/src/server/server.ts +111 -105
- package/src/session/agent.js +66 -60
- package/src/session/compaction.ts +136 -111
- package/src/session/index.ts +189 -156
- package/src/session/message-v2.ts +312 -268
- package/src/session/message.ts +73 -57
- package/src/session/processor.ts +180 -166
- package/src/session/prompt.ts +678 -533
- package/src/session/retry.ts +26 -23
- package/src/session/revert.ts +76 -62
- package/src/session/status.ts +26 -26
- package/src/session/summary.ts +97 -76
- package/src/session/system.ts +77 -63
- package/src/session/todo.ts +22 -16
- package/src/snapshot/index.ts +92 -76
- package/src/storage/storage.ts +157 -120
- package/src/tool/bash.ts +116 -106
- package/src/tool/batch.ts +73 -59
- package/src/tool/codesearch.ts +60 -53
- package/src/tool/edit.ts +319 -263
- package/src/tool/glob.ts +32 -28
- package/src/tool/grep.ts +72 -53
- package/src/tool/invalid.ts +7 -7
- package/src/tool/ls.ts +77 -64
- package/src/tool/multiedit.ts +30 -21
- package/src/tool/patch.ts +121 -94
- package/src/tool/read.ts +140 -122
- package/src/tool/registry.ts +38 -38
- package/src/tool/task.ts +93 -60
- package/src/tool/todo.ts +16 -16
- package/src/tool/tool.ts +45 -36
- package/src/tool/webfetch.ts +97 -74
- package/src/tool/websearch.ts +78 -64
- package/src/tool/write.ts +21 -15
- package/src/util/binary.ts +27 -19
- package/src/util/context.ts +8 -8
- package/src/util/defer.ts +7 -5
- package/src/util/error.ts +24 -19
- package/src/util/eventloop.ts +16 -10
- package/src/util/filesystem.ts +37 -33
- package/src/util/fn.ts +11 -8
- package/src/util/iife.ts +1 -1
- package/src/util/keybind.ts +44 -44
- package/src/util/lazy.ts +7 -7
- package/src/util/locale.ts +20 -16
- package/src/util/lock.ts +43 -38
- package/src/util/log.ts +95 -85
- package/src/util/queue.ts +8 -8
- package/src/util/rpc.ts +35 -23
- package/src/util/scrap.ts +4 -4
- package/src/util/signal.ts +5 -5
- package/src/util/timeout.ts +6 -6
- package/src/util/token.ts +2 -2
- package/src/util/wildcard.ts +38 -27
package/EXAMPLES.md
CHANGED
|
@@ -17,6 +17,7 @@ This document provides practical examples for using each tool with both `@link-a
|
|
|
17
17
|
### Simplest Examples - Start Here!
|
|
18
18
|
|
|
19
19
|
**Plain text (@link-assistant/agent only, easiest!):**
|
|
20
|
+
|
|
20
21
|
```bash
|
|
21
22
|
echo "hi" | agent
|
|
22
23
|
```
|
|
@@ -24,11 +25,13 @@ echo "hi" | agent
|
|
|
24
25
|
**Simple JSON message (both @link-assistant/agent and opencode):**
|
|
25
26
|
|
|
26
27
|
@link-assistant/agent:
|
|
28
|
+
|
|
27
29
|
```bash
|
|
28
30
|
echo '{"message":"hi"}' | agent
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
opencode:
|
|
34
|
+
|
|
32
35
|
```bash
|
|
33
36
|
echo '{"message":"hi"}' | opencode run --format json --model opencode/grok-code
|
|
34
37
|
```
|
|
@@ -49,11 +52,13 @@ echo "search the web for latest React news" | agent
|
|
|
49
52
|
### JSON Input Examples
|
|
50
53
|
|
|
51
54
|
**@link-assistant/agent:**
|
|
55
|
+
|
|
52
56
|
```bash
|
|
53
57
|
echo '{"message":"hello world"}' | agent
|
|
54
58
|
```
|
|
55
59
|
|
|
56
60
|
**opencode:**
|
|
61
|
+
|
|
57
62
|
```bash
|
|
58
63
|
echo '{"message":"hello world"}' | opencode run --format json --model opencode/grok-code
|
|
59
64
|
```
|
|
@@ -65,16 +70,19 @@ echo '{"message":"hello world"}' | opencode run --format json --model opencode/g
|
|
|
65
70
|
Execute shell commands.
|
|
66
71
|
|
|
67
72
|
**@link-assistant/agent:**
|
|
73
|
+
|
|
68
74
|
```bash
|
|
69
75
|
echo '{"message":"run command","tools":[{"name":"bash","params":{"command":"echo hello world"}}]}' | agent
|
|
70
76
|
```
|
|
71
77
|
|
|
72
78
|
**opencode:**
|
|
79
|
+
|
|
73
80
|
```bash
|
|
74
81
|
echo '{"message":"run command","tools":[{"name":"bash","params":{"command":"echo hello world"}}]}' | opencode run --format json --model opencode/grok-code
|
|
75
82
|
```
|
|
76
83
|
|
|
77
84
|
**Example with description:**
|
|
85
|
+
|
|
78
86
|
```bash
|
|
79
87
|
echo '{"message":"list files","tools":[{"name":"bash","params":{"command":"ls -la","description":"List all files in current directory"}}]}' | agent
|
|
80
88
|
```
|
|
@@ -84,11 +92,13 @@ echo '{"message":"list files","tools":[{"name":"bash","params":{"command":"ls -l
|
|
|
84
92
|
Read file contents.
|
|
85
93
|
|
|
86
94
|
**@link-assistant/agent:**
|
|
95
|
+
|
|
87
96
|
```bash
|
|
88
97
|
echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/path/to/file.txt"}}]}' | agent
|
|
89
98
|
```
|
|
90
99
|
|
|
91
100
|
**opencode:**
|
|
101
|
+
|
|
92
102
|
```bash
|
|
93
103
|
echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/path/to/file.txt"}}]}' | opencode run --format json --model opencode/grok-code
|
|
94
104
|
```
|
|
@@ -98,11 +108,13 @@ echo '{"message":"read file","tools":[{"name":"read","params":{"file_path":"/pat
|
|
|
98
108
|
Write content to a file.
|
|
99
109
|
|
|
100
110
|
**@link-assistant/agent:**
|
|
111
|
+
|
|
101
112
|
```bash
|
|
102
113
|
echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/tmp/test.txt","content":"Hello World"}}]}' | agent
|
|
103
114
|
```
|
|
104
115
|
|
|
105
116
|
**opencode:**
|
|
117
|
+
|
|
106
118
|
```bash
|
|
107
119
|
echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/tmp/test.txt","content":"Hello World"}}]}' | opencode run --format json --model opencode/grok-code
|
|
108
120
|
```
|
|
@@ -112,11 +124,13 @@ echo '{"message":"write file","tools":[{"name":"write","params":{"file_path":"/t
|
|
|
112
124
|
Edit file with string replacement.
|
|
113
125
|
|
|
114
126
|
**@link-assistant/agent:**
|
|
127
|
+
|
|
115
128
|
```bash
|
|
116
129
|
echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp/test.txt","old_string":"Hello","new_string":"Hi"}}]}' | agent
|
|
117
130
|
```
|
|
118
131
|
|
|
119
132
|
**opencode:**
|
|
133
|
+
|
|
120
134
|
```bash
|
|
121
135
|
echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp/test.txt","old_string":"Hello","new_string":"Hi"}}]}' | opencode run --format json --model opencode/grok-code
|
|
122
136
|
```
|
|
@@ -126,11 +140,13 @@ echo '{"message":"edit file","tools":[{"name":"edit","params":{"file_path":"/tmp
|
|
|
126
140
|
List directory contents.
|
|
127
141
|
|
|
128
142
|
**@link-assistant/agent:**
|
|
143
|
+
|
|
129
144
|
```bash
|
|
130
145
|
echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}]}' | agent
|
|
131
146
|
```
|
|
132
147
|
|
|
133
148
|
**opencode:**
|
|
149
|
+
|
|
134
150
|
```bash
|
|
135
151
|
echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}]}' | opencode run --format json --model opencode/grok-code
|
|
136
152
|
```
|
|
@@ -142,6 +158,7 @@ echo '{"message":"list directory","tools":[{"name":"list","params":{"path":"."}}
|
|
|
142
158
|
Find files using glob patterns.
|
|
143
159
|
|
|
144
160
|
**@link-assistant/agent:**
|
|
161
|
+
|
|
145
162
|
```bash
|
|
146
163
|
# Find all JavaScript files
|
|
147
164
|
echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**/*.js"}}]}' | agent
|
|
@@ -151,6 +168,7 @@ echo '{"message":"find ts files","tools":[{"name":"glob","params":{"pattern":"sr
|
|
|
151
168
|
```
|
|
152
169
|
|
|
153
170
|
**opencode:**
|
|
171
|
+
|
|
154
172
|
```bash
|
|
155
173
|
echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**/*.js"}}]}' | opencode run --format json --model opencode/grok-code
|
|
156
174
|
```
|
|
@@ -160,6 +178,7 @@ echo '{"message":"find js files","tools":[{"name":"glob","params":{"pattern":"**
|
|
|
160
178
|
Search text in files with regex.
|
|
161
179
|
|
|
162
180
|
**@link-assistant/agent:**
|
|
181
|
+
|
|
163
182
|
```bash
|
|
164
183
|
# Search for pattern in files
|
|
165
184
|
echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"function","output_mode":"files_with_matches"}}]}' | agent
|
|
@@ -172,6 +191,7 @@ echo '{"message":"search error","tools":[{"name":"grep","params":{"pattern":"err
|
|
|
172
191
|
```
|
|
173
192
|
|
|
174
193
|
**opencode:**
|
|
194
|
+
|
|
175
195
|
```bash
|
|
176
196
|
echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"TODO","output_mode":"content"}}]}' | opencode run --format json --model opencode/grok-code
|
|
177
197
|
```
|
|
@@ -181,6 +201,7 @@ echo '{"message":"search pattern","tools":[{"name":"grep","params":{"pattern":"T
|
|
|
181
201
|
Search the web using Exa API.
|
|
182
202
|
|
|
183
203
|
**@link-assistant/agent (no environment variable needed!):**
|
|
204
|
+
|
|
184
205
|
```bash
|
|
185
206
|
echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"TypeScript latest features"}}]}' | agent
|
|
186
207
|
|
|
@@ -188,6 +209,7 @@ echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"Re
|
|
|
188
209
|
```
|
|
189
210
|
|
|
190
211
|
**opencode (requires OPENCODE_EXPERIMENTAL_EXA=true):**
|
|
212
|
+
|
|
191
213
|
```bash
|
|
192
214
|
echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"TypeScript latest features"}}]}' | OPENCODE_EXPERIMENTAL_EXA=true opencode run --format json --model opencode/grok-code
|
|
193
215
|
```
|
|
@@ -197,6 +219,7 @@ echo '{"message":"search web","tools":[{"name":"websearch","params":{"query":"Ty
|
|
|
197
219
|
Search code repositories and documentation.
|
|
198
220
|
|
|
199
221
|
**@link-assistant/agent (no environment variable needed!):**
|
|
222
|
+
|
|
200
223
|
```bash
|
|
201
224
|
echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"React hooks implementation"}}]}' | agent
|
|
202
225
|
|
|
@@ -204,6 +227,7 @@ echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"
|
|
|
204
227
|
```
|
|
205
228
|
|
|
206
229
|
**opencode (requires OPENCODE_EXPERIMENTAL_EXA=true):**
|
|
230
|
+
|
|
207
231
|
```bash
|
|
208
232
|
echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"React hooks implementation"}}]}' | OPENCODE_EXPERIMENTAL_EXA=true opencode run --format json --model opencode/grok-code
|
|
209
233
|
```
|
|
@@ -215,11 +239,13 @@ echo '{"message":"search code","tools":[{"name":"codesearch","params":{"query":"
|
|
|
215
239
|
Batch multiple tool calls together for optimal performance.
|
|
216
240
|
|
|
217
241
|
**@link-assistant/agent (no configuration needed!):**
|
|
242
|
+
|
|
218
243
|
```bash
|
|
219
244
|
echo '{"message":"run batch","tools":[{"name":"batch","params":{"tool_calls":[{"tool":"bash","parameters":{"command":"echo hello"}},{"tool":"bash","parameters":{"command":"echo world"}}]}}]}' | agent
|
|
220
245
|
```
|
|
221
246
|
|
|
222
247
|
**opencode (requires experimental config):**
|
|
248
|
+
|
|
223
249
|
```bash
|
|
224
250
|
# Create config file first
|
|
225
251
|
mkdir -p .opencode
|
|
@@ -234,11 +260,13 @@ echo '{"message":"run batch","tools":[{"name":"batch","params":{"tool_calls":[{"
|
|
|
234
260
|
Launch specialized agents for complex tasks.
|
|
235
261
|
|
|
236
262
|
**@link-assistant/agent:**
|
|
263
|
+
|
|
237
264
|
```bash
|
|
238
265
|
echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"Analyze codebase","prompt":"Find all TODO comments in JavaScript files","subagent_type":"general-purpose"}}]}' | agent
|
|
239
266
|
```
|
|
240
267
|
|
|
241
268
|
**opencode:**
|
|
269
|
+
|
|
242
270
|
```bash
|
|
243
271
|
echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"Analyze codebase","prompt":"Find all TODO comments in JavaScript files","subagent_type":"general-purpose"}}]}' | opencode run --format json --model opencode/grok-code
|
|
244
272
|
```
|
|
@@ -250,6 +278,7 @@ echo '{"message":"launch task","tools":[{"name":"task","params":{"description":"
|
|
|
250
278
|
Read and write TODO items for task tracking.
|
|
251
279
|
|
|
252
280
|
**@link-assistant/agent:**
|
|
281
|
+
|
|
253
282
|
```bash
|
|
254
283
|
# Write todos
|
|
255
284
|
echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"content":"Implement feature X","status":"pending","activeForm":"Implementing feature X"},{"content":"Write tests","status":"pending","activeForm":"Writing tests"}]}}]}' | agent
|
|
@@ -259,6 +288,7 @@ echo '{"message":"read todos","tools":[{"name":"todoread","params":{}}]}' | agen
|
|
|
259
288
|
```
|
|
260
289
|
|
|
261
290
|
**opencode:**
|
|
291
|
+
|
|
262
292
|
```bash
|
|
263
293
|
echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"content":"Implement feature X","status":"pending","activeForm":"Implementing feature X"}]}}]}' | opencode run --format json --model opencode/grok-code
|
|
264
294
|
```
|
|
@@ -268,18 +298,41 @@ echo '{"message":"add todos","tools":[{"name":"todowrite","params":{"todos":[{"c
|
|
|
268
298
|
Fetch and process web content.
|
|
269
299
|
|
|
270
300
|
**@link-assistant/agent:**
|
|
301
|
+
|
|
271
302
|
```bash
|
|
272
303
|
echo '{"message":"fetch url","tools":[{"name":"webfetch","params":{"url":"https://example.com","prompt":"Summarize the content"}}]}' | agent
|
|
273
304
|
```
|
|
274
305
|
|
|
275
306
|
**opencode:**
|
|
307
|
+
|
|
276
308
|
```bash
|
|
277
309
|
echo '{"message":"fetch url","tools":[{"name":"webfetch","params":{"url":"https://example.com","prompt":"Summarize the content"}}]}' | opencode run --format json --model opencode/grok-code
|
|
278
310
|
```
|
|
279
311
|
|
|
280
312
|
## Output Format
|
|
281
313
|
|
|
282
|
-
### JSON
|
|
314
|
+
### JSON Standards
|
|
315
|
+
|
|
316
|
+
@link-assistant/agent supports two JSON output format standards via the `--json-standard` option:
|
|
317
|
+
|
|
318
|
+
#### OpenCode Standard (default)
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Default - same as --json-standard opencode
|
|
322
|
+
echo "hi" | agent
|
|
323
|
+
|
|
324
|
+
# Explicit opencode standard
|
|
325
|
+
echo "hi" | agent --json-standard opencode
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### Claude Standard (experimental)
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Claude CLI compatible format (NDJSON)
|
|
332
|
+
echo "hi" | agent --json-standard claude
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### JSON Event Streaming (Pretty-Printed) - OpenCode Standard
|
|
283
336
|
|
|
284
337
|
@link-assistant/agent outputs JSON events in pretty-printed streaming format for easy readability, 100% compatible with OpenCode's event structure:
|
|
285
338
|
|
|
@@ -288,6 +341,7 @@ echo "hi" | agent
|
|
|
288
341
|
```
|
|
289
342
|
|
|
290
343
|
Output (pretty-printed JSON events):
|
|
344
|
+
|
|
291
345
|
```json
|
|
292
346
|
{
|
|
293
347
|
"type": "step_start",
|
|
@@ -322,11 +376,36 @@ Output (pretty-printed JSON events):
|
|
|
322
376
|
```
|
|
323
377
|
|
|
324
378
|
This format is designed for:
|
|
379
|
+
|
|
325
380
|
- **Readability**: Pretty-printed JSON is easy to read and debug
|
|
326
381
|
- **Streaming**: Events output in real-time as they occur
|
|
327
382
|
- **Compatibility**: 100% compatible with OpenCode's event structure
|
|
328
383
|
- **Automation**: Can be parsed using standard JSON tools (see filtering examples below)
|
|
329
384
|
|
|
385
|
+
### Claude Stream-JSON Output (NDJSON)
|
|
386
|
+
|
|
387
|
+
When using `--json-standard claude`, output is in NDJSON (Newline-Delimited JSON) format, compatible with Claude CLI:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
echo "hi" | agent --json-standard claude
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Output (compact NDJSON):
|
|
394
|
+
|
|
395
|
+
```json
|
|
396
|
+
{"type":"init","timestamp":"2025-01-01T00:00:00.000Z","session_id":"ses_560236487ffe3ROK1ThWvPwTEF"}
|
|
397
|
+
{"type":"message","timestamp":"2025-01-01T00:00:01.000Z","session_id":"ses_560236487ffe3ROK1ThWvPwTEF","role":"assistant","content":[{"type":"text","text":"Hi! How can I help with your coding tasks today?"}]}
|
|
398
|
+
{"type":"result","timestamp":"2025-01-01T00:00:01.100Z","session_id":"ses_560236487ffe3ROK1ThWvPwTEF","status":"success","duration_ms":1100}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Key differences from OpenCode format:
|
|
402
|
+
|
|
403
|
+
- **Compact**: One JSON per line (no pretty-printing)
|
|
404
|
+
- **Event Types**: `init`, `message`, `tool_use`, `tool_result`, `result`
|
|
405
|
+
- **Timestamps**: ISO 8601 strings instead of Unix milliseconds
|
|
406
|
+
- **Session ID**: `session_id` (snake_case) instead of `sessionID` (camelCase)
|
|
407
|
+
- **Content**: Message content in array format with `{type, text}` objects
|
|
408
|
+
|
|
330
409
|
### Filtering Output
|
|
331
410
|
|
|
332
411
|
Extract specific event types using `jq`:
|
package/MODELS.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
# Models
|
|
2
2
|
|
|
3
|
-
This agent uses models from the [OpenCode Zen](https://opencode.ai/docs/zen/) subscription service.
|
|
3
|
+
This agent supports multiple model providers. By default, it uses models from the [OpenCode Zen](https://opencode.ai/docs/zen/) subscription service. Additionally, you can use models directly from providers like [Groq](https://groq.com/) by setting the appropriate API key.
|
|
4
|
+
|
|
5
|
+
## Supported Providers
|
|
6
|
+
|
|
7
|
+
| Provider | Format | API Key Env Variable | Documentation |
|
|
8
|
+
| ------------ | ------------------------- | ---------------------------- | -------------------------------------------------- |
|
|
9
|
+
| OpenCode Zen | `opencode/<model-id>` | N/A (public for free models) | [OpenCode Zen](https://opencode.ai/docs/zen/) |
|
|
10
|
+
| Anthropic | `anthropic/<model-id>` | `ANTHROPIC_API_KEY` | [Anthropic Docs](https://docs.anthropic.com/) |
|
|
11
|
+
| Claude OAuth | `claude-oauth/<model-id>` | `CLAUDE_CODE_OAUTH_TOKEN` | [Claude OAuth Documentation](docs/claude-oauth.md) |
|
|
12
|
+
| Groq | `groq/<model-id>` | `GROQ_API_KEY` | [Groq Documentation](docs/groq.md) |
|
|
13
|
+
|
|
14
|
+
> **Claude OAuth:** The `claude-oauth` provider allows using your Claude Pro/Max subscription. Authenticate with `agent auth claude` or use existing Claude Code CLI credentials with `--use-existing-claude-oauth`.
|
|
4
15
|
|
|
5
16
|
## Available Models
|
|
6
17
|
|
|
7
|
-
All models are accessed using the format
|
|
18
|
+
All models are accessed using the format `<provider>/<model-id>`. Use the `--model` option to specify which model to use:
|
|
8
19
|
|
|
9
20
|
```bash
|
|
10
21
|
echo "hi" | agent --model opencode/grok-code
|
|
@@ -14,29 +25,29 @@ echo "hi" | agent --model opencode/grok-code
|
|
|
14
25
|
|
|
15
26
|
Below are the prices per 1M tokens for OpenCode Zen models. Models are sorted by output price (lowest first) for best pricing visibility.
|
|
16
27
|
|
|
17
|
-
| Model
|
|
18
|
-
|
|
19
|
-
| **Free Models (Output: $0.00)**
|
|
20
|
-
| Grok Code Fast 1
|
|
21
|
-
| GPT 5 Nano
|
|
22
|
-
| Big Pickle
|
|
28
|
+
| Model | Model ID | Input | Output | Cached Read | Cached Write |
|
|
29
|
+
| ---------------------------------------- | --------------------------- | ------ | ------ | ----------- | ------------ |
|
|
30
|
+
| **Free Models (Output: $0.00)** |
|
|
31
|
+
| Grok Code Fast 1 | `opencode/grok-code` | Free | Free | Free | - |
|
|
32
|
+
| GPT 5 Nano | `opencode/gpt-5-nano` | Free | Free | Free | - |
|
|
33
|
+
| Big Pickle | `opencode/big-pickle` | Free | Free | Free | - |
|
|
23
34
|
| **Paid Models (sorted by output price)** |
|
|
24
|
-
| Qwen3 Coder 480B
|
|
25
|
-
| GLM 4.6
|
|
26
|
-
| Kimi K2
|
|
27
|
-
| Claude Haiku 3.5
|
|
28
|
-
| Claude Haiku 4.5
|
|
29
|
-
| GPT 5.1
|
|
30
|
-
| GPT 5.1 Codex
|
|
31
|
-
| GPT 5
|
|
32
|
-
| GPT 5 Codex
|
|
33
|
-
| Gemini 3 Pro (≤ 200K tokens)
|
|
34
|
-
| Claude Sonnet 4.5 (≤ 200K tokens)
|
|
35
|
-
| Claude Sonnet 4 (≤ 200K tokens)
|
|
36
|
-
| Gemini 3 Pro (> 200K tokens)
|
|
37
|
-
| Claude Sonnet 4.5 (> 200K tokens)
|
|
38
|
-
| Claude Sonnet 4 (> 200K tokens)
|
|
39
|
-
| Claude Opus 4.1
|
|
35
|
+
| Qwen3 Coder 480B | `opencode/qwen3-coder-480b` | $0.45 | $1.50 | - | - |
|
|
36
|
+
| GLM 4.6 | `opencode/glm-4-6` | $0.60 | $2.20 | $0.10 | - |
|
|
37
|
+
| Kimi K2 | `opencode/kimi-k2` | $0.60 | $2.50 | $0.36 | - |
|
|
38
|
+
| Claude Haiku 3.5 | `opencode/claude-haiku-3-5` | $0.80 | $4.00 | $0.08 | $1.00 |
|
|
39
|
+
| Claude Haiku 4.5 | `opencode/haiku` | $1.00 | $5.00 | $0.10 | $1.25 |
|
|
40
|
+
| GPT 5.1 | `opencode/gpt-5-1` | $1.25 | $10.00 | $0.125 | - |
|
|
41
|
+
| GPT 5.1 Codex | `opencode/gpt-5-1-codex` | $1.25 | $10.00 | $0.125 | - |
|
|
42
|
+
| GPT 5 | `opencode/gpt-5` | $1.25 | $10.00 | $0.125 | - |
|
|
43
|
+
| GPT 5 Codex | `opencode/gpt-5-codex` | $1.25 | $10.00 | $0.125 | - |
|
|
44
|
+
| Gemini 3 Pro (≤ 200K tokens) | `opencode/gemini-3-pro` | $2.00 | $12.00 | $0.20 | - |
|
|
45
|
+
| Claude Sonnet 4.5 (≤ 200K tokens) | `opencode/sonnet` | $3.00 | $15.00 | $0.30 | $3.75 |
|
|
46
|
+
| Claude Sonnet 4 (≤ 200K tokens) | `opencode/claude-sonnet-4` | $3.00 | $15.00 | $0.30 | $3.75 |
|
|
47
|
+
| Gemini 3 Pro (> 200K tokens) | `opencode/gemini-3-pro` | $4.00 | $18.00 | $0.40 | - |
|
|
48
|
+
| Claude Sonnet 4.5 (> 200K tokens) | `opencode/sonnet` | $6.00 | $22.50 | $0.60 | $7.50 |
|
|
49
|
+
| Claude Sonnet 4 (> 200K tokens) | `opencode/claude-sonnet-4` | $6.00 | $22.50 | $0.60 | $7.50 |
|
|
50
|
+
| Claude Opus 4.1 | `opencode/opus` | $15.00 | $75.00 | $1.50 | $18.75 |
|
|
40
51
|
|
|
41
52
|
## Default Model
|
|
42
53
|
|
|
@@ -93,3 +104,40 @@ For complete details about OpenCode Zen subscription and pricing, visit the [Ope
|
|
|
93
104
|
- Cache pricing applies when using prompt caching features
|
|
94
105
|
- Token context limits vary by model
|
|
95
106
|
- Free models have no token costs but may have rate limits
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Groq Provider
|
|
111
|
+
|
|
112
|
+
[Groq](https://groq.com/) provides ultra-fast inference for open-source large language models. To use Groq models, set your API key:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
export GROQ_API_KEY=your_api_key_here
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Groq Models
|
|
119
|
+
|
|
120
|
+
| Model | Model ID | Context Window | Tool Use |
|
|
121
|
+
| ----------------------- | ------------------------------ | -------------- | -------- |
|
|
122
|
+
| Llama 3.3 70B Versatile | `groq/llama-3.3-70b-versatile` | 131,072 tokens | Yes |
|
|
123
|
+
| Llama 3.1 8B Instant | `groq/llama-3.1-8b-instant` | 131,072 tokens | Yes |
|
|
124
|
+
| GPT-OSS 120B | `groq/openai/gpt-oss-120b` | 131,072 tokens | Yes |
|
|
125
|
+
| GPT-OSS 20B | `groq/openai/gpt-oss-20b` | 131,072 tokens | Yes |
|
|
126
|
+
| Qwen3 32B | `groq/qwen/qwen3-32b` | 131,072 tokens | Yes |
|
|
127
|
+
| Compound | `groq/groq/compound` | 131,072 tokens | Yes |
|
|
128
|
+
| Compound Mini | `groq/groq/compound-mini` | 131,072 tokens | Yes |
|
|
129
|
+
|
|
130
|
+
### Groq Usage Examples
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Using Llama 3.3 70B (recommended)
|
|
134
|
+
echo "hello" | agent --model groq/llama-3.3-70b-versatile
|
|
135
|
+
|
|
136
|
+
# Using faster Llama 3.1 8B
|
|
137
|
+
echo "hello" | agent --model groq/llama-3.1-8b-instant
|
|
138
|
+
|
|
139
|
+
# Using Compound (agentic with server-side tools)
|
|
140
|
+
echo "hello" | agent --model groq/groq/compound
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For more details, see the [Groq Documentation](docs/groq.md).
|