Skip to content

Instantly share code, notes, and snippets.

@knowsuchagency
Created January 6, 2026 22:56
Show Gist options
  • Select an option

  • Save knowsuchagency/5645fca82f0882e87fb32d9b4ee515e9 to your computer and use it in GitHub Desktop.

Select an option

Save knowsuchagency/5645fca82f0882e87fb32d9b4ee515e9 to your computer and use it in GitHub Desktop.
Leverage your ChatGPT Plus/Pro subscription for AI coding workloads instead of buying API tokens

Use Your ChatGPT Subscription for AI Coding Workloads

The Problem

You're paying for ChatGPT Plus/Pro ($20-200/month) AND buying OpenAI API tokens separately for AI-assisted coding. That's double-dipping.

The Solution

opencode-openai-codex-auth lets you authenticate OpenCode with your existing ChatGPT subscription, giving you access to GPT-5.x models for coding tasks without purchasing additional API credits.

Quick Setup

# Install the auth plugin
npx -y opencode-openai-codex-auth@latest

# Authenticate with your ChatGPT account
opencode auth login

# Start using GPT-5.2 for coding tasks
opencode run "refactor this function for readability" --model=openai/gpt-5.2

Available Models

Model Variants Best For
gpt-5.2 low/medium/high/xhigh General coding
gpt-5.2-codex low/medium/high/xhigh Code-optimized tasks
gpt-5.1-codex-max low/medium/high/xhigh Complex refactoring
gpt-5.1-codex low/medium/high Everyday coding
gpt-5.1-codex-mini medium/high Quick tasks

Example: Custom Tools + Subscription Models

You can combine this with OpenCode's custom tools for powerful workflows:

# Create a custom tool
mkdir -p .opencode/tool
// .opencode/tool/analyzeCode.ts
import { tool } from "@opencode-ai/plugin"

export default tool({
  description: "Analyze code for security vulnerabilities",
  args: {
    filepath: tool.schema.string().describe("Path to file to analyze"),
  },
  async execute(args) {
    const file = await Bun.file(args.filepath).text()
    return `Analyzing: ${args.filepath}\n\nCode:\n${file}`
  },
})
# Run with your subscription
opencode run "analyze src/auth.ts for security issues" --model=openai/gpt-5.2-codex --variant=high

Cost Comparison

Approach Monthly Cost Notes
ChatGPT Pro + API tokens $200 + $50-500 Paying twice
ChatGPT Pro + this plugin $200 Single subscription
API tokens only $50-500+ No chat interface

Caveats

  • Intended for personal development use with individual subscriptions
  • Production/multi-user apps should use OpenAI's Platform API
  • Subject to ChatGPT's usage policies and rate limits

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment