|
2 | 2 |
|
3 | 3 | [](https://github.com/gaoguobin/codex-fast-proxy/actions/workflows/ci.yml) |
4 | 4 |
|
5 | | -Codex App Fast/Priority proxy for third-party OpenAI-compatible APIs. |
| 5 | +Codex App auth-split proxy for third-party OpenAI-compatible APIs. |
6 | 6 |
|
7 | | -This project is for Codex App users who already use a third-party API provider or relay service. |
8 | | -It lets Codex App route model requests through a local proxy, keep streaming intact, preserve the |
9 | | -App's own Fast control when available, and optionally inject `service_tier="priority"` when Codex |
10 | | -does not send a tier. |
| 7 | +Use Codex App while you sign in with ChatGPT for the full App UI, but keep model requests on your |
| 8 | +third-party OpenAI-compatible API provider. `codex-fast-proxy` routes provider traffic through a |
| 9 | +local proxy, applies an optional provider-auth override, preserves streaming, and keeps the App's |
| 10 | +own Fast controls intact when they are available. |
11 | 11 |
|
12 | 12 | [Chinese Guide](docs/README.zh-CN.md) · [Quick Start](#quick-start) · [Common Workflows](#common-workflows) · [Dashboard](#dashboard) · [Safety](#safety) · [Advanced Usage](docs/advanced-usage.md) · [Sponsor](#sponsor) |
13 | 13 |
|
14 | | - |
| 14 | + |
| 15 | + |
| 16 | +[Watch the 10-second overview video](docs/assets/codex-fast-proxy-promo.mp4) |
15 | 17 |
|
16 | 18 | ## Why |
17 | 19 |
|
18 | | -Codex CLI can already use Fast mode. The main use case here is Codex App + third-party API |
19 | | -providers, where users may still want the richer App experience: plugin marketplace, GitHub/Apps |
20 | | -connectors, manual Fast controls, status hints, voice input, and a local dashboard. |
| 20 | +Codex App features such as plugin marketplace, GitHub/Apps connectors, manual Fast controls, status |
| 21 | +hints, and voice input are tied to signing in with ChatGPT. Users of third-party API providers still |
| 22 | +need model requests to use the provider's endpoint and API key. |
| 23 | + |
| 24 | +This project keeps those two concerns separate: Codex App can stay signed in with ChatGPT for UI and |
| 25 | +connector features, while `/v1/responses` model traffic continues through your configured provider. |
| 26 | +Fast/Priority routing is then treated as a provider capability that should be measured, not assumed. |
21 | 27 |
|
22 | 28 | ## What It Does |
23 | 29 |
|
| 30 | +- Lets Codex App stay signed in with ChatGPT while provider API requests use your third-party |
| 31 | + upstream. |
24 | 32 | - Routes Codex provider traffic from `http://127.0.0.1:8787/v1` to your saved upstream provider. |
| 33 | +- Optionally replaces proxied provider `Authorization` with a key from an environment variable, so |
| 34 | + ChatGPT account auth is not forwarded to the third-party provider. |
25 | 35 | - Only patches `POST /v1/responses`, and only when the configured Fast policy allows it. |
26 | 36 | - Leaves `model`, `reasoning`, `tools`, `input`, request bodies, and SSE frames unchanged. |
27 | | -- Supports an optional auth split for ChatGPT-login users: provider API requests can use a separate |
28 | | - environment variable while ChatGPT plugin/GitHub/App connector traffic remains untouched. |
| 37 | +- Preserves Codex App's manual Fast controls when the App sends its own `service_tier`. |
29 | 38 | - Installs a Codex `SessionStart` hook so future Codex sessions can start a missing proxy. |
30 | 39 | - Provides a read-only local dashboard with redacted status, recent traffic, and benchmark summary. |
31 | 40 |
|
| 41 | +## Fast Effect |
| 42 | + |
| 43 | +Fast/Priority is an important feature, but it is not a local guarantee. This proxy can send the |
| 44 | +priority hint, but the real latency effect depends on the upstream OpenAI-compatible provider. Some |
| 45 | +providers accept `service_tier="priority"` without making the measured workload faster, and some may |
| 46 | +not echo priority metadata in the response. |
| 47 | + |
| 48 | +Use the built-in A/B benchmark as the source of truth for your current provider and model: |
| 49 | + |
| 50 | +```text |
| 51 | +Run the Codex Fast proxy A/B benchmark |
| 52 | +``` |
| 53 | + |
| 54 | +Benchmark results separate three facts: whether priority requests were accepted, whether the |
| 55 | +measured workload got faster, and whether provider response metadata explicitly confirmed priority. |
| 56 | +The benchmark also records whether the control split was valid, so default samples must omit |
| 57 | +`service_tier` while priority samples send the expected value. |
| 58 | + |
32 | 59 | ## Quick Start |
33 | 60 |
|
34 | 61 | Paste this into Codex: |
@@ -84,10 +111,11 @@ In API-key mode, the default `auto` policy can inject global priority when Codex |
84 | 111 | `service_tier`. In ChatGPT-login or unclear states, the default behavior is conservative and |
85 | 112 | preserves Codex's own Fast choice. |
86 | 113 |
|
87 | | -## ChatGPT Login |
| 114 | +## Sign In With ChatGPT |
88 | 115 |
|
89 | | -ChatGPT login is optional. Use it only if you want the full Codex App UI, such as plugin |
90 | | -marketplace, GitHub/Apps/connectors, manual Fast controls, status hints, or voice input. |
| 116 | +Signing in with ChatGPT is optional. Use it only if you want the full Codex App UI, such as plugin |
| 117 | +marketplace, GitHub/Apps/connectors, manual Fast controls, status hints, or voice input. The proxy's |
| 118 | +auth split keeps model requests on your third-party provider after that sign-in. |
91 | 119 |
|
92 | 120 | Before switching Codex App to ChatGPT login, ask Codex to prepare provider auth: |
93 | 121 |
|
|
0 commit comments