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
296 changes: 159 additions & 137 deletions README.md

Large diffs are not rendered by default.

110 changes: 76 additions & 34 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,101 @@
# Configuration

This directory contains the official opencode configuration for the OpenAI Codex OAuth plugin.
This directory contains the official opencode configuration files for the OpenAI Codex OAuth plugin.

## ⚠️ REQUIRED Configuration File
## ⚠️ REQUIRED: Choose the Right Configuration

### full-opencode.json (REQUIRED - USE THIS ONLY)
**Two configuration files are available based on your OpenCode version:**

**YOU MUST use this configuration file** - it is the ONLY officially supported setup:
| File | OpenCode Version | Description |
|------|------------------|-------------|
| [`opencode-modern.json`](./opencode-modern.json) | **v1.0.210+ (Jan 2026+)** | Compact config using variants system - 6 models with built-in reasoning level variants |
| [`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 |

### Which one should I use?

**If you have OpenCode v1.0.210 or newer** (check with `opencode --version`):
```bash
cp config/opencode-modern.json ~/.config/opencode/opencode.json
```

**If you have OpenCode v1.0.209 or older**:
```bash
cp config/full-opencode.json ~/.config/opencode/opencode.json
cp config/opencode-legacy.json ~/.config/opencode/opencode.json
```

**Why this is required:**
- GPT 5 models can be temperamental and need proper configuration
- Contains 22 verified GPT 5.2/5.1 model variants (GPT 5.2, GPT 5.2 Codex, Codex, Codex Max, Codex Mini, and general GPT 5.1 including `gpt-5.1-codex-max-low/medium/high/xhigh`)
- Includes all required metadata for OpenCode features
- Guaranteed to work reliably
- Global options for all models + per-model configuration overrides
### Why two configs?

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.

**What you get:**

**What's included:**
- 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
- Proper reasoning effort settings for each variant (including new `xhigh` for Codex Max)
- Context limits (272k context / 128k output for all Codex families, including Codex Max)
- Required options: `store: false`, `include: ["reasoning.encrypted_content"]`
| Config File | Model Families | Reasoning Variants | Total Models |
|------------|----------------|-------------------|--------------|
| `opencode-modern.json` | 6 | Built-in variants (low/medium/high/xhigh) | 6 base models with 19 total variants |
| `opencode-legacy.json` | 6 | Separate model entries | 20 individual model definitions |

### ❌ Other Configurations (NOT SUPPORTED)
Both configs provide:
- ✅ 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
- ✅ Proper reasoning effort settings for each variant (including `xhigh` for Codex Max/5.2)
- ✅ Context limits (272k context / 128k output for all Codex families)
- ✅ Required options: `store: false`, `include: ["reasoning.encrypted_content"]`
- ✅ Image input support for all models
- ✅ All required metadata for OpenCode features

**DO NOT use:**
- `minimal-opencode.json` - NOT supported, will fail unpredictably
- `full-opencode-gpt5.json` - DEPRECATED, GPT 5.0 models are being phased out by OpenAI
- Custom configurations - NOT recommended, may not work reliably
### Modern Config Benefits (v1.0.210+)

**Why other configs don't work:**
- GPT 5 models need specific configurations
- Missing metadata breaks OpenCode features
- No support for usage limits or context compaction
- Cannot guarantee stable operation
- **74% smaller**: 150 lines vs 572 lines
- **DRY**: Common options defined once at provider level
- **Variant cycling**: Built-in support for `Ctrl+T` to switch reasoning levels
- **Easier maintenance**: Add new variants without copying model definitions

## Usage

**ONLY ONE OPTION** - use the full configuration:
1. **Check your OpenCode version**:
```bash
opencode --version
```

1. Copy `full-opencode.json` to your opencode config directory:
- Global: `~/.config/opencode/opencode.json`
- Project: `<project>/.opencode.json`
2. **Copy the appropriate config** based on your version:
```bash
# For v1.0.210+ (recommended):
cp config/opencode-modern.json ~/.config/opencode/opencode.json

2. **DO NOT modify** the configuration unless you know exactly what you're doing. The provided settings have been tested and verified to work.
# For older versions:
cp config/opencode-legacy.json ~/.config/opencode/opencode.json
```

3. Run opencode: `opencode run "your prompt" --model=openai/gpt-5.1-codex-medium`
3. **Run opencode**:
```bash
# Modern config (v1.0.210+):
opencode run "task" --model=openai/gpt-5.2:medium
opencode run "task" --model=openai/gpt-5.2:high

> **⚠️ Critical**: GPT 5 models require this exact configuration. Do not use minimal configs or create custom variants - they are not supported and will fail unpredictably.
# Legacy config:
opencode run "task" --model=openai/gpt-5.2-medium
opencode run "task" --model=openai/gpt-5.2-high
```

> **⚠️ 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.

## Available Models

Both configs provide access to the same model families:

- **gpt-5.2** (none/low/medium/high/xhigh) - Latest GPT 5.2 model with full reasoning support
- **gpt-5.2-codex** (low/medium/high/xhigh) - GPT 5.2 Codex presets
- **gpt-5.1-codex-max** (low/medium/high/xhigh) - Codex Max presets
- **gpt-5.1-codex** (low/medium/high) - Codex model presets
- **gpt-5.1-codex-mini** (medium/high) - Codex mini tier presets
- **gpt-5.1** (none/low/medium/high) - General-purpose reasoning presets

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

## Configuration Options

See the main [README.md](../README.md#configuration) for detailed documentation of all configuration options.

**Remember**: Use `full-opencode.json` as-is for guaranteed compatibility. Custom configurations are not officially supported.
## Version History

- **January 2026 (v1.0.210+)**: Introduced variant system support. Use `opencode-modern.json`
- **December 2025 and earlier**: Use `opencode-legacy.json`
File renamed without changes.
239 changes: 239 additions & 0 deletions config/opencode-modern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"opencode-openai-codex-auth@4.2.0"
],
"provider": {
"openai": {
"options": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium",
"include": [
"reasoning.encrypted_content"
],
"store": false
},
"models": {
"gpt-5.2": {
"name": "GPT 5.2 (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"none": {
"reasoningEffort": "none",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.2-codex": {
"name": "GPT 5.2 Codex (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex-max": {
"name": "GPT 5.1 Codex Max (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex": {
"name": "GPT 5.1 Codex (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1-codex-mini": {
"name": "GPT 5.1 Codex Mini (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "medium"
}
}
},
"gpt-5.1": {
"name": "GPT 5.1 (OAuth)",
"limit": {
"context": 272000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"variants": {
"none": {
"reasoningEffort": "none",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto",
"textVerbosity": "low"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto",
"textVerbosity": "medium"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "detailed",
"textVerbosity": "high"
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion lib/prompts/opencode-codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { homedir } from "node:os";
import { mkdir, readFile, writeFile } from "node:fs/promises";

const OPENCODE_CODEX_URL =
"https://raw.githubusercontent.com/sst/opencode/dev/packages/opencode/src/session/prompt/codex.txt";
"https://raw.githubusercontent.com/anomalyco/opencode/dev/packages/opencode/src/session/prompt/codex.txt";
const CACHE_DIR = join(homedir(), ".opencode", "cache");
const CACHE_FILE = join(CACHE_DIR, "opencode-codex.txt");
const CACHE_META_FILE = join(CACHE_DIR, "opencode-codex-meta.json");
Expand Down
Loading