oc-codex-multi-auth 6.1.0 → 6.1.2
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 +21 -21
- package/config/README.md +32 -29
- package/config/opencode-legacy.json +16 -16
- package/config/opencode-modern.json +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +6 -0
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/request/fetch-helpers.d.ts +1 -0
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +89 -14
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +29 -3
- package/dist/lib/request/helpers/model-map.js.map +1 -1
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +47 -29
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-oc-codex-multi-auth-core.js +1 -1
- package/dist/lib/audit.d.ts +0 -45
- package/dist/lib/audit.d.ts.map +0 -1
- package/dist/lib/audit.js +0 -154
- package/dist/lib/audit.js.map +0 -1
- package/dist/lib/auth-rate-limit.d.ts +0 -20
- package/dist/lib/auth-rate-limit.d.ts.map +0 -1
- package/dist/lib/auth-rate-limit.js +0 -91
- package/dist/lib/auth-rate-limit.js.map +0 -1
- package/dist/lib/runtime-contracts.d.ts +0 -16
- package/dist/lib/runtime-contracts.d.ts.map +0 -1
- package/dist/lib/runtime-contracts.js +0 -24
- package/dist/lib/runtime-contracts.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
<!--
|
|
4
4
|
Badges: CI + OpenSSF Scorecard will turn green once Phase 3 Batch A (CI workflow + Scorecard workflow) lands and runs its first job. Until then they may render as "no status" / 404 — that is expected and self-resolves automatically.
|
|
5
5
|
-->
|
|
6
|
-
[](https://github.com/ndycode/oc-codex-multi-auth/actions/workflows/ci.yml)
|
|
7
6
|
[](https://www.npmjs.com/package/oc-codex-multi-auth)
|
|
8
7
|
[](https://www.npmjs.com/package/oc-codex-multi-auth)
|
|
9
8
|
[](https://nodejs.org)
|
|
10
9
|
[](LICENSE)
|
|
11
|
-
[](https://securityscorecards.dev/viewer/?uri=github.com/ndycode/oc-codex-multi-auth)
|
|
12
10
|
|
|
13
11
|
Use your ChatGPT Plus/Pro subscription inside OpenCode with OAuth login, GPT-5/Codex model presets, and multi-account failover.
|
|
14
12
|
|
|
@@ -16,10 +14,10 @@ Use your ChatGPT Plus/Pro subscription inside OpenCode with OAuth login, GPT-5/C
|
|
|
16
14
|
|
|
17
15
|
## What This Project Does
|
|
18
16
|
|
|
19
|
-
- Adds an OpenCode plugin that authenticates with ChatGPT Plus/Pro through official OAuth
|
|
20
|
-
- Ships ready-to-use
|
|
21
|
-
- Routes requests through a stateless Codex-compatible request pipeline with automatic token refresh
|
|
22
|
-
- Supports multi-account rotation, per-project account storage, and guided onboarding commands
|
|
17
|
+
- Adds an OpenCode plugin that authenticates with ChatGPT Plus/Pro through official OAuth
|
|
18
|
+
- Ships ready-to-use GPT-5.5 release templates, explicit `gpt-5.5-medium` / `gpt-5.5-high` selectors, `gpt-5-codex`, and related GPT-5 families
|
|
19
|
+
- Routes requests through a stateless Codex-compatible request pipeline with automatic token refresh
|
|
20
|
+
- Supports multi-account rotation, per-project account storage, and guided onboarding commands
|
|
23
21
|
|
|
24
22
|
## Quick Start
|
|
25
23
|
|
|
@@ -27,12 +25,12 @@ Use your ChatGPT Plus/Pro subscription inside OpenCode with OAuth login, GPT-5/C
|
|
|
27
25
|
# 1. Install or refresh the plugin config
|
|
28
26
|
npx -y oc-codex-multi-auth@latest
|
|
29
27
|
|
|
30
|
-
# 2. Sign in with ChatGPT Plus/Pro
|
|
31
|
-
opencode auth login
|
|
32
|
-
|
|
33
|
-
# 3. Run a prompt in OpenCode
|
|
34
|
-
opencode run "Explain this repository" --model=openai/gpt-5.
|
|
35
|
-
```
|
|
28
|
+
# 2. Sign in with ChatGPT Plus/Pro
|
|
29
|
+
opencode auth login
|
|
30
|
+
|
|
31
|
+
# 3. Run a prompt in OpenCode
|
|
32
|
+
opencode run "Explain this repository" --model=openai/gpt-5.5-medium
|
|
33
|
+
```
|
|
36
34
|
|
|
37
35
|
What the installer does:
|
|
38
36
|
|
|
@@ -41,18 +39,20 @@ What the installer does:
|
|
|
41
39
|
- normalizes the plugin entry to `"oc-codex-multi-auth"`
|
|
42
40
|
- clears the cached plugin copy so OpenCode reinstalls the latest package
|
|
43
41
|
|
|
44
|
-
By default, the installer now writes a full catalog config that includes both:
|
|
45
|
-
- modern base model entries such as `gpt-5.
|
|
46
|
-
- explicit preset entries such as `gpt-5.
|
|
42
|
+
By default, the installer now writes a full catalog config that includes both:
|
|
43
|
+
- modern base model entries such as `gpt-5.5` for `--variant` workflows
|
|
44
|
+
- explicit preset entries such as `gpt-5.5-medium` / `gpt-5.5-high` so the shipped catalog is visible directly in model pickers
|
|
45
|
+
|
|
46
|
+
Tested live on OpenCode `1.14.22`: explicit GPT-5.5 model IDs like `openai/gpt-5.5-medium` and `openai/gpt-5.5-high` work directly. Some OpenCode releases still reject bare `openai/gpt-5.5` on the CLI even when the base config entry exists in the effective config.
|
|
47
47
|
|
|
48
48
|
## Example Usage
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
# General GPT-5 workflow
|
|
52
|
-
opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.
|
|
53
|
-
|
|
54
|
-
# Codex-focused workflow
|
|
55
|
-
opencode run "Refactor the retry logic and update the tests" --model=openai/gpt-5-codex --variant=high
|
|
51
|
+
# General GPT-5 workflow
|
|
52
|
+
opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.5-medium
|
|
53
|
+
|
|
54
|
+
# Codex-focused workflow
|
|
55
|
+
opencode run "Refactor the retry logic and update the tests" --model=openai/gpt-5-codex --variant=high
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Usage Notice
|
|
@@ -86,7 +86,7 @@ OpenCode users often want the same GPT-5 and Codex model experience they use in
|
|
|
86
86
|
|
|
87
87
|
## Common Workflows
|
|
88
88
|
|
|
89
|
-
- Personal coding sessions in OpenCode using `gpt-5.
|
|
89
|
+
- Personal coding sessions in OpenCode using `gpt-5.5-medium`, `gpt-5.5-high`, or `gpt-5-codex`
|
|
90
90
|
- Switching between personal and workspace-linked ChatGPT accounts
|
|
91
91
|
- Keeping separate account pools per project or monorepo
|
|
92
92
|
- Recovering from unsupported-model, auth, or rate-limit issues with guided commands
|
package/config/README.md
CHANGED
|
@@ -35,13 +35,13 @@ opencode --version
|
|
|
35
35
|
|
|
36
36
|
OpenCode v1.0.210+ added model `variants`, so one model entry can expose multiple reasoning levels. That keeps modern config much smaller while preserving the same effective presets.
|
|
37
37
|
|
|
38
|
-
Both templates include:
|
|
39
|
-
- GPT-5.
|
|
40
|
-
- Reasoning variants per model family
|
|
41
|
-
- `store: false` and `include: ["reasoning.encrypted_content"]`
|
|
42
|
-
- Context metadata (`gpt-5.
|
|
43
|
-
|
|
44
|
-
Use `opencode debug config` to verify that these template entries were merged into your effective config. `opencode models openai`
|
|
38
|
+
Both templates include:
|
|
39
|
+
- GPT-5.5, GPT-5.5 Pro, GPT-5.4 Mini, GPT-5.4 Nano, GPT-5 Codex, GPT-5.1, GPT-5.1 Codex, GPT-5.1 Codex Max, GPT-5.1 Codex Mini
|
|
40
|
+
- Reasoning variants per model family
|
|
41
|
+
- `store: false` and `include: ["reasoning.encrypted_content"]`
|
|
42
|
+
- Context metadata (`gpt-5.5`/`gpt-5.5-pro`: 1,050,000; `gpt-5.4-mini`/`gpt-5.4-nano`/Codex models: 400,000; `gpt-5.1`: 272,000; all output: 128,000)
|
|
43
|
+
|
|
44
|
+
Use `opencode debug config` to verify that these template entries were merged into your effective config. On tested OpenCode `1.14.22`, `opencode models openai` exposes explicit GPT-5.5 entries such as `gpt-5.5-medium` / `gpt-5.5-high`, while bare `gpt-5.5` may still be omitted or rejected by provider lookup even when it exists in the effective config.
|
|
45
45
|
|
|
46
46
|
If your OpenCode runtime supports global compaction tuning, you can also set:
|
|
47
47
|
- `model_context_window = 1050000`
|
|
@@ -55,19 +55,18 @@ If your workspace is entitled, you can add Spark model IDs manually.
|
|
|
55
55
|
|
|
56
56
|
## Usage examples
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
opencode run "task" --model=openai/gpt-5.
|
|
62
|
-
opencode run "task" --model=openai/gpt-5-codex --variant=high
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
opencode run "task" --model=openai/gpt-5.
|
|
69
|
-
|
|
70
|
-
```
|
|
58
|
+
Recommended real-session selectors (tested on OpenCode `1.14.22`):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
opencode run "task" --model=openai/gpt-5.5-medium
|
|
62
|
+
opencode run "task" --model=openai/gpt-5-codex --variant=high
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If your OpenCode release already exposes bare GPT-5.5 base entries, the compact modern template also supports:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
opencode run "task" --model=openai/gpt-5.5 --variant=medium
|
|
69
|
+
```
|
|
71
70
|
|
|
72
71
|
## Minimal config (advanced)
|
|
73
72
|
|
|
@@ -77,15 +76,19 @@ A barebones debug template is available at [`minimal-opencode.json`](./minimal-o
|
|
|
77
76
|
|
|
78
77
|
Current defaults are strict entitlement handling:
|
|
79
78
|
- `unsupportedCodexPolicy: "strict"` returns entitlement errors directly
|
|
80
|
-
- set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable automatic fallback retries
|
|
81
|
-
- `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
|
|
82
|
-
- `gpt-5.
|
|
83
|
-
- `
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- `gpt-5.
|
|
79
|
+
- set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable automatic fallback retries
|
|
80
|
+
- `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
|
|
81
|
+
- `gpt-5.5 -> gpt-5.4` is included by default for current ChatGPT-account entitlement gaps
|
|
82
|
+
- `gpt-5.5-pro -> gpt-5.5-20260423` is included by default in fallback mode
|
|
83
|
+
- `gpt-5.4-pro -> gpt-5.4` remains available for older manual configs
|
|
84
|
+
- `unsupportedCodexFallbackChain` lets you override fallback order per model
|
|
85
|
+
|
|
86
|
+
Default fallback chain (when policy is `fallback`):
|
|
87
|
+
- `gpt-5.5 -> gpt-5.4`
|
|
88
|
+
- `gpt-5.5-pro -> gpt-5.5-20260423`
|
|
89
|
+
- `gpt-5.4-pro -> gpt-5.4` (if you manually select `gpt-5.4-pro`)
|
|
90
|
+
- `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
|
|
91
|
+
- `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (only relevant if Spark IDs are added manually)
|
|
89
92
|
- `gpt-5.2-codex -> gpt-5-codex`
|
|
90
93
|
- `gpt-5.1-codex -> gpt-5-codex`
|
|
91
94
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"store": false
|
|
16
16
|
},
|
|
17
17
|
"models": {
|
|
18
|
-
"gpt-5.
|
|
19
|
-
"name": "GPT 5.
|
|
18
|
+
"gpt-5.5-none": {
|
|
19
|
+
"name": "GPT 5.5 20260423 None (OAuth)",
|
|
20
20
|
"limit": {
|
|
21
21
|
"context": 1050000,
|
|
22
22
|
"output": 128000
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"store": false
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gpt-5.
|
|
44
|
-
"name": "GPT 5.
|
|
43
|
+
"gpt-5.5-low": {
|
|
44
|
+
"name": "GPT 5.5 20260423 Low (OAuth)",
|
|
45
45
|
"limit": {
|
|
46
46
|
"context": 1050000,
|
|
47
47
|
"output": 128000
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"store": false
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"gpt-5.
|
|
69
|
-
"name": "GPT 5.
|
|
68
|
+
"gpt-5.5-medium": {
|
|
69
|
+
"name": "GPT 5.5 20260423 Medium (OAuth)",
|
|
70
70
|
"limit": {
|
|
71
71
|
"context": 1050000,
|
|
72
72
|
"output": 128000
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"store": false
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
-
"gpt-5.
|
|
94
|
-
"name": "GPT 5.
|
|
93
|
+
"gpt-5.5-high": {
|
|
94
|
+
"name": "GPT 5.5 20260423 High (OAuth)",
|
|
95
95
|
"limit": {
|
|
96
96
|
"context": 1050000,
|
|
97
97
|
"output": 128000
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
"store": false
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
"gpt-5.
|
|
119
|
-
"name": "GPT 5.
|
|
118
|
+
"gpt-5.5-xhigh": {
|
|
119
|
+
"name": "GPT 5.5 20260423 Extra High (OAuth)",
|
|
120
120
|
"limit": {
|
|
121
121
|
"context": 1050000,
|
|
122
122
|
"output": 128000
|
|
@@ -265,8 +265,8 @@
|
|
|
265
265
|
"store": false
|
|
266
266
|
}
|
|
267
267
|
},
|
|
268
|
-
"gpt-5.
|
|
269
|
-
"name": "GPT 5.
|
|
268
|
+
"gpt-5.5-pro-medium": {
|
|
269
|
+
"name": "GPT 5.5 Pro 20260423 Medium (OAuth)",
|
|
270
270
|
"limit": {
|
|
271
271
|
"context": 1050000,
|
|
272
272
|
"output": 128000
|
|
@@ -290,8 +290,8 @@
|
|
|
290
290
|
"store": false
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
-
"gpt-5.
|
|
294
|
-
"name": "GPT 5.
|
|
293
|
+
"gpt-5.5-pro-high": {
|
|
294
|
+
"name": "GPT 5.5 Pro 20260423 High (OAuth)",
|
|
295
295
|
"limit": {
|
|
296
296
|
"context": 1050000,
|
|
297
297
|
"output": 128000
|
|
@@ -315,8 +315,8 @@
|
|
|
315
315
|
"store": false
|
|
316
316
|
}
|
|
317
317
|
},
|
|
318
|
-
"gpt-5.
|
|
319
|
-
"name": "GPT 5.
|
|
318
|
+
"gpt-5.5-pro-xhigh": {
|
|
319
|
+
"name": "GPT 5.5 Pro 20260423 Extra High (OAuth)",
|
|
320
320
|
"limit": {
|
|
321
321
|
"context": 1050000,
|
|
322
322
|
"output": 128000
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"store": false
|
|
16
16
|
},
|
|
17
17
|
"models": {
|
|
18
|
-
"gpt-5.
|
|
19
|
-
"name": "GPT 5.
|
|
18
|
+
"gpt-5.5": {
|
|
19
|
+
"name": "GPT 5.5 20260423 (OAuth)",
|
|
20
20
|
"limit": {
|
|
21
21
|
"context": 1050000,
|
|
22
22
|
"output": 128000
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
"gpt-5.
|
|
62
|
-
"name": "GPT 5.
|
|
61
|
+
"gpt-5.5-pro": {
|
|
62
|
+
"name": "GPT 5.5 Pro 20260423 (OAuth)",
|
|
63
63
|
"limit": {
|
|
64
64
|
"context": 1050000,
|
|
65
65
|
"output": 128000
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAwL/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAwL/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAmrG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAElD,eAAe,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1406,7 +1406,7 @@ export const OpenAIOAuthPlugin = async ({ client }) => {
|
|
|
1406
1406
|
if (contextOverflowResult.handled) {
|
|
1407
1407
|
return contextOverflowResult.response;
|
|
1408
1408
|
}
|
|
1409
|
-
const { response: errorResponse, rateLimit, errorBody } = await handleErrorResponse(response, {
|
|
1409
|
+
const { response: errorResponse, rateLimit, errorBody, retryAsServerError } = await handleErrorResponse(response, {
|
|
1410
1410
|
requestCorrelationId,
|
|
1411
1411
|
threadId: threadIdCandidate,
|
|
1412
1412
|
});
|
|
@@ -1582,13 +1582,22 @@ export const OpenAIOAuthPlugin = async ({ client }) => {
|
|
|
1582
1582
|
await showToast(`${toastContent.title}: ${toastContent.message}`, "warning", { duration: toastDurationMs });
|
|
1583
1583
|
logDebug(`[${PLUGIN_NAME}] Recoverable error detected: ${errorType}`);
|
|
1584
1584
|
}
|
|
1585
|
-
// Handle 5xx server errors
|
|
1586
|
-
|
|
1587
|
-
|
|
1585
|
+
// Handle 5xx server errors, and exact overload payloads flagged by
|
|
1586
|
+
// handleErrorResponse, by rotating to another account.
|
|
1587
|
+
if (retryAsServerError || (response.status >= 500 && response.status < 600)) {
|
|
1588
|
+
if (retryAsServerError && rateLimit) {
|
|
1589
|
+
accountManager.markRateLimitedWithReason(account, rateLimit.retryAfterMs, modelFamily, parseRateLimitReason(rateLimit.code), model);
|
|
1590
|
+
account.lastSwitchReason = "rate-limit";
|
|
1591
|
+
accountManager.saveToDiskDebounced();
|
|
1592
|
+
}
|
|
1593
|
+
const retryableServerLabel = retryAsServerError && response.status < 500
|
|
1594
|
+
? `Retryable server overload (HTTP ${response.status})`
|
|
1595
|
+
: `Server error ${response.status}`;
|
|
1596
|
+
logWarn(`${retryableServerLabel} for account ${account.index + 1}. Rotating to next account.`);
|
|
1588
1597
|
runtimeMetrics.failedRequests++;
|
|
1589
1598
|
runtimeMetrics.serverErrors++;
|
|
1590
1599
|
runtimeMetrics.accountRotations++;
|
|
1591
|
-
runtimeMetrics.lastError =
|
|
1600
|
+
runtimeMetrics.lastError = retryableServerLabel;
|
|
1592
1601
|
runtimeMetrics.lastErrorCategory = "server";
|
|
1593
1602
|
accountManager.refundToken(account, modelFamily, model);
|
|
1594
1603
|
accountManager.recordFailure(account, modelFamily, model);
|