better-opencode-openai-codex-auth 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +5 -17
  2. package/config/README.md +14 -93
  3. package/config/minimal-opencode.json +1 -1
  4. package/config/opencode-modern.json +26 -107
  5. package/dist/index.d.ts +0 -12
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +195 -94
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/account-pool.d.ts +29 -3
  10. package/dist/lib/account-pool.d.ts.map +1 -1
  11. package/dist/lib/account-pool.js +210 -47
  12. package/dist/lib/account-pool.js.map +1 -1
  13. package/dist/lib/auth/auth.d.ts +55 -4
  14. package/dist/lib/auth/auth.d.ts.map +1 -1
  15. package/dist/lib/auth/auth.js +130 -6
  16. package/dist/lib/auth/auth.js.map +1 -1
  17. package/dist/lib/auth/ui/account-menu.d.ts +50 -0
  18. package/dist/lib/auth/ui/account-menu.d.ts.map +1 -0
  19. package/dist/lib/auth/ui/account-menu.js +258 -0
  20. package/dist/lib/auth/ui/account-menu.js.map +1 -0
  21. package/dist/lib/auth/ui/ansi.d.ts +23 -0
  22. package/dist/lib/auth/ui/ansi.d.ts.map +1 -0
  23. package/dist/lib/auth/ui/ansi.js +37 -0
  24. package/dist/lib/auth/ui/ansi.js.map +1 -0
  25. package/dist/lib/auth/ui/confirm.d.ts +2 -0
  26. package/dist/lib/auth/ui/confirm.d.ts.map +1 -0
  27. package/dist/lib/auth/ui/confirm.js +8 -0
  28. package/dist/lib/auth/ui/confirm.js.map +1 -0
  29. package/dist/lib/auth/ui/select.d.ts +21 -0
  30. package/dist/lib/auth/ui/select.d.ts.map +1 -0
  31. package/dist/lib/auth/ui/select.js +208 -0
  32. package/dist/lib/auth/ui/select.js.map +1 -0
  33. package/dist/lib/constants.d.ts +51 -3
  34. package/dist/lib/constants.d.ts.map +1 -1
  35. package/dist/lib/constants.js +55 -3
  36. package/dist/lib/constants.js.map +1 -1
  37. package/dist/lib/refresh-queue.d.ts +56 -0
  38. package/dist/lib/refresh-queue.d.ts.map +1 -0
  39. package/dist/lib/refresh-queue.js +148 -0
  40. package/dist/lib/refresh-queue.js.map +1 -0
  41. package/dist/lib/request/fetch-helpers.d.ts +2 -1
  42. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  43. package/dist/lib/request/fetch-helpers.js +23 -3
  44. package/dist/lib/request/fetch-helpers.js.map +1 -1
  45. package/dist/lib/types.d.ts +18 -2
  46. package/dist/lib/types.d.ts.map +1 -1
  47. package/package.json +1 -2
  48. package/scripts/install-opencode-codex-auth.js +10 -29
  49. package/config/opencode-legacy.json +0 -571
package/README.md CHANGED
@@ -33,14 +33,7 @@ Then authenticate and run:
33
33
 
34
34
  ```bash
35
35
  opencode auth login
36
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
37
- ```
38
-
39
- **Legacy OpenCode** (v1.0.209 and below):
40
-
41
- ```bash
42
- bunx better-opencode-openai-codex-auth@latest --legacy
43
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2-medium
36
+ opencode run "write hello world to test.txt" --model=openai/gpt-5.4 --variant=medium
44
37
  ```
45
38
 
46
39
  **Uninstall:**
@@ -80,19 +73,14 @@ bunx better-opencode-openai-codex-auth@dev
80
73
 
81
74
  - **gpt-5.3** (none/low/medium/high/xhigh)
82
75
  - **gpt-5.3-codex** (low/medium/high/xhigh)
