oc-codex-multi-auth 6.1.8 → 6.1.10

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 CHANGED
@@ -1,11 +1,15 @@
1
- # oc-codex-multi-auth
1
+ # oc-codex-multi-auth: ChatGPT OAuth and multi-account Codex routing for OpenCode
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/oc-codex-multi-auth.svg)](https://www.npmjs.com/package/oc-codex-multi-auth)
4
4
  [![npm downloads](https://img.shields.io/npm/dw/oc-codex-multi-auth.svg)](https://www.npmjs.com/package/oc-codex-multi-auth)
5
+ [![CI](https://github.com/ndycode/oc-codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/oc-codex-multi-auth/actions/workflows/ci.yml)
6
+ [![MIT license](https://img.shields.io/npm/l/oc-codex-multi-auth.svg)](LICENSE)
5
7
 
6
- OpenCode plugin for ChatGPT Plus/Pro OAuth, Codex-first GPT-5 workflows, and multi-account rotation.
8
+ `oc-codex-multi-auth` is an OpenCode plugin for ChatGPT Plus/Pro OAuth, Codex and GPT-5 model routing, multi-account rotation, account switching, health checks, quota visibility, diagnostics, and recovery tools. It installs the OpenCode provider/TUI configuration, registers a `codex-*` command toolkit, and routes OpenCode OpenAI SDK requests through the ChatGPT-backed Codex flow with local account state.
7
9
 
8
- <img width="1227" height="702" alt="cover" src="https://github.com/user-attachments/assets/b796eb2f-282e-468a-ba6a-acadf09d731b" />
10
+ Use it when you want OpenCode to run Codex-style coding workflows from your own ChatGPT subscription while keeping accounts visible, switchable, health-checked, and recoverable from the terminal.
11
+
12
+ <img width="1227" height="702" alt="oc-codex-multi-auth OpenCode plugin dashboard for ChatGPT OAuth, Codex routing, and multi-account health" src="https://github.com/user-attachments/assets/b796eb2f-282e-468a-ba6a-acadf09d731b" />
9
13
 
10
14
 
11
15
 
@@ -15,16 +19,39 @@ OpenCode plugin for ChatGPT Plus/Pro OAuth, Codex-first GPT-5 workflows, and mul
15
19
 
16
20
  ## What You Get
17
21
 
18
- - Official ChatGPT OAuth login through OpenCode's auth flow
22
+ - OpenCode plugin support for ChatGPT Plus/Pro OAuth and Codex/GPT-5 coding workflows
19
23
  - Ready-to-use GPT-5.5, GPT-5.5 Fast, GPT-5.4 Mini, GPT-5.4 Nano, GPT-5.1, and Codex model templates
20
- - Compact modern OpenCode config with model variants, plus legacy explicit selector IDs when needed
24
+ - Compact modern OpenCode config with variant-based selectors, plus explicit legacy selector IDs when needed
21
25
  - Stateless Codex-compatible request handling with `store: false` and `reasoning.encrypted_content`
22
- - Multi-account rotation with health-aware selection, cooldowns, and automatic token refresh
26
+ - Multi-account rotation with health-aware selection, cooldowns, automatic token refresh, and failover
27
+ - Explicit saved-account listing, account switching, labeling, tagging, notes, health checks, and diagnostics
23
28
  - Per-project account storage under `~/.opencode/projects/<project-key>/...`
24
- - Guided account setup, health, dashboard, export/import, keychain, and troubleshooting tools
29
+ - Guided setup, doctor, next-action, dashboard, export/import, keychain, and troubleshooting tools
25
30
  - Optional OS-native keychain backend for stored account pools
26
- - Request logging, metrics, and diagnostics for OpenCode integration debugging
27
- - Stable docs set for install, config, troubleshooting, privacy, and development architecture
31
+ - TUI prompt quota status and quota detail views for OpenCode sessions
32
+ - Request logging, runtime metrics, routing visibility, and redacted diagnostic snapshots for debugging
33
+ - Stable docs for install, configuration, troubleshooting, privacy, architecture, testing, and release history
34
+
35
+ ---
36
+
37
+ ## Why Developers Use It
38
+
39
+ `oc-codex-multi-auth` makes OpenCode's ChatGPT OAuth state understandable and operable. Instead of treating auth as one opaque provider file, you get a local account pool, deterministic account switching, health-aware request selection, visible quota status, JSON-friendly diagnostics, and safe repair commands for stale or damaged state. The plugin is designed for personal development workflows: credentials stay local, OpenCode keeps owning the host runtime, and the plugin only handles the OAuth-backed Codex routing layer it is installed for.
40
+
41
+ ---
42
+
43
+ ## Current Architecture At A Glance
44
+
45
+ `oc-codex-multi-auth` ships four user-visible surfaces:
46
+
47
+ | Surface | Purpose |
48
+ | --- | --- |
49
+ | `oc-codex-multi-auth` | npm installer bin; updates `~/.config/opencode/opencode.json`, manages `tui.json`, normalizes stale plugin entries, and clears OpenCode plugin cache |
50
+ | OpenCode plugin entry (`index.ts`) | auth loader, OAuth login modes, provider fetch pipeline, account rotation, retry/failover, and `codex-*` tool registry |
51
+ | OpenCode TUI plugin (`tui.ts`) | prompt quota status, quota details, shared quota cache, and active-account-aware display |
52
+ | 21 `codex-*` tools | setup, help, status, list, switch, limits, health, metrics, doctor, dashboard, backup, keychain, diagnostics, and recovery actions |
53
+
54
+ The plugin does not replace OpenCode. OpenCode remains the host; this package installs provider/TUI config and supplies the OAuth-backed Codex request pipeline that OpenCode calls.
28
55
 
29
56
  ---
30
57
 
@@ -71,7 +98,7 @@ opencode debug config
71
98
  opencode auth login
72
99
  ```
73
100
 
74
- The installer updates `~/.config/opencode/opencode.json`, backs up the previous config, normalizes the plugin entry to `"oc-codex-multi-auth"`, and clears the OpenCode cached plugin copy so OpenCode reinstalls the latest package.
101
+ The installer updates `~/.config/opencode/opencode.json`, backs up the previous config, normalizes the plugin entry to `"oc-codex-multi-auth"`, enables the TUI status plugin in `~/.config/opencode/tui.json`, and clears the OpenCode cached plugin copy so OpenCode reinstalls the latest package.
75
102
 
76
103
  </details>
77
104
 
@@ -114,7 +141,7 @@ npx -y oc-codex-multi-auth@latest
114
141
  opencode auth login
115
142
  ```
116
143
 
117
- Run a prompt with the compact modern selectors:
144
+ Run a prompt with compact modern selectors:
118
145
 
119
146
  ```bash
120
147
  opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.5 --variant=medium
@@ -127,7 +154,7 @@ Use Codex-focused routing:
127
154
  opencode run "Refactor the retry logic and update the tests" --model=openai/gpt-5-codex --variant=high
128
155
  ```
129
156
 
130
- If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
157
+ If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#remote-or-headless-login).
131
158
 
132
159
  ---
133
160
 
@@ -168,7 +195,7 @@ If browser launch is blocked, use the alternate login paths in [docs/getting-sta
168
195
  | --- | --- |
169
196
  | `codex-health` | Which accounts look healthy, limited, or disabled? |
170
197
  | `codex-metrics` | What runtime counters and request metrics are visible? |
171
- | `codex-diag` | Can I export a diagnostic snapshot? |
198
+ | `codex-diag` | Can I export a redacted diagnostic snapshot? |
172
199
  | `codex-diff` | What changed between account/config snapshots? |
173
200
  | `codex-export` | How do I back up account storage? |
174
201
  | `codex-import` | How do I restore accounts with a dry-run first? |
@@ -181,7 +208,8 @@ If browser launch is blocked, use the alternate login paths in [docs/getting-sta
181
208
  - account rotation is health-aware and avoids repeatedly selecting cooling accounts
182
209
  - 5xx bursts, network failures, and quota responses penalize account health
183
210
  - token refresh is queued to avoid refresh races
184
- - unsupported-model fallback is strict by default, with opt-in fallback controls
211
+ - unsupported-model handling is strict by default, with opt-in fallback controls
212
+ - TUI quota status follows the account/workspace used by the latest request
185
213
 
186
214
  ---
187
215
 
@@ -190,6 +218,7 @@ If browser launch is blocked, use the alternate login paths in [docs/getting-sta
190
218
  | File | Default path |
191
219
  | --- | --- |
192
220
  | OpenCode config | `~/.config/opencode/opencode.json` |
221
+ | OpenCode TUI config | `~/.config/opencode/tui.json` |
193
222
  | OpenCode auth tokens | `~/.opencode/auth/openai.json` |
194
223
  | Plugin config | `~/.opencode/openai-codex-auth-config.json` |
195
224
  | Global account storage | `~/.opencode/oc-codex-multi-auth-accounts.json` |
@@ -197,6 +226,7 @@ If browser launch is blocked, use the alternate login paths in [docs/getting-sta
197
226
  | Flagged accounts | `~/.opencode/oc-codex-multi-auth-flagged-accounts.json` |
198
227
  | Backups | `~/.opencode/backups/` or `~/.opencode/projects/<project-key>/backups/` |
199
228
  | Logs | `~/.opencode/logs/codex-plugin/` |
229
+ | TUI quota cache | OpenCode state path plus `~/.opencode/oc-codex-multi-auth-tui-quota.json` fallback |
200
230
 
201
231
  Per-project storage is enabled by default. The plugin walks up from the current directory to find a project root, then stores account pools under the project-specific key. If no project root is found, it falls back to global storage.
202
232
 
@@ -205,7 +235,9 @@ Per-project storage is enabled by default. The plugin walks up from the current
205
235
  ## Configuration
206
236
 
207
237
  Primary config files:
238
+
208
239
  - `~/.config/opencode/opencode.json`
240
+ - `~/.config/opencode/tui.json`
209
241
  - `~/.opencode/openai-codex-auth-config.json`
210
242
 
211
243
  Selected runtime/environment overrides:
@@ -297,7 +329,7 @@ opencode auth login
297
329
  - Plugin does not load: rerun `npx -y oc-codex-multi-auth@latest`, then restart OpenCode
298
330
  - Config looks wrong: run `opencode debug config` and confirm `"plugin": ["oc-codex-multi-auth"]`
299
331
  - OAuth callback fails: free port `1455`, then rerun `opencode auth login`
300
- - Browser launch is blocked: use the device-code/manual login path from [docs/getting-started.md](docs/getting-started.md#alternate-login-paths)
332
+ - Browser launch is blocked: use the remote/headless login path from [docs/getting-started.md](docs/getting-started.md#remote-or-headless-login)
301
333
  - Wrong account is selected: run `codex-list`, then `codex-switch`
302
334
  - Account pool looks unhealthy: run `codex-health format="json"` and `codex-doctor deep=true format="json"`
303
335
  - Import/export feels risky: run `codex-import path="..." dryRun=true` before applying
@@ -333,15 +365,17 @@ codex-doctor deep=true format="json"
333
365
  - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
334
366
  - FAQ: [docs/faq.md](docs/faq.md)
335
367
  - Privacy: [docs/privacy.md](docs/privacy.md)
336
- - Architecture: [docs/development/ARCHITECTURE.md](docs/development/ARCHITECTURE.md)
368
+ - Public architecture: [docs/architecture.md](docs/architecture.md)
369
+ - Maintainer architecture: [docs/development/ARCHITECTURE.md](docs/development/ARCHITECTURE.md)
337
370
  - Testing: [docs/development/TESTING.md](docs/development/TESTING.md)
371
+ - Discoverability guide: [docs/development/GITHUB_DISCOVERABILITY.md](docs/development/GITHUB_DISCOVERABILITY.md)
338
372
  - Audit index: [docs/audits/INDEX.md](docs/audits/INDEX.md)
339
373
 
340
374
  ---
341
375
 
342
376
  ## Release Notes
343
377
 
344
- - Current package version: `6.1.7`
378
+ - Current package version: `6.1.8`
345
379
  - Changelog: [CHANGELOG.md](CHANGELOG.md)
346
380
  - Releases are automated with [release-please](https://github.com/googleapis/release-please)
347
381
 
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="oc-codex-multi-auth icon">
2
+ <rect width="512" height="512" rx="112" fill="#0b0f19"/>
3
+ <circle cx="168" cy="178" r="54" fill="#38bdf8" opacity=".95"/>
4
+ <circle cx="344" cy="178" r="54" fill="#a78bfa" opacity=".95"/>
5
+ <circle cx="256" cy="334" r="64" fill="#34d399" opacity=".95"/>
6
+ <path d="M206 205 256 282l50-77" fill="none" stroke="#f8fafc" stroke-width="34" stroke-linecap="round" stroke-linejoin="round" opacity=".92"/>
7
+ <path d="M144 334h224" fill="none" stroke="#f8fafc" stroke-width="28" stroke-linecap="round" opacity=".9"/>
8
+ </svg>
package/config/README.md CHANGED
@@ -75,17 +75,21 @@ A barebones debug template is available at [`minimal-opencode.json`](./minimal-o
75
75
 
76
76
  ## Unsupported-model behavior
77
77
 
78
- Current defaults are strict entitlement handling:
79
- - `unsupportedCodexPolicy: "strict"` returns entitlement errors directly
80
- - set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable automatic fallback retries
78
+ Current defaults are strict entitlement handling except for default public selectors that are commonly entitlement-gated:
79
+ - `gpt-5.5` and canonical `gpt-5-codex` can auto-fallback through `gpt-5.4`, `gpt-5.4-mini`, then `gpt-5.4-nano` when the backend reports the selected model is not supported for the active account/workspace
80
+ - `unsupportedCodexPolicy: "strict"` returns other entitlement errors directly
81
+ - set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable the full fallback chain for manual/legacy selectors
81
82
  - `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
82
- - `gpt-5.5 -> gpt-5.4` is included by default for accounts/workspaces that do not yet expose GPT-5.5
83
83
  - user-typed `gpt-5.5-pro*` is canonicalized to `gpt-5.5` before fallback because GPT-5.5 Pro is ChatGPT-only, not a Codex-routable model
84
+ - legacy Codex selectors such as `gpt-5.2-codex`, `gpt-5.3-codex`, and `gpt-5.3-codex-spark` normalize to canonical `gpt-5-codex`; if that canonical Codex model is gated, the default auto-fallback can retry through the GPT-5.4 family
85
+ - set `CODEX_AUTH_DISABLE_GPT55_AUTO_FALLBACK=1` to disable GPT-5.5 auto-fallback
86
+ - set `CODEX_AUTH_DISABLE_CODEX_AUTO_FALLBACK=1` to disable canonical Codex/GPT-5.4-family auto-fallback
84
87
  - `gpt-5.4-pro -> gpt-5.4` remains available for older manual configs
85
88
  - `unsupportedCodexFallbackChain` lets you override fallback order per model
86
89
 
87
- Default fallback chain (when policy is `fallback`):
88
- - `gpt-5.5 -> gpt-5.4`
90
+ Default fallback chain (auto-fallback for `gpt-5.5`/`gpt-5-codex` through the GPT-5.4 family; full chain when policy is `fallback`):
91
+ - `gpt-5.5 -> gpt-5.4 -> gpt-5.4-mini -> gpt-5.4-nano`
92
+ - `gpt-5-codex -> gpt-5.4 -> gpt-5.4-mini -> gpt-5.4-nano`
89
93
  - `gpt-5.4-pro -> gpt-5.4` (if you manually select `gpt-5.4-pro`)
90
94
  - `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
91
95
  - `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (only relevant if Spark IDs are added manually)
package/dist/index.js CHANGED
@@ -1856,7 +1856,7 @@ export const OpenAIOAuthPlugin = async ({ client }) => {
1856
1856
  : waitMs > 0
1857
1857
  ? `All ${count} account(s) are rate-limited. Try again in ${waitLabel} or add another account with \`opencode auth login\`.`
1858
1858
  : wasEntitlementExhaustion
1859
- ? `All ${count} account(s) returned 'model not supported' for the requested model.${entitlementDetail} If this is a GPT-5.5 request during the rollout period, set \`unsupportedCodexPolicy: "fallback"\` (or \`CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback\`) to auto-fallback to gpt-5.4. See \`codex-health\` for per-account details.`
1859
+ ? `All ${count} account(s) returned 'model not supported' for the requested model.${entitlementDetail} Codex model access is account/workspace gated; default gpt-5.5/gpt-5-codex selectors auto-fallback through the GPT-5.4 family when possible. Set \`unsupportedCodexPolicy: "fallback"\` for the full manual fallback chain, or see \`codex-health\` for per-account details.`
1860
1860
  : `All ${count} account(s) failed (server errors or auth issues). Check account health with \`codex-health\`.`;
1861
1861
  runtimeMetrics.failedRequests++;
1862
1862
  runtimeMetrics.lastError = message;