oc-codex-multi-auth 6.1.7 → 6.1.9

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,209 +1,395 @@
1
- # oc-codex-multi-auth
1
+ # oc-codex-multi-auth: ChatGPT OAuth and multi-account Codex routing for OpenCode
2
2
 
3
- <!--
4
- Badges: CI + OpenSSF Scorecard will turn green once Phase 3 Batch A (CI workflow + Scorecard workflow) lands and runs its first job. Until then they may render as "no status" / 404 — that is expected and self-resolves automatically.
5
- -->
6
3
  [![npm version](https://img.shields.io/npm/v/oc-codex-multi-auth.svg)](https://www.npmjs.com/package/oc-codex-multi-auth)
7
4
  [![npm downloads](https://img.shields.io/npm/dw/oc-codex-multi-auth.svg)](https://www.npmjs.com/package/oc-codex-multi-auth)
8
- [![Node.js Version](https://img.shields.io/node/v/oc-codex-multi-auth.svg)](https://nodejs.org)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
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)
10
7
 
11
- <img width="1227" height="702" alt="cover" src="https://github.com/user-attachments/assets/b796eb2f-282e-468a-ba6a-acadf09d731b" />
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.
12
9
 
13
- Use your ChatGPT Plus/Pro subscription inside OpenCode with OAuth login, GPT-5/Codex model presets, and multi-account failover.
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.
14
11
 
15
- `oc-codex-multi-auth` is an OpenCode plugin for developers who want Codex-first GPT-5 workflows in OpenCode without switching to separate Platform API credentials for personal use. It uses the same official OAuth flow as the Codex CLI, adds model templates for current GPT-5 families, and can rotate across multiple ChatGPT accounts when one account is rate-limited or unavailable.
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" />
16
13
 
17
- ## What This Project Does
18
14
 
19
- - Adds an OpenCode plugin that authenticates with ChatGPT Plus/Pro through official OAuth
20
- - Ships ready-to-use GPT-5.5 OAuth model templates, variant picker presets, optional explicit selector IDs, `gpt-5-codex`, and related GPT-5 families
21
- - Routes requests through a stateless Codex-compatible request pipeline with automatic token refresh
22
- - Supports multi-account rotation, per-project account storage, and guided onboarding commands
23
15
 
24
- ## Quick Start
16
+ > [!NOTE]
17
+ > This package is the supported OpenCode plugin line.
18
+ > Older package names and config entries should be replaced with `oc-codex-multi-auth`.
19
+
20
+ ## What You Get
21
+
22
+ - OpenCode plugin support for ChatGPT Plus/Pro OAuth and Codex/GPT-5 coding workflows
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
24
+ - Compact modern OpenCode config with variant-based selectors, plus explicit legacy selector IDs when needed
25
+ - Stateless Codex-compatible request handling with `store: false` and `reasoning.encrypted_content`
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
28
+ - Per-project account storage under `~/.opencode/projects/<project-key>/...`
29
+ - Guided setup, doctor, next-action, dashboard, export/import, keychain, and troubleshooting tools
30
+ - Optional OS-native keychain backend for stored account pools
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.
55
+
56
+ ---
57
+
58
+ <details open>
59
+ <summary><b>Terms and Usage Notice</b></summary>
60
+
61
+ > [!CAUTION]
62
+ > This project is for personal development use with your own ChatGPT Plus/Pro subscription.
63
+ >
64
+ > By using this plugin, you acknowledge:
65
+ > - This is an independent open-source project, not an official OpenAI product
66
+ > - It is not intended for commercial resale, shared multi-user access, or production services
67
+ > - You are responsible for your own usage and policy compliance
68
+ > - For production/commercial workloads, use the OpenAI Platform API
69
+
70
+ </details>
71
+
72
+ ---
73
+
74
+ ## Installation
75
+
76
+ <details open>
77
+ <summary><b>For Humans</b></summary>
78
+
79
+ ### Option A: Standard install
25
80
 
26
81
  ```bash
27
- # 1. Install or refresh the plugin config
28
82
  npx -y oc-codex-multi-auth@latest
83
+ ```
84
+
85
+ ### Option B: Full explicit model catalog
29
86
 
30
- # 2. Sign in with ChatGPT Plus/Pro
87
+ Use this when you want direct selector IDs such as `openai/gpt-5.5-medium` in addition to OpenCode variants.
88
+
89
+ ```bash
90
+ npx -y oc-codex-multi-auth@latest --full
91
+ ```
92
+
93
+ ### Option C: Verify wiring
94
+
95
+ ```bash
96
+ opencode --version
97
+ opencode debug config
31
98
  opencode auth login
99
+ ```
100
+
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.
102
+
103
+ </details>
32
104
 
33
- # 3. Run a prompt in OpenCode
34
- opencode run "Explain this repository" --model=openai/gpt-5.5 --variant=medium
105
+ <details>
106
+ <summary><b>For LLM Agents</b></summary>
107
+
108
+ ### Step-by-step
109
+
110
+ 1. Install or refresh config:
111
+ - `npx -y oc-codex-multi-auth@latest`
112
+ 2. Run first login flow:
113
+ - `opencode auth login`
114
+ 3. Validate config:
115
+ - `opencode debug config`
116
+ 4. Run a smoke request:
117
+ - `opencode run "Explain this repository" --model=openai/gpt-5.5 --variant=medium`
118
+ 5. Inspect plugin state with the OpenCode tool surface:
119
+ - `codex-status`
120
+ - `codex-doctor`
121
+ - `codex-list`
122
+
123
+ ### Verification
124
+
125
+ ```bash
126
+ opencode debug config
127
+ opencode auth login
128
+ opencode run "ping" --model=openai/gpt-5.5 --variant=medium
35
129
  ```
36
130
 
37
- What the installer does:
131
+ </details>
38
132
 
39
- - writes `~/.config/opencode/opencode.json`
40
- - backs up an existing config before changing it
41
- - normalizes the plugin entry to `"oc-codex-multi-auth"`
42
- - clears the cached plugin copy so OpenCode reinstalls the latest package
133
+ ---
43
134
 
44
- After install, the plugin checks npm once per day. When a newer version exists, it clears its OpenCode-managed cached package on exit; restart OpenCode and the latest package is installed automatically. Disable this with `"autoUpdate": false` in `~/.opencode/openai-codex-auth-config.json` or `CODEX_AUTH_AUTO_UPDATE=0`.
135
+ ## Quick Start
45
136
 
46
- By default, the installer writes the compact UI config:
47
- - model picker entries stay on actual OAuth model families such as `gpt-5.5` and `gpt-5.5-fast`
48
- - reasoning presets are selected through OpenCode's model variant picker (`none`, `low`, `medium`, `high`, `xhigh`)
49
- - rerunning the default installer removes explicit preset entries and stale base models from earlier plugin catalogs
137
+ Install and sign in:
50
138
 
51
- If you prefer direct model IDs such as `openai/gpt-5.5-medium` or `openai/gpt-5.5-fast-medium`, install with `--full`.
139
+ ```bash
140
+ npx -y oc-codex-multi-auth@latest
141
+ opencode auth login
142
+ ```
52
143
 
53
- ## Example Usage
144
+ Run a prompt with compact modern selectors:
54
145
 
55
146
  ```bash
56
- # General GPT-5 workflow
57
147
  opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.5 --variant=medium
58
148
  opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.5-fast --variant=medium
149
+ ```
59
150
 
60
- # Codex-focused workflow
151
+ Use Codex-focused routing:
152
+
153
+ ```bash
61
154
  opencode run "Refactor the retry logic and update the tests" --model=openai/gpt-5-codex --variant=high
62
155
  ```
63
156
 
64
- ## Usage Notice
157
+ If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#remote-or-headless-login).
65
158
 
66
- > [!CAUTION]
67
- > This project is for personal development use with your own ChatGPT Plus/Pro subscription.
68
- >
69
- > - It is not intended for commercial resale, shared multi-user access, or production services.
70
- > - It uses official OAuth authentication, but it is an independent open-source project and is not affiliated with OpenAI.
71
- > - For production applications, use the [OpenAI Platform API](https://platform.openai.com/).
72
- > - You are responsible for complying with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/).
159
+ ---
73
160
 
74
- ## Why This Exists
161
+ ## Command Toolkit
75
162
 
76
- OpenCode users often want the same GPT-5 and Codex model experience they use in ChatGPT, but inside a local terminal workflow. This plugin exists to bridge that gap cleanly:
163
+ ### Start here
77
164
 
78
- - official OAuth instead of scraped cookies or unofficial auth flows
79
- - OpenCode-ready model definitions instead of hand-rolled config every time
80
- - account rotation and recovery features for people who work across multiple ChatGPT accounts or workspaces
165
+ | Tool | What it answers |
166
+ | --- | --- |
167
+ | `codex-setup` | How do I finish first-run setup safely? |
168
+ | `codex-help` | Which plugin commands exist and what do they do? |
169
+ | `codex-doctor` | What is wrong with auth, config, storage, or routing? |
170
+ | `codex-next` | What should I do next to get unstuck? |
81
171
 
82
- ## Features
172
+ ### Daily use
83
173
 
84
- - Official OAuth login flow compatible with ChatGPT Plus/Pro access
85
- - GPT-5 and Codex model templates for modern and legacy OpenCode versions
86
- - Multi-account rotation with health-aware failover
87
- - Per-project account storage support
88
- - Beginner-focused commands such as `codex-setup`, `codex-help`, `codex-doctor`, and `codex-next`
89
- - Interactive account switching, labeling, tagging, and backup/import commands
90
- - Stateless request handling with `reasoning.encrypted_content` for multi-turn sessions
91
- - Daily npm update detection with OpenCode cache refresh on restart
92
- - Request logging and troubleshooting hooks for debugging OpenCode integration issues
174
+ | Tool | What it answers |
175
+ | --- | --- |
176
+ | `codex-list` | Which accounts are saved and which one is active? |
177
+ | `codex-switch` | How do I move to a different saved account? |
178
+ | `codex-status` | Which account, model family, and routing state are active? |
179
+ | `codex-limits` | What quota or rate-limit state is visible now? |
180
+ | `codex-dashboard` | Can I manage accounts from one interactive surface? |
93
181
 
94
- ## Common Workflows
182
+ ### Account management
95
183
 
96
- - Personal coding sessions in OpenCode using `gpt-5.5` / `gpt-5.5-fast` with variants, or `gpt-5-codex`
97
- - Switching between personal and workspace-linked ChatGPT accounts
98
- - Keeping separate account pools per project or monorepo
99
- - Recovering from unsupported-model, auth, or rate-limit issues with guided commands
184
+ | Tool | What it answers |
185
+ | --- | --- |
186
+ | `codex-label` | How do I name an account? |
187
+ | `codex-tag` | How do I group accounts with tags? |
188
+ | `codex-note` | How do I attach a private note to an account? |
189
+ | `codex-remove` | How do I remove a saved account safely? |
190
+ | `codex-refresh` | How do I refresh or re-login an account? |
100
191
 
101
- ## How It Works
192
+ ### Diagnostics and backup
102
193
 
103
- The plugin sits between OpenCode and the ChatGPT-backed Codex workflow:
194
+ | Tool | What it answers |
195
+ | --- | --- |
196
+ | `codex-health` | Which accounts look healthy, limited, or disabled? |
197
+ | `codex-metrics` | What runtime counters and request metrics are visible? |
198
+ | `codex-diag` | Can I export a redacted diagnostic snapshot? |
199
+ | `codex-diff` | What changed between account/config snapshots? |
200
+ | `codex-export` | How do I back up account storage? |
201
+ | `codex-import` | How do I restore accounts with a dry-run first? |
202
+ | `codex-keychain` | Which credential backend is active and can I migrate it? |
104
203
 
105
- 1. OpenCode loads the plugin and sends model requests through the plugin fetch pipeline.
106
- 2. The plugin authenticates with ChatGPT OAuth and refreshes tokens when needed.
107
- 3. Requests are normalized for the Codex backend and sent with `store: false`.
108
- 4. The plugin chooses the best account/workspace candidate, retries intelligently, and preserves conversation continuity through encrypted reasoning state.
204
+ ### Reliability behavior
109
205
 
110
- See [Architecture](docs/development/ARCHITECTURE.md) for implementation details.
206
+ - stateless request handling forces `store: false`
207
+ - `reasoning.encrypted_content` is preserved for multi-turn continuity
208
+ - account rotation is health-aware and avoids repeatedly selecting cooling accounts
209
+ - 5xx bursts, network failures, and quota responses penalize account health
210
+ - token refresh is queued to avoid refresh races
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
111
213
 
112
- ## Installation
214
+ ---
113
215
 
114
- Use the quick-start path above for the fastest setup. For full setup, local development installs, legacy OpenCode support, and verification steps, see [Getting Started](docs/getting-started.md).
216
+ ## Storage Paths
115
217
 
116
- For direct selector IDs in scripts or older habits, use the full catalog:
218
+ | File | Default path |
219
+ | --- | --- |
220
+ | OpenCode config | `~/.config/opencode/opencode.json` |
221
+ | OpenCode TUI config | `~/.config/opencode/tui.json` |
222
+ | OpenCode auth tokens | `~/.opencode/auth/openai.json` |
223
+ | Plugin config | `~/.opencode/openai-codex-auth-config.json` |
224
+ | Global account storage | `~/.opencode/oc-codex-multi-auth-accounts.json` |
225
+ | Per-project accounts | `~/.opencode/projects/<project-key>/oc-codex-multi-auth-accounts.json` |
226
+ | Flagged accounts | `~/.opencode/oc-codex-multi-auth-flagged-accounts.json` |
227
+ | Backups | `~/.opencode/backups/` or `~/.opencode/projects/<project-key>/backups/` |
228
+ | Logs | `~/.opencode/logs/codex-plugin/` |
229
+ | TUI quota cache | OpenCode state path plus `~/.opencode/oc-codex-multi-auth-tui-quota.json` fallback |
117
230
 
118
- ```bash
119
- npx -y oc-codex-multi-auth@latest --full
120
- ```
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.
232
+
233
+ ---
121
234
 
122
235
  ## Configuration
123
236
 
124
- Detailed configuration lives outside this README:
237
+ Primary config files:
238
+
239
+ - `~/.config/opencode/opencode.json`
240
+ - `~/.config/opencode/tui.json`
241
+ - `~/.opencode/openai-codex-auth-config.json`
242
+
243
+ Selected runtime/environment overrides:
244
+
245
+ | Variable | Effect |
246
+ | --- | --- |
247
+ | `CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy` | Re-enable legacy Codex request rewriting |
248
+ | `CODEX_MODE=0/1` | Disable/enable bridge prompt behavior |
249
+ | `CODEX_TUI_V2=0/1` | Disable/enable codex-style tool output |
250
+ | `CODEX_TUI_COLOR_PROFILE=truecolor|ansi256|ansi16` | Force terminal color profile |
251
+ | `CODEX_TUI_GLYPHS=ascii|unicode|auto` | Force terminal glyph style |
252
+ | `CODEX_AUTH_PER_PROJECT_ACCOUNTS=0/1` | Disable/enable per-project account pools |
253
+ | `CODEX_AUTH_AUTO_UPDATE=0/1` | Disable/enable daily npm update check and cache refresh |
254
+ | `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=strict|fallback` | Control unsupported-model retry behavior |
255
+ | `CODEX_AUTH_ACCOUNT_ID=<id>` | Force a specific workspace/account id |
256
+ | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
257
+ | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | SSE stream stall timeout override |
258
+ | `ENABLE_PLUGIN_REQUEST_LOGGING=1` | Enable request metadata logs |
259
+ | `CODEX_PLUGIN_LOG_BODIES=1` | Include raw request/response bodies in logs; sensitive |
260
+ | `CODEX_KEYCHAIN=1` | Opt in to OS-native keychain account storage |
261
+
262
+ Validate config after changes:
125
263
 
126
- - [Getting Started](docs/getting-started.md) for install and first-run setup
127
- - [Configuration Reference](docs/configuration.md) for config keys, env vars, and fallback behavior
128
- - [Config Templates](config/README.md) for modern vs legacy OpenCode examples
264
+ ```bash
265
+ opencode debug config
266
+ opencode run "test" --model=openai/gpt-5.5 --variant=medium
267
+ ```
268
+
269
+ Modern OpenCode versions use [config/opencode-modern.json](config/opencode-modern.json). Older versions can use [config/opencode-legacy.json](config/opencode-legacy.json). See [config/README.md](config/README.md) for the full model template matrix.
270
+
271
+ ---
129
272
 
130
273
  ## Credential Storage
131
274
 
132
- By default, this plugin stores OAuth refresh tokens as a V3 JSON file under the per-project path determined by `lib/storage/paths.ts`. File permissions are restricted (`0o600` on the file, `0o700` on containing directories) on platforms that honour them.
275
+ <details open>
276
+ <summary><b>Default JSON backend</b></summary>
133
277
 
134
- ### Optional: OS-native keychain
278
+ By default, account pools are stored locally as V3 JSON files. File permissions are restricted where the platform supports them.
135
279
 
136
- Set `CODEX_KEYCHAIN=1` in the environment to store credentials in the OS keychain instead:
280
+ Use JSON storage when you want predictable, inspectable local files and easy backup/export behavior.
137
281
 
138
- - **macOS**: Keychain
139
- - **Windows**: Credential Manager
140
- - **Linux**: libsecret (requires a running secret service such as GNOME Keyring or KWallet)
282
+ </details>
141
283
 
142
- The opt-in is strict: only the literal value `"1"` enables the keychain backend. Any other value (unset, `"0"`, `"false"`, `""`, `"yes"`, ...) leaves behavior identical to earlier releases. Existing users see zero change by default.
284
+ <details>
285
+ <summary><b>Optional OS keychain backend</b></summary>
143
286
 
144
- When enabled on an existing install, the plugin auto-migrates the JSON file into the keychain on the next credential write and renames the original as `accounts.json.migrated-to-keychain.<timestamp>` for rollback. The original is never deleted automatically.
287
+ Set `CODEX_KEYCHAIN=1` to store account pools in the OS keychain instead:
145
288
 
146
- Use the `codex-keychain` tool to inspect and manage the backend:
289
+ - macOS: Keychain
290
+ - Windows: Credential Manager
291
+ - Linux: libsecret, with a running secret service such as GNOME Keyring or KWallet
147
292
 
148
- ```bash
149
- codex-keychain status # which backend is active, is the keychain reachable
150
- codex-keychain migrate # force-migrate on-disk JSON to the keychain now
151
- codex-keychain rollback # restore the most recent .migrated-to-keychain.<ts> backup
293
+ Manage the backend from OpenCode:
294
+
295
+ ```text
296
+ codex-keychain status
297
+ codex-keychain migrate
298
+ codex-keychain rollback
152
299
  ```
153
300
 
154
- ### Keychain fallback
301
+ If the keychain is unavailable, the plugin logs a warning and falls back to JSON storage for that operation. Credentials are never silently deleted.
155
302
 
156
- If the OS keychain is unavailable (Linux without secret service, permission denied, locked session, missing native module), the plugin logs a clear warning and falls back to the JSON backend for that operation. Credentials are never silently lost.
303
+ </details>
157
304
 
158
- See [SECURITY.md](SECURITY.md#credential-storage-backends) for the threat model that applies to each backend.
305
+ ---
159
306
 
160
307
  ## Troubleshooting
161
308
 
162
- Start here if the plugin does not load or authenticate correctly:
309
+ <details open>
310
+ <summary><b>60-second recovery</b></summary>
163
311
 
164
- - [Troubleshooting](docs/troubleshooting.md)
165
- - [Privacy & Data Handling](docs/privacy.md)
166
- - [FAQ](docs/faq.md)
167
- - [Security Policy](SECURITY.md)
312
+ ```text
313
+ codex-doctor --fix
314
+ codex-next
315
+ codex-status format="json"
316
+ ```
168
317
 
169
- Common first checks:
318
+ If still broken:
170
319
 
171
- - confirm `"plugin": ["oc-codex-multi-auth"]` is present in your OpenCode config
320
+ ```bash
321
+ opencode auth login
322
+ ```
172
323
 
173
- ## 6.0.0 Cutover
324
+ </details>
325
+
326
+ <details>
327
+ <summary><b>Common symptoms</b></summary>
328
+
329
+ - Plugin does not load: rerun `npx -y oc-codex-multi-auth@latest`, then restart OpenCode
330
+ - Config looks wrong: run `opencode debug config` and confirm `"plugin": ["oc-codex-multi-auth"]`
331
+ - OAuth callback fails: free port `1455`, then rerun `opencode auth login`
332
+ - Browser launch is blocked: use the remote/headless login path from [docs/getting-started.md](docs/getting-started.md#remote-or-headless-login)
333
+ - Wrong account is selected: run `codex-list`, then `codex-switch`
334
+ - Account pool looks unhealthy: run `codex-health format="json"` and `codex-doctor deep=true format="json"`
335
+ - Import/export feels risky: run `codex-import path="..." dryRun=true` before applying
336
+ - Debugging model fallback: enable `ENABLE_PLUGIN_REQUEST_LOGGING=1` and inspect `~/.opencode/logs/codex-plugin/`
337
+
338
+ </details>
339
+
340
+ <details>
341
+ <summary><b>Diagnostics pack</b></summary>
342
+
343
+ ```text
344
+ codex-status format="json"
345
+ codex-limits format="json"
346
+ codex-health format="json"
347
+ codex-next format="json"
348
+ codex-list format="json"
349
+ codex-dashboard format="json"
350
+ codex-metrics format="json"
351
+ codex-doctor deep=true format="json"
352
+ ```
174
353
 
175
- This release intentionally breaks the old package line and moves the runtime to package-aligned storage names.
354
+ </details>
176
355
 
177
- - Rename the GitHub repository to `ndycode/oc-codex-multi-auth`
178
- - Publish `oc-codex-multi-auth@6.0.0`
179
- - Deprecate the legacy npm package with a pointer to the new package
180
- - Verify docs, badges, repo links, and OpenCode config examples all resolve to `oc-codex-multi-auth`
181
- - rerun `opencode auth login`
182
- - inspect `~/.opencode/logs/codex-plugin/` after running one request with `ENABLE_PLUGIN_REQUEST_LOGGING=1`
356
+ ---
183
357
 
184
- ## FAQ
358
+ ## Documentation
185
359
 
186
- Short answers for the most common questions live in [docs/faq.md](docs/faq.md), including:
360
+ - Docs portal: [docs/README.md](docs/README.md)
361
+ - Documentation map: [docs/DOCUMENTATION.md](docs/DOCUMENTATION.md)
362
+ - Getting started: [docs/getting-started.md](docs/getting-started.md)
363
+ - Configuration: [docs/configuration.md](docs/configuration.md)
364
+ - Config templates: [config/README.md](config/README.md)
365
+ - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
366
+ - FAQ: [docs/faq.md](docs/faq.md)
367
+ - Privacy: [docs/privacy.md](docs/privacy.md)
368
+ - Public architecture: [docs/architecture.md](docs/architecture.md)
369
+ - Maintainer architecture: [docs/development/ARCHITECTURE.md](docs/development/ARCHITECTURE.md)
370
+ - Testing: [docs/development/TESTING.md](docs/development/TESTING.md)
371
+ - Discoverability guide: [docs/development/GITHUB_DISCOVERABILITY.md](docs/development/GITHUB_DISCOVERABILITY.md)
372
+ - Audit index: [docs/audits/INDEX.md](docs/audits/INDEX.md)
187
373
 
188
- - who this plugin is for
189
- - which OpenCode versions it supports
190
- - how the modern and legacy config templates differ
191
- - when to use this plugin versus the OpenAI Platform API
374
+ ---
192
375
 
193
- ## Contributing
376
+ ## Release Notes
194
377
 
195
- Contributions are welcome if they keep the project accurate, maintainable, and aligned with its personal-use scope.
378
+ - Current package version: `6.1.8`
379
+ - Changelog: [CHANGELOG.md](CHANGELOG.md)
380
+ - Releases are automated with [release-please](https://github.com/googleapis/release-please)
196
381
 
197
- - [Contributing Guide](CONTRIBUTING.md)
198
- - [Code of Conduct](CODE_OF_CONDUCT.md)
199
- - [Security Policy](SECURITY.md)
382
+ Merging the release-please PR cuts the tagged release and publishes the package through the configured release workflow. Manual `npm publish` is not required for routine releases.
200
383
 
201
- ## Releases
384
+ ## License
202
385
 
203
- Releases are automated via [release-please](https://github.com/googleapis/release-please). Conventional Commits landed on `main` drive version bumps and CHANGELOG entries; merging the open "Release candidate" PR cuts a tagged release. Manual `npm publish` is not required for routine releases.
386
+ MIT License. See [LICENSE](LICENSE).
204
387
 
205
- ## License
388
+ <details>
389
+ <summary><b>Legal</b></summary>
206
390
 
207
- MIT. See [LICENSE](LICENSE).
391
+ - Not affiliated with OpenAI.
392
+ - "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI.
393
+ - You assume responsibility for your own usage and compliance.
208
394
 
209
- ChatGPT, GPT-5, Codex, and OpenAI are trademarks of OpenAI, L.L.C.
395
+ </details>
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)
@@ -5,7 +5,8 @@
5
5
  "provider": {
6
6
  "openai": {
7
7
  "options": {
8
- "store": false
8
+ "store": false,
9
+ "include": ["reasoning.encrypted_content"]
9
10
  }
10
11
  }
11
12
  },
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;