Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 85 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Follow me on [X @nummanthinks](https://x.com/nummanthinks) for future updates an
## Features

- ✅ **ChatGPT Plus/Pro OAuth authentication** - Use your existing subscription
- ✅ **8 pre-configured GPT 5.1 variants** - GPT 5.1, GPT 5.1 Codex, and GPT 5.1 Codex Mini presets for common reasoning levels
- ✅ **12 pre-configured GPT 5.1 variants** - GPT 5.1 Codex Max, GPT 5.1, GPT 5.1 Codex, and GPT 5.1 Codex Mini presets
- ⚠️ **GPT 5.1 only** - Older GPT 5.0 models are deprecated and may not work reliably
- ✅ **Zero external dependencies** - Lightweight with only @openauthjs/openauth
- ✅ **Auto-refreshing tokens** - Handles token expiration automatically
Expand Down Expand Up @@ -82,6 +82,70 @@ Follow me on [X @nummanthinks](https://x.com/nummanthinks) for future updates an
"store": false
},
"models": {
"gpt-5.1-codex-max-low": {
"name": "GPT 5.1 Codex Max Low (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-medium": {
"name": "GPT 5.1 Codex Max Medium (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-high": {
"name": "GPT 5.1 Codex Max High (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-xhigh": {
"name": "GPT 5.1 Codex Max XHigh (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-low": {
"name": "GPT 5.1 Codex Low (OAuth)",
"limit": {
Expand Down Expand Up @@ -219,12 +283,13 @@ Follow me on [X @nummanthinks](https://x.com/nummanthinks) for future updates an
**Global config**: `~/.config/opencode/opencode.json`
**Project config**: `<project>/.opencode.json`

This gives you 8 GPT 5.1 variants with different reasoning levels:
This gives you 12 GPT 5.1 variants with different reasoning levels:
- **gpt-5.1-codex-max** (low/medium/high/xhigh) - Latest Codex-optimized flagship for deep reasoning
- **gpt-5.1-codex** (low/medium/high) - Latest Codex model presets
- **gpt-5.1-codex-mini** (medium/high) - Latest Codex mini tier presets
- **gpt-5.1** (low/medium/high) - Latest general-purpose reasoning presets

All appear in the opencode model selector as "GPT 5.1 Codex Low (OAuth)", "GPT 5.1 High (OAuth)", etc.
All appear in the opencode model selector as "GPT 5.1 Codex Max Low (OAuth)", "GPT 5.1 Codex Low (OAuth)", etc.

### Prompt caching & usage limits

Expand Down Expand Up @@ -290,6 +355,10 @@ Check [releases](https://github.com/numman-ali/opencode-openai-codex-auth/releas
If using the full configuration, select from the model picker in opencode, or specify via command line:

```bash
# Use different reasoning levels for gpt-5.1-codex-max
opencode run "complex architectural task" --model=openai/gpt-5.1-codex-max-xhigh
opencode run "refactor codebase" --model=openai/gpt-5.1-codex-max-high

# Use different reasoning levels for gpt-5.1-codex
opencode run "simple task" --model=openai/gpt-5.1-codex-low
opencode run "complex task" --model=openai/gpt-5.1-codex-high
Expand All @@ -309,6 +378,10 @@ When using [`config/full-opencode.json`](./config/full-opencode.json), you get t

| CLI Model ID | TUI Display Name | Reasoning Effort | Best For |
|--------------|------------------|-----------------|----------|
| `gpt-5.1-codex-max-low` | GPT 5.1 Codex Max Low (OAuth) | Low | Fast responses with lighter reasoning |
| `gpt-5.1-codex-max-medium` | GPT 5.1 Codex Max Medium (OAuth) | Medium | Balanced speed and reasoning depth |
| `gpt-5.1-codex-max-high` | GPT 5.1 Codex Max High (OAuth) | High | Complex problems |
| `gpt-5.1-codex-max-xhigh` | GPT 5.1 Codex Max XHigh (OAuth) | XHigh | Extra high reasoning depth |
| `gpt-5.1-codex-low` | GPT 5.1 Codex Low (OAuth) | Low | Fast code generation |
| `gpt-5.1-codex-medium` | GPT 5.1 Codex Medium (OAuth) | Medium | Balanced code tasks |
| `gpt-5.1-codex-high` | GPT 5.1 Codex High (OAuth) | High | Complex code & tools |
Expand Down Expand Up @@ -364,7 +437,7 @@ These defaults match the official Codex CLI behavior and can be customized (see
### ⚠️ REQUIRED: Use Pre-Configured File

**YOU MUST use [`config/full-opencode.json`](./config/full-opencode.json)** - this is the only officially supported configuration:
- 8 pre-configured GPT 5.1 model variants with verified settings
- 12 pre-configured GPT 5.1 model variants with verified settings
- Optimal configuration for each reasoning level
- All variants visible in the opencode model selector
- Required metadata for OpenCode features to work properly
Expand All @@ -379,16 +452,16 @@ If you want to customize settings yourself, you can configure options at provide

#### Available Settings

⚠️ **Important**: The two base models have different supported values.
⚠️ **Important**: The base models have different supported values.

| Setting | GPT-5 Values | GPT-5-Codex Values | Plugin Default |
|---------|-------------|-------------------|----------------|
| `reasoningEffort` | `minimal`, `low`, `medium`, `high` | `low`, `medium`, `high` | `medium` |
| `reasoningSummary` | `auto`, `detailed` | `auto`, `detailed` | `auto` |
| `textVerbosity` | `low`, `medium`, `high` | `medium` only | `medium` |
| `include` | Array of strings | Array of strings | `["reasoning.encrypted_content"]` |
| Setting | GPT-5-Codex-Max Values | GPT-5 Values | GPT-5-Codex Values | Plugin Default |
|---------|------------------------|-------------|-------------------|----------------|
| `reasoningEffort` | `low`, `medium`, `high`, `xhigh` | `minimal`, `low`, `medium`, `high` | `low`, `medium`, `high` | `medium` |
| `reasoningSummary` | `auto`, `detailed` | `auto`, `detailed` | `auto`, `detailed` | `auto` |
| `textVerbosity` | `medium` only | `low`, `medium`, `high` | `medium` only | `medium` |
| `include` | Array of strings | Array of strings | Array of strings | `["reasoning.encrypted_content"]` |

> **Note**: `minimal` effort is auto-normalized to `low` for gpt-5-codex (not supported by the API).
> **Note**: `minimal` effort is auto-normalized to `low` for gpt-5-codex (not supported by the API). `gpt-5.1-codex-max` supports `xhigh`.

#### Global Configuration Example

Expand Down
4 changes: 2 additions & 2 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ cp config/full-opencode.json ~/.config/opencode/opencode.json

**Why this is required:**
- GPT 5 models can be temperamental and need proper configuration
- Contains 8 verified GPT 5.1 model variants (Codex, Codex Mini, and general GPT 5.1)
- Contains 12 verified GPT 5.1 model variants (Codex Max, Codex, Codex Mini, and general GPT 5.1)
- Includes all required metadata for OpenCode features
- Guaranteed to work reliably
- Global options for all models + per-model configuration overrides

**What's included:**
- All supported GPT 5.1 variants: gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini
- All supported GPT 5.1 variants: gpt-5.1-codex-max, gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini
- Proper reasoning effort settings for each variant
- Context limits (272k context / 128k output)
- Required options: `store: false`, `include: ["reasoning.encrypted_content"]`
Expand Down
64 changes: 64 additions & 0 deletions config/full-opencode.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,70 @@
"store": false
},
"models": {
"gpt-5.1-codex-max-low": {
"name": "GPT 5.1 Codex Max Low (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-medium": {
"name": "GPT 5.1 Codex Max Medium (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-high": {
"name": "GPT 5.1 Codex Max High (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-max-xhigh": {
"name": "GPT 5.1 Codex Max XHigh (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
}
},
"gpt-5.1-codex-low": {
"name": "GPT 5.1 Codex Low (OAuth)",
"limit": {
Expand Down
25 changes: 23 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ Complete reference for configuring the OpenCode OpenAI Codex Auth Plugin.
"store": false
},
"models": {
"gpt-5.1-codex-max-low": {
"name": "GPT 5.1 Codex Max Low (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"options": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": ["reasoning.encrypted_content"],
"store": false
}
},
"gpt-5.1-codex-low": {
"name": "GPT 5.1 Codex Low (OAuth)",
"limit": {
Expand Down Expand Up @@ -46,6 +60,12 @@ Complete reference for configuring the OpenCode OpenAI Codex Auth Plugin.

Controls computational effort for reasoning.

**GPT-5.1-Codex-Max Values:**
- `low` - Fast responses
- `medium` - Balanced (default)
- `high` - Deep reasoning
- `xhigh` - Extra high reasoning depth

**GPT-5 Values:**
- `minimal` - Fastest, least reasoning
- `low` - Light reasoning
Expand All @@ -60,12 +80,13 @@ Controls computational effort for reasoning.
**Notes**:
- `minimal` auto-converts to `low` for gpt-5-codex (API limitation)
- `gpt-5-codex-mini*` and `gpt-5.1-codex-mini*` only support `medium` or `high`; lower settings are clamped to `medium`
- `xhigh` is only supported by `gpt-5.1-codex-max`

**Example:**
```json
{
"options": {
"reasoningEffort": "high"
"reasoningEffort": "xhigh"
}
}
```
Expand Down Expand Up @@ -96,7 +117,7 @@ Controls output length.
- `medium` - Balanced (default)
- `high` - Verbose

**GPT-5-Codex:**
**GPT-5-Codex & GPT-5.1-Codex-Max:**
- `medium` only (API limitation)

**Example:**
Expand Down
9 changes: 9 additions & 0 deletions lib/request/helpers/model-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
* Value: The normalized model name to send to the API
*/
export const MODEL_MAP: Record<string, string> = {
// ============================================================================
// GPT-5.1 Codex Max Models
// ============================================================================
"gpt-5.1-codex-max": "gpt-5.1-codex-max",
"gpt-5.1-codex-max-low": "gpt-5.1-codex-max",
"gpt-5.1-codex-max-medium": "gpt-5.1-codex-max",
"gpt-5.1-codex-max-high": "gpt-5.1-codex-max",
"gpt-5.1-codex-max-xhigh": "gpt-5.1-codex-max",

// ============================================================================
// GPT-5.1 Codex Models
// ============================================================================
Expand Down
14 changes: 11 additions & 3 deletions lib/request/request-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,23 @@ export function normalizeModel(model: string | undefined): string {
const normalized = modelId.toLowerCase();

// Priority order for pattern matching (most specific first):
// 1. GPT-5.1 Codex Mini
// 1. GPT-5.1 Codex Max
if (
normalized.includes("gpt-5.1-codex-max") ||
normalized.includes("gpt 5.1 codex max")
) {
return "gpt-5.1-codex-max";
}

// 2. GPT-5.1 Codex Mini
if (
normalized.includes("gpt-5.1-codex-mini") ||
normalized.includes("gpt 5.1 codex mini")
) {
return "gpt-5.1-codex-mini";
}

// 2. Legacy Codex Mini
// 3. Legacy Codex Mini
if (
normalized.includes("codex-mini-latest") ||
normalized.includes("gpt-5-codex-mini") ||
Expand Down Expand Up @@ -129,7 +137,7 @@ export function getReasoningConfig(
normalizedOriginal.includes("mini"));

// Default based on model type (Codex CLI defaults)
const defaultEffort: "minimal" | "low" | "medium" | "high" = isCodexMini
const defaultEffort: "minimal" | "low" | "medium" | "high" | "xhigh" = isCodexMini
? "medium"
: isLightweight
? "minimal"
Expand Down
4 changes: 2 additions & 2 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface UserConfig {
* Configuration options for reasoning and text settings
*/
export interface ConfigOptions {
reasoningEffort?: "minimal" | "low" | "medium" | "high";
reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";
reasoningSummary?: "auto" | "concise" | "detailed";
textVerbosity?: "low" | "medium" | "high";
include?: string[];
Expand All @@ -37,7 +37,7 @@ export interface ConfigOptions {
* Reasoning configuration for requests
*/
export interface ReasoningConfig {
effort: "minimal" | "low" | "medium" | "high";
effort: "minimal" | "low" | "medium" | "high" | "xhigh";
summary: "auto" | "concise" | "detailed";
}

Expand Down
Loading