opencode-openai-codex-auth-multi 4.3.0-multiaccount.1 → 4.5.0
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/LICENSE +37 -37
- package/README.md +463 -80
- package/assets/opencode-logo-ornate-dark.svg +18 -18
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +98 -98
- package/config/minimal-opencode.json +11 -11
- package/config/opencode-legacy.json +568 -568
- package/config/opencode-modern.json +236 -236
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +391 -135
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +85 -11
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +352 -62
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/auth/auth.d.ts +9 -1
- package/dist/lib/auth/auth.d.ts.map +1 -1
- package/dist/lib/auth/auth.js +26 -13
- package/dist/lib/auth/auth.js.map +1 -1
- package/dist/lib/auth/browser.d.ts.map +1 -1
- package/dist/lib/auth/browser.js +9 -2
- package/dist/lib/auth/browser.js.map +1 -1
- package/dist/lib/auth/server.d.ts.map +1 -1
- package/dist/lib/auth/server.js +11 -4
- package/dist/lib/auth/server.js.map +1 -1
- package/dist/lib/auto-update-checker.d.ts +10 -0
- package/dist/lib/auto-update-checker.d.ts.map +1 -0
- package/dist/lib/auto-update-checker.js +129 -0
- package/dist/lib/auto-update-checker.js.map +1 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +11 -6
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/config.d.ts +5 -7
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +49 -6
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +7 -0
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +7 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/logger.d.ts +13 -17
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +89 -24
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/oauth-success.html +712 -712
- package/dist/lib/prompts/codex-opencode-bridge.js +121 -121
- package/dist/lib/prompts/codex.d.ts +5 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +114 -93
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/refresh-queue.d.ts +100 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -0
- package/dist/lib/refresh-queue.js +196 -0
- package/dist/lib/refresh-queue.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +2 -3
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +26 -29
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-backoff.js +74 -0
- package/dist/lib/request/rate-limit-backoff.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +3 -2
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/request/response-handler.js +1 -1
- package/dist/lib/request/response-handler.js.map +1 -1
- package/dist/lib/rotation.d.ts +121 -0
- package/dist/lib/rotation.d.ts.map +1 -0
- package/dist/lib/rotation.js +248 -0
- package/dist/lib/rotation.js.map +1 -0
- package/dist/lib/storage.d.ts +72 -4
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +189 -19
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/types.d.ts +37 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +85 -71
- package/scripts/install-opencode-codex-auth.js +191 -191
- package/scripts/test-all-models.sh +258 -258
- 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,490 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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**
|
|
30
55
|
|
|
31
56
|
```bash
|
|
32
|
-
npx -y opencode-openai-codex-auth-multi@
|
|
57
|
+
npx -y opencode-openai-codex-auth-multi@4.3.1
|
|
33
58
|
```
|
|
34
59
|
|
|
35
|
-
|
|
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@4.3.1"]
|
|
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@4.3.1"]
|
|
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
|
-
|
|
113
|
+
opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
|
|
39
114
|
```
|
|
40
115
|
|
|
41
|
-
|
|
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
|
|
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 "
|
|
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@4.3.1"],
|
|
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
|
-
|
|
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@4.3.1
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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@4.3.1",
|
|
403
|
+
"oh-my-opencode@latest"
|
|
404
|
+
]
|
|
405
|
+
}
|
|
59
406
|
```
|
|
60
407
|
|
|
61
|
-
|
|
408
|
+
### @tarquinen/opencode-dcp
|
|
409
|
+
|
|
410
|
+
List this plugin BEFORE DCP:
|
|
62
411
|
|
|
63
412
|
```json
|
|
64
413
|
{
|
|
65
|
-
"plugin": [
|
|
414
|
+
"plugin": [
|
|
415
|
+
"opencode-openai-codex-auth-multi@4.3.1",
|
|
416
|
+
"@tarquinen/opencode-dcp@latest"
|
|
417
|
+
]
|
|
66
418
|
}
|
|
67
419
|
```
|
|
68
420
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- **
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
|
|
443
|
+
CODEX_MODE=0 opencode # Temporarily disable bridge prompt
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
For all options, see [docs/configuration.md](docs/configuration.md).
|
|
447
|
+
|
|
83
448
|
---
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
449
|
+
|
|
450
|
+
## Documentation
|
|
451
|
+
|
|
452
|
+
- [Getting Started](docs/getting-started.md) — Complete installation guide
|
|
453
|
+
- [Configuration](docs/configuration.md) — All configuration options
|
|
454
|
+
- [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
|
|
455
|
+
- [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
|
|
456
|
+
|
|
89
457
|
---
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
458
|
+
|
|
459
|
+
## Credits
|
|
460
|
+
|
|
461
|
+
- [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
|
|
462
|
+
- [ndycode](https://github.com/ndycode) — Multi-account support and maintenance
|
|
463
|
+
|
|
464
|
+
## License
|
|
465
|
+
|
|
466
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
467
|
+
|
|
468
|
+
<details>
|
|
469
|
+
<summary><b>Legal</b></summary>
|
|
470
|
+
|
|
471
|
+
### Intended Use
|
|
472
|
+
|
|
473
|
+
- Personal / internal development only
|
|
474
|
+
- Respect subscription quotas and data handling policies
|
|
475
|
+
- Not for production services or bypassing intended limits
|
|
476
|
+
|
|
477
|
+
### Warning
|
|
478
|
+
|
|
479
|
+
By using this plugin, you acknowledge:
|
|
480
|
+
|
|
481
|
+
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
482
|
+
- **No guarantees** — APIs may change without notice
|
|
483
|
+
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
484
|
+
|
|
485
|
+
### Disclaimer
|
|
486
|
+
|
|
487
|
+
- Not affiliated with OpenAI. This is an independent open-source project.
|
|
488
|
+
- "ChatGPT", "GPT-5", "Codex", and "OpenAI" are trademarks of OpenAI, L.L.C.
|
|
489
|
+
|
|
490
|
+
</details>
|