惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
博客园 - 司徒正美
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
月光博客
月光博客
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
雷峰网
雷峰网
博客园 - 叶小钗
量子位
IT之家
IT之家

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - raine/claude-codex-proxy: Use Claude Code with y...
rane · 2026-04-19 · via Hacker News: Show HN

claude-codex-proxy lets you use Claude Code with your ChatGPT Plus or Pro subscription.

Claude Code running through claude-codex-proxy

Quick start · How it works · Configuration · Limitations

Why?

I feel Claude Code is still the best harness around, despite occasional frustrations caused by updates. However, Anthropic keeps tightening the usage limits, while OpenAI is still much more generous.

If you want to use OpenAI plans, your best options seem to be OpenCode and Codex. I tried OpenCode, but the UX has many rough edges, especially around skills feeling like a second-class feature. Fortunately it's open source and I ended up forking it and applying some patches, but would much rather not do it.

Quick start

1. Install

Homebrew (macOS and Linux):

brew install raine/claude-codex-proxy/claude-codex-proxy

Install script (macOS and Linux):

curl -fsSL https://raw.githubusercontent.com/raine/claude-codex-proxy/main/scripts/install.sh | bash

Manual: download a prebuilt binary for your platform from the releases page.

2. Authenticate with ChatGPT

Open a browser (PKCE flow):

claude-codex-proxy auth login

Or, on a headless machine (device code flow):

claude-codex-proxy auth device

Either command prints a URL. Sign in with your ChatGPT Plus/Pro account. On macOS, credentials are stored in Keychain. On other platforms, they are stored locally for reuse by the proxy.

Verify it stuck:

claude-codex-proxy auth status

3. Start the proxy

claude-codex-proxy serve

Defaults to http://127.0.0.1:18765 (loopback only). Override with PORT=11435 claude-codex-proxy serve.

4. Point Claude Code at it

One-shot:

ANTHROPIC_BASE_URL=http://localhost:18765 \
ANTHROPIC_AUTH_TOKEN=unused \
ANTHROPIC_MODEL=gpt-5.4 \
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 \
  claude

Or set it persistently in ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:18765",
    "ANTHROPIC_AUTH_TOKEN": "unused",
    "ANTHROPIC_MODEL": "gpt-5.4",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
  }
}

Supported models

Set ANTHROPIC_MODEL to a model your ChatGPT subscription is allowed to use. Confirmed working on Plus:

  • gpt-5.4
  • gpt-5.3-codex

Also verified working on this project:

  • gpt-5.2
  • gpt-5.4-mini

The proxy also accepts a small set of convenience aliases and resolves them before calling the upstream Codex backend:

  • haiku, claude-haiku-4-5, claude-haiku-4-5-20251001gpt-5.4-mini
  • sonnet, claude-sonnet-4-6gpt-5.4
  • opus, claude-opus-4-7gpt-5.4

These aliases are only shorthand for portability and cheaper subagent configs; they are not semantic equivalents of the Claude models they resemble.

If the resolved model isn't supported by your account, upstream returns a 400 like "The 'gpt-4.1' model is not supported when using Codex with a ChatGPT account.". The proxy surfaces that verbatim.

For example, you can now point Claude Code or a subagent at the proxy with:

ANTHROPIC_MODEL=haiku claude

and the proxy will send gpt-5.4-mini upstream.

How it works

sequenceDiagram
    autonumber
    participant CC as Claude Code
    participant P as claude-codex-proxy
    participant AUTH as auth.openai.com
    participant CGX as chatgpt.com/<br/>backend-api/codex

    Note over P,AUTH: One-time: PKCE or device OAuth<br/>tokens cached locally for reuse

    CC->>P: POST /v1/messages (Anthropic shape, stream: true)

    alt access token expiring
        P->>AUTH: POST /oauth/token (refresh_token)
        AUTH-->>P: new access + refresh
    end

    P->>P: translate request<br/>• strip max_tokens / temperature / cache_control<br/>• system blocks → top-level "instructions"<br/>• tool_use.id = call_id (identity)<br/>• prompt_cache_key = session id
    P->>CGX: POST /responses<br/>Bearer + ChatGPT-Account-Id + originator=claude-codex-proxy
    CGX-->>P: Responses API SSE<br/>(output_item.*, output_text.delta, function_call_arguments.*, codex.rate_limits, response.completed)
    P->>P: reducer: typed events<br/>(text/tool start/delta/stop, finish)
    P-->>CC: Anthropic SSE<br/>(message_start, content_block_*, message_delta, message_stop)
Loading

Commands

serve Start the proxy on PORT (default 18765) auth login Browser OAuth (PKCE) auth device Device-code OAuth (headless) auth status Show account ID and token expiry auth logout Delete stored auth credentials
Command Description

