You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides coding guidance for AI agents (including Claude Code, Codex,
4
4
5
5
## Overview
6
6
7
-
This is an **opencode plugin** that enables OAuth authentication with OpenAI's ChatGPT Plus/Pro Codex backend. It allows users to access `gpt-5-codex`, `gpt-5-codex-mini`, and `gpt-5` models through their ChatGPT subscription instead of using OpenAI Platform API credits.
7
+
This is an **opencode plugin** that enables OAuth authentication with OpenAI's ChatGPT Plus/Pro Codex backend. It allows users to access `gpt-5.1-codex`, `gpt-5.1-codex-mini`, `gpt-5-codex`, `gpt-5-codex-mini`, `gpt-5.1`, and `gpt-5` models through their ChatGPT subscription instead of using OpenAI Platform API credits.
8
8
9
9
**Key architecture principle**: 7-step fetch flow that intercepts opencode's OpenAI SDK requests, transforms them for the ChatGPT backend API, and handles OAuth token management.
10
10
@@ -41,7 +41,7 @@ The main entry point orchestrates a **7-step fetch flow**:
41
41
1.**Token Management**: Check token expiration, refresh if needed
42
42
2.**URL Rewriting**: Transform OpenAI Platform API URLs → ChatGPT backend API (`https://chatgpt.com/backend-api/codex/responses`)
43
43
3.**Request Transformation**:
44
-
- Normalize model names (all variants → `gpt-5`, `gpt-5-codex`, or `codex-mini-latest`)
44
+
- Normalize model names (all variants → `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-mini`, `gpt-5`, `gpt-5-codex`, or `codex-mini-latest`)
45
45
- Inject Codex system instructions from latest GitHub release
Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,15 @@
2
2
3
3
All notable changes to this project are documented here. Dates use the ISO format (YYYY-MM-DD).
4
4
5
+
## [3.2.0] - 2025-11-14
6
+
### Added
7
+
- GPT 5.1 model family support: normalization for `gpt-5.1`, `gpt-5.1-codex`, and `gpt-5.1-codex-mini` plus new GPT 5.1-only presets in the canonical `config/full-opencode.json`.
8
+
- Documentation updates (README, docs, AGENTS) describing the 5.1 families, their reasoning defaults, and how they map to ChatGPT slugs and token limits.
9
+
10
+
### Changed
11
+
- Model normalization docs and tests now explicitly cover both 5.0 and 5.1 Codex/general families and the two Codex Mini tiers.
12
+
- The legacy GPT 5.0 full configuration is now published as `config/full-opencode-gpt5.json`; new installs should prefer the 5.1 presets.
13
+
5
14
## [3.1.0] - 2025-11-11
6
15
### Added
7
16
- Codex Mini support end-to-end: normalization to the `codex-mini-latest` slug, proper reasoning defaults, and two new presets (`gpt-5-codex-mini-medium` / `gpt-5-codex-mini-high`).
- ✅ **Prompt caching** - Reuses responses across turns via stable `prompt_cache_key`
@@ -52,9 +53,15 @@ Follow me on [X @nummanthinks](https://x.com/nummanthinks) for future updates an
52
53
53
54
**No npm install needed!** opencode automatically installs plugins when you add them to your config.
54
55
55
-
#### Recommended: Full Configuration (Codex CLI Experience)
56
+
#### ⚠️ REQUIRED: Full Configuration (Only Supported Setup)
56
57
57
-
For the complete experience with all reasoning variants matching the official Codex CLI:
58
+
**IMPORTANT**: You MUST use the full configuration from [`config/full-opencode.json`](./config/full-opencode.json). Other configurations are not officially supported and may not work reliably.
59
+
60
+
**Why the full config is required:**
61
+
- GPT 5 models can be temperamental - some work, some don't, some may error
62
+
- The full config has been tested and verified to work
63
+
- Minimal configs lack proper model metadata for OpenCode features
64
+
- Older GPT 5.0 models are deprecated and being phased out by OpenAI
58
65
59
66
1.**Copy the full configuration** from [`config/full-opencode.json`](./config/full-opencode.json) to your opencode config file:
60
67
```json
@@ -75,8 +82,8 @@ For the complete experience with all reasoning variants matching the official Co
75
82
"store": false
76
83
},
77
84
"models": {
78
-
"gpt-5-codex-low": {
79
-
"name": "GPT 5 Codex Low (OAuth)",
85
+
"gpt-5.1-codex-low": {
86
+
"name": "GPT 5.1 Codex Low (OAuth)",
80
87
"limit": {
81
88
"context": 272000,
82
89
"output": 128000
@@ -91,8 +98,8 @@ For the complete experience with all reasoning variants matching the official Co
91
98
"store": false
92
99
}
93
100
},
94
-
"gpt-5-codex-medium": {
95
-
"name": "GPT 5 Codex Medium (OAuth)",
101
+
"gpt-5.1-codex-medium": {
102
+
"name": "GPT 5.1 Codex Medium (OAuth)",
96
103
"limit": {
97
104
"context": 272000,
98
105
"output": 128000
@@ -107,8 +114,8 @@ For the complete experience with all reasoning variants matching the official Co
107
114
"store": false
108
115
}
109
116
},
110
-
"gpt-5-codex-high": {
111
-
"name": "GPT 5 Codex High (OAuth)",
117
+
"gpt-5.1-codex-high": {
118
+
"name": "GPT 5.1 Codex High (OAuth)",
112
119
"limit": {
113
120
"context": 272000,
114
121
"output": 128000
@@ -123,11 +130,11 @@ For the complete experience with all reasoning variants matching the official Co
123
130
"store": false
124
131
}
125
132
},
126
-
"gpt-5-codex-mini-medium": {
127
-
"name": "GPT 5 Codex Mini Medium (OAuth)",
133
+
"gpt-5.1-codex-mini-medium": {
134
+
"name": "GPT 5.1 Codex Mini Medium (OAuth)",
128
135
"limit": {
129
-
"context": 200000,
130
-
"output": 100000
136
+
"context": 272000,
137
+
"output": 128000
131
138
},
132
139
"options": {
133
140
"reasoningEffort": "medium",
@@ -139,11 +146,11 @@ For the complete experience with all reasoning variants matching the official Co
139
146
"store": false
140
147
}
141
148
},
142
-
"gpt-5-codex-mini-high": {
143
-
"name": "GPT 5 Codex Mini High (OAuth)",
149
+
"gpt-5.1-codex-mini-high": {
150
+
"name": "GPT 5.1 Codex Mini High (OAuth)",
144
151
"limit": {
145
-
"context": 200000,
146
-
"output": 100000
152
+
"context": 272000,
153
+
"output": 128000
147
154
},
148
155
"options": {
149
156
"reasoningEffort": "high",
@@ -155,24 +162,8 @@ For the complete experience with all reasoning variants matching the official Co
155
162
"store": false
156
163
}
157
164
},
158
-
"gpt-5-minimal": {
159
-
"name": "GPT 5 Minimal (OAuth)",
160
-
"limit": {
161
-
"context": 272000,
162
-
"output": 128000
163
-
},
164
-
"options": {
165
-
"reasoningEffort": "minimal",
166
-
"reasoningSummary": "auto",
167
-
"textVerbosity": "low",
168
-
"include": [
169
-
"reasoning.encrypted_content"
170
-
],
171
-
"store": false
172
-
}
173
-
},
174
-
"gpt-5-low": {
175
-
"name": "GPT 5 Low (OAuth)",
165
+
"gpt-5.1-low": {
166
+
"name": "GPT 5.1 Low (OAuth)",
176
167
"limit": {
177
168
"context": 272000,
178
169
"output": 128000
@@ -187,8 +178,8 @@ For the complete experience with all reasoning variants matching the official Co
187
178
"store": false
188
179
}
189
180
},
190
-
"gpt-5-medium": {
191
-
"name": "GPT 5 Medium (OAuth)",
181
+
"gpt-5.1-medium": {
182
+
"name": "GPT 5.1 Medium (OAuth)",
192
183
"limit": {
193
184
"context": 272000,
194
185
"output": 128000
@@ -203,8 +194,8 @@ For the complete experience with all reasoning variants matching the official Co
203
194
"store": false
204
195
}
205
196
},
206
-
"gpt-5-high": {
207
-
"name": "GPT 5 High (OAuth)",
197
+
"gpt-5.1-high": {
198
+
"name": "GPT 5.1 High (OAuth)",
208
199
"limit": {
209
200
"context": 272000,
210
201
"output": 128000
@@ -218,38 +209,6 @@ For the complete experience with all reasoning variants matching the official Co
218
209
],
219
210
"store": false
220
211
}
221
-
},
222
-
"gpt-5-mini": {
223
-
"name": "GPT 5 Mini (OAuth)",
224
-
"limit": {
225
-
"context": 272000,
226
-
"output": 128000
227
-
},
228
-
"options": {
229
-
"reasoningEffort": "low",
230
-
"reasoningSummary": "auto",
231
-
"textVerbosity": "low",
232
-
"include": [
233
-
"reasoning.encrypted_content"
234
-
],
235
-
"store": false
236
-
}
237
-
},
238
-
"gpt-5-nano": {
239
-
"name": "GPT 5 Nano (OAuth)",
240
-
"limit": {
241
-
"context": 272000,
242
-
"output": 128000
243
-
},
244
-
"options": {
245
-
"reasoningEffort": "minimal",
246
-
"reasoningSummary": "auto",
247
-
"textVerbosity": "low",
248
-
"include": [
249
-
"reasoning.encrypted_content"
250
-
],
251
-
"store": false
252
-
}
253
212
}
254
213
}
255
214
}
@@ -260,25 +219,25 @@ For the complete experience with all reasoning variants matching the official Co
All appear in the opencode model selector as "GPT 5 Codex Low (OAuth)", "GPT 5 High (OAuth)", etc.
227
+
All appear in the opencode model selector as "GPT 5.1 Codex Low (OAuth)", "GPT 5.1 High (OAuth)", etc.
270
228
271
229
### Prompt caching & usage limits
272
230
273
231
Codex backend caching is enabled automatically. When OpenCode supplies a `prompt_cache_key` (its session identifier), the plugin forwards it unchanged so Codex can reuse work between turns. The plugin no longer synthesizes its own cache IDs—if the host omits `prompt_cache_key`, Codex will treat the turn as uncached. The bundled CODEX_MODE bridge prompt is synchronized with the latest Codex CLI release, so opencode and Codex stay in lock-step on tool availability. When your ChatGPT subscription nears a limit, opencode surfaces the plugin's friendly error message with the 5-hour and weekly windows, mirroring the Codex CLI summary.
274
232
275
-
> **Auto-compaction note:** OpenCode's context auto-compaction and usage sidebar only populate when the full configuration above is used (the minimal config lacks the per-model metadata OpenCode needs). Stick with `config/full-opencode.json` if you want live token counts and automatic history compaction inside the UI.
233
+
> **⚠️ IMPORTANT:**You MUST use the full configuration above. OpenCode's context auto-compaction and usage sidebar only work with the full config. Additionally, GPT 5 models require proper configuration - minimal configs are NOT supported and may fail unpredictably.
276
234
277
-
#### Alternative: Minimal Configuration
235
+
#### ❌ Minimal Configuration (NOT RECOMMENDED - DO NOT USE)
278
236
279
-
For a simpler setup (uses plugin defaults: medium reasoning, auto summaries):
237
+
**DO NOT use minimal configurations** - they are not supported for GPT 5.1 and will not work reliably:
280
238
281
239
```json
240
+
// ❌ DO NOT USE THIS - WILL NOT WORK RELIABLY
282
241
{
283
242
"$schema": "https://opencode.ai/config.json",
284
243
"plugin": [
@@ -288,7 +247,11 @@ For a simpler setup (uses plugin defaults: medium reasoning, auto summaries):
288
247
}
289
248
```
290
249
291
-
**Note**: This gives you basic functionality but you won't see the different reasoning variants in the model selector.
250
+
**Why this doesn't work:**
251
+
- GPT 5 models are temperamental and need proper configuration
252
+
- Missing model metadata breaks OpenCode features
253
+
- No support for usage limits or context compaction
254
+
- Cannot guarantee stable operation
292
255
293
256
2.**That's it!** opencode will auto-install the plugin on first run.
|`gpt-5.1-medium`| GPT 5.1 Medium (OAuth) | Medium | Balanced general-purpose tasks |
319
+
|`gpt-5.1-high`| GPT 5.1 High (OAuth) | High | Deep reasoning, complex problems |
320
+
321
+
**Usage**: `--model=openai/<CLI Model ID>` (e.g., `--model=openai/gpt-5.1-codex-low`)
322
+
**Display**: TUI shows the friendly name (e.g., "GPT 5.1 Codex Low (OAuth)")
323
+
324
+
> **Note**: All `gpt-5.1-codex-mini*` presets map directly to the `gpt-5.1-codex-mini` slug with standard Codex limits (272k context / 128k output).
325
+
326
+
> **⚠️ Important**: GPT 5 models can be temperamental - some variants may work better than others, some may give errors, and behavior may vary. Stick to the presets above configured in `full-opencode.json` for best results.
365
327
366
328
All accessed via your ChatGPT Plus/Pro subscription.
367
329
@@ -371,10 +333,10 @@ All accessed via your ChatGPT Plus/Pro subscription.
371
333
372
334
```yaml
373
335
# ✅ Correct
374
-
model: openai/gpt-5-codex-low
336
+
model: openai/gpt-5.1-codex-low
375
337
376
338
# ❌ Wrong - will fail
377
-
model: gpt-5-codex-low
339
+
model: gpt-5.1-codex-low
378
340
```
379
341
380
342
See [Configuration Guide](https://numman-ali.github.io/opencode-openai-codex-auth/configuration) for advanced usage.
@@ -399,12 +361,15 @@ These defaults match the official Codex CLI behavior and can be customized (see
399
361
400
362
## Configuration
401
363
402
-
### Recommended: Use Pre-Configured File
364
+
### ⚠️ REQUIRED: Use Pre-Configured File
403
365
404
-
The easiest way to get started is to use [`config/full-opencode.json`](./config/full-opencode.json), which provides:
405
-
-11 pre-configured model variants matching Codex CLI presets
406
-
- Optimal settings for each reasoning level
366
+
**YOU MUST use [`config/full-opencode.json`](./config/full-opencode.json)** - this is the only officially supported configuration:
367
+
-8 pre-configured GPT 5.1 model variants with verified settings
368
+
- Optimal configuration for each reasoning level
407
369
- All variants visible in the opencode model selector
370
+
- Required metadata for OpenCode features to work properly
371
+
372
+
**Do NOT use other configurations** - they are not supported and may fail unpredictably with GPT 5 models.
408
373
409
374
See [Installation](#installation) for setup instructions.
0 commit comments