oc-chatgpt-multi-auth 5.3.2 → 5.3.4
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 +198 -85
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1623 -50
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +16 -0
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +60 -0
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +36 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/refresh-queue.d.ts +16 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -1
- package/dist/lib/refresh-queue.js +46 -0
- package/dist/lib/refresh-queue.js.map +1 -1
- package/dist/lib/request/retry-budget.d.ts +19 -0
- package/dist/lib/request/retry-budget.d.ts.map +1 -0
- package/dist/lib/request/retry-budget.js +99 -0
- package/dist/lib/request/retry-budget.js.map +1 -0
- package/dist/lib/schemas.d.ts +26 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +28 -0
- package/dist/lib/schemas.js.map +1 -1
- package/dist/lib/storage/migrations.d.ts +4 -0
- package/dist/lib/storage/migrations.d.ts.map +1 -1
- package/dist/lib/storage/migrations.js +2 -0
- package/dist/lib/storage/migrations.js.map +1 -1
- package/dist/lib/storage.d.ts +31 -5
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +354 -71
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +23 -5
- package/dist/lib/ui/auth-menu.js.map +1 -1
- package/dist/lib/ui/beginner.d.ts +57 -0
- package/dist/lib/ui/beginner.d.ts.map +1 -0
- package/dist/lib/ui/beginner.js +230 -0
- package/dist/lib/ui/beginner.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@ OAuth plugin for OpenCode that lets you use ChatGPT Plus/Pro rate limits with mo
|
|
|
15
15
|
- **Per-project accounts** — Each project gets its own account storage (new in v4.10.0)
|
|
16
16
|
- **Workspace-aware identity persistence** — Keeps workspace/org identity stable across token refresh and verify-flagged restore flows
|
|
17
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
|
|
18
22
|
- **Strict tool validation** — Automatically cleans schemas for compatibility with strict models
|
|
19
23
|
- **Auto-update notifications** — Get notified when a new version is available
|
|
20
24
|
- **21 template model presets** — Full variant system with reasoning levels (none/low/medium/high/xhigh)
|
|
@@ -278,177 +282,253 @@ The plugin provides built-in tools for managing your OpenAI accounts. These are
|
|
|
278
282
|
|
|
279
283
|
### codex-list
|
|
280
284
|
|
|
281
|
-
List all configured accounts with
|
|
285
|
+
List all configured accounts with status badges.
|
|
282
286
|
|
|
283
|
-
```
|
|
287
|
+
```text
|
|
284
288
|
codex-list
|
|
285
289
|
```
|
|
286
290
|
|
|
287
|
-
|
|
288
|
-
```
|
|
289
|
-
OpenAI Accounts (3 total):
|
|
290
|
-
|
|
291
|
-
[1] user@gmail.com (active)
|
|
292
|
-
[2] work@company.com
|
|
293
|
-
[3] backup@email.com
|
|
291
|
+
Filter by tag:
|
|
294
292
|
|
|
295
|
-
|
|
293
|
+
```text
|
|
294
|
+
codex-list tag="work"
|
|
296
295
|
```
|
|
297
296
|
|
|
297
|
+
Shows account labels, IDs, tags, active state, and rate-limit/cooldown markers.
|
|
298
|
+
|
|
298
299
|
---
|
|
299
300
|
|
|
300
301
|
### codex-switch
|
|
301
302
|
|
|
302
|
-
Switch to a different account
|
|
303
|
+
Switch to a different account. If `index` is omitted and your terminal supports menus, an interactive picker opens.
|
|
303
304
|
|
|
304
|
-
```
|
|
305
|
+
```text
|
|
305
306
|
codex-switch index=2
|
|
306
307
|
```
|
|
307
308
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
or:
|
|
310
|
+
|
|
311
|
+
```text
|
|
312
|
+
codex-switch
|
|
311
313
|
```
|
|
312
314
|
|
|
313
315
|
---
|
|
314
316
|
|
|
315
|
-
### codex-
|
|
317
|
+
### codex-label
|
|
316
318
|
|
|
317
|
-
|
|
319
|
+
Set or clear a display label for an account. Useful for workspace naming.
|
|
318
320
|
|
|
321
|
+
```text
|
|
322
|
+
codex-label index=2 label="Work"
|
|
319
323
|
```
|
|
320
|
-
|
|
324
|
+
|
|
325
|
+
Clear:
|
|
326
|
+
|
|
327
|
+
```text
|
|
328
|
+
codex-label index=2 label=""
|
|
321
329
|
```
|
|
322
330
|
|
|
323
|
-
|
|
331
|
+
If `index` is omitted in interactive terminals, a picker opens.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### codex-tag
|
|
336
|
+
|
|
337
|
+
Set or clear comma-separated tags for filtering and grouping.
|
|
338
|
+
|
|
339
|
+
```text
|
|
340
|
+
codex-tag index=2 tags="work,team-a"
|
|
324
341
|
```
|
|
325
|
-
OpenAI Account Status:
|
|
326
342
|
|
|
327
|
-
|
|
328
|
-
Health: 100/100
|
|
329
|
-
Rate Limit: 45/50 requests remaining
|
|
330
|
-
Resets: 2m 30s
|
|
331
|
-
Last Used: 5 minutes ago
|
|
343
|
+
Clear:
|
|
332
344
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
Rate Limit: 12/50 requests remaining
|
|
336
|
-
Resets: 8m 15s
|
|
337
|
-
Last Used: 1 hour ago
|
|
345
|
+
```text
|
|
346
|
+
codex-tag index=2 tags=""
|
|
338
347
|
```
|
|
339
348
|
|
|
349
|
+
Use tags with `codex-list tag="work"`.
|
|
350
|
+
|
|
340
351
|
---
|
|
341
352
|
|
|
342
|
-
### codex-
|
|
353
|
+
### codex-note
|
|
343
354
|
|
|
344
|
-
|
|
355
|
+
Set or clear a short per-account note for reminders.
|
|
345
356
|
|
|
346
|
-
```
|
|
347
|
-
codex-
|
|
357
|
+
```text
|
|
358
|
+
codex-note index=2 note="primary for weekday daytime usage"
|
|
348
359
|
```
|
|
349
360
|
|
|
350
|
-
|
|
361
|
+
Clear:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
codex-note index=2 note=""
|
|
351
365
|
```
|
|
352
|
-
Codex Plugin Metrics:
|
|
353
366
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### codex-help
|
|
370
|
+
|
|
371
|
+
Show beginner-friendly command guidance. Optional topic filter:
|
|
372
|
+
|
|
373
|
+
```text
|
|
374
|
+
codex-help
|
|
375
|
+
codex-help topic="backup"
|
|
359
376
|
```
|
|
360
377
|
|
|
378
|
+
Available topics: `setup`, `switch`, `health`, `backup`, `dashboard`, `metrics`.
|
|
379
|
+
|
|
361
380
|
---
|
|
362
381
|
|
|
363
|
-
### codex-
|
|
382
|
+
### codex-setup
|
|
364
383
|
|
|
365
|
-
|
|
384
|
+
Show readiness checklist for first-run onboarding and account health.
|
|
366
385
|
|
|
386
|
+
```text
|
|
387
|
+
codex-setup
|
|
367
388
|
```
|
|
368
|
-
|
|
389
|
+
|
|
390
|
+
Open guided wizard (menu-driven when terminal supports it, checklist fallback otherwise):
|
|
391
|
+
|
|
392
|
+
```text
|
|
393
|
+
codex-setup wizard=true
|
|
369
394
|
```
|
|
370
395
|
|
|
371
|
-
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### codex-doctor
|
|
399
|
+
|
|
400
|
+
Run diagnostics with actionable findings.
|
|
401
|
+
|
|
402
|
+
```text
|
|
403
|
+
codex-doctor
|
|
404
|
+
codex-doctor deep=true
|
|
372
405
|
```
|
|
373
|
-
Checking 3 account(s):
|
|
374
406
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
407
|
+
Apply safe auto-fixes (`--fix` equivalent):
|
|
408
|
+
- Refreshes tokens where possible
|
|
409
|
+
- Persists refreshed credentials
|
|
410
|
+
- Switches active account to the healthiest eligible account
|
|
378
411
|
|
|
379
|
-
|
|
412
|
+
```text
|
|
413
|
+
codex-doctor fix=true
|
|
380
414
|
```
|
|
381
415
|
|
|
382
416
|
---
|
|
383
417
|
|
|
384
|
-
### codex-
|
|
418
|
+
### codex-next
|
|
385
419
|
|
|
386
|
-
|
|
420
|
+
Show the single most recommended next action based on current account/runtime state.
|
|
387
421
|
|
|
422
|
+
```text
|
|
423
|
+
codex-next
|
|
388
424
|
```
|
|
389
|
-
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
### codex-status
|
|
429
|
+
|
|
430
|
+
Show detailed status including rate limits and health scores.
|
|
431
|
+
|
|
432
|
+
```text
|
|
433
|
+
codex-status
|
|
390
434
|
```
|
|
391
435
|
|
|
392
|
-
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
### codex-metrics
|
|
439
|
+
|
|
440
|
+
Show live runtime metrics (request counts, latency, errors, retries, and safe mode).
|
|
441
|
+
|
|
442
|
+
```text
|
|
443
|
+
codex-metrics
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
### codex-health
|
|
449
|
+
|
|
450
|
+
Check if all account tokens are still valid (read-only check).
|
|
451
|
+
|
|
452
|
+
```text
|
|
453
|
+
codex-health
|
|
393
454
|
```
|
|
394
|
-
Refreshing 3 account(s):
|
|
395
455
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
### codex-refresh
|
|
459
|
+
|
|
460
|
+
Refresh all OAuth tokens and save them to disk. Use this after long idle periods.
|
|
399
461
|
|
|
400
|
-
|
|
462
|
+
```text
|
|
463
|
+
codex-refresh
|
|
401
464
|
```
|
|
402
465
|
|
|
403
|
-
|
|
466
|
+
`codex-health` validates. `codex-refresh` validates + refreshes + persists.
|
|
404
467
|
|
|
405
468
|
---
|
|
406
469
|
|
|
407
470
|
### codex-remove
|
|
408
471
|
|
|
409
|
-
Remove an account
|
|
472
|
+
Remove an account entry. If `index` is omitted and your terminal supports menus, an interactive picker opens.
|
|
410
473
|
|
|
411
|
-
```
|
|
474
|
+
```text
|
|
412
475
|
codex-remove index=3
|
|
413
476
|
```
|
|
414
477
|
|
|
415
|
-
|
|
416
|
-
```
|
|
417
|
-
Removed: [3] old@expired.com
|
|
478
|
+
or:
|
|
418
479
|
|
|
419
|
-
|
|
480
|
+
```text
|
|
481
|
+
codex-remove
|
|
420
482
|
```
|
|
421
483
|
|
|
422
484
|
---
|
|
423
485
|
|
|
424
486
|
### codex-export
|
|
425
487
|
|
|
426
|
-
Export
|
|
488
|
+
Export accounts to JSON for backup/migration.
|
|
427
489
|
|
|
428
|
-
|
|
490
|
+
Explicit path:
|
|
491
|
+
|
|
492
|
+
```text
|
|
429
493
|
codex-export path="~/backup/accounts.json"
|
|
430
494
|
```
|
|
431
495
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
496
|
+
Auto timestamped backup path (default behavior when `path` is omitted):
|
|
497
|
+
|
|
498
|
+
```text
|
|
499
|
+
codex-export
|
|
435
500
|
```
|
|
436
501
|
|
|
502
|
+
Generated paths are stored in a `backups/` subdirectory near the active account storage file.
|
|
503
|
+
|
|
437
504
|
---
|
|
438
505
|
|
|
439
506
|
### codex-import
|
|
440
507
|
|
|
441
|
-
Import accounts from a JSON file (
|
|
508
|
+
Import accounts from a JSON file (dedupe-aware merge).
|
|
509
|
+
|
|
510
|
+
Dry-run preview (no writes):
|
|
442
511
|
|
|
512
|
+
```text
|
|
513
|
+
codex-import path="~/backup/accounts.json" dryRun=true
|
|
443
514
|
```
|
|
515
|
+
|
|
516
|
+
Apply import:
|
|
517
|
+
|
|
518
|
+
```text
|
|
444
519
|
codex-import path="~/backup/accounts.json"
|
|
445
520
|
```
|
|
446
521
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
522
|
+
Before apply, the plugin creates an automatic timestamped pre-import backup when existing accounts are present. If backup creation fails, import apply is aborted.
|
|
523
|
+
|
|
524
|
+
---
|
|
450
525
|
|
|
451
|
-
|
|
526
|
+
### codex-dashboard
|
|
527
|
+
|
|
528
|
+
Show live account eligibility, retry budget usage, refresh queue metrics, and the recommended next step.
|
|
529
|
+
|
|
530
|
+
```text
|
|
531
|
+
codex-dashboard
|
|
452
532
|
```
|
|
453
533
|
|
|
454
534
|
---
|
|
@@ -457,18 +537,38 @@ Total accounts: 4
|
|
|
457
537
|
|
|
458
538
|
| Tool | What It Does | Example |
|
|
459
539
|
|------|--------------|---------|
|
|
460
|
-
| `codex-
|
|
461
|
-
| `codex-
|
|
462
|
-
| `codex-
|
|
463
|
-
| `codex-
|
|
464
|
-
| `codex-
|
|
465
|
-
| `codex-
|
|
466
|
-
| `codex-
|
|
467
|
-
| `codex-
|
|
468
|
-
| `codex-
|
|
540
|
+
| `codex-help` | Command guide by topic | `codex-help topic="setup"` |
|
|
541
|
+
| `codex-setup` | Readiness checklist/wizard | `codex-setup wizard=true` |
|
|
542
|
+
| `codex-next` | Best next action | `codex-next` |
|
|
543
|
+
| `codex-doctor` | Diagnostics and optional safe fixes | `codex-doctor fix=true` |
|
|
544
|
+
| `codex-list` | List/filter accounts | `codex-list tag="work"` |
|
|
545
|
+
| `codex-switch` | Switch active account | `codex-switch index=2` |
|
|
546
|
+
| `codex-label` | Set/clear display label | `codex-label index=2 label="Work"` |
|
|
547
|
+
| `codex-tag` | Set/clear tag list | `codex-tag index=2 tags="work,team-a"` |
|
|
548
|
+
| `codex-note` | Set/clear account note | `codex-note index=2 note="night backup"` |
|
|
549
|
+
| `codex-status` | Per-account health/rate limit detail | `codex-status` |
|
|
550
|
+
| `codex-dashboard` | Live selection and retry view | `codex-dashboard` |
|
|
551
|
+
| `codex-metrics` | Runtime metrics summary | `codex-metrics` |
|
|
552
|
+
| `codex-health` | Validate token health (read-only) | `codex-health` |
|
|
553
|
+
| `codex-refresh` | Refresh and persist tokens | `codex-refresh` |
|
|
554
|
+
| `codex-remove` | Remove account entry | `codex-remove index=3` |
|
|
555
|
+
| `codex-export` | Export account backups | `codex-export` |
|
|
556
|
+
| `codex-import` | Dry-run or apply imports | `codex-import path="~/backup/accounts.json" dryRun=true` |
|
|
469
557
|
|
|
470
558
|
---
|
|
471
559
|
|
|
560
|
+
### Sample Output (codex-list)
|
|
561
|
+
|
|
562
|
+
```text
|
|
563
|
+
Codex Accounts (3):
|
|
564
|
+
|
|
565
|
+
[1] Account 1 (user@gmail.com, workspace:Work, tags:work,team-a) active
|
|
566
|
+
[2] Account 2 (backup@email.com, tags:backup) ok
|
|
567
|
+
[3] Account 3 (personal@email.com) rate-limited
|
|
568
|
+
|
|
569
|
+
Storage: ~/.opencode/openai-codex-accounts.json
|
|
570
|
+
```
|
|
571
|
+
|
|
472
572
|
## Rotation Behavior
|
|
473
573
|
|
|
474
574
|
**How rotation works:**
|
|
@@ -724,11 +824,14 @@ Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
|
|
|
724
824
|
|--------|---------|--------------|
|
|
725
825
|
| `perProjectAccounts` | `true` | Each project gets its own account storage namespace under `~/.opencode/projects/` |
|
|
726
826
|
| `toastDurationMs` | `5000` | How long toast notifications stay visible (ms) |
|
|
827
|
+
| `beginnerSafeMode` | `false` | Beginner-safe retry profile: conservative retry budget, disables all-accounts wait/retry, and caps all-accounts retries |
|
|
727
828
|
|
|
728
829
|
### Retry Behavior
|
|
729
830
|
|
|
730
831
|
| Option | Default | What It Does |
|
|
731
832
|
|--------|---------|--------------|
|
|
833
|
+
| `retryProfile` | `balanced` | Global retry budget profile (`conservative`, `balanced`, `aggressive`) |
|
|
834
|
+
| `retryBudgetOverrides` | `{}` | Per-class retry budget overrides (`authRefresh`, `network`, `server`, `rateLimitShort`, `rateLimitGlobal`, `emptyResponse`) |
|
|
732
835
|
| `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |
|
|
733
836
|
| `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |
|
|
734
837
|
| `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |
|
|
@@ -745,6 +848,11 @@ Default unsupported-model fallback chain (used when `unsupportedCodexPolicy` is
|
|
|
745
848
|
- `gpt-5.2-codex -> gpt-5-codex`
|
|
746
849
|
- `gpt-5.1-codex -> gpt-5-codex`
|
|
747
850
|
|
|
851
|
+
When `beginnerSafeMode` is enabled, runtime behavior is intentionally conservative:
|
|
852
|
+
- Retry profile is forced to `conservative`
|
|
853
|
+
- `retryAllAccountsRateLimited` is forced `false`
|
|
854
|
+
- `retryAllAccountsMaxRetries` is capped to `1`
|
|
855
|
+
|
|
748
856
|
### Environment Variables
|
|
749
857
|
|
|
750
858
|
```bash
|
|
@@ -761,6 +869,11 @@ CODEX_AUTH_PREWARM=0 opencode # Disable startup prewarm (prom
|
|
|
761
869
|
CODEX_AUTH_FAST_SESSION=1 opencode # Enable faster response defaults
|
|
762
870
|
CODEX_AUTH_FAST_SESSION_STRATEGY=always opencode # Force fast mode for all prompts
|
|
763
871
|
CODEX_AUTH_FAST_SESSION_MAX_INPUT_ITEMS=24 opencode # Tune fast-mode history window
|
|
872
|
+
CODEX_AUTH_BEGINNER_SAFE_MODE=1 opencode # Enable beginner-safe runtime profile
|
|
873
|
+
CODEX_AUTH_RETRY_PROFILE=aggressive opencode # Override retry profile (ignored when beginner safe mode is on)
|
|
874
|
+
CODEX_AUTH_RETRY_ALL_RATE_LIMITED=0 opencode # Disable all-accounts wait-and-retry
|
|
875
|
+
CODEX_AUTH_RETRY_ALL_MAX_WAIT_MS=30000 opencode # Cap all-accounts wait duration
|
|
876
|
+
CODEX_AUTH_RETRY_ALL_MAX_RETRIES=1 opencode # Cap all-accounts retry attempts
|
|
764
877
|
CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback opencode # Enable generic unsupported-model fallback
|
|
765
878
|
CODEX_AUTH_FALLBACK_UNSUPPORTED_MODEL=1 opencode # Legacy fallback toggle (prefer policy var above)
|
|
766
879
|
CODEX_AUTH_FALLBACK_GPT53_TO_GPT52=0 opencode # Disable only the legacy gpt-5.3 -> gpt-5.2 edge
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AA+J/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MA8kK/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAElD,eAAe,iBAAiB,CAAC"}
|