better-opencode-openai-codex-auth 0.1.2 → 0.1.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.
Files changed (47) hide show
  1. package/config/README.md +19 -93
  2. package/config/opencode-modern.json +149 -42
  3. package/dist/index.d.ts +0 -12
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +195 -94
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/account-pool.d.ts +29 -3
  8. package/dist/lib/account-pool.d.ts.map +1 -1
  9. package/dist/lib/account-pool.js +210 -47
  10. package/dist/lib/account-pool.js.map +1 -1
  11. package/dist/lib/auth/auth.d.ts +55 -4
  12. package/dist/lib/auth/auth.d.ts.map +1 -1
  13. package/dist/lib/auth/auth.js +130 -6
  14. package/dist/lib/auth/auth.js.map +1 -1
  15. package/dist/lib/auth/ui/account-menu.d.ts +50 -0
  16. package/dist/lib/auth/ui/account-menu.d.ts.map +1 -0
  17. package/dist/lib/auth/ui/account-menu.js +258 -0
  18. package/dist/lib/auth/ui/account-menu.js.map +1 -0
  19. package/dist/lib/auth/ui/ansi.d.ts +23 -0
  20. package/dist/lib/auth/ui/ansi.d.ts.map +1 -0
  21. package/dist/lib/auth/ui/ansi.js +37 -0
  22. package/dist/lib/auth/ui/ansi.js.map +1 -0
  23. package/dist/lib/auth/ui/confirm.d.ts +2 -0
  24. package/dist/lib/auth/ui/confirm.d.ts.map +1 -0
  25. package/dist/lib/auth/ui/confirm.js +8 -0
  26. package/dist/lib/auth/ui/confirm.js.map +1 -0
  27. package/dist/lib/auth/ui/select.d.ts +21 -0
  28. package/dist/lib/auth/ui/select.d.ts.map +1 -0
  29. package/dist/lib/auth/ui/select.js +208 -0
  30. package/dist/lib/auth/ui/select.js.map +1 -0
  31. package/dist/lib/constants.d.ts +51 -3
  32. package/dist/lib/constants.d.ts.map +1 -1
  33. package/dist/lib/constants.js +55 -3
  34. package/dist/lib/constants.js.map +1 -1
  35. package/dist/lib/refresh-queue.d.ts +56 -0
  36. package/dist/lib/refresh-queue.d.ts.map +1 -0
  37. package/dist/lib/refresh-queue.js +148 -0
  38. package/dist/lib/refresh-queue.js.map +1 -0
  39. package/dist/lib/request/fetch-helpers.d.ts +2 -1
  40. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  41. package/dist/lib/request/fetch-helpers.js +23 -3
  42. package/dist/lib/request/fetch-helpers.js.map +1 -1
  43. package/dist/lib/types.d.ts +18 -2
  44. package/dist/lib/types.d.ts.map +1 -1
  45. package/package.json +1 -2
  46. package/scripts/install-opencode-codex-auth.js +7 -27
  47. package/config/opencode-legacy.json +0 -571
package/config/README.md CHANGED
@@ -1,103 +1,29 @@
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
+ ## Available Models
13
11
 
14
- ### Which one should I use?
12
+ | Model | Variants | Notes |
13
+ |-------|----------|-------|
14
+ | `gpt-5.4` | none / low / medium / high / xhigh | Latest general model |
15
+ | `gpt-5.4-pro` | medium / high / xhigh | Pro tier (no none/low) |
16
+ | `gpt-5.3-codex` | low / medium / high / xhigh | Newest Codex family |
17
+ | `gpt-5.3` | none / low / medium / high / xhigh | GPT-5.3 general |
18
+ | `gpt-5.2` | none / low / medium / high / xhigh | |
19
+ | `gpt-5.2-codex` | low / medium / high / xhigh | |
20
+ | `gpt-5.1-codex-max` | low / medium / high / xhigh | |
21
+ | `gpt-5.1-codex` | low / medium / high | |
22
+ | `gpt-5.1-codex-mini` | medium / high | |
23
+ | `gpt-5.1` | none / low / medium / high | |
24
+
25
+ ## Manual install
15
26
 
16
- **If you have OpenCode v1.0.210 or newer** (check with `opencode --version`):
17
27
  ```bash
18
28
  cp config/opencode-modern.json ~/.config/opencode/opencode.jsonc
19
29
  ```
20
-
21
- **If you have OpenCode v1.0.209 or older**:
22
- ```bash
23
- cp config/opencode-legacy.json ~/.config/opencode/opencode.jsonc
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`
@@ -15,6 +15,143 @@
15
15
  "store": false
16
16
  },
