opencode-openai-codex-auth-multi 4.3.0-multiaccount.1 → 4.3.1

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.
Files changed (70) hide show
  1. package/LICENSE +37 -37
  2. package/README.md +461 -79
  3. package/assets/opencode-logo-ornate-dark.svg +18 -18
  4. package/assets/readme-hero.svg +31 -31
  5. package/config/README.md +98 -98
  6. package/config/minimal-opencode.json +11 -11
  7. package/config/opencode-legacy.json +568 -568
  8. package/config/opencode-modern.json +236 -236
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +368 -133
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/accounts.d.ts +78 -11
  14. package/dist/lib/accounts.d.ts.map +1 -1
  15. package/dist/lib/accounts.js +303 -66
  16. package/dist/lib/accounts.js.map +1 -1
  17. package/dist/lib/auth/auth.d.ts.map +1 -1
  18. package/dist/lib/auth/auth.js +19 -12
  19. package/dist/lib/auth/auth.js.map +1 -1
  20. package/dist/lib/auth/browser.d.ts.map +1 -1
  21. package/dist/lib/auth/browser.js +9 -2
  22. package/dist/lib/auth/browser.js.map +1 -1
  23. package/dist/lib/auth/server.d.ts.map +1 -1
  24. package/dist/lib/auth/server.js +11 -4
  25. package/dist/lib/auth/server.js.map +1 -1
  26. package/dist/lib/cli.d.ts +1 -0
  27. package/dist/lib/cli.d.ts.map +1 -1
  28. package/dist/lib/cli.js +10 -6
  29. package/dist/lib/cli.js.map +1 -1
  30. package/dist/lib/config.d.ts +5 -7
  31. package/dist/lib/config.d.ts.map +1 -1
  32. package/dist/lib/config.js +49 -6
  33. package/dist/lib/config.js.map +1 -1
  34. package/dist/lib/constants.d.ts +7 -0
  35. package/dist/lib/constants.d.ts.map +1 -1
  36. package/dist/lib/constants.js +7 -0
  37. package/dist/lib/constants.js.map +1 -1
  38. package/dist/lib/index.d.ts +13 -0
  39. package/dist/lib/index.d.ts.map +1 -0
  40. package/dist/lib/index.js +13 -0
  41. package/dist/lib/index.js.map +1 -0
  42. package/dist/lib/oauth-success.html +712 -712
  43. package/dist/lib/prompts/codex-opencode-bridge.js +121 -121
  44. package/dist/lib/prompts/codex.d.ts +5 -0
  45. package/dist/lib/prompts/codex.d.ts.map +1 -1
  46. package/dist/lib/prompts/codex.js +114 -93
  47. package/dist/lib/prompts/codex.js.map +1 -1
  48. package/dist/lib/request/fetch-helpers.d.ts +2 -3
  49. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  50. package/dist/lib/request/fetch-helpers.js +24 -27
  51. package/dist/lib/request/fetch-helpers.js.map +1 -1
  52. package/dist/lib/request/rate-limit-backoff.d.ts +13 -0
  53. package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
  54. package/dist/lib/request/rate-limit-backoff.js +54 -0
  55. package/dist/lib/request/rate-limit-backoff.js.map +1 -0
  56. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  57. package/dist/lib/request/request-transformer.js +3 -2
  58. package/dist/lib/request/request-transformer.js.map +1 -1
  59. package/dist/lib/request/response-handler.js +1 -1
  60. package/dist/lib/request/response-handler.js.map +1 -1
  61. package/dist/lib/storage.d.ts +72 -4
  62. package/dist/lib/storage.d.ts.map +1 -1
  63. package/dist/lib/storage.js +189 -19
  64. package/dist/lib/storage.js.map +1 -1
  65. package/dist/lib/types.d.ts +37 -1
  66. package/dist/lib/types.d.ts.map +1 -1
  67. package/package.json +85 -71
  68. package/scripts/install-opencode-codex-auth.js +191 -191
  69. package/scripts/test-all-models.sh +258 -258
  70. package/scripts/validate-model-map.sh +97 -97
package/LICENSE CHANGED
@@ -1,37 +1,37 @@
1
- MIT License with Usage Disclaimer
2
-
3
- Copyright (c) 2024-2025 numman-ali
4
-
5
- USAGE NOTICE AND DISCLAIMER:
6
- This software is provided for personal development use only. Users must comply
7
- with OpenAI's Terms of Service (https://openai.com/policies/terms-of-use/) and
8
- Usage Policies (https://openai.com/policies/usage-policies/) when using this
9
- software to access OpenAI services.
10
-
11
- The authors and contributors are not responsible for any violations of
12
- third-party terms of service. For commercial use or production applications,
13
- obtain proper API access from OpenAI directly through the OpenAI Platform
14
- (https://platform.openai.com/).
15
-
16
- This software uses OpenAI's official OAuth authentication system and is not
17
- affiliated with, endorsed by, or sponsored by OpenAI.
18
-
19
- ---
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice, usage notice, and this permission notice shall be
29
- included in all copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
1
+ MIT License with Usage Disclaimer
2
+
3
+ Copyright (c) 2024-2025 numman-ali
4
+
5
+ USAGE NOTICE AND DISCLAIMER:
6
+ This software is provided for personal development use only. Users must comply
7
+ with OpenAI's Terms of Service (https://openai.com/policies/terms-of-use/) and
8
+ Usage Policies (https://openai.com/policies/usage-policies/) when using this
9
+ software to access OpenAI services.
10
+
11
+ The authors and contributors are not responsible for any violations of
12
+ third-party terms of service. For commercial use or production applications,
13
+ obtain proper API access from OpenAI directly through the OpenAI Platform
14
+ (https://platform.openai.com/).
15
+
16
+ This software uses OpenAI's official OAuth authentication system and is not
17
+ affiliated with, endorsed by, or sponsored by OpenAI.
18
+
19
+ ---
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice, usage notice, and this permission notice shall be
29
+ included in all copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
package/README.md CHANGED
@@ -1,107 +1,489 @@
1
- ![Image 1: opencode-openai-codex-auth-multi](assets/readme-hero.svg)
2
-
3
-
4
- **Forked from [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) (by [Numman Ali](https://x.com/nummanali))**
5
- **Maintained by [ndycode](https://github.com/ndycode)**
6
-
7
- [![Twitter Follow](https://img.shields.io/twitter/follow/nummanali?style=social)](https://x.com/nummanali)
8
- [![npm version](https://img.shields.io/npm/v/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
9
- [![Tests](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions)
10
- [![npm downloads](https://img.shields.io/npm/dm/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
11
- **One install. Every Codex model.**
12
- [Install](#-quick-start) · [Models](#-models) · [Configuration](#-configuration) · [Docs](#-docs)
13
-
14
- ---
15
- ## 💡 Philosophy
16
- > **"One config. Every model."**
17
- OpenCode should feel effortless. This plugin keeps the setup minimal while giving you full GPT‑5.x + Codex access via ChatGPT OAuth.
18
- ```
19
- ┌─────────────────────────────────────────────────────────┐
20
- │ │
21
- │ ChatGPT OAuth → Codex backend → OpenCode │
22
- │ One command install, full model presets, done. │
23
- │ │
24
- └─────────────────────────────────────────────────────────┘
25
- ```
26
- ---
27
- ## 🚀 Quick Start
28
-
29
- ### Install from npm (recommended)
1
+ # OpenAI Codex Auth Plugin for OpenCode
2
+
3
+ [![npm version](https://img.shields.io/npm/v/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
4
+ [![npm downloads](https://img.shields.io/npm/dw/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
5
+ [![Tests](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+ [![X (Twitter)](https://img.shields.io/badge/X-@ndycode-000000?style=flat&logo=x)](https://x.com/ndycode)
8
+
9
+ Enable OpenCode to authenticate against **OpenAI's Codex backend** via OAuth so you can use ChatGPT Plus/Pro rate limits and access models like `gpt-5.2`, `gpt-5.2-codex`, and `gpt-5.1-codex-max` with your ChatGPT credentials.
10
+
11
+ ## What You Get
12
+
13
+ - **GPT-5.2, GPT-5.2 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
14
+ - **Multi-account support** — add multiple ChatGPT accounts, auto-rotates when rate-limited
15
+ - **22 model presets** — full variant system with reasoning levels (none/low/medium/high/xhigh)
16
+ - **Prompt caching** session-based caching for faster multi-turn conversations
17
+ - **Usage-aware errors** friendly messages with rate limit reset timing
18
+ - **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
19
+
20
+ ---
21
+
22
+ <details open>
23
+ <summary><b>Terms of Service Warning — Read Before Installing</b></summary>
24
+
25
+ > [!CAUTION]
26
+ > 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.
27
+ >
28
+ > **This plugin is for personal development only:**
29
+ > - Not for commercial services, API resale, or multi-user applications
30
+ > - For production use, see [OpenAI Platform API](https://platform.openai.com/)
31
+ >
32
+ > **By using this plugin, you acknowledge:**
33
+ > - This is an unofficial tool not endorsed by OpenAI
34
+ > - Users are responsible for compliance with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/)
35
+ > - You assume all risks associated with using this plugin
36
+
37
+ </details>
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ <details open>
44
+ <summary><b>For Humans</b></summary>
45
+
46
+ **Option A: Let an LLM do it**
47
+
48
+ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
49
+
50
+ ```
51
+ Install the opencode-openai-codex-auth-multi plugin and add the OpenAI model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/ndycode/opencode-openai-codex-auth-multi/main/README.md
52
+ ```
53
+
54
+ **Option B: One-command install**
30
55
 
31
56
  ```bash
32
57
  npx -y opencode-openai-codex-auth-multi@latest
33
58
  ```
34
59
 
35
- Legacy OpenCode (v1.0.209 and below):
60
+ This writes the config to `~/.config/opencode/opencode.json`, backs up existing config, and clears the plugin cache.
61
+
62
+ > Want legacy config (OpenCode v1.0.209 and below)? Add `--legacy` flag.
63
+
64
+ **Option C: Manual setup**
65
+
66
+ 1. **Add the plugin** to `~/.config/opencode/opencode.json`:
67
+
68
+ ```json
69
+ {
70
+ "plugin": ["opencode-openai-codex-auth-multi@latest"]
71
+ }
72
+ ```
73
+
74
+ 2. **Login** with your ChatGPT account:
75
+
76
+ ```bash
77
+ opencode auth login
78
+ ```
79
+
80
+ 3. **Add models** — copy the [full configuration](#models) below
81
+
82
+ 4. **Use it:**
83
+
84
+ ```bash
85
+ opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
86
+ ```
87
+
88
+ </details>
89
+
90
+ <details>
91
+ <summary><b>For LLM Agents</b></summary>
92
+
93
+ ### Step-by-Step Instructions
94
+
95
+ 1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
96
+
97
+ > **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
98
+
99
+ 2. Add the plugin to the `plugin` array:
100
+ ```json
101
+ {
102
+ "plugin": ["opencode-openai-codex-auth-multi@latest"]
103
+ }
104
+ ```
105
+
106
+ 3. Add the model definitions from the [Full models configuration](#full-models-configuration-copy-paste-ready) section
107
+
108
+ 4. Set `provider` to `"openai"` and choose a model
109
+
110
+ ### Verification
36
111
 
37
112
  ```bash
38
- npx -y opencode-openai-codex-auth-multi@latest --legacy
113
+ opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
39
114
  ```
40
115
 
41
- Then:
116
+ </details>
117
+
118
+ ---
119
+
120
+ ## Models
42
121
 
122
+ ### Model Reference
123
+
124
+ | Model | Variants | Notes |
125
+ |-------|----------|-------|
126
+ | `gpt-5.2` | none, low, medium, high, xhigh | Latest GPT-5.2 with reasoning levels |
127
+ | `gpt-5.2-codex` | low, medium, high, xhigh | GPT-5.2 Codex for code generation |
128
+ | `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |
129
+ | `gpt-5.1-codex` | low, medium, high | Standard Codex |
130
+ | `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |
131
+ | `gpt-5.1` | none, low, medium, high | GPT-5.1 base model |
132
+
133
+ **Using variants:**
43
134
  ```bash
44
135
  # Modern OpenCode (v1.0.210+)
45
- opencode auth login
46
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
136
+ opencode run "Hello" --model=openai/gpt-5.2 --variant=high
47
137
 
48
138
  # Legacy OpenCode (v1.0.209 and below)
49
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2-medium
139
+ opencode run "Hello" --model=openai/gpt-5.2-high
140
+ ```
141
+
142
+ <details>
143
+ <summary><b>Full models configuration (copy-paste ready)</b></summary>
144
+
145
+ Add this to your `~/.config/opencode/opencode.json`:
146
+
147
+ ```json
148
+ {
149
+ "$schema": "https://opencode.ai/config.json",
150
+ "plugin": ["opencode-openai-codex-auth-multi@latest"],
151
+ "provider": {
152
+ "openai": {
153
+ "options": {
154
+ "reasoningEffort": "medium",
155
+ "reasoningSummary": "auto",
156
+ "textVerbosity": "medium",
157
+ "include": ["reasoning.encrypted_content"],
158
+ "store": false
159
+ },
160
+ "models": {
161
+ "gpt-5.2": {
162
+ "name": "GPT 5.2 (OAuth)",
163
+ "limit": { "context": 272000, "output": 128000 },
164
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
165
+ "variants": {
166
+ "none": { "reasoningEffort": "none" },
167
+ "low": { "reasoningEffort": "low" },
168
+ "medium": { "reasoningEffort": "medium" },
169
+ "high": { "reasoningEffort": "high" },
170
+ "xhigh": { "reasoningEffort": "xhigh" }
171
+ }
172
+ },
173
+ "gpt-5.2-codex": {
174
+ "name": "GPT 5.2 Codex (OAuth)",
175
+ "limit": { "context": 272000, "output": 128000 },
176
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
177
+ "variants": {
178
+ "low": { "reasoningEffort": "low" },
179
+ "medium": { "reasoningEffort": "medium" },
180
+ "high": { "reasoningEffort": "high" },
181
+ "xhigh": { "reasoningEffort": "xhigh" }
182
+ }
183
+ },
184
+ "gpt-5.1-codex-max": {
185
+ "name": "GPT 5.1 Codex Max (OAuth)",
186
+ "limit": { "context": 272000, "output": 128000 },
187
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
188
+ "variants": {
189
+ "low": { "reasoningEffort": "low" },
190
+ "medium": { "reasoningEffort": "medium" },
191
+ "high": { "reasoningEffort": "high" },
192
+ "xhigh": { "reasoningEffort": "xhigh" }
193
+ }
194
+ },
195
+ "gpt-5.1-codex": {
196
+ "name": "GPT 5.1 Codex (OAuth)",
197
+ "limit": { "context": 272000, "output": 128000 },
198
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
199
+ "variants": {
200
+ "low": { "reasoningEffort": "low" },
201
+ "medium": { "reasoningEffort": "medium" },
202
+ "high": { "reasoningEffort": "high" }
203
+ }
204
+ },
205
+ "gpt-5.1-codex-mini": {
206
+ "name": "GPT 5.1 Codex Mini (OAuth)",
207
+ "limit": { "context": 272000, "output": 128000 },
208
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
209
+ "variants": {
210
+ "medium": { "reasoningEffort": "medium" },
211
+ "high": { "reasoningEffort": "high" }
212
+ }
213
+ },
214
+ "gpt-5.1": {
215
+ "name": "GPT 5.1 (OAuth)",
216
+ "limit": { "context": 272000, "output": 128000 },
217
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
218
+ "variants": {
219
+ "none": { "reasoningEffort": "none" },
220
+ "low": { "reasoningEffort": "low" },
221
+ "medium": { "reasoningEffort": "medium" },
222
+ "high": { "reasoningEffort": "high" }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ For legacy OpenCode (v1.0.209 and below), use `config/opencode-legacy.json` which has individual model entries like `gpt-5.2-low`, `gpt-5.2-medium`, etc.
232
+
233
+ </details>
234
+
235
+ ---
236
+
237
+ ## Multi-Account Setup
238
+
239
+ Add multiple ChatGPT accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
240
+
241
+ ```bash
242
+ opencode auth login # Run again to add more accounts
50
243
  ```
51
244
 
52
- ### Install from source (optional)
245
+ **Manage accounts:**
246
+ - `openai-accounts` — List all accounts
247
+ - `openai-accounts-switch` — Switch active account
248
+ - `openai-accounts-status` — Show rate limit status
249
+
250
+ **Storage:** `~/.opencode/openai-codex-accounts.json`
251
+
252
+ ---
253
+
254
+ ## Troubleshoot
255
+
256
+ > **Quick Reset**: Most issues can be resolved by deleting `~/.opencode/auth/openai.json` and running `opencode auth login` again.
257
+
258
+ ### Configuration Path (All Platforms)
259
+
260
+ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
261
+
262
+ | File | Path |
263
+ |------|------|
264
+ | Main config | `~/.config/opencode/opencode.json` |
265
+ | Auth tokens | `~/.opencode/auth/openai.json` |
266
+ | Multi-account | `~/.opencode/openai-codex-accounts.json` |
267
+ | Plugin config | `~/.opencode/openai-codex-auth-config.json` |
268
+ | Debug logs | `~/.opencode/logs/codex-plugin/` |
269
+
270
+ > **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
271
+
272
+ ---
273
+
274
+ <details>
275
+ <summary><b>401 Unauthorized Error</b></summary>
276
+
277
+ **Cause:** Token expired or not authenticated.
278
+
279
+ **Solutions:**
280
+ 1. Re-authenticate:
281
+ ```bash
282
+ opencode auth login
283
+ ```
284
+ 2. Check auth file exists:
285
+ ```bash
286
+ cat ~/.opencode/auth/openai.json
287
+ ```
288
+
289
+ </details>
290
+
291
+ <details>
292
+ <summary><b>Browser Doesn't Open for OAuth</b></summary>
293
+
294
+ **Cause:** Port 1455 conflict or SSH/WSL environment.
295
+
296
+ **Solutions:**
297
+ 1. **Manual URL paste:**
298
+ - Re-run `opencode auth login`
299
+ - Select **"ChatGPT Plus/Pro (Manual URL Paste)"**
300
+ - Paste the full redirect URL after login
301
+
302
+ 2. **Check port availability:**
303
+ ```bash
304
+ # macOS/Linux
305
+ lsof -i :1455
306
+
307
+ # Windows
308
+ netstat -ano | findstr :1455
309
+ ```
310
+
311
+ 3. **Stop Codex CLI if running** — both use port 1455
312
+
313
+ </details>
314
+
315
+ <details>
316
+ <summary><b>Model Not Found</b></summary>
317
+
318
+ **Cause:** Missing provider prefix or config mismatch.
319
+
320
+ **Solutions:**
321
+ 1. Use `openai/` prefix:
322
+ ```bash
323
+ # Correct
324
+ --model=openai/gpt-5.2
325
+
326
+ # Wrong
327
+ --model=gpt-5.2
328
+ ```
329
+
330
+ 2. Verify model is in your config:
331
+ ```json
332
+ { "models": { "gpt-5.2": { ... } } }
333
+ ```
334
+
335
+ </details>
336
+
337
+ <details>
338
+ <summary><b>Rate Limit Exceeded</b></summary>
339
+
340
+ **Cause:** ChatGPT subscription usage limit reached.
53
341
 
342
+ **Solutions:**
343
+ 1. Wait for reset (plugin shows timing in error message)
344
+ 2. Add more accounts: `opencode auth login`
345
+ 3. Switch to a different model family
346
+
347
+ </details>
348
+
349
+ <details>
350
+ <summary><b>Multi-Turn Context Lost</b></summary>
351
+
352
+ **Cause:** Old plugin version or missing config.
353
+
354
+ **Solutions:**
355
+ 1. Update plugin:
356
+ ```bash
357
+ npx -y opencode-openai-codex-auth-multi@latest
358
+ ```
359
+ 2. Ensure config has:
360
+ ```json
361
+ {
362
+ "include": ["reasoning.encrypted_content"],
363
+ "store": false
364
+ }
365
+ ```
366
+
367
+ </details>
368
+
369
+ <details>
370
+ <summary><b>OAuth Callback Issues (Safari/WSL/Docker)</b></summary>
371
+
372
+ **Safari HTTPS-Only Mode:**
373
+ - Use Chrome or Firefox instead, or
374
+ - Temporarily disable Safari > Settings > Privacy > "Enable HTTPS-Only Mode"
375
+
376
+ **WSL2:**
377
+ - Use VS Code's port forwarding, or
378
+ - Configure Windows → WSL port forwarding
379
+
380
+ **SSH / Remote:**
54
381
  ```bash
55
- git clone https://github.com/ndycode/opencode-openai-codex-auth-multi.git
56
- cd opencode-openai-codex-auth-multi
57
- npm ci
58
- npm run build
382
+ ssh -L 1455:localhost:1455 user@remote
383
+ ```
384
+
385
+ **Docker / Containers:**
386
+ - OAuth with localhost redirect doesn't work in containers
387
+ - Use SSH port forwarding or manual URL flow
388
+
389
+ </details>
390
+
391
+ ---
392
+
393
+ ## Plugin Compatibility
394
+
395
+ ### oh-my-opencode
396
+
397
+ Works alongside oh-my-opencode. No special configuration needed.
398
+
399
+ ```json
400
+ {
401
+ "plugin": [
402
+ "opencode-openai-codex-auth-multi@latest",
403
+ "oh-my-opencode@latest"
404
+ ]
405
+ }
59
406
  ```
60
407
 
61
- Point OpenCode at the local build output (replace with your absolute path):
408
+ ### @tarquinen/opencode-dcp
409
+
410
+ List this plugin BEFORE DCP:
62
411
 
63
412
  ```json
64
413
  {
65
- "plugin": ["file:///absolute/path/to/opencode-openai-codex-auth-multi/dist"]
414
+ "plugin": [
415
+ "opencode-openai-codex-auth-multi@latest",
416
+ "@tarquinen/opencode-dcp@latest"
417
+ ]
66
418
  }
67
419
  ```
68
420
 
69
- ---
70
- ## 📦 Models
71
- - **gpt-5.2** (none/low/medium/high/xhigh)
72
- - **gpt-5.2-codex** (low/medium/high/xhigh)
73
- - **gpt-5.1-codex-max** (low/medium/high/xhigh)
74
- - **gpt-5.1-codex** (low/medium/high)
75
- - **gpt-5.1-codex-mini** (medium/high)
76
- - **gpt-5.1** (none/low/medium/high)
77
- ---
78
- ## 🧩 Configuration
79
- - Modern (OpenCode v1.0.210+): `config/opencode-modern.json`
80
- - Legacy (OpenCode v1.0.209 and below): `config/opencode-legacy.json`
81
-
82
- Minimal configs are not recommended for GPT–5.x/Codex; use the full configs above. For advanced/debug use only, see `config/minimal-opencode.json`.
421
+ ### Plugins you don't need
422
+
423
+ - **openai-codex-auth** — Not needed. This plugin replaces the original.
424
+
425
+ ---
426
+
427
+ ## Configuration
428
+
429
+ Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
430
+
431
+ ### Model Behavior
432
+
433
+ | Option | Default | What it does |
434
+ |--------|---------|--------------|
435
+ | `codexMode` | `true` | Uses Codex-OpenCode bridge prompt (synced with latest Codex CLI) |
436
+
437
+ ### Environment Variables
438
+
439
+ ```bash
440
+ DEBUG_CODEX_PLUGIN=1 opencode # Enable debug logging
441
+ ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode # Log all API requests
442
+ CODEX_MODE=0 opencode # Temporarily disable bridge prompt
443
+ ```
444
+
445
+ For all options, see [docs/configuration.md](docs/configuration.md).
446
+
83
447
  ---
84
- ## Multi-account
85
- - Add multiple accounts by running `opencode auth login` and choosing add more accounts.
86
- - Auto-rotation kicks in on rate limits.
87
- - Manage accounts with `openai-accounts`, `openai-accounts-switch`, and `openai-accounts-status`.
88
- - Storage: `~/.opencode/openai-codex-accounts.json`
448
+
449
+ ## Documentation
450
+
451
+ - [Getting Started](docs/getting-started.md) Complete installation guide
452
+ - [Configuration](docs/configuration.md) — All configuration options
453
+ - [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
454
+ - [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
455
+
89
456
  ---
90
- ## ✅ Features
91
- - ChatGPT Plus/Pro OAuth authentication (official flow)
92
- - 22 model presets across GPT–5.2 / GPT–5.2 Codex / GPT–5.1 families
93
- - Variant system support (v1.0.210+) + legacy presets
94
- - Multimodal input enabled for all models
95
- - Usage–aware errors + automatic token refresh
96
- ---
97
- ## 📚 Docs
98
- - Getting Started: `docs/getting-started.md`
99
- - Configuration: `docs/configuration.md`
100
- - Troubleshooting: `docs/troubleshooting.md`
101
- - Architecture: `docs/development/ARCHITECTURE.md`
102
- ---
103
- ## ⚠️ Usage Notice
104
- This plugin is for **personal development use** with your own ChatGPT Plus/Pro subscription.
105
- For production or multi‑user applications, use the OpenAI Platform API.
106
-
107
- **Built for developers who value simplicity.**
457
+
458
+ ## Credits
459
+
460
+ - [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) by [@nummanali](https://x.com/nummanali) Original plugin
461
+ - [ndycode](https://github.com/ndycode) Multi-account support and maintenance
462
+
463
+ ## License
464
+
465
+ MIT License. See [LICENSE](LICENSE) for details.
466
+
467
+ <details>
468
+ <summary><b>Legal</b></summary>
469
+
470
+ ### Intended Use
471
+
472
+ - Personal / internal development only
473
+ - Respect subscription quotas and data handling policies
474
+ - Not for production services or bypassing intended limits
475
+
476
+ ### Warning
477
+
478
+ By using this plugin, you acknowledge:
479
+
480
+ - **Terms of Service risk** — This approach may violate ToS of AI model providers
481
+ - **No guarantees** — APIs may change without notice
482
+ - **Assumption of risk** — You assume all legal, financial, and technical risks
483
+
484
+ ### Disclaimer
485
+
486
+ - Not affiliated with OpenAI. This is an independent open-source project.
487
+ - "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI, L.L.C.
488
+
489
+ </details>