oc-chatgpt-multi-auth 5.4.2 → 5.4.3
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 +939 -931
- package/config/README.md +92 -88
- package/config/opencode-legacy.json +5 -5
- package/config/opencode-modern.json +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/prompts/codex.d.ts +1 -1
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +8 -1
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/request/helpers/model-map.d.ts +0 -6
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +18 -4
- 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 +48 -7
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/schemas.d.ts +3 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/storage.d.ts +4 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +108 -2
- package/dist/lib/storage.js.map +1 -1
- package/package.json +106 -106
package/config/README.md
CHANGED
|
@@ -1,88 +1,92 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
This directory contains the official OpenCode config templates for the ChatGPT Codex OAuth plugin.
|
|
4
|
-
|
|
5
|
-
## Required: choose the right config file
|
|
6
|
-
|
|
7
|
-
| File | OpenCode version | Description |
|
|
8
|
-
|------|------------------|-------------|
|
|
9
|
-
| [`opencode-modern.json`](./opencode-modern.json) | **v1.0.210+** | Variant-based config: 6 base models with 21 total presets |
|
|
10
|
-
| [`opencode-legacy.json`](./opencode-legacy.json) | **v1.0.209 and below** | Legacy explicit entries: 21 individual model definitions |
|
|
11
|
-
|
|
12
|
-
## Quick pick
|
|
13
|
-
|
|
14
|
-
If your OpenCode version is v1.0.210 or newer:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
cp config/opencode-modern.json ~/.config/opencode/opencode.json
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
If your OpenCode version is v1.0.209 or older:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
cp config/opencode-legacy.json ~/.config/opencode/opencode.json
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Check your version with:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
opencode --version
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Why there are two templates
|
|
33
|
-
|
|
34
|
-
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.
|
|
35
|
-
|
|
36
|
-
Both templates include:
|
|
37
|
-
- GPT-5.4, GPT-5 Codex, GPT-5.1, GPT-5.1 Codex, GPT-5.1 Codex Max, GPT-5.1 Codex Mini
|
|
38
|
-
- Reasoning variants per model family
|
|
39
|
-
- `store: false` and `include: ["reasoning.encrypted_content"]`
|
|
40
|
-
- Context metadata (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- `gpt-5.4-pro -> gpt-5.4` (if you
|
|
79
|
-
- `
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- `gpt-5.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
This directory contains the official OpenCode config templates for the ChatGPT Codex OAuth plugin.
|
|
4
|
+
|
|
5
|
+
## Required: choose the right config file
|
|
6
|
+
|
|
7
|
+
| File | OpenCode version | Description |
|
|
8
|
+
|------|------------------|-------------|
|
|
9
|
+
| [`opencode-modern.json`](./opencode-modern.json) | **v1.0.210+** | Variant-based config: 6 base models with 21 total presets |
|
|
10
|
+
| [`opencode-legacy.json`](./opencode-legacy.json) | **v1.0.209 and below** | Legacy explicit entries: 21 individual model definitions |
|
|
11
|
+
|
|
12
|
+
## Quick pick
|
|
13
|
+
|
|
14
|
+
If your OpenCode version is v1.0.210 or newer:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cp config/opencode-modern.json ~/.config/opencode/opencode.json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If your OpenCode version is v1.0.209 or older:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cp config/opencode-legacy.json ~/.config/opencode/opencode.json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check your version with:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
opencode --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Why there are two templates
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
Both templates include:
|
|
37
|
+
- GPT-5.4, GPT-5 Codex, GPT-5.1, GPT-5.1 Codex, GPT-5.1 Codex Max, GPT-5.1 Codex Mini
|
|
38
|
+
- Reasoning variants per model family
|
|
39
|
+
- `store: false` and `include: ["reasoning.encrypted_content"]`
|
|
40
|
+
- Context metadata (`gpt-5.4*`: 1,000,000 context / 128,000 output; other shipped models: 272,000 / 128,000)
|
|
41
|
+
|
|
42
|
+
If your OpenCode runtime supports global compaction tuning, you can also set:
|
|
43
|
+
- `model_context_window = 1000000`
|
|
44
|
+
- `model_auto_compact_token_limit = 900000`
|
|
45
|
+
|
|
46
|
+
## Spark model note
|
|
47
|
+
|
|
48
|
+
The templates intentionally do **not** include `gpt-5.3-codex-spark` by default. Spark is often entitlement-gated at the account/workspace level, so shipping it by default causes avoidable startup failures for many users.
|
|
49
|
+
|
|
50
|
+
If your workspace is entitled, you can add Spark model IDs manually.
|
|
51
|
+
|
|
52
|
+
## Usage examples
|
|
53
|
+
|
|
54
|
+
Modern template (v1.0.210+):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
opencode run "task" --model=openai/gpt-5.4 --variant=medium
|
|
58
|
+
opencode run "task" --model=openai/gpt-5-codex --variant=high
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Legacy template (v1.0.209 and below):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
opencode run "task" --model=openai/gpt-5.4-medium
|
|
65
|
+
opencode run "task" --model=openai/gpt-5-codex-high
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Minimal config (advanced)
|
|
69
|
+
|
|
70
|
+
A barebones debug template is available at [`minimal-opencode.json`](./minimal-opencode.json). It omits the full preset catalog.
|
|
71
|
+
|
|
72
|
+
## Unsupported-model behavior
|
|
73
|
+
|
|
74
|
+
Current defaults are strict entitlement handling:
|
|
75
|
+
- `unsupportedCodexPolicy: "strict"` returns entitlement errors directly
|
|
76
|
+
- set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable automatic fallback retries
|
|
77
|
+
- `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
|
|
78
|
+
- `gpt-5.4-pro -> gpt-5.4` is included by default in fallback mode (relevant only if you add `gpt-5.4-pro` manually)
|
|
79
|
+
- `unsupportedCodexFallbackChain` lets you override fallback order per model
|
|
80
|
+
|
|
81
|
+
Default fallback chain (when policy is `fallback`):
|
|
82
|
+
- `gpt-5.4-pro -> gpt-5.4` (if you manually select `gpt-5.4-pro`)
|
|
83
|
+
- `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
|
|
84
|
+
- `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (only relevant if Spark IDs are added manually)
|
|
85
|
+
- `gpt-5.2-codex -> gpt-5-codex`
|
|
86
|
+
- `gpt-5.1-codex -> gpt-5-codex`
|
|
87
|
+
|
|
88
|
+
## Additional docs
|
|
89
|
+
|
|
90
|
+
- Main config reference: [`docs/configuration.md`](../docs/configuration.md)
|
|
91
|
+
- Getting started: [`docs/getting-started.md`](../docs/getting-started.md)
|
|
92
|
+
- Troubleshooting: [`docs/troubleshooting.md`](../docs/troubleshooting.md)
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"gpt-5.4-none": {
|
|
19
19
|
"name": "GPT 5.4 None (OAuth)",
|
|
20
20
|
"limit": {
|
|
21
|
-
"context":
|
|
21
|
+
"context": 1000000,
|
|
22
22
|
"output": 128000
|
|
23
23
|
},
|
|
24
24
|
"modalities": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"gpt-5.4-low": {
|
|
44
44
|
"name": "GPT 5.4 Low (OAuth)",
|
|
45
45
|
"limit": {
|
|
46
|
-
"context":
|
|
46
|
+
"context": 1000000,
|
|
47
47
|
"output": 128000
|
|
48
48
|
},
|
|
49
49
|
"modalities": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"gpt-5.4-medium": {
|
|
69
69
|
"name": "GPT 5.4 Medium (OAuth)",
|
|
70
70
|
"limit": {
|
|
71
|
-
"context":
|
|
71
|
+
"context": 1000000,
|
|
72
72
|
"output": 128000
|
|
73
73
|
},
|
|
74
74
|
"modalities": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"gpt-5.4-high": {
|
|
94
94
|
"name": "GPT 5.4 High (OAuth)",
|
|
95
95
|
"limit": {
|
|
96
|
-
"context":
|
|
96
|
+
"context": 1000000,
|
|
97
97
|
"output": 128000
|
|
98
98
|
},
|
|
99
99
|
"modalities": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"gpt-5.4-xhigh": {
|
|
119
119
|
"name": "GPT 5.4 Extra High (OAuth)",
|
|
120
120
|
"limit": {
|
|
121
|
-
"context":
|
|
121
|
+
"context": 1000000,
|
|
122
122
|
"output": 128000
|
|
123
123
|
},
|
|
124
124
|
"modalities": {
|
package/dist/index.js
CHANGED
|
@@ -1407,7 +1407,7 @@ export const OpenAIOAuthPlugin = async ({ client }) => {
|
|
|
1407
1407
|
const originalUrl = extractRequestUrl(input);
|
|
1408
1408
|
const url = rewriteUrlForCodex(originalUrl);
|
|
1409
1409
|
// Step 3: Transform request body with model-specific Codex instructions
|
|
1410
|
-
// Instructions are fetched per model family (codex-max, codex, gpt-5.
|
|
1410
|
+
// Instructions are fetched per model family (codex-max, codex, gpt-5.4, etc.)
|
|
1411
1411
|
// Capture original stream value before transformation
|
|
1412
1412
|
// generateText() sends no stream field, streamText() sends stream=true
|
|
1413
1413
|
const normalizeRequestInit = async (requestInput, requestInit) => {
|
|
@@ -1473,7 +1473,7 @@ export const OpenAIOAuthPlugin = async ({ client }) => {
|
|
|
1473
1473
|
let transformedBody = transformation?.body;
|
|
1474
1474
|
const promptCacheKey = transformedBody?.prompt_cache_key;
|
|
1475
1475
|
let model = transformedBody?.model;
|
|
1476
|
-
let modelFamily = model ? getModelFamily(model) : "gpt-5.
|
|
1476
|
+
let modelFamily = model ? getModelFamily(model) : "gpt-5.4";
|
|
1477
1477
|
let quotaKey = model ? `${modelFamily}:${model}` : modelFamily;
|
|
1478
1478
|
const threadIdCandidate = (process.env.CODEX_THREAD_ID ?? promptCacheKey ?? "")
|
|
1479
1479
|
.toString()
|