一键导入
opencode-openai-codex-auth
OAuth authentication plugin for OpenCode that enables GPT-5.x and Codex model access via ChatGPT Plus/Pro subscriptions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
OAuth authentication plugin for OpenCode that enables GPT-5.x and Codex model access via ChatGPT Plus/Pro subscriptions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Convert attached object images into code-only, animation-ready procedural Three.js models through guided sculpting workflow
Create and manage AI video storyboard projects with automated asset generation through Codex Storyboard workspace
Continue-thinking middleware that detects and handles reasoning truncation in Codex/OpenAI Responses-compatible APIs
Desktop manager for OpenAI Codex CLI with prompt injection, provider switching, and TOML/Auth visualization
Inject unrestricted developer mode instructions into Codex CLI (GPT-5.5) to bypass content filters
Install and use TradingCodex to build Codex-native investment research workflows with fixed-role agents, order approval gates, and local Django service plane
| name | opencode-openai-codex-auth |
| description | OAuth authentication plugin for OpenCode that enables GPT-5.x and Codex model access via ChatGPT Plus/Pro subscriptions |
| triggers | ["set up OpenCode with ChatGPT authentication","configure OpenCode to use GPT-5 models","install opencode-openai-codex-auth plugin","authenticate OpenCode with my ChatGPT account","use GPT-5.2 Codex models in OpenCode","configure OpenCode model variants","troubleshoot OpenCode OAuth authentication","switch between OpenCode GPT-5 models"] |
Skill by ara.so — Codex Skills collection.
opencode-openai-codex-auth is a TypeScript-based OAuth authentication plugin that connects OpenCode to OpenAI's GPT-5.x and Codex models using your existing ChatGPT Plus/Pro subscription. It provides 22 pre-configured model presets with variant support, eliminating complex API setup while maintaining full model access.
Key Features:
# Modern OpenCode (v1.0.210+)
npx -y opencode-openai-codex-auth@latest
# Legacy OpenCode (v1.0.209 and below)
npx -y opencode-openai-codex-auth@latest --legacy
# Clone or download the config
git clone https://github.com/numman-ali/opencode-openai-codex-auth.git
cd opencode-openai-codex-auth
# Copy config to OpenCode directory
# Modern:
cp config/opencode-modern.json ~/.opencode/config.json
# Legacy:
cp config/opencode-legacy.json ~/.opencode/config.json
# Remove plugin only
npx -y opencode-openai-codex-auth@latest --uninstall
# Remove plugin and all configs
npx -y opencode-openai-codex-auth@latest --uninstall --all
# Authenticate with ChatGPT account
opencode auth login
This opens your browser to complete OAuth flow. Follow the prompts to authorize OpenCode access.
# Check current auth status
opencode auth status
# Refresh token if needed
opencode auth refresh
opencode auth logout
gpt-5.2 (General purpose, latest flagship)
none, low, medium, high, xhighgpt-5.2-codex (Code-specialized)
low, medium, high, xhighgpt-5.1-codex-max (Maximum code performance)
low, medium, high, xhighgpt-5.1-codex (Balanced code model)
low, medium, highgpt-5.1-codex-mini (Faster, lighter)
medium, highgpt-5.1 (General purpose)
none, low, medium, high# Basic usage with model and variant
opencode run "write hello world to test.txt" \
--model=openai/gpt-5.2 \
--variant=medium
# Use Codex-specialized model
opencode run "refactor this function for performance" \
--model=openai/gpt-5.2-codex \
--variant=high
# File operations with multimodal input
opencode run "analyze this image and extract data" \
--model=openai/gpt-5.2 \
--variant=medium \
--input=screenshot.png
# Maximum quality for complex tasks
opencode run "implement OAuth2 flow with PKCE" \
--model=openai/gpt-5.1-codex-max \
--variant=xhigh
# Model name includes variant suffix
opencode run "write hello world to test.txt" \
--model=openai/gpt-5.2-medium
# High-quality code generation
opencode run "create REST API with Express" \
--model=openai/gpt-5.2-codex-high
# Fast iterations
opencode run "fix syntax error in app.ts" \
--model=openai/gpt-5.1-codex-mini-medium
# Start interactive session
opencode chat --model=openai/gpt-5.2-codex --variant=medium
# In chat:
> create a TypeScript interface for a User model
> add validation methods
> generate unit tests
{
"models": {
"openai/gpt-5.2": {
"provider": "openai",
"model": "gpt-5.2-base",
"apiKeyEnv": "OPENAI_SESSION_TOKEN",
"endpoint": "https://chat.openai.com/backend-api/conversation",
"variants": {
"none": {"temperature": 0.3},
"low": {"temperature": 0.5},
"medium": {"temperature": 0.7},
"high": {"temperature": 0.85},
"xhigh": {"temperature": 0.95}
},
"capabilities": ["code", "multimodal"],
"maxTokens": 8192
}
}
}
{
"models": {
"openai/gpt-5.2-medium": {
"provider": "openai",
"model": "gpt-5.2-base",
"apiKeyEnv": "OPENAI_SESSION_TOKEN",
"endpoint": "https://chat.openai.com/backend-api/conversation",
"temperature": 0.7,
"capabilities": ["code", "multimodal"],
"maxTokens": 8192
}
}
}
The plugin stores the OAuth session token automatically. No manual environment configuration needed.
Token storage location:
~/.opencode/auth/session.json
Create or modify ~/.opencode/config.json:
// Add custom model preset
{
"models": {
"openai/my-custom-preset": {
"provider": "openai",
"model": "gpt-5.2-codex",
"temperature": 0.6,
"maxTokens": 4096,
"topP": 0.9,
"capabilities": ["code"]
}
}
}
# Quick tasks, fast iteration → codex-mini or low variant
opencode run "add comments to this function" \
--model=openai/gpt-5.1-codex-mini --variant=medium
# Standard development → gpt-5.2-codex medium
opencode run "implement user authentication" \
--model=openai/gpt-5.2-codex --variant=medium
# Complex architecture → codex-max high/xhigh
opencode run "design microservices architecture" \
--model=openai/gpt-5.1-codex-max --variant=xhigh
# Documentation/mixed → gpt-5.2 or gpt-5.1
opencode run "write API documentation" \
--model=openai/gpt-5.2 --variant=medium
# Process multiple files
for file in src/*.ts; do
opencode run "add TypeScript strict type checks to $file" \
--model=openai/gpt-5.2-codex \
--variant=medium
done
# Generate project structure
opencode run "create Next.js 14 project with TypeScript, Tailwind, and shadcn/ui" \
--model=openai/gpt-5.2-codex \
--variant=high \
--output=./new-project
# Analyze code quality
opencode run "review this PR for security issues and best practices" \
--model=openai/gpt-5.2-codex \
--variant=high \
--input=git-diff.txt
If you're building tools on top of this plugin:
import { OpenCodeAuth } from 'opencode-openai-codex-auth';
// Initialize auth client
const auth = new OpenCodeAuth({
configPath: '~/.opencode/config.json'
});
// Authenticate
await auth.login();
// Get session token
const token = await auth.getSessionToken();
// Make authenticated request
const response = await auth.request({
model: 'gpt-5.2-codex',
variant: 'medium',
messages: [
{ role: 'user', content: 'Write a TypeScript function' }
]
});
// Refresh token if expired
if (auth.isTokenExpired()) {
await auth.refresh();
}
// Logout
await auth.logout();
Problem: opencode auth login fails or times out
# Clear auth cache
rm -rf ~/.opencode/auth/
# Re-authenticate
opencode auth login
# Check for browser issues
opencode auth login --debug
Problem: "Invalid session token" error
# Refresh token
opencode auth refresh
# If refresh fails, re-login
opencode auth logout
opencode auth login
Problem: "Model not available" error
# Modern (v1.0.210+)
--model=openai/gpt-5.2 --variant=medium
# Legacy (v1.0.209-)
--model=openai/gpt-5.2-medium
Problem: Rate limiting or quota errors
low, medium) for less resource-intensive taskscodex-mini for quick iterationsProblem: Config not loading
# Verify config exists
cat ~/.opencode/config.json
# Reinstall with correct version flag
npx -y opencode-openai-codex-auth@latest # modern
npx -y opencode-openai-codex-auth@latest --legacy # legacy
# Check OpenCode version
opencode --version
Problem: Wrong config format
# Check OpenCode version
opencode --version
# If v1.0.210+ but using legacy config:
npx -y opencode-openai-codex-auth@latest
# If v1.0.209- but using modern config:
npx -y opencode-openai-codex-auth@latest --legacy
Problem: Slow responses
low, medium) instead of xhighcodex-mini for simpler tasksProblem: Timeouts
# Increase timeout in config
{
"timeout": 120000, // 2 minutes
"retries": 3
}
# Enable verbose logging
export OPENCODE_DEBUG=1
opencode run "test command" --model=openai/gpt-5.2 --variant=medium
# Check logs
tail -f ~/.opencode/logs/debug.log
medium, scale up only when neededcodex variants for pure code tasks, general models for mixed content~/.opencode/auth/ directory; tokens are sensitivedocs/configuration.mddocs/development/ARCHITECTURE.mddocs/troubleshooting.md