opencode-codex-auth-rotation 1.0.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.
Files changed (95) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +170 -0
  3. package/assets/codex-auth.schema.json +26 -0
  4. package/assets/opencode-logo-ornate-dark.svg +18 -0
  5. package/assets/readme-hero.svg +31 -0
  6. package/config/README.md +103 -0
  7. package/config/minimal-opencode.json +12 -0
  8. package/config/opencode-legacy.json +571 -0
  9. package/config/opencode-modern.json +239 -0
  10. package/dist/index.d.ts +42 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +299 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/lib/auth/auth.d.ts +43 -0
  15. package/dist/lib/auth/auth.d.ts.map +1 -0
  16. package/dist/lib/auth/auth.js +163 -0
  17. package/dist/lib/auth/auth.js.map +1 -0
  18. package/dist/lib/auth/browser.d.ts +17 -0
  19. package/dist/lib/auth/browser.d.ts.map +1 -0
  20. package/dist/lib/auth/browser.js +76 -0
  21. package/dist/lib/auth/browser.js.map +1 -0
  22. package/dist/lib/auth/server.d.ts +10 -0
  23. package/dist/lib/auth/server.d.ts.map +1 -0
  24. package/dist/lib/auth/server.js +78 -0
  25. package/dist/lib/auth/server.js.map +1 -0
  26. package/dist/lib/config.d.ts +33 -0
  27. package/dist/lib/config.d.ts.map +1 -0
  28. package/dist/lib/config.js +84 -0
  29. package/dist/lib/config.js.map +1 -0
  30. package/dist/lib/constants.d.ts +67 -0
  31. package/dist/lib/constants.d.ts.map +1 -0
  32. package/dist/lib/constants.js +67 -0
  33. package/dist/lib/constants.js.map +1 -0
  34. package/dist/lib/logger.d.ts +21 -0
  35. package/dist/lib/logger.d.ts.map +1 -0
  36. package/dist/lib/logger.js +77 -0
  37. package/dist/lib/logger.js.map +1 -0
  38. package/dist/lib/oauth-success.html +712 -0
  39. package/dist/lib/prompts/codex-opencode-bridge.d.ts +19 -0
  40. package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
  41. package/dist/lib/prompts/codex-opencode-bridge.js +152 -0
  42. package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
  43. package/dist/lib/prompts/codex.d.ts +27 -0
  44. package/dist/lib/prompts/codex.d.ts.map +1 -0
  45. package/dist/lib/prompts/codex.js +241 -0
  46. package/dist/lib/prompts/codex.js.map +1 -0
  47. package/dist/lib/prompts/opencode-codex.d.ts +21 -0
  48. package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
  49. package/dist/lib/prompts/opencode-codex.js +91 -0
  50. package/dist/lib/prompts/opencode-codex.js.map +1 -0
  51. package/dist/lib/request/fetch-helpers.d.ts +73 -0
  52. package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
  53. package/dist/lib/request/fetch-helpers.js +221 -0
  54. package/dist/lib/request/fetch-helpers.js.map +1 -0
  55. package/dist/lib/request/helpers/input-utils.d.ts +6 -0
  56. package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
  57. package/dist/lib/request/helpers/input-utils.js +174 -0
  58. package/dist/lib/request/helpers/input-utils.js.map +1 -0
  59. package/dist/lib/request/helpers/model-map.d.ts +28 -0
  60. package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
  61. package/dist/lib/request/helpers/model-map.js +109 -0
  62. package/dist/lib/request/helpers/model-map.js.map +1 -0
  63. package/dist/lib/request/request-transformer.d.ts +93 -0
  64. package/dist/lib/request/request-transformer.d.ts.map +1 -0
  65. package/dist/lib/request/request-transformer.js +403 -0
  66. package/dist/lib/request/request-transformer.js.map +1 -0
  67. package/dist/lib/request/response-handler.d.ts +14 -0
  68. package/dist/lib/request/response-handler.d.ts.map +1 -0
  69. package/dist/lib/request/response-handler.js +88 -0
  70. package/dist/lib/request/response-handler.js.map +1 -0
  71. package/dist/lib/types.d.ts +184 -0
  72. package/dist/lib/types.d.ts.map +1 -0
  73. package/dist/lib/types.js +2 -0
  74. package/dist/lib/types.js.map +1 -0
  75. package/dist/src/plugin/accounts.d.ts +21 -0
  76. package/dist/src/plugin/accounts.d.ts.map +1 -0
  77. package/dist/src/plugin/accounts.js +53 -0
  78. package/dist/src/plugin/accounts.js.map +1 -0
  79. package/dist/src/plugin/config/schema.d.ts +38 -0
  80. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  81. package/dist/src/plugin/config/schema.js +32 -0
  82. package/dist/src/plugin/config/schema.js.map +1 -0
  83. package/dist/src/plugin/storage.d.ts +15 -0
  84. package/dist/src/plugin/storage.d.ts.map +1 -0
  85. package/dist/src/plugin/storage.js +38 -0
  86. package/dist/src/plugin/storage.js.map +1 -0
  87. package/dist/src/plugin/usage.d.ts +9 -0
  88. package/dist/src/plugin/usage.d.ts.map +1 -0
  89. package/dist/src/plugin/usage.js +76 -0
  90. package/dist/src/plugin/usage.js.map +1 -0
  91. package/package.json +74 -0
  92. package/scripts/check-usage.ts +92 -0
  93. package/scripts/install-opencode-codex-auth.js +430 -0
  94. package/scripts/test-all-models.sh +259 -0
  95. package/scripts/validate-model-map.sh +97 -0
