oc-chatgpt-multi-auth 5.4.2 → 5.4.3
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 +939 -931
- package/config/README.md +92 -88
- package/config/opencode-legacy.json +5 -5
- package/config/opencode-modern.json +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/prompts/codex.d.ts +1 -1
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +8 -1
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/request/helpers/model-map.d.ts +0 -6
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +18 -4
- package/dist/lib/request/helpers/model-map.js.map +1 -1
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +48 -7
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/schemas.d.ts +3 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/storage.d.ts +4 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +108 -2
- package/dist/lib/storage.js.map +1 -1
- package/package.json +106 -106
package/README.md
CHANGED
|
@@ -1,931 +1,939 @@
|
|
|
1
|
-
# OpenAI Codex Auth Plugin for OpenCode
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/oc-chatgpt-multi-auth)
|
|
4
|
-
[](https://www.npmjs.com/package/oc-chatgpt-multi-auth)
|
|
5
|
-
|
|
6
|
-
OAuth plugin for OpenCode that lets you use ChatGPT Plus/Pro rate limits with models like `gpt-5.4`, `gpt-5-codex`, and `gpt-5.1-codex-max` (plus optional/manual `gpt-5.4-pro`, entitlement-gated Spark IDs, and legacy Codex aliases).
|
|
7
|
-
|
|
8
|
-
> [!NOTE]
|
|
9
|
-
> **Renamed from `opencode-openai-codex-auth-multi`** — If you were using the old package, update your config to use `oc-chatgpt-multi-auth` instead. The rename was necessary because OpenCode blocks plugins containing `opencode-openai-codex-auth` in the name.
|
|
10
|
-
|
|
11
|
-
## What You Get
|
|
12
|
-
|
|
13
|
-
- **GPT-5.4, GPT-5 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
|
|
14
|
-
- **Multi-account support** — Add up to 20 ChatGPT accounts, health-aware rotation with automatic failover
|
|
15
|
-
- **Per-project accounts** — Each project gets its own account storage (new in v4.10.0)
|
|
16
|
-
- **Workspace-aware identity persistence** — Keeps workspace/org identity stable across token refresh and verify-flagged restore flows
|
|
17
|
-
- **Click-to-switch** — Switch accounts directly from the OpenCode TUI
|
|
18
|
-
- **Beginner command toolkit** — Guided onboarding with `codex-help`, `codex-setup`, `codex-doctor`, and `codex-next`
|
|
19
|
-
- **Account metadata controls** — Per-account labels, tags, and notes with quick filtering
|
|
20
|
-
- **Safer backup/import flow** — Timestamped exports, import dry-run preview, and conditional pre-import backups when existing accounts are present
|
|
21
|
-
- **Startup preflight summary** — One-line health/readiness summary at plugin startup with suggested next step
|
|
22
|
-
- **Strict tool validation** — Automatically cleans schemas for compatibility with strict models
|
|
23
|
-
- **Auto-update notifications** — Get notified when a new version is available
|
|
24
|
-
- **21 template model presets** — Full variant system with reasoning levels (none/low/medium/high/xhigh)
|
|
25
|
-
- **Prompt caching** — Session-based caching for faster multi-turn conversations
|
|
26
|
-
- **Usage-aware errors** — Friendly messages with rate limit reset timing
|
|
27
|
-
- **Plugin compatible** — Works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
<details open>
|
|
32
|
-
<summary><b>Terms of Service Warning — Read Before Installing</b></summary>
|
|
33
|
-
|
|
34
|
-
> [!CAUTION]
|
|
35
|
-
> This plugin uses OpenAI's official OAuth authentication (the same method as OpenAI's official Codex CLI) for personal development use with your ChatGPT Plus/Pro subscription.
|
|
36
|
-
>
|
|
37
|
-
> **This plugin is for personal development only:**
|
|
38
|
-
> - Not for commercial services, API resale, or multi-user applications
|
|
39
|
-
> - For production use, see [OpenAI Platform API](https://platform.openai.com/)
|
|
40
|
-
>
|
|
41
|
-
> **By using this plugin, you acknowledge:**
|
|
42
|
-
> - This is an unofficial tool not endorsed by OpenAI
|
|
43
|
-
> - Users are responsible for compliance with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/)
|
|
44
|
-
> - You assume all risks associated with using this plugin
|
|
45
|
-
|
|
46
|
-
</details>
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
<details open>
|
|
53
|
-
<summary><b>For Humans</b></summary>
|
|
54
|
-
|
|
55
|
-
**Option A: Let an LLM do it**
|
|
56
|
-
|
|
57
|
-
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
Install the oc-chatgpt-multi-auth plugin and add the OpenAI model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/ndycode/oc-chatgpt-multi-auth/main/README.md
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Option B: One-command install**
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npx -y oc-chatgpt-multi-auth@latest
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
This writes the config to `~/.config/opencode/opencode.json`, backs up existing config, and clears the plugin cache.
|
|
70
|
-
|
|
71
|
-
> Want legacy config (OpenCode v1.0.209 and below)? Add `--legacy` flag.
|
|
72
|
-
|
|
73
|
-
**Option C: Manual setup**
|
|
74
|
-
|
|
75
|
-
1. **Add the plugin** to `~/.config/opencode/opencode.json`:
|
|
76
|
-
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"plugin": ["oc-chatgpt-multi-auth@latest"]
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
2. **Login** with your ChatGPT account:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
opencode auth login
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
3. **Add models** — Copy the [full configuration](#models) below
|
|
90
|
-
|
|
91
|
-
4. **Use it:**
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
opencode run "Hello" --model=openai/gpt-5.4 --variant=medium
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
</details>
|
|
98
|
-
|
|
99
|
-
<details>
|
|
100
|
-
<summary><b>For LLM Agents</b></summary>
|
|
101
|
-
|
|
102
|
-
### Step-by-Step Instructions
|
|
103
|
-
|
|
104
|
-
1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
|
|
105
|
-
|
|
106
|
-
> **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
107
|
-
|
|
108
|
-
2. Add the plugin to the `plugin` array:
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"plugin": ["oc-chatgpt-multi-auth@latest"]
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
3. Add the model definitions from the [Full Models Configuration](#full-models-configuration-copy-paste-ready) section
|
|
116
|
-
|
|
117
|
-
4. Set `provider` to `"openai"` and choose a model
|
|
118
|
-
|
|
119
|
-
### Verification
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
opencode run "Hello" --model=openai/gpt-5.4 --variant=medium
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
</details>
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## Models
|
|
130
|
-
|
|
131
|
-
### Model Reference
|
|
132
|
-
|
|
133
|
-
| Model | Variants | Notes |
|
|
134
|
-
|-------|----------|-------|
|
|
135
|
-
| `gpt-5.4` | none, low, medium, high, xhigh | Latest GPT-5.4 with reasoning levels |
|
|
136
|
-
| `gpt-5.4-pro` | low, medium, high, xhigh | Optional manual model for deeper reasoning; fallback
|
|
137
|
-
| `gpt-5-codex` | low, medium, high | Canonical Codex model for code generation (default: high) |
|
|
138
|
-
| `gpt-5.3-codex-spark` | low, medium, high, xhigh | Spark IDs are supported by the plugin, but access is entitlement-gated by account/workspace |
|
|
139
|
-
| `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |
|
|
140
|
-
| `gpt-5.1-codex` | low, medium, high | Standard Codex |
|
|
141
|
-
| `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |
|
|
142
|
-
| `gpt-5.1` | none, low, medium, high | GPT-5.1 base model |
|
|
143
|
-
|
|
144
|
-
Config templates intentionally omit Spark model IDs by default to reduce entitlement failures on unsupported accounts. Add Spark manually only if your workspace is entitled.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
"
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
"
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
|
548
|
-
|
|
549
|
-
| `codex-
|
|
550
|
-
| `codex-
|
|
551
|
-
| `codex-
|
|
552
|
-
| `codex-
|
|
553
|
-
| `codex-
|
|
554
|
-
| `codex-
|
|
555
|
-
| `codex-
|
|
556
|
-
| `codex-
|
|
557
|
-
| `codex-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
**
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
-
|
|
589
|
-
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
**
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
|
826
|
-
|
|
827
|
-
| `
|
|
828
|
-
| `
|
|
829
|
-
| `
|
|
830
|
-
|
|
831
|
-
###
|
|
832
|
-
|
|
833
|
-
| Option | Default | What It Does |
|
|
834
|
-
|--------|---------|--------------|
|
|
835
|
-
| `
|
|
836
|
-
| `
|
|
837
|
-
| `
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
|
842
|
-
|
|
843
|
-
| `
|
|
844
|
-
| `
|
|
845
|
-
| `
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
-
|
|
856
|
-
- `
|
|
857
|
-
- `
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
- [
|
|
903
|
-
- [
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
-
|
|
923
|
-
-
|
|
924
|
-
-
|
|
925
|
-
|
|
926
|
-
###
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1
|
+
# OpenAI Codex Auth Plugin for OpenCode
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/oc-chatgpt-multi-auth)
|
|
4
|
+
[](https://www.npmjs.com/package/oc-chatgpt-multi-auth)
|
|
5
|
+
|
|
6
|
+
OAuth plugin for OpenCode that lets you use ChatGPT Plus/Pro rate limits with models like `gpt-5.4`, `gpt-5-codex`, and `gpt-5.1-codex-max` (plus optional/manual `gpt-5.4-pro`, entitlement-gated Spark IDs, and legacy Codex aliases).
|
|
7
|
+
|
|
8
|
+
> [!NOTE]
|
|
9
|
+
> **Renamed from `opencode-openai-codex-auth-multi`** — If you were using the old package, update your config to use `oc-chatgpt-multi-auth` instead. The rename was necessary because OpenCode blocks plugins containing `opencode-openai-codex-auth` in the name.
|
|
10
|
+
|
|
11
|
+
## What You Get
|
|
12
|
+
|
|
13
|
+
- **GPT-5.4, GPT-5 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
|
|
14
|
+
- **Multi-account support** — Add up to 20 ChatGPT accounts, health-aware rotation with automatic failover
|
|
15
|
+
- **Per-project accounts** — Each project gets its own account storage (new in v4.10.0)
|
|
16
|
+
- **Workspace-aware identity persistence** — Keeps workspace/org identity stable across token refresh and verify-flagged restore flows
|
|
17
|
+
- **Click-to-switch** — Switch accounts directly from the OpenCode TUI
|
|
18
|
+
- **Beginner command toolkit** — Guided onboarding with `codex-help`, `codex-setup`, `codex-doctor`, and `codex-next`
|
|
19
|
+
- **Account metadata controls** — Per-account labels, tags, and notes with quick filtering
|
|
20
|
+
- **Safer backup/import flow** — Timestamped exports, import dry-run preview, and conditional pre-import backups when existing accounts are present
|
|
21
|
+
- **Startup preflight summary** — One-line health/readiness summary at plugin startup with suggested next step
|
|
22
|
+
- **Strict tool validation** — Automatically cleans schemas for compatibility with strict models
|
|
23
|
+
- **Auto-update notifications** — Get notified when a new version is available
|
|
24
|
+
- **21 template model presets** — Full variant system with reasoning levels (none/low/medium/high/xhigh)
|
|
25
|
+
- **Prompt caching** — Session-based caching for faster multi-turn conversations
|
|
26
|
+
- **Usage-aware errors** — Friendly messages with rate limit reset timing
|
|
27
|
+
- **Plugin compatible** — Works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<details open>
|
|
32
|
+
<summary><b>Terms of Service Warning — Read Before Installing</b></summary>
|
|
33
|
+
|
|
34
|
+
> [!CAUTION]
|
|
35
|
+
> This plugin uses OpenAI's official OAuth authentication (the same method as OpenAI's official Codex CLI) for personal development use with your ChatGPT Plus/Pro subscription.
|
|
36
|
+
>
|
|
37
|
+
> **This plugin is for personal development only:**
|
|
38
|
+
> - Not for commercial services, API resale, or multi-user applications
|
|
39
|
+
> - For production use, see [OpenAI Platform API](https://platform.openai.com/)
|
|
40
|
+
>
|
|
41
|
+
> **By using this plugin, you acknowledge:**
|
|
42
|
+
> - This is an unofficial tool not endorsed by OpenAI
|
|
43
|
+
> - Users are responsible for compliance with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/)
|
|
44
|
+
> - You assume all risks associated with using this plugin
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
<details open>
|
|
53
|
+
<summary><b>For Humans</b></summary>
|
|
54
|
+
|
|
55
|
+
**Option A: Let an LLM do it**
|
|
56
|
+
|
|
57
|
+
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Install the oc-chatgpt-multi-auth plugin and add the OpenAI model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/ndycode/oc-chatgpt-multi-auth/main/README.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Option B: One-command install**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx -y oc-chatgpt-multi-auth@latest
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This writes the config to `~/.config/opencode/opencode.json`, backs up existing config, and clears the plugin cache.
|
|
70
|
+
|
|
71
|
+
> Want legacy config (OpenCode v1.0.209 and below)? Add `--legacy` flag.
|
|
72
|
+
|
|
73
|
+
**Option C: Manual setup**
|
|
74
|
+
|
|
75
|
+
1. **Add the plugin** to `~/.config/opencode/opencode.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"plugin": ["oc-chatgpt-multi-auth@latest"]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Login** with your ChatGPT account:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
opencode auth login
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
3. **Add models** — Copy the [full configuration](#models) below
|
|
90
|
+
|
|
91
|
+
4. **Use it:**
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
opencode run "Hello" --model=openai/gpt-5.4 --variant=medium
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
</details>
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary><b>For LLM Agents</b></summary>
|
|
101
|
+
|
|
102
|
+
### Step-by-Step Instructions
|
|
103
|
+
|
|
104
|
+
1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
|
|
105
|
+
|
|
106
|
+
> **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
107
|
+
|
|
108
|
+
2. Add the plugin to the `plugin` array:
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"plugin": ["oc-chatgpt-multi-auth@latest"]
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
3. Add the model definitions from the [Full Models Configuration](#full-models-configuration-copy-paste-ready) section
|
|
116
|
+
|
|
117
|
+
4. Set `provider` to `"openai"` and choose a model
|
|
118
|
+
|
|
119
|
+
### Verification
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
opencode run "Hello" --model=openai/gpt-5.4 --variant=medium
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
</details>
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Models
|
|
130
|
+
|
|
131
|
+
### Model Reference
|
|
132
|
+
|
|
133
|
+
| Model | Variants | Notes |
|
|
134
|
+
|-------|----------|-------|
|
|
135
|
+
| `gpt-5.4` | none, low, medium, high, xhigh | Latest GPT-5.4 with reasoning levels and 1,000,000 context window |
|
|
136
|
+
| `gpt-5.4-pro` | low, medium, high, xhigh | Optional manual model for deeper reasoning; when `unsupportedCodexPolicy=fallback`, fallback includes `gpt-5.4-pro -> gpt-5.4` (also 1,000,000 context window) |
|
|
137
|
+
| `gpt-5-codex` | low, medium, high | Canonical Codex model for code generation (default: high) |
|
|
138
|
+
| `gpt-5.3-codex-spark` | low, medium, high, xhigh | Spark IDs are supported by the plugin, but access is entitlement-gated by account/workspace |
|
|
139
|
+
| `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |
|
|
140
|
+
| `gpt-5.1-codex` | low, medium, high | Standard Codex |
|
|
141
|
+
| `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |
|
|
142
|
+
| `gpt-5.1` | none, low, medium, high | GPT-5.1 base model |
|
|
143
|
+
|
|
144
|
+
Config templates intentionally omit Spark model IDs by default to reduce entitlement failures on unsupported accounts. Add Spark manually only if your workspace is entitled.
|
|
145
|
+
|
|
146
|
+
Legacy and snapshot aliases supported by the plugin:
|
|
147
|
+
- `gpt-5`, `gpt-5-mini`, `gpt-5-nano` normalize to `gpt-5.4`
|
|
148
|
+
- `gpt-5.4-2026-03-05` and `gpt-5.4-pro-2026-03-05` (including effort suffix variants) normalize to their stable families
|
|
149
|
+
|
|
150
|
+
If your OpenCode runtime supports global auto-compaction settings, set:
|
|
151
|
+
- `model_context_window = 1000000`
|
|
152
|
+
- `model_auto_compact_token_limit = 900000`
|
|
153
|
+
|
|
154
|
+
**Using variants:**
|
|
155
|
+
```bash
|
|
156
|
+
# Modern OpenCode (v1.0.210+)
|
|
157
|
+
opencode run "Hello" --model=openai/gpt-5.4 --variant=high
|
|
158
|
+
|
|
159
|
+
# Legacy OpenCode (v1.0.209 and below)
|
|
160
|
+
opencode run "Hello" --model=openai/gpt-5.4-high
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
<details>
|
|
164
|
+
<summary><b>Full Models Configuration (Copy-Paste Ready)</b></summary>
|
|
165
|
+
|
|
166
|
+
Add this to your `~/.config/opencode/opencode.json`:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"$schema": "https://opencode.ai/config.json",
|
|
171
|
+
"plugin": ["oc-chatgpt-multi-auth@latest"],
|
|
172
|
+
"provider": {
|
|
173
|
+
"openai": {
|
|
174
|
+
"options": {
|
|
175
|
+
"reasoningEffort": "medium",
|
|
176
|
+
"reasoningSummary": "auto",
|
|
177
|
+
"textVerbosity": "medium",
|
|
178
|
+
"include": ["reasoning.encrypted_content"],
|
|
179
|
+
"store": false
|
|
180
|
+
},
|
|
181
|
+
"models": {
|
|
182
|
+
"gpt-5.4": {
|
|
183
|
+
"name": "GPT 5.4 (OAuth)",
|
|
184
|
+
"limit": { "context": 1000000, "output": 128000 },
|
|
185
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
186
|
+
"variants": {
|
|
187
|
+
"none": { "reasoningEffort": "none" },
|
|
188
|
+
"low": { "reasoningEffort": "low" },
|
|
189
|
+
"medium": { "reasoningEffort": "medium" },
|
|
190
|
+
"high": { "reasoningEffort": "high" },
|
|
191
|
+
"xhigh": { "reasoningEffort": "xhigh" }
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"gpt-5-codex": {
|
|
195
|
+
"name": "GPT 5 Codex (OAuth)",
|
|
196
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
197
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
198
|
+
"variants": {
|
|
199
|
+
"low": { "reasoningEffort": "low" },
|
|
200
|
+
"medium": { "reasoningEffort": "medium" },
|
|
201
|
+
"high": { "reasoningEffort": "high" }
|
|
202
|
+
},
|
|
203
|
+
"options": {
|
|
204
|
+
"reasoningEffort": "high",
|
|
205
|
+
"reasoningSummary": "detailed"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"gpt-5.1-codex-max": {
|
|
209
|
+
"name": "GPT 5.1 Codex Max (OAuth)",
|
|
210
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
211
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
212
|
+
"variants": {
|
|
213
|
+
"low": { "reasoningEffort": "low" },
|
|
214
|
+
"medium": { "reasoningEffort": "medium" },
|
|
215
|
+
"high": { "reasoningEffort": "high" },
|
|
216
|
+
"xhigh": { "reasoningEffort": "xhigh" }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"gpt-5.1-codex": {
|
|
220
|
+
"name": "GPT 5.1 Codex (OAuth)",
|
|
221
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
222
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
223
|
+
"variants": {
|
|
224
|
+
"low": { "reasoningEffort": "low" },
|
|
225
|
+
"medium": { "reasoningEffort": "medium" },
|
|
226
|
+
"high": { "reasoningEffort": "high" }
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"gpt-5.1-codex-mini": {
|
|
230
|
+
"name": "GPT 5.1 Codex Mini (OAuth)",
|
|
231
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
232
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
233
|
+
"variants": {
|
|
234
|
+
"medium": { "reasoningEffort": "medium" },
|
|
235
|
+
"high": { "reasoningEffort": "high" }
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"gpt-5.1": {
|
|
239
|
+
"name": "GPT 5.1 (OAuth)",
|
|
240
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
241
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
242
|
+
"variants": {
|
|
243
|
+
"none": { "reasoningEffort": "none" },
|
|
244
|
+
"low": { "reasoningEffort": "low" },
|
|
245
|
+
"medium": { "reasoningEffort": "medium" },
|
|
246
|
+
"high": { "reasoningEffort": "high" }
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Optional Spark model block (manual add only when entitled):
|
|
256
|
+
```json
|
|
257
|
+
"gpt-5.3-codex-spark": {
|
|
258
|
+
"name": "GPT 5.3 Codex Spark (OAuth)",
|
|
259
|
+
"limit": { "context": 272000, "output": 128000 },
|
|
260
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
261
|
+
"variants": {
|
|
262
|
+
"low": { "reasoningEffort": "low" },
|
|
263
|
+
"medium": { "reasoningEffort": "medium" },
|
|
264
|
+
"high": { "reasoningEffort": "high" },
|
|
265
|
+
"xhigh": { "reasoningEffort": "xhigh" }
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
For legacy OpenCode (v1.0.209 and below), use `config/opencode-legacy.json` which has individual model entries like `gpt-5.4-low`, `gpt-5.4-medium`, etc.
|
|
271
|
+
|
|
272
|
+
</details>
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Multi-Account Setup
|
|
277
|
+
|
|
278
|
+
Add multiple ChatGPT accounts for higher combined quotas. The plugin uses **health-aware rotation** with automatic failover and supports up to 20 accounts.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
opencode auth login # Run again to add more accounts
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Account Management Tools
|
|
287
|
+
|
|
288
|
+
The plugin provides built-in tools for managing your OpenAI accounts. These are available directly in OpenCode — just ask the agent or type the tool name.
|
|
289
|
+
|
|
290
|
+
> **Note:** Tools were renamed from `openai-accounts-*` to `codex-*` in v4.12.0 for brevity.
|
|
291
|
+
|
|
292
|
+
### codex-list
|
|
293
|
+
|
|
294
|
+
List all configured accounts with status badges.
|
|
295
|
+
|
|
296
|
+
```text
|
|
297
|
+
codex-list
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Filter by tag:
|
|
301
|
+
|
|
302
|
+
```text
|
|
303
|
+
codex-list tag="work"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Shows account labels, IDs, tags, active state, and rate-limit/cooldown markers.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### codex-switch
|
|
311
|
+
|
|
312
|
+
Switch to a different account. If `index` is omitted and your terminal supports menus, an interactive picker opens.
|
|
313
|
+
|
|
314
|
+
```text
|
|
315
|
+
codex-switch index=2
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
or:
|
|
319
|
+
|
|
320
|
+
```text
|
|
321
|
+
codex-switch
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### codex-label
|
|
327
|
+
|
|
328
|
+
Set or clear a display label for an account. Useful for workspace naming.
|
|
329
|
+
|
|
330
|
+
```text
|
|
331
|
+
codex-label index=2 label="Work"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Clear:
|
|
335
|
+
|
|
336
|
+
```text
|
|
337
|
+
codex-label index=2 label=""
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
If `index` is omitted in interactive terminals, a picker opens.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
### codex-tag
|
|
345
|
+
|
|
346
|
+
Set or clear comma-separated tags for filtering and grouping.
|
|
347
|
+
|
|
348
|
+
```text
|
|
349
|
+
codex-tag index=2 tags="work,team-a"
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Clear:
|
|
353
|
+
|
|
354
|
+
```text
|
|
355
|
+
codex-tag index=2 tags=""
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Use tags with `codex-list tag="work"`.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
### codex-note
|
|
363
|
+
|
|
364
|
+
Set or clear a short per-account note for reminders.
|
|
365
|
+
|
|
366
|
+
```text
|
|
367
|
+
codex-note index=2 note="primary for weekday daytime usage"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Clear:
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
codex-note index=2 note=""
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
### codex-help
|
|
379
|
+
|
|
380
|
+
Show beginner-friendly command guidance. Optional topic filter:
|
|
381
|
+
|
|
382
|
+
```text
|
|
383
|
+
codex-help
|
|
384
|
+
codex-help topic="backup"
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Available topics: `setup`, `switch`, `health`, `backup`, `dashboard`, `metrics`.
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
### codex-setup
|
|
392
|
+
|
|
393
|
+
Show readiness checklist for first-run onboarding and account health.
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
codex-setup
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Open guided wizard (menu-driven when terminal supports it, checklist fallback otherwise):
|
|
400
|
+
|
|
401
|
+
```text
|
|
402
|
+
codex-setup wizard=true
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
### codex-doctor
|
|
408
|
+
|
|
409
|
+
Run diagnostics with actionable findings.
|
|
410
|
+
|
|
411
|
+
```text
|
|
412
|
+
codex-doctor
|
|
413
|
+
codex-doctor deep=true
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Apply safe auto-fixes (`--fix` equivalent):
|
|
417
|
+
- Refreshes tokens where possible
|
|
418
|
+
- Persists refreshed credentials
|
|
419
|
+
- Switches active account to the healthiest eligible account
|
|
420
|
+
|
|
421
|
+
```text
|
|
422
|
+
codex-doctor fix=true
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
### codex-next
|
|
428
|
+
|
|
429
|
+
Show the single most recommended next action based on current account/runtime state.
|
|
430
|
+
|
|
431
|
+
```text
|
|
432
|
+
codex-next
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
### codex-status
|
|
438
|
+
|
|
439
|
+
Show detailed status including rate limits and health scores.
|
|
440
|
+
|
|
441
|
+
```text
|
|
442
|
+
codex-status
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
### codex-metrics
|
|
448
|
+
|
|
449
|
+
Show live runtime metrics (request counts, latency, errors, retries, and safe mode).
|
|
450
|
+
|
|
451
|
+
```text
|
|
452
|
+
codex-metrics
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
### codex-health
|
|
458
|
+
|
|
459
|
+
Check if all account tokens are still valid (read-only check).
|
|
460
|
+
|
|
461
|
+
```text
|
|
462
|
+
codex-health
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
### codex-refresh
|
|
468
|
+
|
|
469
|
+
Refresh all OAuth tokens and save them to disk. Use this after long idle periods.
|
|
470
|
+
|
|
471
|
+
```text
|
|
472
|
+
codex-refresh
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
`codex-health` validates. `codex-refresh` validates + refreshes + persists.
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
### codex-remove
|
|
480
|
+
|
|
481
|
+
Remove an account entry. If `index` is omitted and your terminal supports menus, an interactive picker opens.
|
|
482
|
+
|
|
483
|
+
```text
|
|
484
|
+
codex-remove index=3
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
or:
|
|
488
|
+
|
|
489
|
+
```text
|
|
490
|
+
codex-remove
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
### codex-export
|
|
496
|
+
|
|
497
|
+
Export accounts to JSON for backup/migration.
|
|
498
|
+
|
|
499
|
+
Explicit path:
|
|
500
|
+
|
|
501
|
+
```text
|
|
502
|
+
codex-export path="~/backup/accounts.json"
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Auto timestamped backup path (default behavior when `path` is omitted):
|
|
506
|
+
|
|
507
|
+
```text
|
|
508
|
+
codex-export
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Generated paths are stored in a `backups/` subdirectory near the active account storage file.
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
### codex-import
|
|
516
|
+
|
|
517
|
+
Import accounts from a JSON file (dedupe-aware merge).
|
|
518
|
+
|
|
519
|
+
Dry-run preview (no writes):
|
|
520
|
+
|
|
521
|
+
```text
|
|
522
|
+
codex-import path="~/backup/accounts.json" dryRun=true
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
Apply import:
|
|
526
|
+
|
|
527
|
+
```text
|
|
528
|
+
codex-import path="~/backup/accounts.json"
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Before apply, the plugin creates an automatic timestamped pre-import backup when existing accounts are present. If backup creation fails, import apply is aborted.
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
### codex-dashboard
|
|
536
|
+
|
|
537
|
+
Show live account eligibility, retry budget usage, refresh queue metrics, and the recommended next step.
|
|
538
|
+
|
|
539
|
+
```text
|
|
540
|
+
codex-dashboard
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
### Quick Reference
|
|
546
|
+
|
|
547
|
+
| Tool | What It Does | Example |
|
|
548
|
+
|------|--------------|---------|
|
|
549
|
+
| `codex-help` | Command guide by topic | `codex-help topic="setup"` |
|
|
550
|
+
| `codex-setup` | Readiness checklist/wizard | `codex-setup wizard=true` |
|
|
551
|
+
| `codex-next` | Best next action | `codex-next` |
|
|
552
|
+
| `codex-doctor` | Diagnostics and optional safe fixes | `codex-doctor fix=true` |
|
|
553
|
+
| `codex-list` | List/filter accounts | `codex-list tag="work"` |
|
|
554
|
+
| `codex-switch` | Switch active account | `codex-switch index=2` |
|
|
555
|
+
| `codex-label` | Set/clear display label | `codex-label index=2 label="Work"` |
|
|
556
|
+
| `codex-tag` | Set/clear tag list | `codex-tag index=2 tags="work,team-a"` |
|
|
557
|
+
| `codex-note` | Set/clear account note | `codex-note index=2 note="night backup"` |
|
|
558
|
+
| `codex-status` | Per-account health/rate limit detail | `codex-status` |
|
|
559
|
+
| `codex-dashboard` | Live selection and retry view | `codex-dashboard` |
|
|
560
|
+
| `codex-metrics` | Runtime metrics summary | `codex-metrics` |
|
|
561
|
+
| `codex-health` | Validate token health (read-only) | `codex-health` |
|
|
562
|
+
| `codex-refresh` | Refresh and persist tokens | `codex-refresh` |
|
|
563
|
+
| `codex-remove` | Remove account entry | `codex-remove index=3` |
|
|
564
|
+
| `codex-export` | Export account backups | `codex-export` |
|
|
565
|
+
| `codex-import` | Dry-run or apply imports | `codex-import path="~/backup/accounts.json" dryRun=true` |
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
### Sample Output (codex-list)
|
|
570
|
+
|
|
571
|
+
```text
|
|
572
|
+
Codex Accounts (3):
|
|
573
|
+
|
|
574
|
+
[1] Account 1 (user@gmail.com, workspace:Work, tags:work,team-a) active
|
|
575
|
+
[2] Account 2 (backup@email.com, tags:backup) ok
|
|
576
|
+
[3] Account 3 (personal@email.com) rate-limited
|
|
577
|
+
|
|
578
|
+
Storage: ~/.opencode/openai-codex-accounts.json
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
## Rotation Behavior
|
|
582
|
+
|
|
583
|
+
**How rotation works:**
|
|
584
|
+
- Health scoring tracks success/failure per account
|
|
585
|
+
- Token bucket prevents hitting rate limits
|
|
586
|
+
- Hybrid selection prefers healthy accounts with available tokens
|
|
587
|
+
- Always retries when all accounts are rate-limited (waits for reset with live countdown)
|
|
588
|
+
- 20% jitter on retry delays to avoid thundering herd
|
|
589
|
+
- Auto-removes accounts after 3 consecutive auth failures (new in v4.11.0)
|
|
590
|
+
|
|
591
|
+
**Per-project accounts (v4.10.0+):**
|
|
592
|
+
|
|
593
|
+
By default, each project gets its own account storage namespace. This means you can keep different active accounts per project without writing account files into your repo. Works from subdirectories too; the plugin walks up to find the project root (v4.11.0). Disable with `perProjectAccounts: false` in your config.
|
|
594
|
+
|
|
595
|
+
**Storage locations:**
|
|
596
|
+
- Per-project: `~/.opencode/projects/{project-key}/openai-codex-accounts.json`
|
|
597
|
+
- Global (when per-project disabled): `~/.opencode/openai-codex-accounts.json`
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Troubleshooting
|
|
602
|
+
|
|
603
|
+
> **Quick reset**: Most issues can be resolved by deleting `~/.opencode/auth/openai.json` and running `opencode auth login` again.
|
|
604
|
+
|
|
605
|
+
### Configuration Paths (All Platforms)
|
|
606
|
+
|
|
607
|
+
OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
608
|
+
|
|
609
|
+
| File | Path |
|
|
610
|
+
|------|------|
|
|
611
|
+
| Main config | `~/.config/opencode/opencode.json` |
|
|
612
|
+
| Auth tokens | `~/.opencode/auth/openai.json` |
|
|
613
|
+
| Multi-account (global) | `~/.opencode/openai-codex-accounts.json` |
|
|
614
|
+
| Multi-account (per-project) | `~/.opencode/projects/{project-key}/openai-codex-accounts.json` |
|
|
615
|
+
| Flagged accounts | `~/.opencode/openai-codex-flagged-accounts.json` |
|
|
616
|
+
| Plugin config | `~/.opencode/openai-codex-auth-config.json` |
|
|
617
|
+
| Debug logs | `~/.opencode/logs/codex-plugin/` |
|
|
618
|
+
|
|
619
|
+
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
<details>
|
|
624
|
+
<summary><b>401 Unauthorized Error</b></summary>
|
|
625
|
+
|
|
626
|
+
**Cause:** Token expired or not authenticated.
|
|
627
|
+
|
|
628
|
+
**Solutions:**
|
|
629
|
+
1. Re-authenticate:
|
|
630
|
+
```bash
|
|
631
|
+
opencode auth login
|
|
632
|
+
```
|
|
633
|
+
2. Check auth file exists:
|
|
634
|
+
```bash
|
|
635
|
+
cat ~/.opencode/auth/openai.json
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
</details>
|
|
639
|
+
|
|
640
|
+
<details>
|
|
641
|
+
<summary><b>Browser Doesn't Open for OAuth</b></summary>
|
|
642
|
+
|
|
643
|
+
**Cause:** Port 1455 conflict or SSH/WSL environment.
|
|
644
|
+
|
|
645
|
+
**Solutions:**
|
|
646
|
+
1. **Manual URL paste:**
|
|
647
|
+
- Re-run `opencode auth login`
|
|
648
|
+
- Select **"ChatGPT Plus/Pro (manual URL paste)"**
|
|
649
|
+
- Paste the full redirect URL (including `#code=...`) after login
|
|
650
|
+
|
|
651
|
+
2. **Check port availability:**
|
|
652
|
+
```bash
|
|
653
|
+
# macOS/Linux
|
|
654
|
+
lsof -i :1455
|
|
655
|
+
|
|
656
|
+
# Windows
|
|
657
|
+
netstat -ano | findstr :1455
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
3. **Stop Codex CLI if running** — Both use port 1455
|
|
661
|
+
|
|
662
|
+
</details>
|
|
663
|
+
|
|
664
|
+
<details>
|
|
665
|
+
<summary><b>Model Not Found</b></summary>
|
|
666
|
+
|
|
667
|
+
**Cause:** Missing provider prefix or config mismatch.
|
|
668
|
+
|
|
669
|
+
**Solutions:**
|
|
670
|
+
1. Use `openai/` prefix:
|
|
671
|
+
```bash
|
|
672
|
+
# Correct
|
|
673
|
+
--model=openai/gpt-5.4
|
|
674
|
+
|
|
675
|
+
# Wrong
|
|
676
|
+
--model=gpt-5.4
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
2. Verify model is in your config:
|
|
680
|
+
```json
|
|
681
|
+
{ "models": { "gpt-5.4": { ... } } }
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
</details>
|
|
685
|
+
|
|
686
|
+
<details>
|
|
687
|
+
<summary><b>Unsupported Codex Model for ChatGPT Account</b></summary>
|
|
688
|
+
|
|
689
|
+
**Error example:** `Bad Request: {"detail":"The 'gpt-5.3-codex-spark' model is not supported when using Codex with a ChatGPT account."}`
|
|
690
|
+
|
|
691
|
+
**Cause:** Active workspace/account is not entitled for the requested Codex model.
|
|
692
|
+
|
|
693
|
+
**Solutions:**
|
|
694
|
+
1. Re-auth to refresh workspace selection (most common Spark fix):
|
|
695
|
+
```bash
|
|
696
|
+
opencode auth login
|
|
697
|
+
```
|
|
698
|
+
2. Add another entitled account/workspace. The plugin will try remaining accounts/workspaces before model fallback.
|
|
699
|
+
3. Enable automatic fallback only if you want degraded-model retries when Spark is not entitled:
|
|
700
|
+
```bash
|
|
701
|
+
CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback opencode
|
|
702
|
+
```
|
|
703
|
+
4. Use custom fallback chain in `~/.opencode/openai-codex-auth-config.json`:
|
|
704
|
+
```json
|
|
705
|
+
{
|
|
706
|
+
"unsupportedCodexPolicy": "fallback",
|
|
707
|
+
"fallbackOnUnsupportedCodexModel": true,
|
|
708
|
+
"unsupportedCodexFallbackChain": {
|
|
709
|
+
"gpt-5.4-pro": ["gpt-5.4"],
|
|
710
|
+
"gpt-5-codex": ["gpt-5.2-codex"],
|
|
711
|
+
"gpt-5.3-codex": ["gpt-5-codex", "gpt-5.2-codex"],
|
|
712
|
+
"gpt-5.3-codex-spark": ["gpt-5-codex", "gpt-5.3-codex", "gpt-5.2-codex"]
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
5. Verify effective upstream model when needed:
|
|
717
|
+
```bash
|
|
718
|
+
ENABLE_PLUGIN_REQUEST_LOGGING=1 CODEX_PLUGIN_LOG_BODIES=1 opencode run "ping" --model=openai/gpt-5.3-codex-spark
|
|
719
|
+
```
|
|
720
|
+
The UI can keep showing your selected model while fallback is applied internally.
|
|
721
|
+
|
|
722
|
+
</details>
|
|
723
|
+
|
|
724
|
+
<details>
|
|
725
|
+
<summary><b>Rate Limit Exceeded</b></summary>
|
|
726
|
+
|
|
727
|
+
**Cause:** ChatGPT subscription usage limit reached.
|
|
728
|
+
|
|
729
|
+
**Solutions:**
|
|
730
|
+
1. Wait for reset (plugin shows timing in error message)
|
|
731
|
+
2. Add more accounts: `opencode auth login`
|
|
732
|
+
3. Switch to a different model family
|
|
733
|
+
|
|
734
|
+
</details>
|
|
735
|
+
|
|
736
|
+
<details>
|
|
737
|
+
<summary><b>Multi-Turn Context Lost</b></summary>
|
|
738
|
+
|
|
739
|
+
**Cause:** Old plugin version or missing config.
|
|
740
|
+
|
|
741
|
+
**Solutions:**
|
|
742
|
+
1. Update plugin:
|
|
743
|
+
```bash
|
|
744
|
+
npx -y oc-chatgpt-multi-auth@latest
|
|
745
|
+
```
|
|
746
|
+
2. Ensure config has:
|
|
747
|
+
```json
|
|
748
|
+
{
|
|
749
|
+
"include": ["reasoning.encrypted_content"],
|
|
750
|
+
"store": false
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
</details>
|
|
755
|
+
|
|
756
|
+
<details>
|
|
757
|
+
<summary><b>OAuth Callback Issues (Safari/WSL/Docker)</b></summary>
|
|
758
|
+
|
|
759
|
+
**Safari HTTPS-only mode:**
|
|
760
|
+
- Use Chrome or Firefox instead, or
|
|
761
|
+
- Temporarily disable Safari > Settings > Privacy > "Enable HTTPS-only mode"
|
|
762
|
+
|
|
763
|
+
**WSL2:**
|
|
764
|
+
- Use VS Code's port forwarding, or
|
|
765
|
+
- Configure Windows → WSL port forwarding
|
|
766
|
+
|
|
767
|
+
**SSH / Remote:**
|
|
768
|
+
```bash
|
|
769
|
+
ssh -L 1455:localhost:1455 user@remote
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**Docker / Containers:**
|
|
773
|
+
- OAuth with localhost redirect doesn't work in containers
|
|
774
|
+
- Use SSH port forwarding or manual URL flow
|
|
775
|
+
|
|
776
|
+
</details>
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
## Plugin Compatibility
|
|
781
|
+
|
|
782
|
+
### oh-my-opencode
|
|
783
|
+
|
|
784
|
+
Works alongside oh-my-opencode. No special configuration needed.
|
|
785
|
+
|
|
786
|
+
```json
|
|
787
|
+
{
|
|
788
|
+
"plugin": [
|
|
789
|
+
"oc-chatgpt-multi-auth@latest",
|
|
790
|
+
"oh-my-opencode@latest"
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
### @tarquinen/opencode-dcp
|
|
796
|
+
|
|
797
|
+
List this plugin before dcp:
|
|
798
|
+
|
|
799
|
+
```json
|
|
800
|
+
{
|
|
801
|
+
"plugin": [
|
|
802
|
+
"oc-chatgpt-multi-auth@latest",
|
|
803
|
+
"@tarquinen/opencode-dcp@latest"
|
|
804
|
+
]
|
|
805
|
+
}
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
### Plugins You Don't Need
|
|
809
|
+
|
|
810
|
+
- **openai-codex-auth** — Not needed. This plugin replaces the original.
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## Configuration
|
|
815
|
+
|
|
816
|
+
Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
|
|
817
|
+
|
|
818
|
+
### Model Behavior
|
|
819
|
+
|
|
820
|
+
| Option | Default | What It Does |
|
|
821
|
+
|--------|---------|--------------|
|
|
822
|
+
| `requestTransformMode` | `native` | Request shaping mode: `native` keeps OpenCode payloads unchanged; `legacy` enables Codex compatibility rewrites |
|
|
823
|
+
| `codexMode` | `true` | Legacy-only bridge prompt behavior (applies when `requestTransformMode=legacy`) |
|
|
824
|
+
| `codexTuiV2` | `true` | Enables Codex-style terminal UI output (set `false` for legacy output) |
|
|
825
|
+
| `codexTuiColorProfile` | `truecolor` | Terminal color profile for Codex UI (`truecolor`, `ansi256`, `ansi16`) |
|
|
826
|
+
| `codexTuiGlyphMode` | `ascii` | Glyph mode for Codex UI (`ascii`, `unicode`, `auto`) |
|
|
827
|
+
| `fastSession` | `false` | Forces low-latency settings per request (`reasoningEffort=none/low`, `reasoningSummary=auto`, `textVerbosity=low`) |
|
|
828
|
+
| `fastSessionStrategy` | `hybrid` | `hybrid` speeds simple turns but keeps full-depth on complex prompts; `always` forces fast tuning on every turn |
|
|
829
|
+
| `fastSessionMaxInputItems` | `30` | Max input items kept when fast tuning is applied |
|
|
830
|
+
|
|
831
|
+
### Account Settings (v4.10.0+)
|
|
832
|
+
|
|
833
|
+
| Option | Default | What It Does |
|
|
834
|
+
|--------|---------|--------------|
|
|
835
|
+
| `perProjectAccounts` | `true` | Each project gets its own account storage namespace under `~/.opencode/projects/` |
|
|
836
|
+
| `toastDurationMs` | `5000` | How long toast notifications stay visible (ms) |
|
|
837
|
+
| `beginnerSafeMode` | `false` | Beginner-safe retry profile: conservative retry budget, disables all-accounts wait/retry, and caps all-accounts retries |
|
|
838
|
+
|
|
839
|
+
### Retry Behavior
|
|
840
|
+
|
|
841
|
+
| Option | Default | What It Does |
|
|
842
|
+
|--------|---------|--------------|
|
|
843
|
+
| `retryProfile` | `balanced` | Global retry budget profile (`conservative`, `balanced`, `aggressive`) |
|
|
844
|
+
| `retryBudgetOverrides` | `{}` | Per-class retry budget overrides (`authRefresh`, `network`, `server`, `rateLimitShort`, `rateLimitGlobal`, `emptyResponse`) |
|
|
845
|
+
| `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |
|
|
846
|
+
| `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |
|
|
847
|
+
| `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |
|
|
848
|
+
| `unsupportedCodexPolicy` | `strict` | Unsupported-model behavior: `strict` (return entitlement error) or `fallback` (retry next model in fallback chain) |
|
|
849
|
+
| `fallbackOnUnsupportedCodexModel` | `false` | Legacy fallback toggle mapped to `unsupportedCodexPolicy` (prefer using `unsupportedCodexPolicy`) |
|
|
850
|
+
| `fallbackToGpt52OnUnsupportedGpt53` | `true` | Legacy compatibility toggle for the `gpt-5.3-codex -> gpt-5.2-codex` edge when generic fallback is enabled |
|
|
851
|
+
| `unsupportedCodexFallbackChain` | `{}` | Optional per-model fallback-chain override (map of `model -> [fallback1, fallback2, ...]`) |
|
|
852
|
+
| `fetchTimeoutMs` | `60000` | Request timeout to Codex backend (ms) |
|
|
853
|
+
| `streamStallTimeoutMs` | `45000` | Abort non-stream parsing if SSE stalls (ms) |
|
|
854
|
+
|
|
855
|
+
Default unsupported-model fallback chain (used when `unsupportedCodexPolicy` is `fallback`):
|
|
856
|
+
- `gpt-5.4-pro -> gpt-5.4` (if `gpt-5.4-pro` is selected manually)
|
|
857
|
+
- `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
|
|
858
|
+
- `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (applies if you manually select Spark model IDs)
|
|
859
|
+
- `gpt-5.2-codex -> gpt-5-codex`
|
|
860
|
+
- `gpt-5.1-codex -> gpt-5-codex`
|
|
861
|
+
|
|
862
|
+
When `beginnerSafeMode` is enabled, runtime behavior is intentionally conservative:
|
|
863
|
+
- Retry profile is forced to `conservative`
|
|
864
|
+
- `retryAllAccountsRateLimited` is forced `false`
|
|
865
|
+
- `retryAllAccountsMaxRetries` is capped to `1`
|
|
866
|
+
|
|
867
|
+
### Environment Variables
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
DEBUG_CODEX_PLUGIN=1 opencode # Enable debug logging
|
|
871
|
+
ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode # Log request metadata
|
|
872
|
+
CODEX_PLUGIN_LOG_BODIES=1 opencode # Include raw request/response payloads in request logs (sensitive)
|
|
873
|
+
CODEX_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
|
|
874
|
+
CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy opencode # Re-enable legacy Codex request rewrites
|
|
875
|
+
CODEX_MODE=0 opencode # Temporarily disable bridge prompt
|
|
876
|
+
CODEX_TUI_V2=0 opencode # Disable Codex-style UI (legacy output)
|
|
877
|
+
CODEX_TUI_COLOR_PROFILE=ansi16 opencode # Force UI color profile
|
|
878
|
+
CODEX_TUI_GLYPHS=unicode opencode # Override glyph mode (ascii|unicode|auto)
|
|
879
|
+
CODEX_AUTH_PREWARM=0 opencode # Disable startup prewarm (prompt/instruction cache warmup)
|
|
880
|
+
CODEX_AUTH_FAST_SESSION=1 opencode # Enable faster response defaults
|
|
881
|
+
CODEX_AUTH_FAST_SESSION_STRATEGY=always opencode # Force fast mode for all prompts
|
|
882
|
+
CODEX_AUTH_FAST_SESSION_MAX_INPUT_ITEMS=24 opencode # Tune fast-mode history window
|
|
883
|
+
CODEX_AUTH_BEGINNER_SAFE_MODE=1 opencode # Enable beginner-safe runtime profile
|
|
884
|
+
CODEX_AUTH_RETRY_PROFILE=aggressive opencode # Override retry profile (ignored when beginner safe mode is on)
|
|
885
|
+
CODEX_AUTH_RETRY_ALL_RATE_LIMITED=0 opencode # Disable all-accounts wait-and-retry
|
|
886
|
+
CODEX_AUTH_RETRY_ALL_MAX_WAIT_MS=30000 opencode # Cap all-accounts wait duration
|
|
887
|
+
CODEX_AUTH_RETRY_ALL_MAX_RETRIES=1 opencode # Cap all-accounts retry attempts
|
|
888
|
+
CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback opencode # Enable generic unsupported-model fallback
|
|
889
|
+
CODEX_AUTH_FALLBACK_UNSUPPORTED_MODEL=1 opencode # Legacy fallback toggle (prefer policy var above)
|
|
890
|
+
CODEX_AUTH_FALLBACK_GPT53_TO_GPT52=0 opencode # Disable only the legacy gpt-5.3 -> gpt-5.2 edge
|
|
891
|
+
CODEX_AUTH_FETCH_TIMEOUT_MS=120000 opencode # Override request timeout
|
|
892
|
+
CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=60000 opencode # Override SSE stall timeout
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
For all options, see [docs/configuration.md](docs/configuration.md).
|
|
896
|
+
|
|
897
|
+
---
|
|
898
|
+
|
|
899
|
+
## Documentation
|
|
900
|
+
|
|
901
|
+
- [Getting Started](docs/getting-started.md) — Complete installation guide
|
|
902
|
+
- [Configuration](docs/configuration.md) — All configuration options
|
|
903
|
+
- [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
|
|
904
|
+
- [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
|
|
905
|
+
|
|
906
|
+
---
|
|
907
|
+
|
|
908
|
+
## Credits
|
|
909
|
+
|
|
910
|
+
- [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) by [numman-ali](https://github.com/numman-ali) — Original plugin
|
|
911
|
+
- [ndycode](https://github.com/ndycode) — Multi-account support and maintenance
|
|
912
|
+
|
|
913
|
+
## License
|
|
914
|
+
|
|
915
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
916
|
+
|
|
917
|
+
<details>
|
|
918
|
+
<summary><b>Legal</b></summary>
|
|
919
|
+
|
|
920
|
+
### Intended Use
|
|
921
|
+
|
|
922
|
+
- Personal / internal development only
|
|
923
|
+
- Respect subscription quotas and data handling policies
|
|
924
|
+
- Not for production services or bypassing intended limits
|
|
925
|
+
|
|
926
|
+
### Warning
|
|
927
|
+
|
|
928
|
+
By using this plugin, you acknowledge:
|
|
929
|
+
|
|
930
|
+
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
931
|
+
- **No guarantees** — APIs may change without notice
|
|
932
|
+
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
933
|
+
|
|
934
|
+
### Disclaimer
|
|
935
|
+
|
|
936
|
+
- Not affiliated with OpenAI. This is an independent open-source project.
|
|
937
|
+
- "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI, L.L.C.
|
|
938
|
+
|
|
939
|
+
</details>
|