83
- - **gpt-5.2** (none/low/medium/high/xhigh)
84
- - **gpt-5.2-codex** (low/medium/high/xhigh)
85
- - **gpt-5.1-codex-max** (low/medium/high/xhigh)
86
- - **gpt-5.1-codex** (low/medium/high)
87
- - **gpt-5.1-codex-mini** (medium/high)
88
- - **gpt-5.1** (none/low/medium/high)
76
+ - **gpt-5.4** (none/low/medium/high/xhigh)
77
+ - **gpt-5.4-pro** (medium/high/xhigh)
89
78
 
90
79
  ---
91
80
 
92
81
  ## Configuration
93
82
 
94
83
  - **Modern** (OpenCode v1.0.210+): `config/opencode-modern.json`
95
- - **Legacy** (OpenCode v1.0.209 and below): `config/opencode-legacy.json`
96
84
 
97
85
  Minimal configs don't work with GPT-5.x; use the full configs above.
98
86
 
@@ -101,8 +89,8 @@ Minimal configs don't work with GPT-5.x; use the full configs above.
101
89
  ## Features
102
90
 
103
91
  - ChatGPT Plus/Pro OAuth (same flow as official Codex CLI)
104
- - 33 model presets across GPT-5.3, GPT-5.2, and GPT-5.1 families
105
- - Variant system support (v1.0.210+) + legacy presets
92
+ - 18 model presets across GPT-5.4 and GPT-5.3 families
93
+ - Variant system support (v1.0.210+)
106
94
  - Multimodal input for all models
107
95
  - Usage-aware errors with automatic token refresh
108
96
  - Multi-account pool with round-robin or sticky selection (`~/.opencode/openai-codex-accounts.json`)
package/config/README.md CHANGED
@@ -1,103 +1,24 @@
1
1
  # Configuration
2
2
 
3
- This directory contains the official opencode configuration files for the OpenAI Codex OAuth plugin.
3
+ This directory contains the opencode configuration template for the OpenAI Codex OAuth plugin.
4
4
 
5
- ## ⚠️ REQUIRED: Choose the Right Configuration
5
+ ## File
6
6
 
7
- **Two configuration files are available based on your OpenCode version:**
7
+ **`opencode-modern.json`** the only config. Requires opencode v1.0.210+ (variants system).
8
+ The installer (`bunx better-opencode-openai-codex-auth@latest`) writes this to `~/.config/opencode/opencode.jsonc` automatically.
8
9
 
9
- | File | OpenCode Version | Description |
10
- |------|------------------|-------------|
11
- | [`opencode-modern.json`](./opencode-modern.json) | **v1.0.210+ (Jan 2026+)** | Compact config using variants system - 6 models with built-in reasoning level variants |
12
- | [`opencode-legacy.json`](./opencode-legacy.json) | **v1.0.209 and below** | Extended config with separate model entries for each reasoning level - 20+ individual model definitions |
10
+ The shipped template pins the plugin as `better-opencode-openai-codex-auth@latest` so fresh installs always resolve the latest published npm tarball.
13
11
 
14
- ### Which one should I use?
12
+ ## Available Models
15
13
 
16
- **If you have OpenCode v1.0.210 or newer** (check with `opencode --version`):
17
- ```bash
18
- cp config/opencode-modern.json ~/.config/opencode/opencode.jsonc
19
- ```
14
+ | Model | Variants | Notes |
15
+ |-------|----------|-------|
16
+ | `gpt-5.4` | none / low / medium / high / xhigh | Latest general model |
17
+ | `gpt-5.4-pro` | medium / high / xhigh | Pro tier (no none/low) |
18
+ | `gpt-5.3-codex` | low / medium / high / xhigh | Newest Codex family |
19
+ | `gpt-5.3` | none / low / medium / high / xhigh | GPT-5.3 general |
20
+ ## Manual install
20
21
 