package/LICENSE ADDED
@@ -0,0 +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.
package/README.md ADDED
@@ -0,0 +1,170 @@
1
+ ![Image 1: opencode-openai-codex-auth](assets/readme-hero.svg)
2
+
3
+
4
+ **Curated by [Numman Ali](https://x.com/nummanali)**
5
+ [![Twitter Follow](https://img.shields.io/twitter/follow/nummanali?style=social)](https://x.com/nummanali)
6
+ [![npm version](https://img.shields.io/npm/v/opencode-openai-codex-auth.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth)
7
+ [![Tests](https://github.com/numman-ali/opencode-openai-codex-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/numman-ali/opencode-openai-codex-auth/actions)
8
+ [![npm downloads](https://img.shields.io/npm/dm/opencode-openai-codex-auth.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth)
9
+ **One install. Every Codex model.**
10
+ [Install](#-quick-start) · [Models](#-models) · [Configuration](#-configuration) · [Docs](#-docs)
11
+
12
+ ---
13
+ ## 💡 Philosophy
14
+ > **"One config. Every model."**
15
+ OpenCode should feel effortless. This plugin keeps the setup minimal while giving you full GPT‑5.x + Codex access via ChatGPT OAuth.
16
+ ```
17
+ ┌─────────────────────────────────────────────────────────┐
18
+ │ │
19
+ │ ChatGPT OAuth → Codex backend → OpenCode │
20
+ │ One command install, full model presets, done. │
21
+ │ │
22
+ └─────────────────────────────────────────────────────────┘
23
+ ```
24
+ ---
25
+ ## 🚀 Quick Start
26
+ ```bash
27
+ npx -y opencode-openai-codex-auth@latest
28
+ ```
29
+ Then:
30
+ ```bash
31
+ opencode auth login
32
+ opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
33
+ ```
34
+ Legacy OpenCode (v1.0.209 and below):
35
+ ```bash
36
+ npx -y opencode-openai-codex-auth@latest --legacy
37
+ opencode run "write hello world to test.txt" --model=openai/gpt-5.2-medium
38
+ ```
39
+ Uninstall:
40
+ ```bash
41
+ npx -y opencode-openai-codex-auth@latest --uninstall
42
+ npx -y opencode-openai-codex-auth@latest --uninstall --all
43
+ ```
44
+ ---
45
+ ## 📦 Models
46
+ - **gpt-5.2** (none/low/medium/high/xhigh)
47
+ - **gpt-5.2-codex** (low/medium/high/xhigh)
48
+ - **gpt-5.1-codex-max** (low/medium/high/xhigh)
49
+ - **gpt-5.1-codex** (low/medium/high)
50
+ - **gpt-5.1-codex-mini** (medium/high)
51
+ - **gpt-5.1** (none/low/medium/high)
52
+ ---
53
+ ## 🧩 Configuration
54
+ - Modern (OpenCode v1.0.210+): `config/opencode-modern.json`
55
+ - Legacy (OpenCode v1.0.209 and below): `config/opencode-legacy.json`
56
+
57
+ Minimal configs are not supported for GPT‑5.x; use the full configs above.
58
+ ---
59
+ ## ✅ Features
60
+ - ChatGPT Plus/Pro OAuth authentication (official flow)
61
+ - 22 model presets across GPT‑5.2 / GPT‑5.2 Codex / GPT‑5.1 families
62
+ - Variant system support (v1.0.210+) + legacy presets
63
+ - Multimodal input enabled for all models
64
+ - Usage‑aware errors + automatic token refresh
65
+ ---
66
+ ## 📚 Docs
67
+ - Getting Started: `docs/getting-started.md`
68
+ - Configuration: `docs/configuration.md`
69
+ - Troubleshooting: `docs/troubleshooting.md`
70
+ - Architecture: `docs/development/ARCHITECTURE.md`
71
+ ---
72
+ ## 🔄 Multi-Account Setup Guide
73
+
74
+ This plugin supports **multiple ChatGPT accounts** for automatic failover when rate limits occur.
75
+
76
+ ### Configuration
77
+
78
+ Account credentials are stored in `~/.config/opencode/codex-accounts.json`:
79
+
80
+ ```json
81
+ {
82
+ "version": 1,
83
+ "accounts": [
84
+ {
85
+ "id": "account-1",
86
+ "email": "user1@example.com",
87
+ "accessToken": "YOUR_ACCESS_TOKEN_1",
88
+ "refreshToken": "YOUR_REFRESH_TOKEN_1",
89
+ "chatgptAccountId": "chatgpt-account-id-1",
90
+ "enabled": true
91
+ },
92
+ {
93
+ "id": "account-2",
94
+ "email": "user2@example.com",
95
+ "accessToken": "YOUR_ACCESS_TOKEN_2",
96
+ "refreshToken": "YOUR_REFRESH_TOKEN_2",
97
+ "chatgptAccountId": "chatgpt-account-id-2",
98
+ "enabled": true
99
+ }
100
+ ],
101
+ "activeIndex": 0
102
+ }
103
+ ```
104
+
105
+ ### Account Rotation Strategies
106
+
107
+ The plugin supports three rotation strategies:
108
+
109
+ | Strategy | Description | Best For |
110
+ |----------|-------------|----------|
111
+ | **Sticky** (default) | Stay with current account until rate-limited | Low-volume usage |
112
+ | **Round-Robin** | Rotate sequentially through accounts | Even distribution |
113
+
114
+ Environment variable: `CODEX_ACCOUNT_STRATEGY=sticky|round-robin`
115
+
116
+ ## 🔄 Usage-Based Account Selection
117
+
118
+ This plugin selects accounts based on actual ChatGPT usage data from the `/wham/usage` API.
119
+
120
+ ### 30/60/90% Equal Distribution Strategy
121
+
122
+ 1. **Weekly usage buckets**: Accounts are grouped by weekly usage percentage
123
+ - Bucket 0: 0-30%
124
+ - Bucket 1: 30-60%
125
+ - Bucket 2: 60-90%
126
+ - Bucket 3: 90%+
127
+
128
+ 2. **Selection logic**:
129
+ - Filter accounts with the lowest weekly bucket
130
+ - Among those, select the one with lowest 5-hour usage
131
+ - This ensures all accounts reach similar usage levels before moving to the next bucket
132
+
133
+ ### Usage Debugging
134
+
135
+ Check current usage for all accounts:
136
+ ```bash
137
+ bun run scripts/check-usage.ts
138
+ ```
139
+
140
+ JSON output:
141
+ ```bash
142
+ bun run scripts/check-usage.ts --json
143
+ ```
144
+
145
+ ### Automatic Failover
146
+
147
+ When a **429 Rate Limit** error occurs:
148
+
149
+ 1. Current account is marked with `rateLimitResetTime`
150
+ 2. Plugin automatically switches to next available account
151
+ 3. Rate-limited account is skipped until reset time passes
152
+
153
+ ### Adding Multiple Accounts
154
+
155
+ 1. Run the OAuth flow for each account:
156
+ ```bash
157
+ opencode auth login
158
+ ```
159
+
160
+ 2. The plugin will automatically add new accounts to the configuration.
161
+
162
+ 3. You can manually enable/disable accounts by setting `"enabled": false`.
163
+
164
+ ---
165
+
166
+ ## ⚠️ Usage Notice
167
+ This plugin is for **personal development use** with your own ChatGPT Plus/Pro subscription.
168
+ For production or multi‑user applications, use the OpenAI Platform API.
169
+
170
+ **Built for developers who value simplicity.**
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/numman-ali/opencode-openai-codex-auth/blob/main/assets/codex-auth.schema.json",
4
+ "title": "Codex Auth Plugin Configuration",
5
+ "description": "Configuration schema for opencode-openai-codex-auth plugin",
6
+ "type": "object",
7
+ "properties": {
8
+ "codexMode": {
9
+ "type": "boolean",
10
+ "default": true,
11
+ "description": "Enable CODEX_MODE (Codex-OpenCode bridge prompt instead of tool remap)"
12
+ },
13
+ "strategy": {
14
+ "type": "string",
15
+ "enum": ["sticky", "round-robin"],
16
+ "default": "sticky",
17
+ "description": "Account selection strategy. sticky: stay with current account until rate-limited. round-robin: rotate through accounts based on usage."
18
+ },
19
+ "pidOffset": {
20
+ "type": "boolean",
21
+ "default": false,
22
+ "description": "Enable PID-based offset for initial account selection. Distributes starting accounts across parallel processes."
23
+ }
24
+ },
25
+ "additionalProperties": false
26
+ }
@@ -0,0 +1,18 @@
1
+ <svg width="234" height="42" viewBox="0 0 234 42" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18 30H6V18H18V30Z" fill="#4B4646"/>
3
+ <path d="M18 12H6V30H18V12ZM24 36H0V6H24V36Z" fill="#B7B1B1"/>
4
+ <path d="M48 30H36V18H48V30Z" fill="#4B4646"/>
5
+ <path d="M36 30H48V12H36V30ZM54 36H36V42H30V6H54V36Z" fill="#B7B1B1"/>
6
+ <path d="M84 24V30H66V24H84Z" fill="#4B4646"/>
7
+ <path d="M84 24H66V30H84V36H60V6H84V24ZM66 18H78V12H66V18Z" fill="#B7B1B1"/>
8
+ <path d="M108 36H96V18H108V36Z" fill="#4B4646"/>
9
+ <path d="M108 12H96V36H90V6H108V12ZM114 36H108V12H114V36Z" fill="#B7B1B1"/>
10
+ <path d="M144 30H126V18H144V30Z" fill="#4B4646"/>
11
+ <path d="M144 12H126V30H144V36H120V6H144V12Z" fill="#F1ECEC"/>
12
+ <path d="M168 30H156V18H168V30Z" fill="#4B4646"/>
13
+ <path d="M168 12H156V30H168V12ZM174 36H150V6H174V36Z" fill="#F1ECEC"/>
14
+ <path d="M198 30H186V18H198V30Z" fill="#4B4646"/>
15
+ <path d="M198 12H186V30H198V12ZM204 36H180V6H198V0H204V36Z" fill="#F1ECEC"/>
16
+ <path d="M234 24V30H216V24H234Z" fill="#4B4646"/>
17
+ <path d="M216 12V18H228V12H216ZM234 24H216V30H234V36H210V6H234V24Z" fill="#F1ECEC"/>
18
+ </svg>
@@ -0,0 +1,31 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="300" viewBox="0 0 1200 300" role="img" aria-label="OpenCode Codex OAuth">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0%" stop-color="#0f172a" />
5
+ <stop offset="100%" stop-color="#1f2937" />
6
+ </linearGradient>
7
+ <linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">
8
+ <stop offset="0%" stop-color="#38bdf8" />
9
+ <stop offset="100%" stop-color="#22d3ee" />
10
+ </linearGradient>
11
+ </defs>
12
+ <rect width="1200" height="300" rx="28" fill="url(#bg)" />
13
+ <g opacity="0.12">
14
+ <circle cx="1020" cy="70" r="120" fill="#38bdf8" />
15
+ <circle cx="150" cy="260" r="140" fill="#22d3ee" />
16
+ </g>
17
+ <g fill="none" stroke="url(#accent)" stroke-width="8" stroke-linecap="round" stroke-linejoin="round">
18
+ <path d="M160 95 L100 150 L160 205" />
19
+ <path d="M280 95 L340 150 L280 205" />
20
+ <path d="M205 80 L235 220" />
21
+ </g>
22
+ <text x="420" y="120" fill="#e2e8f0" font-size="42" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif" font-weight="600">
23
+ OpenCode Codex OAuth
24
+ </text>
25
+ <text x="420" y="170" fill="#cbd5f5" font-size="24" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif">
26
+ ChatGPT Plus/Pro auth for GPT-5.2 and Codex models
27
+ </text>
28
+ <text x="420" y="220" fill="#7dd3fc" font-size="18" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif">
29
+ One-command install, modern variants, full tool support
30
+ </text>
31
+ </svg>
@@ -0,0 +1,103 @@
1
+ # Configuration
2
+
3
+ This directory contains the official opencode configuration files for the OpenAI Codex OAuth plugin.
4
+
5
+ ## ⚠️ REQUIRED: Choose the Right Configuration
6
+
7
+ **Two configuration files are available based on your OpenCode version:**
8
+
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 |
13
+
14
+ ### Which one should I use?
15
+
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
+ ```
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 (`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`
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "plugin": ["opencode-openai-codex-auth"],
4
+ "provider": {
5
+ "openai": {
6
+ "options": {
7
+ "store": false
8
+ }
9
+ }
10
+ },
11
+ "model": "openai/gpt-5-codex"
12
+ }