17
17
  "models": {
18
+ "gpt-5.4": {
19
+ "name": "GPT 5.4 (OAuth)",
20
+ "limit": {
21
+ "context": 272000,
22
+ "output": 128000
23
+ },
24
+ "modalities": {
25
+ "input": ["text", "image"],
26
+ "output": ["text"]
27
+ },
28
+ "variants": {
29
+ "none": {
30
+ "reasoningEffort": "none",
31
+ "reasoningSummary": "auto",
32
+ "textVerbosity": "medium"
33
+ },
34
+ "low": {
35
+ "reasoningEffort": "low",
36
+ "reasoningSummary": "auto",
37
+ "textVerbosity": "medium"
38
+ },
39
+ "medium": {
40
+ "reasoningEffort": "medium",
41
+ "reasoningSummary": "auto",
42
+ "textVerbosity": "medium"
43
+ },
44
+ "high": {
45
+ "reasoningEffort": "high",
46
+ "reasoningSummary": "detailed",
47
+ "textVerbosity": "medium"
48
+ },
49
+ "xhigh": {
50
+ "reasoningEffort": "xhigh",
51
+ "reasoningSummary": "detailed",
52
+ "textVerbosity": "medium"
53
+ }
54
+ }
55
+ },
56
+ "gpt-5.4-pro": {
57
+ "name": "GPT 5.4 Pro (OAuth)",
58
+ "limit": {
59
+ "context": 272000,
60
+ "output": 128000
61
+ },
62
+ "modalities": {
63
+ "input": ["text", "image"],
64
+ "output": ["text"]
65
+ },
66
+ "variants": {
67
+ "medium": {
68
+ "reasoningEffort": "medium",
69
+ "reasoningSummary": "auto",
70
+ "textVerbosity": "medium"
71
+ },
72
+ "high": {
73
+ "reasoningEffort": "high",
74
+ "reasoningSummary": "detailed",
75
+ "textVerbosity": "medium"
76
+ },
77
+ "xhigh": {
78
+ "reasoningEffort": "xhigh",
79
+ "reasoningSummary": "detailed",
80
+ "textVerbosity": "medium"
81
+ }
82
+ }
83
+ },
84
+ "gpt-5.3-codex": {
85
+ "name": "GPT 5.3 Codex (OAuth)",
86
+ "limit": {
87
+ "context": 272000,
88
+ "output": 128000
89
+ },
90
+ "modalities": {
91
+ "input": ["text", "image"],
92
+ "output": ["text"]
93
+ },
94
+ "variants": {
95
+ "low": {
96
+ "reasoningEffort": "low",
97
+ "reasoningSummary": "auto",
98
+ "textVerbosity": "medium"
99
+ },
100
+ "medium": {
101
+ "reasoningEffort": "medium",
102
+ "reasoningSummary": "auto",
103
+ "textVerbosity": "medium"
104
+ },
105
+ "high": {
106
+ "reasoningEffort": "high",
107
+ "reasoningSummary": "detailed",
108
+ "textVerbosity": "medium"
109
+ },
110
+ "xhigh": {
111
+ "reasoningEffort": "xhigh",
112
+ "reasoningSummary": "detailed",
113
+ "textVerbosity": "medium"
114
+ }
115
+ }
116
+ },
117
+ "gpt-5.3": {
118
+ "name": "GPT 5.3 (OAuth)",
119
+ "limit": {
120
+ "context": 272000,
121
+ "output": 128000
122
+ },
123
+ "modalities": {
124
+ "input": ["text", "image"],
125
+ "output": ["text"]
126
+ },
127
+ "variants": {
128
+ "none": {
129
+ "reasoningEffort": "none",
130
+ "reasoningSummary": "auto",
131
+ "textVerbosity": "medium"
132
+ },
133
+ "low": {
134
+ "reasoningEffort": "low",
135
+ "reasoningSummary": "auto",
136
+ "textVerbosity": "medium"
137
+ },
138
+ "medium": {
139
+ "reasoningEffort": "medium",
140
+ "reasoningSummary": "auto",
141
+ "textVerbosity": "medium"
142
+ },
143
+ "high": {
144
+ "reasoningEffort": "high",
145
+ "reasoningSummary": "detailed",
146
+ "textVerbosity": "medium"
147
+ },
148
+ "xhigh": {
149
+ "reasoningEffort": "xhigh",
150
+ "reasoningSummary": "detailed",
151
+ "textVerbosity": "medium"
152
+ }
153
+ }
154
+ },
18
155
  "gpt-5.2": {
19
156
  "name": "GPT 5.2 (OAuth)",
20
157
  "limit": {
@@ -22,13 +159,8 @@
22
159
  "output": 128000
23
160
  },
24
161
  "modalities": {
25
- "input": [
26
- "text",
27
- "image"
28
- ],
29
- "output": [
30
- "text"
31
- ]
162
+ "input": ["text", "image"],
163
+ "output": ["text"]
32
164
  },
33
165
  "variants": {
34
166
  "none": {
@@ -65,13 +197,8 @@
65
197
  "output": 128000
66
198
  },
67
199
  "modalities": {
68
- "input": [
69
- "text",
70
- "image"
71
- ],
72
- "output": [
73
- "text"
74
- ]
200
+ "input": ["text", "image"],
201
+ "output": ["text"]
75
202
  },
76
203
  "variants": {
77
204
  "low": {
@@ -103,13 +230,8 @@
103
230
  "output": 128000
104
231
  },
105
232
  "modalities": {
106
- "input": [
107
- "text",
108
- "image"
109
- ],
110
- "output": [
111
- "text"
112
- ]
233
+ "input": ["text", "image"],
234
+ "output": ["text"]
113
235
  },
114
236
  "variants": {
115
237
  "low": {
@@ -141,13 +263,8 @@
141
263
  "output": 128000
142
264
  },
143
265
  "modalities": {
144
- "input": [
145
- "text",
146
- "image"
147
- ],
148
- "output": [
149
- "text"
150
- ]
266
+ "input": ["text", "image"],
267
+ "output": ["text"]
151
268
  },
152
269
  "variants": {
153
270
  "low": {
@@ -174,13 +291,8 @@
174
291
  "output": 128000
175
292
  },
176
293
  "modalities": {
177
- "input": [
178
- "text",
179
- "image"
180
- ],
181
- "output": [
182
- "text"
183
- ]
294
+ "input": ["text", "image"],
295
+ "output": ["text"]
184
296
  },
185
297
  "variants": {
186
298
  "medium": {
@@ -202,13 +314,8 @@
202
314
  "output": 128000
203
315
  },
204
316
  "modalities": {
205
- "input": [
206
- "text",
207
- "image"
208
- ],
209
- "output": [
210
- "text"
211
- ]
317
+ "input": ["text", "image"],
318
+ "output": ["text"]
212
319
  },
213
320
  "variants": {
214
321
  "none": {
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"}