21
- **If you have OpenCode v1.0.209 or older**:
22
22
  ```bash
23
- cp config/opencode-legacy.json ~/.config/opencode/opencode.jsonc
23
+ cp config/opencode-modern.json ~/.config/opencode/opencode.jsonc
24
24
  ```
25
-
26
- ### Why two configs?
27
-
28
- OpenCode v1.0.210+ introduced a **variants system** that allows defining reasoning effort levels as variants under a single model. This reduces config size from 572 lines to ~150 lines while maintaining the same functionality.
29
-
30
- **What you get:**
31
-
32
- | Config File | Model Families | Reasoning Variants | Total Models |
33
- |------------|----------------|-------------------|--------------|
34
- | `opencode-modern.json` | 6 | Built-in variants (low/medium/high/xhigh) | 6 base models with 19 total variants |
35
- | `opencode-legacy.json` | 6 | Separate model entries | 20 individual model definitions |
36
-
37
- Both configs provide:
38
- - ✅ All supported GPT 5.2/5.1 variants: gpt-5.2, gpt-5.2-codex, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini
39
- - ✅ Proper reasoning effort settings for each variant (including `xhigh` for Codex Max/5.2)
40
- - ✅ Context limits (272k context / 128k output for all Codex families)
41
- - ✅ Required options: `store: false`, `include: ["reasoning.encrypted_content"]`
42
- - ✅ Image input support for all models
43
- - ✅ All required metadata for OpenCode features
44
-
45
- ### Modern Config Benefits (v1.0.210+)
46
-
47
- - **74% smaller**: 150 lines vs 572 lines
48
- - **DRY**: Common options defined once at provider level
49
- - **Variant cycling**: Built-in support for `Ctrl+T` to switch reasoning levels
50
- - **Easier maintenance**: Add new variants without copying model definitions
51
-
52
- ## Usage
53
-
54
- 1. **Check your OpenCode version**:
55
- ```bash
56
- opencode --version
57
- ```
58
-
59
- 2. **Copy the appropriate config** based on your version:
60
- ```bash
61
- # For v1.0.210+ (recommended):
62
- cp config/opencode-modern.json ~/.config/opencode/opencode.jsonc
63
-
64
- # For older versions:
65
- cp config/opencode-legacy.json ~/.config/opencode/opencode.jsonc
66
- ```
67
-
68
- 3. **Run opencode**:
69
- ```bash
70
- # Modern config (v1.0.210+):
71
- opencode run "task" --model=openai/gpt-5.2 --variant=medium
72
- opencode run "task" --model=openai/gpt-5.2 --variant=high
73
-
74
- # Legacy config:
75
- opencode run "task" --model=openai/gpt-5.2-medium
76
- opencode run "task" --model=openai/gpt-5.2-high
77
- ```
78
-
79
- > **⚠️ Important**: Use the config file appropriate for your OpenCode version. Using the modern config with an older OpenCode version (v1.0.209 or below) will not work correctly.
80
-
81
- > **Note**: The config templates use an **unversioned** plugin entry (`better-opencode-openai-codex-auth`) so the installer can always pull the latest release. If you need reproducibility, pin a specific version manually.
82
-
83
- ## Available Models
84
-
85
- Both configs provide access to the same model families:
86
-
87
- - **gpt-5.2** (none/low/medium/high/xhigh) - Latest GPT 5.2 model with full reasoning support
88
- - **gpt-5.2-codex** (low/medium/high/xhigh) - GPT 5.2 Codex presets
89
- - **gpt-5.1-codex-max** (low/medium/high/xhigh) - Codex Max presets
90
- - **gpt-5.1-codex** (low/medium/high) - Codex model presets
91
- - **gpt-5.1-codex-mini** (medium/high) - Codex mini tier presets
92
- - **gpt-5.1** (none/low/medium/high) - General-purpose reasoning presets
93
-
94
- All appear in the opencode model selector as "GPT 5.1 Codex Low (OAuth)", "GPT 5.1 High (OAuth)", etc.
95
-
96
- ## Configuration Options
97
-
98
- See the main [README.md](../README.md#configuration) for detailed documentation of all configuration options.
99
-
100
- ## Version History
101
-
102
- - **January 2026 (v1.0.210+)**: Introduced variant system support. Use `opencode-modern.json`
103
- - **December 2025 and earlier**: Use `opencode-legacy.json`
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
- "plugin": ["better-opencode-openai-codex-auth"],
3
+ "plugin": ["better-opencode-openai-codex-auth@latest"],
4
4
  "provider": {
5
5
  "openai": {
6
6
  "options": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
3
  "plugin": [
4
- "better-opencode-openai-codex-auth"
4
+ "better-opencode-openai-codex-auth@latest"
5
5
  ],
6
6
  "provider": {
7
7
  "openai": {
@@ -15,20 +15,15 @@
15
15
  "store": false
16
16
  },
17
17
  "models": {
18
- "gpt-5.2": {
19
- "name": "GPT 5.2 (OAuth)",
18
+ "gpt-5.4": {
19
+ "name": "GPT 5.4 (OAuth)",
20
20
  "limit": {
21
21
  "context": 272000,
22
22
  "output": 128000
23
23
  },
24
24
  "modalities": {
25
- "input": [
26
- "text",
27
- "image"
28
- ],
29
- "output": [
30
- "text"
31
- ]
25
+ "input": ["text", "image"],
26
+ "output": ["text"]
32
27
  },
33
28
  "variants": {
34
29
  "none": {
@@ -58,27 +53,17 @@
58
53
  }
59
54
  }
60
55
  },
61
- "gpt-5.2-codex": {
62
- "name": "GPT 5.2 Codex (OAuth)",
56
+ "gpt-5.4-pro": {
57
+ "name": "GPT 5.4 Pro (OAuth)",
63
58
  "limit": {
64
59
  "context": 272000,
65
60
  "output": 128000
66
61
  },
67
62
  "modalities": {
68
- "input": [
69
- "text",
70
- "image"
71
- ],
72
- "output": [
73
- "text"
74
- ]
63
+ "input": ["text", "image"],
64
+ "output": ["text"]
75
65
  },
76
66
  "variants": {
77
- "low": {
78
- "reasoningEffort": "low",
79
- "reasoningSummary": "auto",
80
- "textVerbosity": "medium"
81
- },
82
67
  "medium": {
83
68
  "reasoningEffort": "medium",
84
69
  "reasoningSummary": "auto",
@@ -96,58 +81,15 @@
96
81
  }
97
82
  }
98
83
  },
99
- "gpt-5.1-codex-max": {
100
- "name": "GPT 5.1 Codex Max (OAuth)",
84
+ "gpt-5.3-codex": {
85
+ "name": "GPT 5.3 Codex (OAuth)",
101
86
  "limit": {
102
87
  "context": 272000,
103
88
  "output": 128000
104
89
  },
105
90
  "modalities": {
106
- "input": [
107
- "text",
108
- "image"
109
- ],
110
- "output": [
111
- "text"
112
- ]
113
- },
114
- "variants": {
115
- "low": {
116
- "reasoningEffort": "low",
117
- "reasoningSummary": "detailed",
118
- "textVerbosity": "medium"
119
- },
120
- "medium": {
121
- "reasoningEffort": "medium",
122
- "reasoningSummary": "detailed",
123
- "textVerbosity": "medium"
124
- },
125
- "high": {
126
- "reasoningEffort": "high",
127
- "reasoningSummary": "detailed",
128
- "textVerbosity": "medium"
129
- },
130
- "xhigh": {
131
- "reasoningEffort": "xhigh",
132
- "reasoningSummary": "detailed",
133
- "textVerbosity": "medium"
134
- }
135
- }
136
- },
137
- "gpt-5.1-codex": {
138
- "name": "GPT 5.1 Codex (OAuth)",
139
- "limit": {
140
- "context": 272000,
141
- "output": 128000
142
- },
143
- "modalities": {
144
- "input": [
145
- "text",
146
- "image"
147
- ],
148
- "output": [
149
- "text"
150
- ]
91
+ "input": ["text", "image"],
92
+ "output": ["text"]
151
93
  },
152
94
  "variants": {
153
95
  "low": {
@@ -164,51 +106,23 @@
164
106
  "reasoningEffort": "high",
165
107
  "reasoningSummary": "detailed",
166
108
  "textVerbosity": "medium"
167
- }
168
- }
169
- },
170
- "gpt-5.1-codex-mini": {
171
- "name": "GPT 5.1 Codex Mini (OAuth)",
172
- "limit": {
173
- "context": 272000,
174
- "output": 128000
175
- },
176
- "modalities": {
177
- "input": [
178
- "text",
179
- "image"
180
- ],
181
- "output": [
182
- "text"
183
- ]
184
- },
185
- "variants": {
186
- "medium": {
187
- "reasoningEffort": "medium",
188
- "reasoningSummary": "auto",
189
- "textVerbosity": "medium"
190
109
  },
191
- "high": {
192
- "reasoningEffort": "high",
110
+ "xhigh": {
111
+ "reasoningEffort": "xhigh",
193
112
  "reasoningSummary": "detailed",
194
113
  "textVerbosity": "medium"
195
114
  }
196
115
  }
197
116
  },
198
- "gpt-5.1": {
199
- "name": "GPT 5.1 (OAuth)",
117
+ "gpt-5.3": {
118
+ "name": "GPT 5.3 (OAuth)",
200
119
  "limit": {
201
120
  "context": 272000,
202
121
  "output": 128000
203
122
  },
204
123
  "modalities": {
205
- "input": [
206
- "text",
207
- "image"
208
- ],
209
- "output": [
210
- "text"
211
- ]
124
+ "input": ["text", "image"],
125
+ "output": ["text"]
212
126
  },
213
127
  "variants": {
214
128
  "none": {
@@ -219,7 +133,7 @@
219
133
  "low": {
220
134
  "reasoningEffort": "low",
221
135
  "reasoningSummary": "auto",
222
- "textVerbosity": "low"
136
+ "textVerbosity": "medium"
223
137
  },
224
138
  "medium": {
225
139
  "reasoningEffort": "medium",
@@ -229,7 +143,12 @@
229
143
  "high": {
230
144
  "reasoningEffort": "high",
231
145
  "reasoningSummary": "detailed",
232
- "textVerbosity": "high"
146
+ "textVerbosity": "medium"
147
+ },
148
+ "xhigh": {
149
+ "reasoningEffort": "xhigh",
150
+ "reasoningSummary": "detailed",
151
+ "textVerbosity": "medium"
233
152
  }
234
153
  }
235
154
  }
package/dist/index.d.ts CHANGED
@@ -24,18 +24,6 @@
24
24
  import type { Plugin } from "@opencode-ai/plugin";
25
25
  /**
26
26
  * OpenAI Codex OAuth authentication plugin for opencode
27
- *
28
- * This plugin enables opencode to use OpenAI's Codex backend via ChatGPT Plus/Pro
29
- * OAuth authentication, allowing users to leverage their ChatGPT subscription
30
- * instead of OpenAI Platform API credits.
31
- *
32
- * @example
33
- * ```json
34
- * {
35
- * "plugin": ["better-opencode-openai-codex-auth"],
36
- * "model": "openai/gpt-5-codex"
37
- * }
38
- * ```
39
27
  */
40
28
  export declare const OpenAIAuthPlugin: Plugin;
41
29
  export default OpenAIAuthPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AA4D/D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAwU9B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAiF/D;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAqd9B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}