Skip to content

Add subscription-backed GPT lanes for Claude Code#3

Open
editnori wants to merge 5 commits into
mainfrom
feature/claude-gpt-subscription-proxy
Open

Add subscription-backed GPT lanes for Claude Code#3
editnori wants to merge 5 commits into
mainfrom
feature/claude-gpt-subscription-proxy

Conversation

@editnori

@editnori editnori commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • adds claude-gpt, an opt-in Claude Code launcher backed by a saved ChatGPT/Codex subscription profile rather than OPENAI_API_KEY
  • keeps codex-auth as the only refresh-token owner; the proxy receives a private, access-only lease snapshot with no refresh token
  • maps Claude Code's Opus, Sonnet, and Haiku tiers to GPT-5.6 Sol, Terra, and Luna, plus a GPT-5.6 Sol Ultra Fast option
  • supports dynamic low/medium/high/xhigh/max effort and ultracode workflow orchestration without pinning a proxy-wide effort
  • gives Claude child-facing [1m] model hints while enforcing the real 372K Codex subscription ceiling
  • maps context overflow to terminal HTTP 413 so Claude trims/compacts instead of looping on HTTP 502
  • maps ordinary Codex quota exhaustion to immediate HTTP 429 instead of nesting proxy retries inside Claude retries
  • makes default sessions follow codex-auth active-profile changes through validated atomic lease swaps; explicit --profile NAME sessions stay identity-pinned
  • handles an account switch that happens while the old profile's startup refresh is failing
  • installs and checksum-verifies claude-code-proxy 0.1.10-codex-auth.2
  • contains Claude, proxy, and lease lifecycles with parent-death signaling and fail-closed supervision

The source-visible proxy fixes are also submitted upstream as raine/claude-code-proxy#28, #29, and #30.

Verification

  • 85 shell tests passed, including live-follow, pinned-profile, and switch-during-failed-refresh regressions
  • 82 TUI tests passed
  • compatibility proxy suite passed 447 tests, including HTTP/WebSocket context-window and rate-limit regressions
  • release matrix passed for Linux, macOS, and Windows on amd64/arm64; Windows smoke passed
  • all six published archives were streamed and matched against their companion SHA-256 files
  • local installer fetched the published build; installed proxy reports 0.1.10-codex-auth.2 and the installed launcher byte-matches this branch
  • real installed-launcher subscription smoke returned PATCHED_CODEX_OK through GPT-5.6 Sol
  • parent-death, proxy-failure, identity, access-only, renewal, argument-forwarding, compact-window, and cleanup tests passed

Compatibility boundary

This remains a third-party Anthropic-to-Codex compatibility route; normal claude stays unchanged. A proxy process already in memory keeps its current binary until that Claude session exits, while every new claude-gpt launch uses the installed .2 build. Sol Ultra Fast consumes the selected profile's fast-mode quota.

Summary by CodeRabbit

  • New Features
    • Added an opt-in claude-gpt launcher to run Claude Code with GPT-backed model lanes, effort controls (including ultracode/ultra), and lane overrides.
    • Added claude-gpt-export to export ChatGPT-backed proxy authorization safely.
    • Installer now downloads and verifies a pinned claude-code-proxy (Linux) with optional opt-out.
  • Bug Fixes
    • Improved reliability for context overflow by using HTTP 413 to enable compaction/trimming and recovery without retry loops.
    • More robust handling of auth/quota failures to reduce proxy/harness instability.
  • Documentation
    • Expanded setup, verification, configuration, and removal instructions for claude-gpt and the proxy.
  • Chores
    • Bumped versions to 0.2.0 and added test coverage for the new launcher flow.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@editnori, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ed30b0a-d1ab-4374-a008-7dbe8935dfec

📥 Commits

Reviewing files that changed from the base of the PR and between 740691c and 9c5b334.

📒 Files selected for processing (3)
  • README.md
  • bin/claude-gpt
  • lib/codex-auth/usage.sh
📝 Walkthrough

Walkthrough

Adds an opt-in claude-gpt launcher backed by ChatGPT profiles and a local verified proxy, with ephemeral auth export, model-lane routing, lease renewal, process supervision, installer support, documentation, tests, and version updates.

Changes

Claude GPT integration

