opencode-openai-codex-auth-multi 4.7.0 → 4.8.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.
- package/README.md +504 -504
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -10
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +3 -5
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +12 -5
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/auth/auth.d.ts.map +1 -1
- package/dist/lib/auth/auth.js +4 -0
- package/dist/lib/auth/auth.js.map +1 -1
- package/dist/lib/constants.d.ts +4 -4
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +4 -4
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/request/fetch-helpers.js +1 -1
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,504 +1,504 @@
|
|
|
1
|
-
# OpenAI Codex Auth Plugin for OpenCode
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
|
|
4
|
-
[](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
|
|
5
|
-
[](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
|
|
8
|
-
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.
|
|
9
|
-
|
|
10
|
-
## What You Get
|
|
11
|
-
|
|
12
|
-
- **GPT-5.2, GPT-5.2 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
|
|
13
|
-
- **Multi-account support** — add multiple ChatGPT accounts, health-aware rotation with automatic failover
|
|
14
|
-
- **Auto-update notifications** — get notified when a new version is available
|
|
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**
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx -y opencode-openai-codex-auth-multi@latest
|
|
58
|
-
```
|
|
59
|
-
|
|
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
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
</details>
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Models
|
|
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:**
|
|
134
|
-
```bash
|
|
135
|
-
# Modern OpenCode (v1.0.210+)
|
|
136
|
-
opencode run "Hello" --model=openai/gpt-5.2 --variant=high
|
|
137
|
-
|
|
138
|
-
# Legacy OpenCode (v1.0.209 and below)
|
|
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 uses **health-aware rotation** with automatic failover.
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
opencode auth login # Run again to add more accounts
|
|
243
|
-
```
|
|
244
|
-
|
|
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
|
-
**How rotation works (v4.4.0+):**
|
|
251
|
-
- Health scoring tracks success/failure per account
|
|
252
|
-
- Token bucket prevents hitting rate limits
|
|
253
|
-
- Hybrid selection prefers healthy accounts with available tokens
|
|
254
|
-
- Always retries when all accounts are rate-limited (waits for reset)
|
|
255
|
-
|
|
256
|
-
**Storage:** `~/.opencode/openai-codex-accounts.json`
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## Troubleshoot
|
|
261
|
-
|
|
262
|
-
> **Quick Reset**: Most issues can be resolved by deleting `~/.opencode/auth/openai.json` and running `opencode auth login` again.
|
|
263
|
-
|
|
264
|
-
### Configuration Path (All Platforms)
|
|
265
|
-
|
|
266
|
-
OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
267
|
-
|
|
268
|
-
| File | Path |
|
|
269
|
-
|------|------|
|
|
270
|
-
| Main config | `~/.config/opencode/opencode.json` |
|
|
271
|
-
| Auth tokens | `~/.opencode/auth/openai.json` |
|
|
272
|
-
| Multi-account | `~/.opencode/openai-codex-accounts.json` |
|
|
273
|
-
| Plugin config | `~/.opencode/openai-codex-auth-config.json` |
|
|
274
|
-
| Debug logs | `~/.opencode/logs/codex-plugin/` |
|
|
275
|
-
|
|
276
|
-
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
<details>
|
|
281
|
-
<summary><b>401 Unauthorized Error</b></summary>
|
|
282
|
-
|
|
283
|
-
**Cause:** Token expired or not authenticated.
|
|
284
|
-
|
|
285
|
-
**Solutions:**
|
|
286
|
-
1. Re-authenticate:
|
|
287
|
-
```bash
|
|
288
|
-
opencode auth login
|
|
289
|
-
```
|
|
290
|
-
2. Check auth file exists:
|
|
291
|
-
```bash
|
|
292
|
-
cat ~/.opencode/auth/openai.json
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
</details>
|
|
296
|
-
|
|
297
|
-
<details>
|
|
298
|
-
<summary><b>Browser Doesn't Open for OAuth</b></summary>
|
|
299
|
-
|
|
300
|
-
**Cause:** Port 1455 conflict or SSH/WSL environment.
|
|
301
|
-
|
|
302
|
-
**Solutions:**
|
|
303
|
-
1. **Manual URL paste:**
|
|
304
|
-
- Re-run `opencode auth login`
|
|
305
|
-
- Select **"ChatGPT Plus/Pro (Manual URL Paste)"**
|
|
306
|
-
- Paste the full redirect URL after login
|
|
307
|
-
|
|
308
|
-
2. **Check port availability:**
|
|
309
|
-
```bash
|
|
310
|
-
# macOS/Linux
|
|
311
|
-
lsof -i :1455
|
|
312
|
-
|
|
313
|
-
# Windows
|
|
314
|
-
netstat -ano | findstr :1455
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
3. **Stop Codex CLI if running** — both use port 1455
|
|
318
|
-
|
|
319
|
-
</details>
|
|
320
|
-
|
|
321
|
-
<details>
|
|
322
|
-
<summary><b>Model Not Found</b></summary>
|
|
323
|
-
|
|
324
|
-
**Cause:** Missing provider prefix or config mismatch.
|
|
325
|
-
|
|
326
|
-
**Solutions:**
|
|
327
|
-
1. Use `openai/` prefix:
|
|
328
|
-
```bash
|
|
329
|
-
# Correct
|
|
330
|
-
--model=openai/gpt-5.2
|
|
331
|
-
|
|
332
|
-
# Wrong
|
|
333
|
-
--model=gpt-5.2
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
2. Verify model is in your config:
|
|
337
|
-
```json
|
|
338
|
-
{ "models": { "gpt-5.2": { ... } } }
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
</details>
|
|
342
|
-
|
|
343
|
-
<details>
|
|
344
|
-
<summary><b>Rate Limit Exceeded</b></summary>
|
|
345
|
-
|
|
346
|
-
**Cause:** ChatGPT subscription usage limit reached.
|
|
347
|
-
|
|
348
|
-
**Solutions:**
|
|
349
|
-
1. Wait for reset (plugin shows timing in error message)
|
|
350
|
-
2. Add more accounts: `opencode auth login`
|
|
351
|
-
3. Switch to a different model family
|
|
352
|
-
|
|
353
|
-
</details>
|
|
354
|
-
|
|
355
|
-
<details>
|
|
356
|
-
<summary><b>Multi-Turn Context Lost</b></summary>
|
|
357
|
-
|
|
358
|
-
**Cause:** Old plugin version or missing config.
|
|
359
|
-
|
|
360
|
-
**Solutions:**
|
|
361
|
-
1. Update plugin:
|
|
362
|
-
```bash
|
|
363
|
-
npx -y opencode-openai-codex-auth-multi@latest
|
|
364
|
-
```
|
|
365
|
-
2. Ensure config has:
|
|
366
|
-
```json
|
|
367
|
-
{
|
|
368
|
-
"include": ["reasoning.encrypted_content"],
|
|
369
|
-
"store": false
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
</details>
|
|
374
|
-
|
|
375
|
-
<details>
|
|
376
|
-
<summary><b>OAuth Callback Issues (Safari/WSL/Docker)</b></summary>
|
|
377
|
-
|
|
378
|
-
**Safari HTTPS-Only Mode:**
|
|
379
|
-
- Use Chrome or Firefox instead, or
|
|
380
|
-
- Temporarily disable Safari > Settings > Privacy > "Enable HTTPS-Only Mode"
|
|
381
|
-
|
|
382
|
-
**WSL2:**
|
|
383
|
-
- Use VS Code's port forwarding, or
|
|
384
|
-
- Configure Windows → WSL port forwarding
|
|
385
|
-
|
|
386
|
-
**SSH / Remote:**
|
|
387
|
-
```bash
|
|
388
|
-
ssh -L 1455:localhost:1455 user@remote
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
**Docker / Containers:**
|
|
392
|
-
- OAuth with localhost redirect doesn't work in containers
|
|
393
|
-
- Use SSH port forwarding or manual URL flow
|
|
394
|
-
|
|
395
|
-
</details>
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
## Plugin Compatibility
|
|
400
|
-
|
|
401
|
-
### oh-my-opencode
|
|
402
|
-
|
|
403
|
-
Works alongside oh-my-opencode. No special configuration needed.
|
|
404
|
-
|
|
405
|
-
```json
|
|
406
|
-
{
|
|
407
|
-
"plugin": [
|
|
408
|
-
"opencode-openai-codex-auth-multi@latest",
|
|
409
|
-
"oh-my-opencode@latest"
|
|
410
|
-
]
|
|
411
|
-
}
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### @tarquinen/opencode-dcp
|
|
415
|
-
|
|
416
|
-
List this plugin BEFORE DCP:
|
|
417
|
-
|
|
418
|
-
```json
|
|
419
|
-
{
|
|
420
|
-
"plugin": [
|
|
421
|
-
"opencode-openai-codex-auth-multi@latest",
|
|
422
|
-
"@tarquinen/opencode-dcp@latest"
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Plugins you don't need
|
|
428
|
-
|
|
429
|
-
- **openai-codex-auth** — Not needed. This plugin replaces the original.
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
|
|
433
|
-
## Configuration
|
|
434
|
-
|
|
435
|
-
Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
|
|
436
|
-
|
|
437
|
-
### Model Behavior
|
|
438
|
-
|
|
439
|
-
| Option | Default | What it does |
|
|
440
|
-
|--------|---------|--------------|
|
|
441
|
-
| `codexMode` | `true` | Uses Codex-OpenCode bridge prompt (synced with latest Codex CLI) |
|
|
442
|
-
|
|
443
|
-
### Retry Behavior (v4.4.0+)
|
|
444
|
-
|
|
445
|
-
| Option | Default | What it does |
|
|
446
|
-
|--------|---------|--------------|
|
|
447
|
-
| `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |
|
|
448
|
-
| `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |
|
|
449
|
-
| `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |
|
|
450
|
-
|
|
451
|
-
### Environment Variables
|
|
452
|
-
|
|
453
|
-
```bash
|
|
454
|
-
DEBUG_CODEX_PLUGIN=1 opencode # Enable debug logging
|
|
455
|
-
ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode # Log all API requests
|
|
456
|
-
CODEX_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
|
|
457
|
-
CODEX_MODE=0 opencode # Temporarily disable bridge prompt
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
For all options, see [docs/configuration.md](docs/configuration.md).
|
|
461
|
-
|
|
462
|
-
---
|
|
463
|
-
|
|
464
|
-
## Documentation
|
|
465
|
-
|
|
466
|
-
- [Getting Started](docs/getting-started.md) — Complete installation guide
|
|
467
|
-
- [Configuration](docs/configuration.md) — All configuration options
|
|
468
|
-
- [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
|
|
469
|
-
- [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
## Credits
|
|
474
|
-
|
|
475
|
-
- [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) by [numman-ali](https://github.com/numman-ali) — Original plugin
|
|
476
|
-
- [ndycode](https://github.com/ndycode) — Multi-account support and maintenance
|
|
477
|
-
|
|
478
|
-
## License
|
|
479
|
-
|
|
480
|
-
MIT License. See [LICENSE](LICENSE) for details.
|
|
481
|
-
|
|
482
|
-
<details>
|
|
483
|
-
<summary><b>Legal</b></summary>
|
|
484
|
-
|
|
485
|
-
### Intended Use
|
|
486
|
-
|
|
487
|
-
- Personal / internal development only
|
|
488
|
-
- Respect subscription quotas and data handling policies
|
|
489
|
-
- Not for production services or bypassing intended limits
|
|
490
|
-
|
|
491
|
-
### Warning
|
|
492
|
-
|
|
493
|
-
By using this plugin, you acknowledge:
|
|
494
|
-
|
|
495
|
-
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
496
|
-
- **No guarantees** — APIs may change without notice
|
|
497
|
-
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
498
|
-
|
|
499
|
-
### Disclaimer
|
|
500
|
-
|
|
501
|
-
- Not affiliated with OpenAI. This is an independent open-source project.
|
|
502
|
-
- "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI, L.L.C.
|
|
503
|
-
|
|
504
|
-
</details>
|
|
1
|
+
# OpenAI Codex Auth Plugin for OpenCode
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
|
|
4
|
+
[](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)
|
|
5
|
+
[](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
## What You Get
|
|
11
|
+
|
|
12
|
+
- **GPT-5.2, GPT-5.2 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
|
|
13
|
+
- **Multi-account support** — add multiple ChatGPT accounts, health-aware rotation with automatic failover
|
|
14
|
+
- **Auto-update notifications** — get notified when a new version is available
|
|
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**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx -y opencode-openai-codex-auth-multi@latest
|
|
58
|
+
```
|
|
59
|
+
|
|
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
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Models
|
|
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:**
|
|
134
|
+
```bash
|
|
135
|
+
# Modern OpenCode (v1.0.210+)
|
|
136
|
+
opencode run "Hello" --model=openai/gpt-5.2 --variant=high
|
|
137
|
+
|
|
138
|
+
# Legacy OpenCode (v1.0.209 and below)
|
|
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 uses **health-aware rotation** with automatic failover.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
opencode auth login # Run again to add more accounts
|
|
243
|
+
```
|
|
244
|
+
|
|
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
|
+
**How rotation works (v4.4.0+):**
|
|
251
|
+
- Health scoring tracks success/failure per account
|
|
252
|
+
- Token bucket prevents hitting rate limits
|
|
253
|
+
- Hybrid selection prefers healthy accounts with available tokens
|
|
254
|
+
- Always retries when all accounts are rate-limited (waits for reset)
|
|
255
|
+
|
|
256
|
+
**Storage:** `~/.opencode/openai-codex-accounts.json`
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Troubleshoot
|
|
261
|
+
|
|
262
|
+
> **Quick Reset**: Most issues can be resolved by deleting `~/.opencode/auth/openai.json` and running `opencode auth login` again.
|
|
263
|
+
|
|
264
|
+
### Configuration Path (All Platforms)
|
|
265
|
+
|
|
266
|
+
OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
267
|
+
|
|
268
|
+
| File | Path |
|
|
269
|
+
|------|------|
|
|
270
|
+
| Main config | `~/.config/opencode/opencode.json` |
|
|
271
|
+
| Auth tokens | `~/.opencode/auth/openai.json` |
|
|
272
|
+
| Multi-account | `~/.opencode/openai-codex-accounts.json` |
|
|
273
|
+
| Plugin config | `~/.opencode/openai-codex-auth-config.json` |
|
|
274
|
+
| Debug logs | `~/.opencode/logs/codex-plugin/` |
|
|
275
|
+
|
|
276
|
+
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
<details>
|
|
281
|
+
<summary><b>401 Unauthorized Error</b></summary>
|
|
282
|
+
|
|
283
|
+
**Cause:** Token expired or not authenticated.
|
|
284
|
+
|
|
285
|
+
**Solutions:**
|
|
286
|
+
1. Re-authenticate:
|
|
287
|
+
```bash
|
|
288
|
+
opencode auth login
|
|
289
|
+
```
|
|
290
|
+
2. Check auth file exists:
|
|
291
|
+
```bash
|
|
292
|
+
cat ~/.opencode/auth/openai.json
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
</details>
|
|
296
|
+
|
|
297
|
+
<details>
|
|
298
|
+
<summary><b>Browser Doesn't Open for OAuth</b></summary>
|
|
299
|
+
|
|
300
|
+
**Cause:** Port 1455 conflict or SSH/WSL environment.
|
|
301
|
+
|
|
302
|
+
**Solutions:**
|
|
303
|
+
1. **Manual URL paste:**
|
|
304
|
+
- Re-run `opencode auth login`
|
|
305
|
+
- Select **"ChatGPT Plus/Pro (Manual URL Paste)"**
|
|
306
|
+
- Paste the full redirect URL after login
|
|
307
|
+
|
|
308
|
+
2. **Check port availability:**
|
|
309
|
+
```bash
|
|
310
|
+
# macOS/Linux
|
|
311
|
+
lsof -i :1455
|
|
312
|
+
|
|
313
|
+
# Windows
|
|
314
|
+
netstat -ano | findstr :1455
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
3. **Stop Codex CLI if running** — both use port 1455
|
|
318
|
+
|
|
319
|
+
</details>
|
|
320
|
+
|
|
321
|
+
<details>
|
|
322
|
+
<summary><b>Model Not Found</b></summary>
|
|
323
|
+
|
|
324
|
+
**Cause:** Missing provider prefix or config mismatch.
|
|
325
|
+
|
|
326
|
+
**Solutions:**
|
|
327
|
+
1. Use `openai/` prefix:
|
|
328
|
+
```bash
|
|
329
|
+
# Correct
|
|
330
|
+
--model=openai/gpt-5.2
|
|
331
|
+
|
|
332
|
+
# Wrong
|
|
333
|
+
--model=gpt-5.2
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
2. Verify model is in your config:
|
|
337
|
+
```json
|
|
338
|
+
{ "models": { "gpt-5.2": { ... } } }
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
</details>
|
|
342
|
+
|
|
343
|
+
<details>
|
|
344
|
+
<summary><b>Rate Limit Exceeded</b></summary>
|
|
345
|
+
|
|
346
|
+
**Cause:** ChatGPT subscription usage limit reached.
|
|
347
|
+
|
|
348
|
+
**Solutions:**
|
|
349
|
+
1. Wait for reset (plugin shows timing in error message)
|
|
350
|
+
2. Add more accounts: `opencode auth login`
|
|
351
|
+
3. Switch to a different model family
|
|
352
|
+
|
|
353
|
+
</details>
|
|
354
|
+
|
|
355
|
+
<details>
|
|
356
|
+
<summary><b>Multi-Turn Context Lost</b></summary>
|
|
357
|
+
|
|
358
|
+
**Cause:** Old plugin version or missing config.
|
|
359
|
+
|
|
360
|
+
**Solutions:**
|
|
361
|
+
1. Update plugin:
|
|
362
|
+
```bash
|
|
363
|
+
npx -y opencode-openai-codex-auth-multi@latest
|
|
364
|
+
```
|
|
365
|
+
2. Ensure config has:
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"include": ["reasoning.encrypted_content"],
|
|
369
|
+
"store": false
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
</details>
|
|
374
|
+
|
|
375
|
+
<details>
|
|
376
|
+
<summary><b>OAuth Callback Issues (Safari/WSL/Docker)</b></summary>
|
|
377
|
+
|
|
378
|
+
**Safari HTTPS-Only Mode:**
|
|
379
|
+
- Use Chrome or Firefox instead, or
|
|
380
|
+
- Temporarily disable Safari > Settings > Privacy > "Enable HTTPS-Only Mode"
|
|
381
|
+
|
|
382
|
+
**WSL2:**
|
|
383
|
+
- Use VS Code's port forwarding, or
|
|
384
|
+
- Configure Windows → WSL port forwarding
|
|
385
|
+
|
|
386
|
+
**SSH / Remote:**
|
|
387
|
+
```bash
|
|
388
|
+
ssh -L 1455:localhost:1455 user@remote
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Docker / Containers:**
|
|
392
|
+
- OAuth with localhost redirect doesn't work in containers
|
|
393
|
+
- Use SSH port forwarding or manual URL flow
|
|
394
|
+
|
|
395
|
+
</details>
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Plugin Compatibility
|
|
400
|
+
|
|
401
|
+
### oh-my-opencode
|
|
402
|
+
|
|
403
|
+
Works alongside oh-my-opencode. No special configuration needed.
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"plugin": [
|
|
408
|
+
"opencode-openai-codex-auth-multi@latest",
|
|
409
|
+
"oh-my-opencode@latest"
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### @tarquinen/opencode-dcp
|
|
415
|
+
|
|
416
|
+
List this plugin BEFORE DCP:
|
|
417
|
+
|
|
418
|
+
```json
|
|
419
|
+
{
|
|
420
|
+
"plugin": [
|
|
421
|
+
"opencode-openai-codex-auth-multi@latest",
|
|
422
|
+
"@tarquinen/opencode-dcp@latest"
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Plugins you don't need
|
|
428
|
+
|
|
429
|
+
- **openai-codex-auth** — Not needed. This plugin replaces the original.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Configuration
|
|
434
|
+
|
|
435
|
+
Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
|
|
436
|
+
|
|
437
|
+
### Model Behavior
|
|
438
|
+
|
|
439
|
+
| Option | Default | What it does |
|
|
440
|
+
|--------|---------|--------------|
|
|
441
|
+
| `codexMode` | `true` | Uses Codex-OpenCode bridge prompt (synced with latest Codex CLI) |
|
|
442
|
+
|
|
443
|
+
### Retry Behavior (v4.4.0+)
|
|
444
|
+
|
|
445
|
+
| Option | Default | What it does |
|
|
446
|
+
|--------|---------|--------------|
|
|
447
|
+
| `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |
|
|
448
|
+
| `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |
|
|
449
|
+
| `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |
|
|
450
|
+
|
|
451
|
+
### Environment Variables
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
DEBUG_CODEX_PLUGIN=1 opencode # Enable debug logging
|
|
455
|
+
ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode # Log all API requests
|
|
456
|
+
CODEX_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
|
|
457
|
+
CODEX_MODE=0 opencode # Temporarily disable bridge prompt
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
For all options, see [docs/configuration.md](docs/configuration.md).
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Documentation
|
|
465
|
+
|
|
466
|
+
- [Getting Started](docs/getting-started.md) — Complete installation guide
|
|
467
|
+
- [Configuration](docs/configuration.md) — All configuration options
|
|
468
|
+
- [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
|
|
469
|
+
- [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Credits
|
|
474
|
+
|
|
475
|
+
- [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) by [numman-ali](https://github.com/numman-ali) — Original plugin
|
|
476
|
+
- [ndycode](https://github.com/ndycode) — Multi-account support and maintenance
|
|
477
|
+
|
|
478
|
+
## License
|
|
479
|
+
|
|
480
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
481
|
+
|
|
482
|
+
<details>
|
|
483
|
+
<summary><b>Legal</b></summary>
|
|
484
|
+
|
|
485
|
+
### Intended Use
|
|
486
|
+
|
|
487
|
+
- Personal / internal development only
|
|
488
|
+
- Respect subscription quotas and data handling policies
|
|
489
|
+
- Not for production services or bypassing intended limits
|
|
490
|
+
|
|
491
|
+
### Warning
|
|
492
|
+
|
|
493
|
+
By using this plugin, you acknowledge:
|
|
494
|
+
|
|
495
|
+
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
496
|
+
- **No guarantees** — APIs may change without notice
|
|
497
|
+
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
498
|
+
|
|
499
|
+
### Disclaimer
|
|
500
|
+
|
|
501
|
+
- Not affiliated with OpenAI. This is an independent open-source project.
|
|
502
|
+
- "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI, L.L.C.
|
|
503
|
+
|
|
504
|
+
</details>
|