serve

Starts the HTTP proxy and blocks. Binds to 127.0.0.1 only. Logs to $XDG_STATE_HOME/claude-codex-proxy/proxy.log (rotated at 20 MiB). Set CCP_LOG_STDERR=1 to mirror log lines to stderr while running.

claude-codex-proxy serve
PORT=11435 claude-codex-proxy serve
CCP_LOG_STDERR=1 claude-codex-proxy serve

Prints the exact ANTHROPIC_BASE_URL / ANTHROPIC_MODEL env vars to export on startup. Refuses to start traffic until auth login (or auth device) has stored a token.

auth login

Runs the PKCE browser flow against auth.openai.com using the Codex CLI's client ID. Prints a URL, opens a local callback listener on port 1455, waits for the browser to redirect back, and stores the resulting access / refresh tokens in Keychain on macOS or locally on other platforms. The process exits automatically once the tokens are saved.

claude-codex-proxy auth login

Sign in with your ChatGPT Plus/Pro account, not an OpenAI API account. The token file includes the extracted chatgpt_account_id so the proxy can set the ChatGPT-Account-Id header on every upstream call.

auth device

Same OAuth flow, but for headless machines. Prints a short user code and a URL; you enter the code from any browser on any other device, and the CLI polls auth.openai.com until you authorize, then stores the token.

claude-codex-proxy auth device

Useful over SSH, inside a container, or on any host that can't open a browser.

auth status

Shows whether credentials are stored, the account ID, and how long until the access token expires. Non-zero exit if no auth is present.

claude-codex-proxy auth status

Example output:

Account: 79342a5e-57b7-44ea-bfdc-a83ba070dad6
Expires: 2026-04-28T16:46:04.827Z (in 863946s)
Storage: macOS Keychain

The proxy refreshes the access token 5 minutes before expiry with a single-flight guard, so concurrent requests never trigger stampedes of refresh calls.

auth logout

Removes stored auth credentials. On macOS this deletes the Keychain entry. No server call is needed; the refresh token just becomes dead.

claude-codex-proxy auth logout

Run auth login again to re-authenticate.

Endpoints

The proxy speaks enough of the Anthropic API for Claude Code:

  • POST /v1/messages: the main turn endpoint (streaming and non-streaming)
  • POST /v1/messages?beta=true: same (Claude Code always sends ?beta=true)
  • POST /v1/messages/count_tokens: local token count via gpt-tokenizer (o200k_base); used by Claude Code's compaction logic
  • GET /healthz: liveness check

Configuration

Settings are environment variables on the proxy process, not a config file.

PORT18765 Proxy listen port XDG_STATE_HOME~/.local/state Base dir for proxy.logCCP_LOG_STDERR unset Also mirror log lines to stderr CCP_LOG_VERBOSE unset Log full request/response bodies + every SSE event
Variable Default Purpose

Files

  • $XDG_STATE_HOME/claude-codex-proxy/proxy.log: JSON-lines log, rotated at 20 MiB. Secrets (authorization, access, refresh, id_token, ChatGPT-Account-Id, …) are redacted before write.

Limitations

  • Terms of service: using the Codex backend from a non-official client is the same gray area OpenCode occupies, although OpenAI seems to be cool with OpenCode. Use at your own risk.
  • Rate limits: shared across all clients of your ChatGPT account. codex.rate_limits.limit_reached is surfaced as HTTP 429 with retry-after.
  • Image inputs in tool results: Responses API function_call_output only takes a string, so image blocks nested inside tool_result are replaced with a [image omitted: <media_type>] placeholder. Top-level user-message images do pass through.
  • Reasoning blocks: not forwarded to Claude Code (dropped), even if the upstream model produced them.
  • Session title generation: Claude Code's parallel title-gen request is forwarded to Codex like any other structured-output request. This costs a handful of tokens per session rather than being stubbed.
  • OpenAI-flavored output_config.format: translated to Responses API text.format (json_schema with strict: true); other Anthropic-specific output_config fields are dropped.

Development

bunx tsc --noEmit     # typecheck
bun src/cli.ts serve  # run locally
tail -f ~/.local/state/claude-codex-proxy/proxy.log | jq .

Install a compiled dev build globally: compile the current working tree to a binary and place it on your PATH without linking:

mkdir -p ~/.local/bin
bun build ./src/cli.ts --compile --outfile ~/.local/bin/claude-codex-proxy

Related projects

  • claude-history: search Claude Code conversation history from the terminal
  • git-surgeon: non-interactive hunk-level git staging for AI agents
  • workmux: manage parallel AI coding tasks in separate git worktrees with tmux