codex-proxy
Run an OpenAI-compatible Chat Completions endpoint on localhost that spends the user's ChatGPT/Codex subscription instead of an API key — for apps that take a Base URL, API key and model id (dictation post-processing, editors, scripts). Install it as an always-on LaunchAgent, check its status, print the key, try a request, or debug a failing app.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- codex-proxy
- description
- Run an OpenAI-compatible Chat Completions endpoint on localhost that spends the user's ChatGPT/Codex subscription instead of an API key — for apps that take a Base URL, API key and model id (dictation post-processing, editors, scripts). Install it as an always-on LaunchAgent, check its status, print the key, try a request, or debug a failing app.
- when_to_use
- Trigger on: codex-proxy, "use my Codex subscription in <app>", "OpenAI-compatible endpoint without an API key", "the app wants an OpenAI key", Base URL 127.0.0.1:8723, the dictation app's post-processing provider fails, codex-proxy install / status / key / try / uninstall.
- allowed-tools
- Bash
02 资源文件 3
- 其他codex-proxy21.3 KB
- 参考文档README.md190 B
- 脚本test_codex_proxy.py8.1 KB
03 SKILL.md 正文
codex-proxy
codex-proxy (on PATH via this plugin's bin/) serves http://127.0.0.1:8723/v1:
| Local | Upstream |
|---|---|
POST /v1/chat/completions |
POST chatgpt.com/backend-api/codex/responses (SSE) |
GET /v1/models |
GET chatgpt.com/backend-api/codex/models (list) |
It authenticates with the OAuth token Codex CLI keeps in ~/.codex/auth.json, so Codex must be
logged in with ChatGPT (codex login status → "Logged in using ChatGPT"). An API-key login
has no such token; then the app should just use the key directly.
Commands
codex-proxy install [--port 8723] [--model gpt-6-luna] [--effort low] # LaunchAgent local.codex-proxy
codex-proxy status # launchd loaded? port answering? hours left on the token
codex-proxy key # the local API key to paste into the app
codex-proxy try "текст" # one cleanup request through the running proxy, with timing
codex-proxy uninstall
codex-proxy serve ... # foreground, for debugging
install points launchd at the script's real path — the checkout it was run from — and at
/usr/bin/python3 (stdlib only). Re-run it after moving the checkout or changing flags.
Log: ~/Library/Logs/codex-proxy.log, one line per request with model, effort and seconds.
What to give the app
- Base URL
http://127.0.0.1:8723/v1 - API key: output of
codex-proxy key(stored in~/.config/codex-proxy/key) - Model: any slug from
/v1/models. For short text cleanupgpt-6-lunaat the defaultloweffort answers in ~1.5–2 s; bigger models are slower, not better at this. Thepriorityservice tier was measured slower for such short requests and is not used.
Behaviour worth knowing
- system/developer messages →
instructions; user/assistant →input. A request with only a system message sends it as the input. Tools, images,temperature,max_tokensare dropped;reasoning_effortin the request overrides--effort. stream: truegets Chat Completions chunks and[DONE]; otherwise one JSON completion.auth.jsonis re-read per request. Within 5 minutes of expiry, or on an upstream 401, the proxy refreshes with the refresh token and writes the rotated tokens back atomically (mode 0600, other fields kept) under a lock — codex keeps working off the same file.- Requests need
Authorization: Bearer <key>and a localhostHost, so a web page cannot drive it through the browser.
Debugging an app that fails
codex-proxy status. Not listening → read the log;installagain.codex-proxy try. Works here but not in the app → the app's Base URL (must end in/v1), key or model id; the log shows whether the request even arrived.- Upstream 401 after a refresh →
codex loginagain (the refresh token was revoked). Upstream 400 naming a model → the slug is not in/v1/modelsfor this plan.
This uses the subscription outside the Codex client; OpenAI may change or close the backend at
any time. Tests: python3 -m pytest plugins/bosp/skills/codex-proxy.
04 同仓库更多 Skills
yt-dub
Give a YouTube video Yandex's Russian voice-over (the Yandex Browser / voice-over-translation one) at any length — including past Yandex's 4-hour limit — and mux it into the best video YouTube serves, with the original sound kept as a second track; optionally drop the result into Plex on SugarDaddy. Also when only the translated audio is wanted.
revdiff-ru
Review a diff in revdiff with everything except the code translated into Russian, line numbering preserved 1:1 so annotations map back to the real files. One command does the translation; then /revdiff:revdiff opens the result.
peer-chat
A prompt starting with "Chat from Codex:" is a peer message: answer it only through peer-chat.py, never in your own output. Also use when the user says "chat with codex", "talk to codex", "work with codex", "do this with codex", "build this with codex", "discuss this with codex" (the agent in the other pane of this agterm split). Not for a one-shot task handed off, and not for a read-only second opinion.
memory-review
Use when an agent memory directory has grown large enough that nobody remembers what is in it, when memories look stale or contradictory, when the same fact seems to live in both memory and a CLAUDE.md, or when the user asks to review, prune, audit or clean up their memories. Also use before retiring a project whose memories should move somewhere else.
decomment
Strip the noise comments an AI agent left behind on a branch — the ones that restate the code line by line or narrate the change as a story ("was X, now Y", "added a guard here"). Git holds the history and the code holds the present; only genuinely non-obvious comments survive.
cleanup
Tidy up after yourself and close your own agterm session.