skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
reason-machines/codex-skills243 installs

opencode-openai-codex-auth

OAuth authentication plugin for OpenCode that enables GPT-5.x and Codex model access via ChatGPT Plus/Pro subscriptions

How do I install this agent skill?

npx skills add https://github.com/reason-machines/codex-skills --skill opencode-openai-codex-auth
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubfail

    This skill claims to provide access to unreleased AI models like GPT-5 and requires executing unvetted code from public repositories and package registries. It also manages sensitive session tokens, creating a significant risk of credential theft through deceptive social engineering.

  • Socketwarn

    1 alert: gptAnomaly

  • Snykwarn

    Risk: MEDIUM · 1 issue

What does this agent skill do?

opencode-openai-codex-auth

Skill by ara.so — Codex Skills collection.

Overview

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:

  • Official ChatGPT OAuth flow (no API keys required)
  • 22 model presets across GPT-5.2, GPT-5.2-Codex, and GPT-5.1 families
  • Variant system (none/low/medium/high/xhigh) for fine-grained control
  • Automatic token refresh and usage-aware error handling
  • Multimodal input support (text, images, files)
  • Legacy OpenCode (v1.0.209-) and modern (v1.0.210+) compatibility

Installation

Quick Install (Recommended)

# 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

Manual Installation

# 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

Uninstallation

# 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

Authentication

Initial Login

# Authenticate with ChatGPT account
opencode auth login

This opens your browser to complete OAuth flow. Follow the prompts to authorize OpenCode access.

Verify Authentication

# Check current auth status
opencode auth status

# Refresh token if needed
opencode auth refresh

Logout

opencode auth logout

Available Models

GPT-5.2 Family

gpt-5.2 (General purpose, latest flagship)

  • Variants: none, low, medium, high, xhigh
  • Use case: General coding, documentation, architecture

gpt-5.2-codex (Code-specialized)

  • Variants: low, medium, high, xhigh
  • Use case: Code generation, refactoring, debugging

GPT-5.1 Family

gpt-5.1-codex-max (Maximum code performance)

  • Variants: low, medium, high, xhigh
  • Use case: Complex algorithms, large refactors

gpt-5.1-codex (Balanced code model)

  • Variants: low, medium, high
  • Use case: Standard coding tasks

gpt-5.1-codex-mini (Faster, lighter)

  • Variants: medium, high
  • Use case: Quick fixes, snippets

gpt-5.1 (General purpose)

  • Variants: none, low, medium, high
  • Use case: Mixed coding and documentation

Usage Examples

Modern OpenCode (v1.0.210+)

# 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

Legacy OpenCode (v1.0.209 and below)

# 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

Interactive Mode

# 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

Configuration

Modern Config Structure (v1.0.210+)

{
  "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
    }
  }
}

Legacy Config Structure (v1.0.209-)

{
  "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
    }
  }
}

Environment Variables

The plugin stores the OAuth session token automatically. No manual environment configuration needed.

Token storage location:

~/.opencode/auth/session.json

Custom Configuration

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"]
    }
  }
}

Common Patterns

Selecting the Right Model

# 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

Batch Operations

# 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

Project Scaffolding

# 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

Code Review

# 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

TypeScript Integration

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();

Troubleshooting

Authentication Issues

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

Model Access Issues

Problem: "Model not available" error

  • Verify ChatGPT Plus/Pro subscription is active
  • Check model name matches exactly (case-sensitive)
  • Ensure using correct variant syntax for your OpenCode version
# 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

  • ChatGPT subscriptions have usage limits
  • Wait 1-2 hours and retry
  • Use lower variants (low, medium) for less resource-intensive tasks
  • Switch to codex-mini for quick iterations

Configuration Issues

Problem: 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

Performance Issues

Problem: Slow responses

  • Use lower variants (low, medium) instead of xhigh
  • Switch to codex-mini for simpler tasks
  • Check network connection
  • Verify ChatGPT service status

Problem: Timeouts

# Increase timeout in config
{
  "timeout": 120000,  // 2 minutes
  "retries": 3
}

Debug Mode

# 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

Best Practices

  1. Use appropriate variants: Start with medium, scale up only when needed
  2. Model selection: Use codex variants for pure code tasks, general models for mixed content
  3. Token management: Auth tokens auto-refresh, but monitor session expiry
  4. Rate limiting: Respect ChatGPT usage limits; avoid rapid-fire requests
  5. Version compatibility: Match plugin config to your OpenCode version
  6. Security: Never commit ~/.opencode/auth/ directory; tokens are sensitive

Additional Resources

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/reason-machines/codex-skills/opencode-openai-codex-auth">View opencode-openai-codex-auth on skillZs</a>