Layer / File(s) Summary
Ephemeral authorization export
lib/codex-auth/claude-gpt.sh, bin/codex-auth, tests/run.sh
Adds access-only ChatGPT authorization exports with pinned identity and expiry metadata, exposes them through claude-gpt-export, and tests refresh-token exclusion and identity validation.
Proxy installation and packaging
install.sh, tests/run.sh
Downloads or stages the pinned proxy, verifies its checksum and version, installs it atomically, and tests the verified installation path.
Claude GPT launcher runtime
bin/claude-gpt
Adds profile selection, temporary auth and session handling, proxy health checks, GPT model-lane mapping, effort forwarding, lease renewal, subprocess supervision, and cleanup.
Launcher behavior coverage
tests/run.sh
Tests launcher arguments, routing overrides, dynamic ports, lease renewal, active-profile switching and explicit pinning, proxy failure handling, and child-process cleanup.
Release surface and metadata
README.md, CHANGELOG.md, lib/codex-auth/usage.sh, tui/pyproject.toml, tui/src/codex_auth_tui/__init__.py
Documents the launcher and proxy workflow, updates release notes and client version metadata, and records cleanup commands.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant claude-gpt
  participant codex-auth
  participant claude-code-proxy
  participant ClaudeCode
  User->>claude-gpt: Start GPT-backed Claude Code session
  claude-gpt->>codex-auth: Export selected profile lease
  claude-gpt->>claude-code-proxy: Start proxy and wait for healthz
  claude-gpt->>ClaudeCode: Launch with mapped model lanes
  claude-gpt->>codex-auth: Renew lease during session
  ClaudeCode-->>claude-gpt: Return exit status
  claude-gpt->>claude-code-proxy: Stop proxy and clean temporary state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: subscription-backed GPT lanes added for Claude Code.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/claude-gpt-subscription-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/claude-gpt`:
- Around line 448-452: Enforce the Bash 5.1+ requirement for the wait flow using
wait -p in the launcher, preferably through the script’s existing version-check
mechanism; otherwise document the minimum required Bash version prominently.
Ensure older shells fail with a clear actionable message before reaching the
wait -n invocation.

In `@lib/codex-auth/usage.sh`:
- Line 481: Update the coprocess write redirections in the affected initialize
request and its corresponding second site to explicitly redirect stdout with
1>&"$rate_in" before redirecting stderr to /dev/null. Preserve the existing
printf payload and control flow while replacing the ambiguous redirection order
at both sites.

In `@README.md`:
- Around line 342-343: Update the README cleanup command to use the same
`${PREFIX:-$HOME/.local}` installation directory as install.sh, ensuring all
listed binaries—including claude-gpt and claude-code-proxy—are removed from a
custom prefix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f79ac910-3309-4398-8124-9bedca05e3e5

📥 Commits

Reviewing files that changed from the base of the PR and between 9e84e03 and 165fc48.

⛔ Files ignored due to path filters (1)
  • tui/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • CHANGELOG.md
  • README.md
  • bin/claude-gpt
  • bin/codex-auth
  • install.sh
  • lib/codex-auth/claude-gpt.sh
  • lib/codex-auth/usage.sh
  • tests/run.sh
  • tui/pyproject.toml
  • tui/src/codex_auth_tui/__init__.py

Comment thread bin/claude-gpt
Comment thread lib/codex-auth/usage.sh Outdated
Comment thread README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
README.md (1)

381-382: 🎯 Functional Correctness | 🟡 Minor

Honor the configured install prefix during cleanup.

The removal command hard-codes ~/.local/bin, while installation uses ${PREFIX:-$HOME/.local}. Users with a custom PREFIX can therefore leave claude-gpt and claude-code-proxy installed. Use the same prefix expression as install.sh.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 381 - 382, Update the cleanup rm command in README.md
to use the same ${PREFIX:-$HOME/.local}/bin prefix as install.sh instead of
hard-coding ~/.local/bin, ensuring all listed binaries including claude-gpt and
claude-code-proxy are removed for custom PREFIX values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@README.md`:
- Around line 381-382: Update the cleanup rm command in README.md to use the
same ${PREFIX:-$HOME/.local}/bin prefix as install.sh instead of hard-coding
~/.local/bin, ensuring all listed binaries including claude-gpt and
claude-code-proxy are removed for custom PREFIX values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce626050-cf93-41f9-bcf6-e7eac93cff7b

📥 Commits

Reviewing files that changed from the base of the PR and between 165fc48 and ca83338.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • bin/claude-gpt
  • install.sh
  • tests/run.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • install.sh
  • tests/run.sh
  • bin/claude-gpt

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant