Files
Numman AliandHanzo Dev 0a9834c6fc docs: Enforce GPT 5.1 full-opencode.json as only supported configuration
This PR standardizes all documentation and configuration on GPT 5.1 model identifiers, removes deprecated GPT 5.0 models, and enforces full-opencode.json as the only officially supported configuration. The changes address GPT 5 model temperamental behavior and ensure users have the proper setup for reliable operation with OpenCode.

Co-authored-by: Hanzo Dev <[email protected]>
2025-11-16 21:52:44 +00:00

5.3 KiB

OpenCode OpenAI Codex Auth Plugin

Access GPT-5 Codex through your ChatGPT Plus/Pro subscription in OpenCode

npm version Tests

Found this useful? Follow me on X @nummanthinks for future updates and more projects!

⚠️ Usage Notice

This plugin is for personal development use only. It uses OpenAI's official OAuth authentication (the same method as OpenAI's official Codex CLI) for individual coding assistance with your ChatGPT Plus/Pro subscription.

Not for: Commercial services, API resale, or multi-user applications. For production use, see OpenAI Platform API.

Users are responsible for compliance with OpenAI's Terms of Use.


For Users

For Developers

Explore the engineering depth behind this plugin:

  • Architecture - Technical design, AI SDK compatibility, store:false explained
  • Config System - How configuration loading and merging works
  • Config Fields - Understanding config keys, id, and name fields
  • Testing Guide - Test scenarios, integration testing, verification matrix

Getting Started

Installation

Add to your config, run OpenCode, authenticate:

# 1. Add plugin to ~/.config/opencode/opencode.json
# 2. Run OpenCode
opencode

# 3. Authenticate
opencode auth login

Updating

⚠️ OpenCode does NOT auto-update plugins

To get the latest version:

(cd ~ && sed -i.bak '/"opencode-openai-codex-auth"/d' .cache/opencode/package.json && rm -rf .cache/opencode/node_modules/opencode-openai-codex-auth)
opencode  # Reinstalls latest

Minimal Configuration

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-openai-codex-auth"],
  "model": "openai/gpt-5-codex"
}

Quick Test

opencode run "write hello world to test.txt" --model=openai/gpt-5-codex

Features

✅ OAuth Authentication - Secure ChatGPT Plus/Pro login ✅ GPT 5.1 Models - gpt-5.1, gpt-5.1-codex, gpt-5.1-codex-mini (8 pre-configured variants) ✅ Per-Model Configuration - Different reasoning effort, verbosity for each variant ✅ Multi-Turn Conversations - Full conversation history with stateless backend ✅ Verified Configuration - Use config/full-opencode.json for guaranteed compatibility ✅ Comprehensive Testing - 160+ unit tests + 14 integration tests

⚠️ Important: GPT 5 models can be temperamental. Use the official config/full-opencode.json configuration - it's the ONLY supported setup. Older GPT 5.0 models are deprecated.


Why This Plugin?

Use your ChatGPT subscription instead of OpenAI API credits

  • No separate API key needed
  • Access Codex models through ChatGPT Plus/Pro
  • Same OAuth login as official Codex CLI
  • Full feature parity with Codex CLI

How It Works

The plugin intercepts OpenCode's OpenAI SDK requests and transforms them for the ChatGPT backend API:

  1. OAuth Token Management - Handles token refresh automatically
  2. Request Transformation - Converts OpenCode SDK format → Codex API format
  3. AI SDK Compatibility - Filters SDK-specific constructs for Codex API
  4. Stateless Operation - Works with ChatGPT backend's store: false requirement

See Architecture for technical details.


Development

This plugin represents significant engineering effort to bridge OpenCode and the ChatGPT Codex backend:

  • 7-step fetch flow with precise transformations
  • AI SDK compatibility layer handling item_reference and other SDK constructs
  • Stateless multi-turn conversations via encrypted reasoning content
  • 15-minute caching to prevent GitHub API rate limits
  • Comprehensive test coverage with actual API verification

Explore the development docs to see the depth of implementation:


Support


License

MIT License with Usage Disclaimer - See LICENSE for details


Trademark Notice: Not affiliated with OpenAI. ChatGPT, GPT-5, Codex, and OpenAI are trademarks of OpenAI, L.L.C.