codex-multi-auth 2.16.0 → 2.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/.codex-plugin/plugin.json +9 -9
  2. package/LICENSE +21 -21
  3. package/README.md +487 -463
  4. package/assets/codex-multi-auth-icon.svg +39 -39
  5. package/assets/readme-hero.svg +31 -31
  6. package/config/README.md +31 -31
  7. package/config/codex-legacy.json +1221 -1221
  8. package/config/codex-modern.json +423 -423
  9. package/config/minimal-codex.json +15 -15
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +8 -3
  12. package/dist/lib/account-policy.d.ts +4 -0
  13. package/dist/lib/account-policy.d.ts.map +1 -1
  14. package/dist/lib/account-policy.js +8 -0
  15. package/dist/lib/accounts/rate-limits.d.ts.map +1 -1
  16. package/dist/lib/accounts/rate-limits.js +2 -0
  17. package/dist/lib/accounts.d.ts +15 -3
  18. package/dist/lib/accounts.d.ts.map +1 -1
  19. package/dist/lib/accounts.js +231 -30
  20. package/dist/lib/api-route-store.d.ts +24 -0
  21. package/dist/lib/api-route-store.d.ts.map +1 -0
  22. package/dist/lib/api-route-store.js +145 -0
  23. package/dist/lib/auth/account-access.d.ts +115 -0
  24. package/dist/lib/auth/account-access.d.ts.map +1 -0
  25. package/dist/lib/auth/account-access.js +214 -0
  26. package/dist/lib/auth/token-utils.d.ts +54 -1
  27. package/dist/lib/auth/token-utils.d.ts.map +1 -1
  28. package/dist/lib/auth/token-utils.js +92 -7
  29. package/dist/lib/cli.d.ts +1 -1
  30. package/dist/lib/cli.d.ts.map +1 -1
  31. package/dist/lib/cli.js +4 -0
  32. package/dist/lib/codex-cli/state.d.ts +7 -0
  33. package/dist/lib/codex-cli/state.d.ts.map +1 -1
  34. package/dist/lib/codex-cli/state.js +18 -0
  35. package/dist/lib/codex-cli/writer.d.ts.map +1 -1
  36. package/dist/lib/codex-cli/writer.js +60 -8
  37. package/dist/lib/codex-manager/account-manager-commands.d.ts.map +1 -1
  38. package/dist/lib/codex-manager/account-manager-commands.js +1 -0
  39. package/dist/lib/codex-manager/account-pool-write.d.ts +3 -1
  40. package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
  41. package/dist/lib/codex-manager/account-pool-write.js +4 -0
  42. package/dist/lib/codex-manager/api-login-menu.d.ts +14 -0
  43. package/dist/lib/codex-manager/api-login-menu.d.ts.map +1 -0
  44. package/dist/lib/codex-manager/api-login-menu.js +224 -0
  45. package/dist/lib/codex-manager/commands/account.d.ts.map +1 -1
  46. package/dist/lib/codex-manager/commands/account.js +27 -0
  47. package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
  48. package/dist/lib/codex-manager/commands/best.js +6 -2
  49. package/dist/lib/codex-manager/commands/check.d.ts +7 -1
  50. package/dist/lib/codex-manager/commands/check.d.ts.map +1 -1
  51. package/dist/lib/codex-manager/commands/check.js +24 -3
  52. package/dist/lib/codex-manager/commands/forecast.d.ts +1 -1
  53. package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
  54. package/dist/lib/codex-manager/commands/forecast.js +7 -3
  55. package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
  56. package/dist/lib/codex-manager/commands/report.js +5 -1
  57. package/dist/lib/codex-manager/commands/resets.d.ts +2 -0
  58. package/dist/lib/codex-manager/commands/resets.d.ts.map +1 -0
  59. package/dist/lib/codex-manager/commands/resets.js +67 -0
  60. package/dist/lib/codex-manager/commands/rotation.d.ts +2 -2
  61. package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
  62. package/dist/lib/codex-manager/commands/rotation.js +63 -12
  63. package/dist/lib/codex-manager/commands/status.d.ts +12 -1
  64. package/dist/lib/codex-manager/commands/status.d.ts.map +1 -1
  65. package/dist/lib/codex-manager/commands/status.js +166 -22
  66. package/dist/lib/codex-manager/commands/uninstall.js +1 -1
  67. package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
  68. package/dist/lib/codex-manager/formatters/quota-formatters.js +3 -2
  69. package/dist/lib/codex-manager/health-check.d.ts +3 -0
  70. package/dist/lib/codex-manager/health-check.d.ts.map +1 -1
  71. package/dist/lib/codex-manager/health-check.js +57 -7
  72. package/dist/lib/codex-manager/help.d.ts.map +1 -1
  73. package/dist/lib/codex-manager/help.js +4 -2
  74. package/dist/lib/codex-manager/login-flow.d.ts.map +1 -1
  75. package/dist/lib/codex-manager/login-flow.js +69 -7
  76. package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
  77. package/dist/lib/codex-manager/login-menu-data.js +21 -8
  78. package/dist/lib/codex-manager/login-oauth.d.ts +3 -0
  79. package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -1
  80. package/dist/lib/codex-manager/login-oauth.js +6 -1
  81. package/dist/lib/codex-manager/login-workspace-choice.d.ts +11 -0
  82. package/dist/lib/codex-manager/login-workspace-choice.d.ts.map +1 -0
  83. package/dist/lib/codex-manager/login-workspace-choice.js +37 -0
  84. package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -1
  85. package/dist/lib/codex-manager/persist-selected-account.js +2 -1
  86. package/dist/lib/codex-manager/quota-cache-helpers.d.ts +7 -1
  87. package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -1
  88. package/dist/lib/codex-manager/quota-cache-helpers.js +34 -19
  89. package/dist/lib/codex-manager/repair-commands.d.ts +13 -0
  90. package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
  91. package/dist/lib/codex-manager/repair-commands.js +144 -9
  92. package/dist/lib/codex-manager.d.ts.map +1 -1
  93. package/dist/lib/codex-manager.js +25 -6
  94. package/dist/lib/concurrency.d.ts +3 -0
  95. package/dist/lib/concurrency.d.ts.map +1 -0
  96. package/dist/lib/concurrency.js +31 -0
  97. package/dist/lib/context-budget-response.js +8 -8
  98. package/dist/lib/context-overflow.js +10 -10
  99. package/dist/lib/model-route-policy.d.ts +52 -0
  100. package/dist/lib/model-route-policy.d.ts.map +1 -0
  101. package/dist/lib/model-route-policy.js +159 -0
  102. package/dist/lib/oauth-success.html +125 -125
  103. package/dist/lib/policy/runtime-policy.d.ts +1 -0
  104. package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
  105. package/dist/lib/policy/runtime-policy.js +3 -0
  106. package/dist/lib/preemptive-quota-scheduler.d.ts +2 -0
  107. package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -1
  108. package/dist/lib/preemptive-quota-scheduler.js +4 -0
  109. package/dist/lib/prompts/codex-host-bridge.js +138 -138
  110. package/dist/lib/prompts/codex.js +79 -79
  111. package/dist/lib/quota-cache.d.ts +7 -3
  112. package/dist/lib/quota-cache.d.ts.map +1 -1
  113. package/dist/lib/quota-cache.js +91 -59
  114. package/dist/lib/quota-probe.d.ts +5 -0
  115. package/dist/lib/quota-probe.d.ts.map +1 -1
  116. package/dist/lib/quota-probe.js +26 -2
  117. package/dist/lib/quota-readiness.d.ts +7 -2
  118. package/dist/lib/quota-readiness.d.ts.map +1 -1
  119. package/dist/lib/quota-readiness.js +25 -4
  120. package/dist/lib/request/client-cancellation.d.ts +5 -0
  121. package/dist/lib/request/client-cancellation.d.ts.map +1 -0
  122. package/dist/lib/request/client-cancellation.js +7 -0
  123. package/dist/lib/request/response-outcome.d.ts +25 -0
  124. package/dist/lib/request/response-outcome.d.ts.map +1 -0
  125. package/dist/lib/request/response-outcome.js +49 -0
  126. package/dist/lib/request/stream-failover-runtime.d.ts +2 -1
  127. package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -1
  128. package/dist/lib/request/stream-failover-runtime.js +29 -10
  129. package/dist/lib/runtime/account-check.d.ts.map +1 -1
  130. package/dist/lib/runtime/account-check.js +2 -8
  131. package/dist/lib/runtime/account-model-catalog.d.ts +64 -0
  132. package/dist/lib/runtime/account-model-catalog.d.ts.map +1 -0
  133. package/dist/lib/runtime/account-model-catalog.js +154 -0
  134. package/dist/lib/runtime/account-pool.d.ts +3 -1
  135. package/dist/lib/runtime/account-pool.d.ts.map +1 -1
  136. package/dist/lib/runtime/account-pool.js +4 -0
  137. package/dist/lib/runtime/account-reset-credits.d.ts +42 -0
  138. package/dist/lib/runtime/account-reset-credits.d.ts.map +1 -0
  139. package/dist/lib/runtime/account-reset-credits.js +82 -0
  140. package/dist/lib/runtime/api-model-capabilities.d.ts +30 -0
  141. package/dist/lib/runtime/api-model-capabilities.d.ts.map +1 -0
  142. package/dist/lib/runtime/api-model-capabilities.js +434 -0
  143. package/dist/lib/runtime/api-model-runtime.d.ts +42 -0
  144. package/dist/lib/runtime/api-model-runtime.d.ts.map +1 -0
  145. package/dist/lib/runtime/api-model-runtime.js +358 -0
  146. package/dist/lib/runtime/app-bind.d.ts +19 -1
  147. package/dist/lib/runtime/app-bind.d.ts.map +1 -1
  148. package/dist/lib/runtime/app-bind.js +89 -11
  149. package/dist/lib/runtime/automatic-account-checks.d.ts +35 -0
  150. package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -0
  151. package/dist/lib/runtime/automatic-account-checks.js +140 -0
  152. package/dist/lib/runtime/automatic-subscription-checks.d.ts +7 -0
  153. package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -0
  154. package/dist/lib/runtime/automatic-subscription-checks.js +54 -0
  155. package/dist/lib/runtime/catalog-capabilities.d.ts +8 -0
  156. package/dist/lib/runtime/catalog-capabilities.d.ts.map +1 -0
  157. package/dist/lib/runtime/catalog-capabilities.js +61 -0
  158. package/dist/lib/runtime/inference-activity.d.ts +15 -0
  159. package/dist/lib/runtime/inference-activity.d.ts.map +1 -0
  160. package/dist/lib/runtime/inference-activity.js +95 -0
  161. package/dist/lib/runtime/model-discovery-status.d.ts +100 -0
  162. package/dist/lib/runtime/model-discovery-status.d.ts.map +1 -0
  163. package/dist/lib/runtime/model-discovery-status.js +387 -0
  164. package/dist/lib/runtime/native-account-storage.d.ts +11 -0
  165. package/dist/lib/runtime/native-account-storage.d.ts.map +1 -0
  166. package/dist/lib/runtime/native-account-storage.js +50 -0
  167. package/dist/lib/runtime/native-account-sync.d.ts +19 -0
  168. package/dist/lib/runtime/native-account-sync.d.ts.map +1 -0
  169. package/dist/lib/runtime/native-account-sync.js +62 -0
  170. package/dist/lib/runtime/native-binding-lock.d.ts +3 -0
  171. package/dist/lib/runtime/native-binding-lock.d.ts.map +1 -0
  172. package/dist/lib/runtime/native-binding-lock.js +5 -0
  173. package/dist/lib/runtime/native-client-auth.d.ts +3 -0
  174. package/dist/lib/runtime/native-client-auth.d.ts.map +1 -0
  175. package/dist/lib/runtime/native-client-auth.js +42 -0
  176. package/dist/lib/runtime/native-provider-config.d.ts +4 -0
  177. package/dist/lib/runtime/native-provider-config.d.ts.map +1 -0
  178. package/dist/lib/runtime/native-provider-config.js +52 -0
  179. package/dist/lib/runtime/native-rate-limits.d.ts +18 -0
  180. package/dist/lib/runtime/native-rate-limits.d.ts.map +1 -0
  181. package/dist/lib/runtime/native-rate-limits.js +135 -0
  182. package/dist/lib/runtime/reset-credit-routing.d.ts +41 -0
  183. package/dist/lib/runtime/reset-credit-routing.d.ts.map +1 -0
  184. package/dist/lib/runtime/reset-credit-routing.js +66 -0
  185. package/dist/lib/runtime/reset-credits.d.ts +101 -0
  186. package/dist/lib/runtime/reset-credits.d.ts.map +1 -0
  187. package/dist/lib/runtime/reset-credits.js +162 -0
  188. package/dist/lib/runtime/response-output-history.d.ts +17 -0
  189. package/dist/lib/runtime/response-output-history.d.ts.map +1 -0
  190. package/dist/lib/runtime/response-output-history.js +85 -0
  191. package/dist/lib/runtime/responses-websocket.d.ts +31 -0
  192. package/dist/lib/runtime/responses-websocket.d.ts.map +1 -0
  193. package/dist/lib/runtime/responses-websocket.js +636 -0
  194. package/dist/lib/runtime/resume-picker.d.ts +41 -0
  195. package/dist/lib/runtime/resume-picker.d.ts.map +1 -0
  196. package/dist/lib/runtime/resume-picker.js +169 -0
  197. package/dist/lib/runtime/rotation-account-selection.d.ts +6 -0
  198. package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -1
  199. package/dist/lib/runtime/rotation-account-selection.js +63 -0
  200. package/dist/lib/runtime/rotation-proxy-state.d.ts +33 -0
  201. package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -1
  202. package/dist/lib/runtime/rotation-server-types.d.ts +18 -0
  203. package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -1
  204. package/dist/lib/runtime/runtime-capability-failures.d.ts +14 -0
  205. package/dist/lib/runtime/runtime-capability-failures.d.ts.map +1 -0
  206. package/dist/lib/runtime/runtime-capability-failures.js +76 -0
  207. package/dist/lib/runtime/runtime-observability.d.ts +7 -0
  208. package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
  209. package/dist/lib/runtime/runtime-observability.js +42 -2
  210. package/dist/lib/runtime/subscription-first-use.d.ts +10 -0
  211. package/dist/lib/runtime/subscription-first-use.d.ts.map +1 -0
  212. package/dist/lib/runtime/subscription-first-use.js +64 -0
  213. package/dist/lib/runtime/subscription-quota-event.d.ts +6 -0
  214. package/dist/lib/runtime/subscription-quota-event.d.ts.map +1 -0
  215. package/dist/lib/runtime/subscription-quota-event.js +31 -0
  216. package/dist/lib/runtime/subscription-quota-order.d.ts +17 -0
  217. package/dist/lib/runtime/subscription-quota-order.d.ts.map +1 -0
  218. package/dist/lib/runtime/subscription-quota-order.js +31 -0
  219. package/dist/lib/runtime/workspace-model-scopes.d.ts +15 -0
  220. package/dist/lib/runtime/workspace-model-scopes.d.ts.map +1 -0
  221. package/dist/lib/runtime/workspace-model-scopes.js +34 -0
  222. package/dist/lib/runtime-constants.d.ts +3 -0
  223. package/dist/lib/runtime-constants.d.ts.map +1 -1
  224. package/dist/lib/runtime-constants.js +5 -0
  225. package/dist/lib/runtime-paths.d.ts.map +1 -1
  226. package/dist/lib/runtime-paths.js +4 -1
  227. package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
  228. package/dist/lib/runtime-rotation-proxy.js +852 -42
  229. package/dist/lib/schemas.d.ts +20 -0
  230. package/dist/lib/schemas.d.ts.map +1 -1
  231. package/dist/lib/schemas.js +3 -0
  232. package/dist/lib/storage/credential-sidecars.d.ts +13 -0
  233. package/dist/lib/storage/credential-sidecars.d.ts.map +1 -0
  234. package/dist/lib/storage/credential-sidecars.js +52 -0
  235. package/dist/lib/storage/file-lock.d.ts +9 -0
  236. package/dist/lib/storage/file-lock.d.ts.map +1 -0
  237. package/dist/lib/storage/file-lock.js +186 -0
  238. package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
  239. package/dist/lib/storage/flagged-storage.js +12 -0
  240. package/dist/lib/storage/path-state.d.ts +2 -0
  241. package/dist/lib/storage/path-state.d.ts.map +1 -1
  242. package/dist/lib/storage/path-state.js +9 -0
  243. package/dist/lib/storage/paths.js +4 -4
  244. package/dist/lib/storage/pending-auth.d.ts +18 -0
  245. package/dist/lib/storage/pending-auth.d.ts.map +1 -0
  246. package/dist/lib/storage/pending-auth.js +155 -0
  247. package/dist/lib/storage/public-types.d.ts +13 -0
  248. package/dist/lib/storage/public-types.d.ts.map +1 -1
  249. package/dist/lib/storage/record-identity.d.ts +16 -0
  250. package/dist/lib/storage/record-identity.d.ts.map +1 -0
  251. package/dist/lib/storage/record-identity.js +16 -0
  252. package/dist/lib/storage/snapshot-merge.d.ts +16 -0
  253. package/dist/lib/storage/snapshot-merge.d.ts.map +1 -0
  254. package/dist/lib/storage/snapshot-merge.js +206 -0
  255. package/dist/lib/storage/transactions.d.ts.map +1 -1
  256. package/dist/lib/storage/transactions.js +5 -4
  257. package/dist/lib/storage.d.ts +6 -0
  258. package/dist/lib/storage.d.ts.map +1 -1
  259. package/dist/lib/storage.js +77 -7
  260. package/dist/lib/ui/auth-menu-builder.d.ts +2 -0
  261. package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -1
  262. package/dist/lib/ui/auth-menu-builder.js +1 -0
  263. package/dist/lib/ui/auth-menu.d.ts.map +1 -1
  264. package/dist/lib/ui/auth-menu.js +1 -0
  265. package/dist/lib/ui/check-progress.d.ts +8 -0
  266. package/dist/lib/ui/check-progress.d.ts.map +1 -0
  267. package/dist/lib/ui/check-progress.js +30 -0
  268. package/dist/lib/ui/format.d.ts +3 -1
  269. package/dist/lib/ui/format.d.ts.map +1 -1
  270. package/dist/lib/ui/format.js +8 -0
  271. package/dist/lib/ui/ui-copy.d.ts +2 -2
  272. package/dist/lib/ui/ui-copy.js +2 -2
  273. package/dist/lib/usage/pricing.js +2 -2
  274. package/dist/lib/usage/usage-extraction.d.ts +3 -1
  275. package/dist/lib/usage/usage-extraction.d.ts.map +1 -1
  276. package/dist/lib/usage/usage-extraction.js +46 -9
  277. package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
  278. package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
  279. package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
  280. package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
  281. package/node_modules/@codex-ai/plugin/package.json +9 -9
  282. package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
  283. package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
  284. package/node_modules/@codex-ai/sdk/package.json +8 -8
  285. package/package.json +200 -197
  286. package/scripts/codex-app-launcher.js +653 -653
  287. package/scripts/codex-app-router.js +373 -366
  288. package/scripts/codex-bin-resolver.js +313 -281
  289. package/scripts/codex-multi-auth.js +59 -59
  290. package/scripts/codex-routing.js +62 -61
  291. package/scripts/codex.js +6642 -6564
  292. package/scripts/install-codex-auth-utils.js +213 -213
  293. package/scripts/mcodex.js +367 -367
  294. package/scripts/postinstall.js +114 -114
  295. package/scripts/preuninstall.js +265 -265
  296. package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
  297. package/vendor/codex-ai-plugin/dist/index.js +2 -2
  298. package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
  299. package/vendor/codex-ai-plugin/dist/tool.js +29 -29
  300. package/vendor/codex-ai-plugin/package.json +9 -9
  301. package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
  302. package/vendor/codex-ai-sdk/dist/index.js +2 -2
  303. package/vendor/codex-ai-sdk/package.json +8 -8
package/README.md CHANGED
@@ -1,463 +1,487 @@
1
- # codex-multi-auth: multi-account OAuth for the official Codex CLI
2
-
3
- [![npm version](https://img.shields.io/npm/v/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
4
- [![npm downloads](https://img.shields.io/npm/dw/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
5
- [![CI](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml)
6
- [![MIT license](https://img.shields.io/npm/l/codex-multi-auth.svg)](LICENSE)
7
-
8
- `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It gives Codex CLI users explicit ChatGPT account login, account switching, health checks, local diagnostics, project-scoped storage, and default-on runtime Responses rotation without taking over the official `codex` binary. Use `codex-multi-auth ...` for account management, or `codex-multi-auth-codex ...` only when you intentionally want the optional forwarding wrapper.
9
-
10
- Use it when you need a local Codex CLI multi-account workflow with visible account state, safer recovery commands, and a loopback-only runtime rotation proxy for request-bearing forwarded Codex sessions.
11
-
12
- <img width="1270" height="729" alt="codex-multi-auth terminal dashboard for Codex CLI multi-account OAuth account status" src="https://github.com/user-attachments/assets/0cecb77e-a6d3-432a-ba48-3577db0c7093" />
13
-
14
-
15
-
16
- > [!NOTE]
17
- > Legacy scoped prerelease package `@ndycode/codex-multi-auth` is migration-only.
18
- > Use `codex-multi-auth` for all new installs.
19
-
20
- ## What You Get
21
-
22
- - Codex CLI multi-account OAuth management with a dedicated `codex-multi-auth ...` command family
23
- - Explicit ChatGPT account login, saved-account listing, account switching, health checks, and diagnostics
24
- - Optional `codex-multi-auth-codex ...` forwarding wrapper for official Codex CLI commands when you choose wrapper-launched sessions
25
- - Health-aware account selection, quota forecasting, automatic failover, and flagged-account recovery
26
- - Project-scoped account storage under `~/.codex/multi-auth/projects/<project-key>/...` for repo-specific workflows
27
- - Interactive terminal dashboard for account actions, settings, search, and hotkeys
28
- - Forecast, report, fix, doctor, verify, monitor, and rotation commands for operational confidence
29
- - Local usage ledger, budget guards, account policy controls, routing profiles, and model/account capability views
30
- - Runtime counters, budget/cooldown state, and multi-auth probe visibility in `codex-multi-auth status` / `codex-multi-auth report`
31
- - Default-on loopback Responses proxy for live account rotation inside forwarded Codex CLI/app sessions
32
- - [Image generation/edit transport](docs/reference/image-routes.md) through the same authenticated runtime proxy
33
- - [Built-in image_gen provider compatibility](docs/reference/imagegen-provider-compatibility.md) through the same authenticated runtime proxy
34
- - Optional loopback-only local bridge for `/health`, `/v1/models`, and `/v1/responses`, protected by hashed local client tokens
35
- - Reversible packaged Codex app bind and user-level launcher routing helpers that do not patch official app binaries
36
- - Session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
37
- - Codex-oriented request/prompt compatibility with strict runtime handling and documented error contracts
38
- - Stable docs for install, configuration, troubleshooting, upgrade, public API, storage paths, and release notes
39
-
40
- ---
41
-
42
- ## Why Developers Use It
43
-
44
- `codex-multi-auth` makes local Codex account state visible and recoverable. Instead of one opaque auth file, you get a named account pool, deterministic account switching, health-aware selection, JSON diagnostics for automation, and safe repair commands for stale or damaged local state. The architecture is designed for personal development workflows: credentials stay local, runtime rotation is loopback-only, and official Codex install paths keep owning the `codex` command.
45
-
46
- ---
47
-
48
- ## Current Architecture At A Glance
49
-
50
- `codex-multi-auth` ships four global binaries:
51
-
52
- | Binary | Purpose |
53
- | --- | --- |
54
- | `codex-multi-auth` | Primary account manager; accepts bare auth subcommands such as `login`, `status`, `switch`, `forecast`, and `rotation status` |
55
- | `codex-multi-auth-codex` | Optional wrapper that handles `auth ...` locally and forwards every other command to the official Codex CLI |
56
- | `mcodex` | Convenience launcher over `codex-multi-auth-codex` with optional `--monitor` and `--tmux` modes |
57
- | `codex-multi-auth-app-launcher` | Optional desktop launcher helper for supported user-level shortcuts and wrapper apps |
58
-
59
- The package does not publish a global `codex` binary. Keep `codex` owned by the official OpenAI install path. Use `codex-multi-auth-codex ...` or `mcodex ...` only when you intentionally want this package's forwarding wrapper.
60
-
61
- ---
62
-
63
- <details open>
64
- <summary><b>Terms and Usage Notice</b></summary>
65
-
66
- > [!CAUTION]
67
- > This project uses OAuth account credentials and is intended for personal development use.
68
- >
69
- > By using this package, you acknowledge:
70
- > - This is an independent open-source project, not an official OpenAI product
71
- > - You are responsible for your own usage and policy compliance
72
- > - For production/commercial workloads, use the OpenAI Platform API
73
-
74
- </details>
75
-
76
- ---
77
-
78
- ## Installation
79
-
80
- <details open>
81
- <summary><b>For Humans</b></summary>
82
-
83
- ### Option A: Standard install
84
-
85
- ```bash
86
- npm i -g codex-multi-auth
87
- ```
88
-
89
- ### Option B: Migrate from legacy scoped prerelease
90
-
91
- ```bash
92
- npm uninstall -g @ndycode/codex-multi-auth
93
- npm i -g codex-multi-auth
94
- ```
95
-
96
- ### Option C: Verify wiring
97
-
98
- `codex --version` confirms the official Codex CLI is reachable. `codex-multi-auth --version` confirms the installed manager package version. `codex-multi-auth-codex --version` is the optional forwarding wrapper entrypoint.
99
-
100
- ```bash
101
- codex --version
102
- codex-multi-auth --version
103
- codex-multi-auth status
104
- ```
105
-
106
- Any official install path is fine as long as `codex` is on `PATH`: `npm i -g @openai/codex`, `brew install --cask codex`, or an official release binary.
107
-
108
- </details>
109
-
110
- <details>
111
- <summary><b>For LLM Agents</b></summary>
112
-
113
- ### Step-by-step
114
-
115
- 1. Install global package:
116
- - `npm i -g codex-multi-auth`
117
- 2. Run first login flow with `codex-multi-auth login`
118
- 3. Validate state with `codex-multi-auth status` and `codex-multi-auth check`
119
- 4. Confirm routing with `codex-multi-auth forecast --live`
120
-
121
- ### Verification
122
-
123
- ```bash
124
- codex-multi-auth status
125
- codex-multi-auth check
126
- ```
127
-
128
- </details>
129
-
130
- ---
131
-
132
- ## Quick Start
133
-
134
- Install and sign in:
135
-
136
- ```bash
137
- npm i -g @openai/codex
138
- npm i -g codex-multi-auth
139
- codex-multi-auth login
140
- ```
141
-
142
- If you already installed the official native CLI via Homebrew or a release binary, you only need:
143
-
144
- ```bash
145
- npm i -g codex-multi-auth
146
- codex-multi-auth login
147
- ```
148
-
149
- Verify the manager and the new account:
150
-
151
- ```bash
152
- codex-multi-auth status
153
- codex-multi-auth check
154
- ```
155
-
156
- Use these next:
157
-
158
- ```bash
159
- codex-multi-auth list
160
- codex-multi-auth switch 2
161
- codex-multi-auth forecast --live
162
- ```
163
-
164
- If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
165
- For remote or headless shells, prefer `codex-multi-auth login --device-auth`.
166
- To refresh one saved account without changing the active selection or manual
167
- pin, run:
168
-
169
- ```bash
170
- codex-multi-auth login --account <index|email|account_id> --preserve-selection
171
- ```
172
-
173
- Add `--device-auth` on a remote shell. The refreshed OAuth identity must match
174
- the requested saved account or nothing is written. Refreshing the account Codex
175
- is currently using still publishes its new tokens to the native CLI; refreshing
176
- any other account leaves the active selection and the manual pin untouched. A
177
- disabled account stays disabled. `--account` cannot be combined with `--org`,
178
- which would rebind the row to a different workspace.
179
-
180
- ---
181
-
182
- ## Command Toolkit
183
-
184
- ### Start here
185
-
186
- | Command | What it answers |
187
- | --- | --- |
188
- | `codex-multi-auth login` | How do I add or re-open the account menu? |
189
- | `codex-multi-auth status` | What does my account pool, pin, and runtime metrics look like? (`list` is the same output) |
190
- | `codex-multi-auth check` | Do live health probes against my saved accounts succeed? |
191
-
192
- ### Daily use
193
-
194
- | Command | What it answers |
195
- | --- | --- |
196
- | `codex-multi-auth list` | Alias of `status` — full account/runtime dump |
197
- | `codex-multi-auth switch <index>` | How do I pin a different saved account for runtime routing? |
198
- | `codex-multi-auth unpin` | How do I clear a manual pin and resume hybrid rotation? |
199
- | `codex-multi-auth workspace <account> [workspace]` | How do I list or set an account's active workspace? |
200
- | `codex-multi-auth best --live` | How do I switch to the forecast-best account (clears any pin)? |
201
- | `codex-multi-auth-codex --account <index\|email\|id>` | How do I force one account for a single wrapper session without changing my default? |
202
- | `codex-multi-auth forecast --live` | Which account looks best for the next session? |
203
-
204
- ### Repair
205
-
206
- | Command | What it answers |
207
- | --- | --- |
208
- | `codex-multi-auth verify-flagged` | Can any previously flagged account be restored? |
209
- | `codex-multi-auth verify --paths` | Do my storage path chain and sandbox probes still pass self-test? |
210
- | `codex-multi-auth fix --dry-run` | What safe storage or account repairs are available? |
211
- | `codex-multi-auth doctor --fix` | Can the CLI diagnose and apply the safest fixes now? |
212
- | `codex-multi-auth uninstall` | Remove residual artifacts (run BEFORE `npm uninstall`; npm@7+ no longer fires `preuninstall`) |
213
-
214
- ### Advanced
215
-
216
- | Command | What it answers |
217
- | --- | --- |
218
- | `codex-multi-auth report --live --json` | How do I get the full machine-readable health report? |
219
- | `codex-multi-auth limits --json [--refresh]` | How do I read account quota windows without parsing internal cache files or terminal text? |
220
- | `codex-multi-auth fix --live --model gpt-5.5` | How do I run live repair probes with a chosen model? |
221
- | `codex-multi-auth why-selected --json` | Which account does the selector pick now, and why? |
222
- | `codex-multi-auth usage --since 24h --by project` | What local usage has been recorded recently? |
223
- | `codex-multi-auth monitor --json` | What is the combined usage, policy, quota, runtime, and project state? |
224
- | `codex-multi-auth bridge token create --label local-client` | How do I create a local bridge bearer token? |
225
- | `codex-multi-auth integrations --kind python` | How do I generate local bridge client snippets? |
226
- | `codex-multi-auth rotation status` | Is live runtime account rotation enabled for forwarded Codex sessions? |
227
-
228
- ### Reliability behavior
229
-
230
- - whole-pool replay is disabled by default when every account is rate-limited
231
- - active requests use a bounded outbound request budget so one prompt cannot walk the full pool indefinitely
232
- - repeated cross-account 5xx bursts trigger a short cooldown instead of continuing aggressive rotation
233
- - proactive refresh is staggered to reduce background refresh bursts
234
- - `codex-multi-auth status` surfaces recent runtime request metrics in text output, and `codex-multi-auth report --json` exposes the machine-readable cooldown/runtime snapshot
235
-
236
- ---
237
-
238
- ## Dashboard Hotkeys
239
-
240
- ### Main dashboard
241
-
242
- | Key | Action |
243
- | --- | --- |
244
- | `Up` / `Down` | Move selection |
245
- | `Enter` | Select/open |
246
- | `1-9` | Quick switch |
247
- | `/` | Search |
248
- | `?` | Toggle help |
249
- | `Q` | Back/cancel |
250
-
251
- ### Account details
252
-
253
- | Key | Action |
254
- | --- | --- |
255
- | `S` | Set current account |
256
- | `R` | Refresh/re-login account |
257
- | `E` | Enable/disable account |
258
- | `D` | Delete account |
259
-
260
- ---
261
-
262
- ## Storage Paths
263
-
264
- | File | Default path |
265
- | --- | --- |
266
- | Settings | `~/.codex/multi-auth/settings.json` |
267
- | Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
268
- | Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
269
- | Quota cache | `~/.codex/multi-auth/quota-cache.json` |
270
- | Runtime observability | `~/.codex/multi-auth/runtime-observability.json` |
271
- | Usage ledger | `~/.codex/multi-auth/usage/usage-ledger.jsonl` |
272
- | Account policies | `~/.codex/multi-auth/account-policies.json` |
273
- | Routing profiles | `~/.codex/multi-auth/routing-profiles.json` |
274
- | Budget guards | `~/.codex/multi-auth/budget-guards.json` |
275
- | Local client tokens | `~/.codex/multi-auth/local-client-tokens.json` |
276
- | Runtime app helper status | `~/.codex/multi-auth/runtime-rotation-app-helper.<pid>.json` |
277
- | Runtime app helper owner metadata | `~/.codex/multi-auth/runtime-rotation-app-helper-owner.<pid>.json` |
278
- | Persistent app bind state/logs | `~/.codex/multi-auth/app-bind/` |
279
- | Logs | `~/.codex/multi-auth/logs/codex-plugin/` |
280
- | Per-project accounts | `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` |
281
-
282
- Override root with `CODEX_MULTI_AUTH_DIR=<path>`.
283
-
284
- ---
285
-
286
- ## Configuration
287
-
288
- Primary config root:
289
- - `~/.codex/multi-auth/settings.json`
290
- - or `CODEX_MULTI_AUTH_DIR/settings.json` when custom root is set
291
-
292
- Selected runtime/environment overrides:
293
-
294
- | Variable | Effect |
295
- | --- | --- |
296
- | `CODEX_MULTI_AUTH_DIR` | Override settings/accounts root |
297
- | `CODEX_MULTI_AUTH_CONFIG_PATH` | Prefer this config file when it exists (also the save target when set) |
298
- | `CODEX_MODE=0/1` | Disable/enable Codex mode |
299
- | `CODEX_MULTI_AUTH_FORCE_ACCOUNT=<index\|email\|id>` | Force one account for a single `codex-multi-auth-codex` run (ephemeral; requires rotation proxy) |
300
- | `CODEX_MULTI_AUTH_BYPASS=1` | Skip multi-auth intercept and forward straight to official Codex |
301
- | `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1` | Opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions |
302
- | `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL=http://127.0.0.1:<port>/<path>` | Route the runtime rotation proxy through an explicit loopback HTTP upstream; requires an explicit port and a numeric loopback host (`127.0.0.0/8` or `[::1]`), and rejects credentials, query strings, fragments, HTTPS, and every other host |
303
- | `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS=<ms>` | Wall-clock ceiling on how long one request waits out a "selected model is at capacity" response before giving up (default 600000, max 3600000, `0` disables) |
304
- | `CODEX_MULTI_AUTH_APP_ROTATION_IDLE_MS=<ms>` | Override automatic Codex app helper idle shutdown |
305
- | `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0/1` | Opt out/in of packaged Codex app bind self-heal on first CLI run or rotation enable |
306
- | `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0/1` | Opt out/in of routing supported app shortcuts on first CLI run or rotation enable |
307
- | `CODEX_TUI_V2=0/1` | Disable/enable TUI v2 |
308
- | `CODEX_TUI_COLOR_PROFILE=truecolor\|ansi256\|ansi16` | TUI color profile |
309
- | `CODEX_TUI_GLYPHS=ascii\|unicode\|auto` | TUI glyph style |
310
- | `CODEX_AUTH_BACKGROUND_RESPONSES=0/1` | Opt in/out of stateful Responses `background: true` compatibility |
311
- | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
312
- | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | Stream stall timeout override |
313
-
314
- Validate config after changes:
315
-
316
- ```bash
317
- codex-multi-auth status
318
- codex-multi-auth check
319
- codex-multi-auth forecast --live
320
- ```
321
-
322
- Responses background mode stays opt-in. Enable `backgroundResponses` in settings or `CODEX_AUTH_BACKGROUND_RESPONSES=1` only for callers that intentionally send `background: true`, because those requests switch from stateless `store=false` routing to stateful `store=true`. See [docs/upgrade.md](docs/upgrade.md) for rollout guidance.
323
-
324
- Runtime rotation is enabled by default for request-bearing wrapper-launched Codex sessions. Package install scripts stay side-effect-free: npm postinstall only prints a short notice (and stays silent in CI or non-interactive installs). The first CLI run after an install self-heals supported packaged Codex app binds and user-level launcher routing when possible (recorded once in a `first-run-setup.json` marker under the multi-auth runtime root), while `codex-multi-auth rotation enable` remains the explicit repair command. `codex-multi-auth rotation disable` turns the setting off and removes the persistent app bind. Set `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0`, or `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0` to opt out of the matching default behavior.
325
-
326
- Advanced local proxy chains can set `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL` for one wrapper process. The wrapper passes that URL to both the shadow-runtime and interactive-helper rotation paths and fails closed if the configured upstream is invalid or unavailable; it never falls back silently to the direct backend while an explicit upstream is required. Because the request that reaches the upstream carries the managed OAuth bearer token, the host must be a numeric loopback literal: a name such as `localhost` is rejected, since a hosts-file entry can point it at a routable address. "Fails closed" also covers the case where runtime rotation itself is off (`CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_BYPASS=1`, or the setting disabled): a request-bearing invocation exits non-zero rather than bypassing the configured upstream. Subcommands that make no backend requests still run normally.
327
-
328
- When the backend answers that the selected model is at capacity, the runtime proxy waits and re-sends the request instead of burning the pool. Capacity is a property of the model, not of an account, so rotating spends the transient budget against accounts that all fail identically and the request ends as a 503 within seconds. The wait backs off (2s, 5s, 15s, 30s, then 60s), honors an upstream `retry-after` when one is sent, and stops at a wall-clock deadline set by `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS` (10 minutes by default, 1 hour maximum). Set that variable to `0` to restore the previous rotate-and-fail behavior. The responding account is left completely unpenalized: its pool token is refunded and it is never marked rate limited or cooled down, so selection runs normally on the next pass and may pick any healthy account. The wait is abandoned if the client disconnects, so no further upstream request is sent for a response nobody is reading. See [#689](https://github.com/ndycode/codex-multi-auth/issues/689).
329
-
330
- Trust boundary: the loopback check bounds exposure to the local machine, and nothing more. It does not authenticate the process listening on that port, and plaintext HTTP is what a local inspection proxy needs, so any process that can bind the port you name receives the managed bearer token in cleartext. Set this variable only on a machine where you trust every local process that can bind a loopback port, and only for as long as you need the chain.
331
-
332
- Installed wrappers may perform a best-effort daily npm version check during normal forwarded Codex startup. When a newer package is detected, the wrapper only prints a manual notice on an interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`: `npm install -g codex-multi-auth@latest`. It never runs npm install or update commands for you.
333
-
334
- ---
335
-
336
- ## Experimental Settings Highlights
337
-
338
- The Settings menu now includes an `Experimental` section for staged features:
339
-
340
- - preview-first sync into `oc-chatgpt-multi-auth`
341
- - named local pool backup export with filename prompt
342
- - refresh guard toggle and interval controls moved out of Backend Controls
343
- - context budget guard: pause a session before it hits the model's context window, with independently configurable soft/hard thresholds (default 65% / 69%) — ships disabled; see [Context Budget Guard](docs/features.md#context-budget-guard-experimental)
344
-
345
- These flows are intentionally non-destructive by default: sync previews before apply, destination-only accounts are preserved, and backup filename collisions fail safely.
346
-
347
- ---
348
-
349
- ## Troubleshooting
350
-
351
- <details open>
352
- <summary><b>60-second recovery</b></summary>
353
-
354
- ```bash
355
- codex-multi-auth doctor --fix
356
- codex-multi-auth check
357
- codex-multi-auth forecast --live
358
- ```
359
-
360
- If still broken:
361
-
362
- ```bash
363
- codex-multi-auth login
364
- ```
365
-
366
- </details>
367
-
368
- <details>
369
- <summary><b>Common symptoms</b></summary>
370
-
371
- - `codex-multi-auth` unrecognized: run `where codex-multi-auth` or `which codex-multi-auth`, then follow `docs/troubleshooting.md` for install checks
372
- - Switch succeeds but wrong account appears active: run `codex-multi-auth switch <index>`, then restart session
373
- - Requests fail fast with a pool cooldown message: wait for the cooldown window or inspect `codex-multi-auth status`
374
- - Requests fail fast after repeated upstream 5xx errors: inspect `codex-multi-auth report --json` for runtime traffic and cooldown details
375
- - Storage cleanup fails with `EBUSY` / `EPERM` (Windows): run `codex-multi-auth doctor --fix` to retry, or manually remove `~/.codex/multi-auth/<project-key>/` and re-login
376
- - OAuth callback on port `1455` fails: free the port and re-run `codex-multi-auth login`
377
- - Login hangs in WSL, or installing in WSL breaks a working Windows install: Windows and WSL contend for callback port `1455`, and the browser opens on the Windows host either way — see [Windows and WSL side by side](docs/troubleshooting.md#windows-and-wsl-side-by-side), or use `codex-multi-auth login --device-auth`, which needs no callback port
378
- - Browser launch is blocked or you are in a headless shell: prefer `codex-multi-auth login --device-auth`; use `codex-multi-auth login --manual` or `CODEX_AUTH_NO_BROWSER=1` only when you need the callback-paste fallback
379
- - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account
380
-
381
- </details>
382
-
383
- <details>
384
- <summary><b>Diagnostics pack</b></summary>
385
-
386
- ```bash
387
- codex-multi-auth list
388
- codex-multi-auth status
389
- codex-multi-auth check
390
- codex-multi-auth verify-flagged --json
391
- codex-multi-auth forecast --live
392
- codex-multi-auth fix --dry-run
393
- codex-multi-auth report --live --json
394
- codex-multi-auth doctor --json
395
- ```
396
-
397
- </details>
398
-
399
- ---
400
-
401
- ## Documentation
402
-
403
- - Docs portal: [docs/README.md](docs/README.md)
404
- - Getting started: [docs/getting-started.md](docs/getting-started.md)
405
- - Features: [docs/features.md](docs/features.md)
406
- - Configuration: [docs/configuration.md](docs/configuration.md)
407
- - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
408
- - Commands reference: [docs/reference/commands.md](docs/reference/commands.md)
409
- - Public API contract: [docs/reference/public-api.md](docs/reference/public-api.md)
410
- - Error contracts: [docs/reference/error-contracts.md](docs/reference/error-contracts.md)
411
- - Settings reference: [docs/reference/settings.md](docs/reference/settings.md)
412
- - Storage paths: [docs/reference/storage-paths.md](docs/reference/storage-paths.md)
413
- - Upgrade guide: [docs/upgrade.md](docs/upgrade.md)
414
- - Privacy: [docs/privacy.md](docs/privacy.md)
415
-
416
- ---
417
-
418
- ## Release Notes
419
-
420
- - Current stable: [docs/releases/v2.16.0.md](docs/releases/v2.16.0.md) — install via `npm i -g codex-multi-auth`
421
- - Previous stable: [docs/releases/v2.8.3.md](docs/releases/v2.8.3.md)
422
- - Previous stable: [docs/releases/v2.8.2.md](docs/releases/v2.8.2.md)
423
- - Previous stable: [docs/releases/v2.7.1.md](docs/releases/v2.7.1.md)
424
- - Previous stable: [docs/releases/v2.7.0.md](docs/releases/v2.7.0.md)
425
- - Previous stable: [docs/releases/v2.6.0.md](docs/releases/v2.6.0.md)
426
- - Previous stable: [docs/releases/v2.5.0.md](docs/releases/v2.5.0.md)
427
- - Previous stable: [docs/releases/v2.4.0.md](docs/releases/v2.4.0.md)
428
- - Previous stable: [docs/releases/v2.3.3.md](docs/releases/v2.3.3.md)
429
- - Previous stable: [docs/releases/v2.3.2.md](docs/releases/v2.3.2.md)
430
- - Previous stable: [docs/releases/v2.3.1.md](docs/releases/v2.3.1.md)
431
- - Previous stable: [docs/releases/v2.3.0.md](docs/releases/v2.3.0.md)
432
- - Previous stable: [docs/releases/v2.2.2.md](docs/releases/v2.2.2.md)
433
- - Previous stable: [docs/releases/v2.2.1.md](docs/releases/v2.2.1.md)
434
- - Previous stable: [docs/releases/v2.2.0.md](docs/releases/v2.2.0.md)
435
- - Previous stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
436
- - Earlier stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
437
- - Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
438
- - Earlier stable: [docs/releases/v2.1.8.md](docs/releases/v2.1.8.md)
439
- - Earlier stable: [docs/releases/v2.1.7.md](docs/releases/v2.1.7.md)
440
- - Earlier stable: [docs/releases/v2.1.6.md](docs/releases/v2.1.6.md)
441
- - Earlier stable: [docs/releases/v2.1.5.md](docs/releases/v2.1.5.md)
442
- - Earlier stable: [docs/releases/v2.1.4.md](docs/releases/v2.1.4.md)
443
- - Earlier stable: [docs/releases/v2.1.3.md](docs/releases/v2.1.3.md)
444
- - Earlier stable: [docs/releases/v2.1.2.md](docs/releases/v2.1.2.md)
445
- - Earlier stable: [docs/releases/v2.1.1.md](docs/releases/v2.1.1.md)
446
- - Earlier stable: [docs/releases/v2.1.0.md](docs/releases/v2.1.0.md)
447
- - Earlier stable: [docs/releases/v1.3.2.md](docs/releases/v1.3.2.md)
448
- - Stable archive: [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md)
449
- - Full release archive: [docs/README.md#release-history](docs/README.md#release-history)
450
- - Archived prerelease: [docs/releases/v0.1.0-beta.0.md](docs/releases/v0.1.0-beta.0.md)
451
-
452
- ## License
453
-
454
- MIT License. See [LICENSE](LICENSE).
455
-
456
- <details>
457
- <summary><b>Legal</b></summary>
458
-
459
- - Not affiliated with OpenAI.
460
- - "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
461
- - You assume responsibility for your own usage and compliance.
462
-
463
- </details>
1
+ # codex-multi-auth: multi-account OAuth for the official Codex CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
4
+ [![npm downloads](https://img.shields.io/npm/dw/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
5
+ [![CI](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml)
6
+ [![MIT license](https://img.shields.io/npm/l/codex-multi-auth.svg)](LICENSE)
7
+
8
+ `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It gives Codex CLI users explicit ChatGPT account login, account switching, health checks, local diagnostics, project-scoped storage, and default-on runtime Responses rotation without taking over the official `codex` binary. Use `codex-multi-auth ...` for account management, or `codex-multi-auth-codex ...` only when you intentionally want the optional forwarding wrapper.
9
+
10
+ Use it when you need a local Codex CLI multi-account workflow with visible account state, safer recovery commands, and a loopback-only runtime rotation proxy for request-bearing forwarded Codex sessions.
11
+
12
+ <img width="1270" height="729" alt="codex-multi-auth terminal dashboard for Codex CLI multi-account OAuth account status" src="https://github.com/user-attachments/assets/0cecb77e-a6d3-432a-ba48-3577db0c7093" />
13
+
14
+
15
+
16
+ > [!NOTE]
17
+ > Legacy scoped prerelease package `@ndycode/codex-multi-auth` is migration-only.
18
+ > Use `codex-multi-auth` for all new installs.
19
+
20
+ ## What You Get
21
+
22
+ - Codex CLI multi-account OAuth management with a dedicated `codex-multi-auth ...` command family
23
+ - Explicit ChatGPT account login, saved-account listing, account switching, health checks, and diagnostics
24
+ - Optional `codex-multi-auth-codex ...` forwarding wrapper for official Codex CLI commands when you choose wrapper-launched sessions
25
+ - Health-aware account selection, quota forecasting, automatic failover, and flagged-account recovery
26
+ - Project-scoped account storage under `~/.codex/multi-auth/projects/<project-key>/...` for repo-specific workflows
27
+ - Interactive terminal dashboard for account actions, settings, search, and hotkeys
28
+ - Forecast, report, fix, doctor, verify, monitor, and rotation commands for operational confidence
29
+ - Local usage ledger, budget guards, account policy controls, routing profiles, and model/account capability views
30
+ - Runtime counters, budget/cooldown state, and multi-auth probe visibility in `codex-multi-auth status` / `codex-multi-auth report`
31
+ - Default-on loopback Responses proxy for live account rotation inside forwarded Codex CLI/app sessions
32
+ - [Image generation/edit transport](docs/reference/image-routes.md) through the same authenticated runtime proxy
33
+ - [Built-in image_gen provider compatibility](docs/reference/imagegen-provider-compatibility.md) through the same authenticated runtime proxy
34
+ - Optional loopback-only local bridge for `/health`, `/v1/models`, and `/v1/responses`, protected by hashed local client tokens
35
+ - Reversible packaged Codex app bind and user-level launcher routing helpers that do not patch official app binaries
36
+ - Session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
37
+ - Codex-oriented request/prompt compatibility with strict runtime handling and documented error contracts
38
+ - Stable docs for install, configuration, troubleshooting, upgrade, public API, storage paths, and release notes
39
+
40
+ ---
41
+
42
+ ## Optional automatic subscription priming
43
+
44
+ Run `codex-multi-auth account auto-prime <index> on` to opt an account into
45
+ periodic first-use checks by the running CLI/app router (every 15 minutes).
46
+ It completes a tiny response only for an unused personal subscription and
47
+ consumes subscription quota. Checks follow the saved workspace selection and
48
+ track each saved account separately, including members of a shared organization.
49
+ Status reads quota for the selected workspace; routing reads quota for the request’s exact workspace.
50
+ Select Personal for a Personal subscription. The default is off; use `off` to disable it.
51
+ Manual `check` still needs `--prime`. See the [command reference](docs/reference/commands.md).
52
+
53
+ ## Why Developers Use It
54
+
55
+ `codex-multi-auth` makes local Codex account state visible and recoverable. Instead of one opaque auth file, you get a named account pool, deterministic account switching, health-aware selection, JSON diagnostics for automation, and safe repair commands for stale or damaged local state. The architecture is designed for personal development workflows: credentials stay local, runtime rotation is loopback-only, and official Codex install paths keep owning the `codex` command.
56
+
57
+ ---
58
+
59
+ ## Current Architecture At A Glance
60
+
61
+ `codex-multi-auth` ships four global binaries:
62
+
63
+ | Binary | Purpose |
64
+ | --- | --- |
65
+ | `codex-multi-auth` | Primary account manager; accepts bare auth subcommands such as `login`, `status`, `switch`, `forecast`, and `rotation status` |
66
+ | `codex-multi-auth-codex` | Optional wrapper that handles `auth ...` locally and forwards every other command to the official Codex CLI |
67
+ | `mcodex` | Convenience launcher over `codex-multi-auth-codex` with optional `--monitor` and `--tmux` modes |
68
+ | `codex-multi-auth-app-launcher` | Optional desktop launcher helper for supported user-level shortcuts and wrapper apps |
69
+
70
+ The package does not publish a global `codex` binary. Keep `codex` owned by the official OpenAI install path. Use `codex-multi-auth-codex ...` or `mcodex ...` only when you intentionally want this package's forwarding wrapper.
71
+
72
+ With runtime rotation enabled, interactive `mcodex resume` lists saved CLI and desktop sessions across providers in the current directory. Use `mcodex resume --all` to include other directories, or `-C <directory>` to change the project scope. Select a session to resume it through multi-auth; Escape cancels. Discovery uses the official local Codex app-server and does not rewrite session metadata. Desktop and CLI must use the same `CODEX_HOME` for shared history.
73
+
74
+ Explicit session IDs, `--last`, remote connections, non-interactive invocations, and the in-session `/resume` command retain native Codex behavior. The cross-provider picker requires an official Codex version supporting the app-server `thread/list` API.
75
+
76
+ ---
77
+
78
+ <details open>
79
+ <summary><b>Terms and Usage Notice</b></summary>
80
+
81
+ > [!CAUTION]
82
+ > This project uses OAuth account credentials and is intended for personal development use.
83
+ >
84
+ > By using this package, you acknowledge:
85
+ > - This is an independent open-source project, not an official OpenAI product
86
+ > - You are responsible for your own usage and policy compliance
87
+ > - For production/commercial workloads, use the OpenAI Platform API
88
+
89
+ </details>
90
+
91
+ ---
92
+
93
+ ## Installation
94
+
95
+ <details open>
96
+ <summary><b>For Humans</b></summary>
97
+
98
+ ### Option A: Standard install
99
+
100
+ ```bash
101
+ npm i -g codex-multi-auth
102
+ ```
103
+
104
+ ### Option B: Migrate from legacy scoped prerelease
105
+
106
+ ```bash
107
+ npm uninstall -g @ndycode/codex-multi-auth
108
+ npm i -g codex-multi-auth
109
+ ```
110
+
111
+ ### Option C: Verify wiring
112
+
113
+ `codex --version` confirms the official Codex CLI is reachable. `codex-multi-auth --version` confirms the installed manager package version. `codex-multi-auth-codex --version` is the optional forwarding wrapper entrypoint.
114
+
115
+ ```bash
116
+ codex --version
117
+ codex-multi-auth --version
118
+ codex-multi-auth status
119
+ ```
120
+
121
+ Any official install path is fine as long as `codex` is on `PATH`: `npm i -g @openai/codex`, `brew install --cask codex`, or an official release binary.
122
+
123
+ </details>
124
+
125
+ <details>
126
+ <summary><b>For LLM Agents</b></summary>
127
+
128
+ ### Step-by-step
129
+
130
+ 1. Install global package:
131
+ - `npm i -g codex-multi-auth`
132
+ 2. Run first login flow with `codex-multi-auth login`
133
+ 3. Validate state with `codex-multi-auth status` and `codex-multi-auth check`
134
+ 4. Confirm routing with `codex-multi-auth forecast --live`
135
+
136
+ ### Verification
137
+
138
+ ```bash
139
+ codex-multi-auth status
140
+ codex-multi-auth check
141
+ ```
142
+
143
+ </details>
144
+
145
+ ---
146
+
147
+ ## Quick Start
148
+
149
+ Install and sign in:
150
+
151
+ ```bash
152
+ npm i -g @openai/codex
153
+ npm i -g codex-multi-auth
154
+ codex-multi-auth login
155
+ ```
156
+
157
+ If you already installed the official native CLI via Homebrew or a release binary, you only need:
158
+
159
+ ```bash
160
+ npm i -g codex-multi-auth
161
+ codex-multi-auth login
162
+ ```
163
+
164
+ Verify the manager and the new account:
165
+
166
+ ```bash
167
+ codex-multi-auth status
168
+ codex-multi-auth check
169
+ ```
170
+
171
+ Use these next:
172
+
173
+ ```bash
174
+ codex-multi-auth list
175
+ codex-multi-auth switch 2
176
+ codex-multi-auth forecast --live
177
+ ```
178
+
179
+ If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
180
+ For remote or headless shells, prefer `codex-multi-auth login --device-auth`.
181
+ To refresh one saved account without changing the active selection or manual
182
+ pin, run:
183
+
184
+ ```bash
185
+ codex-multi-auth login --account <index|email|account_id> --preserve-selection
186
+ ```
187
+
188
+ Add `--device-auth` on a remote shell. The refreshed OAuth identity must match
189
+ the requested saved account or nothing is written. Refreshing the account Codex
190
+ is currently using still publishes its new tokens to the native CLI; refreshing
191
+ any other account leaves the active selection and the manual pin untouched. A
192
+ disabled account stays disabled. `--account` cannot be combined with `--org`,
193
+ which would rebind the row to a different workspace.
194
+
195
+ ---
196
+
197
+ ## Command Toolkit
198
+
199
+ ### Start here
200
+
201
+ | Command | What it answers |
202
+ | --- | --- |
203
+ | `codex-multi-auth login` | How do I add or re-open the account menu? |
204
+ | `codex-multi-auth status` | What does my account pool, pin, and runtime metrics look like? (`list` is the same output) |
205
+ | `codex-multi-auth check` | Do live health probes against my saved accounts succeed? |
206
+
207
+ ### Daily use
208
+
209
+ | Command | What it answers |
210
+ | --- | --- |
211
+ | `codex-multi-auth list` | Alias of `status` — full account/runtime dump |
212
+ | `codex-multi-auth switch <index>` | How do I pin a different saved account for runtime routing? |
213
+ | `codex-multi-auth unpin` | How do I clear a manual pin and resume hybrid rotation? |
214
+ | `codex-multi-auth workspace <account> [workspace]` | How do I list or set an account's active workspace? |
215
+ | `codex-multi-auth best --live` | How do I switch to the forecast-best account (clears any pin)? |
216
+ | `codex-multi-auth-codex --account <index\|email\|id>` | How do I force one account for a single wrapper session without changing my default? |
217
+ | `codex-multi-auth forecast --live` | Which account looks best for the next session? |
218
+
219
+ ### Repair
220
+
221
+ | Command | What it answers |
222
+ | --- | --- |
223
+ | `codex-multi-auth verify-flagged` | Can any previously flagged account be restored? |
224
+ | `codex-multi-auth verify --paths` | Do my storage path chain and sandbox probes still pass self-test? |
225
+ | `codex-multi-auth fix --dry-run` | What safe storage or account repairs are available? |
226
+ | `codex-multi-auth doctor --fix` | Can the CLI diagnose and apply the safest fixes now? |
227
+ | `codex-multi-auth uninstall` | Remove residual artifacts (run BEFORE `npm uninstall`; npm@7+ no longer fires `preuninstall`) |
228
+
229
+ ### Advanced
230
+
231
+ | Command | What it answers |
232
+ | --- | --- |
233
+ | `codex-multi-auth report --live --json` | How do I get the full machine-readable health report? |
234
+ | `codex-multi-auth limits --json [--refresh]` | How do I read account quota windows without parsing internal cache files or terminal text? |
235
+ | `codex-multi-auth fix --live --model gpt-5.5` | How do I run live repair probes with a chosen model? |
236
+ | `codex-multi-auth why-selected --json` | Which account does the selector pick now, and why? |
237
+ | `codex-multi-auth usage --since 24h --by project` | What local usage has been recorded recently? |
238
+ | `codex-multi-auth monitor --json` | What is the combined usage, policy, quota, runtime, and project state? |
239
+ | `codex-multi-auth bridge token create --label local-client` | How do I create a local bridge bearer token? |
240
+ | `codex-multi-auth integrations --kind python` | How do I generate local bridge client snippets? |
241
+ | `codex-multi-auth rotation status` | Is live runtime account rotation enabled for forwarded Codex sessions? |
242
+
243
+ ### Reliability behavior
244
+
245
+ - whole-pool replay is disabled by default when every account is rate-limited
246
+ - active requests use a bounded outbound request budget so one prompt cannot walk the full pool indefinitely
247
+ - repeated cross-account 5xx bursts trigger a short cooldown instead of continuing aggressive rotation
248
+ - proactive refresh is staggered to reduce background refresh bursts
249
+ - `codex-multi-auth status` surfaces recent runtime request metrics in text output, and `codex-multi-auth report --json` exposes the machine-readable cooldown/runtime snapshot
250
+
251
+ ---
252
+
253
+ ## Dashboard Hotkeys
254
+
255
+ ### Main dashboard
256
+
257
+ | Key | Action |
258
+ | --- | --- |
259
+ | `Up` / `Down` | Move selection |
260
+ | `Enter` | Select/open |
261
+ | `1-9` | Quick switch |
262
+ | `/` | Search |
263
+ | `?` | Toggle help |
264
+ | `Q` | Back/cancel |
265
+
266
+ ### Account details
267
+
268
+ | Key | Action |
269
+ | --- | --- |
270
+ | `S` | Set current account |
271
+ | `R` | Refresh/re-login account |
272
+ | `E` | Enable/disable account |
273
+ | `D` | Delete account |
274
+
275
+ ---
276
+
277
+ ## Storage Paths
278
+
279
+ | File | Default path |
280
+ | --- | --- |
281
+ | Settings | `~/.codex/multi-auth/settings.json` |
282
+ | Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
283
+ | Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
284
+ | Quota cache | `~/.codex/multi-auth/quota-cache.json` |
285
+ | Runtime observability | `~/.codex/multi-auth/runtime-observability.json` |
286
+ | Usage ledger | `~/.codex/multi-auth/usage/usage-ledger.jsonl` |
287
+ | Account policies | `~/.codex/multi-auth/account-policies.json` |
288
+ | Routing profiles | `~/.codex/multi-auth/routing-profiles.json` |
289
+ | Budget guards | `~/.codex/multi-auth/budget-guards.json` |
290
+ | Local client tokens | `~/.codex/multi-auth/local-client-tokens.json` |
291
+ | Runtime app helper status | `~/.codex/multi-auth/runtime-rotation-app-helper.<pid>.json` |
292
+ | Runtime app helper owner metadata | `~/.codex/multi-auth/runtime-rotation-app-helper-owner.<pid>.json` |
293
+ | Persistent app bind state/logs | `~/.codex/multi-auth/app-bind/` |
294
+ | Logs | `~/.codex/multi-auth/logs/codex-plugin/` |
295
+ | Per-project accounts | `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` |
296
+
297
+ Override root with `CODEX_MULTI_AUTH_DIR=<path>`.
298
+
299
+ ---
300
+
301
+ ## Configuration
302
+
303
+ Primary config root:
304
+ - `~/.codex/multi-auth/settings.json`
305
+ - or `CODEX_MULTI_AUTH_DIR/settings.json` when custom root is set
306
+
307
+ Selected runtime/environment overrides:
308
+
309
+ | Variable | Effect |
310
+ | --- | --- |
311
+ | `CODEX_MULTI_AUTH_DIR` | Override settings/accounts root |
312
+ | `CODEX_MULTI_AUTH_CONFIG_PATH` | Prefer this config file when it exists (also the save target when set) |
313
+ | `CODEX_MODE=0/1` | Disable/enable Codex mode |
314
+ | `CODEX_MULTI_AUTH_FORCE_ACCOUNT=<index\|email\|id>` | Force one account for a single `codex-multi-auth-codex` run (ephemeral; requires rotation proxy) |
315
+ | `CODEX_MULTI_AUTH_BYPASS=1` | Skip multi-auth intercept and forward straight to official Codex |
316
+ | `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1` | Opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions |
317
+ | `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL=http://127.0.0.1:<port>/<path>` | Route the runtime rotation proxy through an explicit loopback HTTP upstream; requires an explicit port and a numeric loopback host (`127.0.0.0/8` or `[::1]`), and rejects credentials, query strings, fragments, HTTPS, and every other host |
318
+ | `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS=<ms>` | Wall-clock ceiling on how long one request waits out a "selected model is at capacity" response before giving up (default 600000, max 3600000, `0` disables) |
319
+ | `CODEX_MULTI_AUTH_APP_ROTATION_IDLE_MS=<ms>` | Override automatic Codex app helper idle shutdown |
320
+ | `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0/1` | Opt out/in of packaged Codex app bind self-heal on first CLI run or rotation enable |
321
+ | `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0/1` | Opt out/in of routing supported app shortcuts on first CLI run or rotation enable |
322
+ | `CODEX_TUI_V2=0/1` | Disable/enable TUI v2 |
323
+ | `CODEX_TUI_COLOR_PROFILE=truecolor\|ansi256\|ansi16` | TUI color profile |
324
+ | `CODEX_TUI_GLYPHS=ascii\|unicode\|auto` | TUI glyph style |
325
+ | `CODEX_AUTH_BACKGROUND_RESPONSES=0/1` | Opt in/out of stateful Responses `background: true` compatibility |
326
+ | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
327
+ | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | Stream stall timeout override |
328
+
329
+ Validate config after changes:
330
+
331
+ ```bash
332
+ codex-multi-auth status
333
+ codex-multi-auth check
334
+ codex-multi-auth forecast --live
335
+ ```
336
+
337
+ Responses background mode stays opt-in. Enable `backgroundResponses` in settings or `CODEX_AUTH_BACKGROUND_RESPONSES=1` only for callers that intentionally send `background: true`, because those requests switch from stateless `store=false` routing to stateful `store=true`. See [docs/upgrade.md](docs/upgrade.md) for rollout guidance.
338
+
339
+ Runtime rotation is enabled by default for request-bearing wrapper-launched Codex sessions. Package install scripts stay side-effect-free: npm postinstall only prints a short notice (and stays silent in CI or non-interactive installs). The first CLI run after an install self-heals supported packaged Codex app binds and user-level launcher routing when possible (recorded once in a `first-run-setup.json` marker under the multi-auth runtime root), while `codex-multi-auth rotation enable` remains the explicit repair command. `codex-multi-auth rotation disable` turns the setting off and removes the persistent app bind. Set `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0`, or `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0` to opt out of the matching default behavior.
340
+
341
+ Advanced local proxy chains can set `CODEX_MULTI_AUTH_RUNTIME_PROXY_UPSTREAM_BASE_URL` for one wrapper process. The wrapper passes that URL to both the shadow-runtime and interactive-helper rotation paths and fails closed if the configured upstream is invalid or unavailable; it never falls back silently to the direct backend while an explicit upstream is required. Because the request that reaches the upstream carries the managed OAuth bearer token, the host must be a numeric loopback literal: a name such as `localhost` is rejected, since a hosts-file entry can point it at a routable address. "Fails closed" also covers the case where runtime rotation itself is off (`CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_BYPASS=1`, or the setting disabled): a request-bearing invocation exits non-zero rather than bypassing the configured upstream. Subcommands that make no backend requests still run normally.
342
+
343
+ When the backend answers that the selected model is at capacity, the runtime proxy waits and re-sends the request instead of burning the pool. Capacity is a property of the model, not of an account, so rotating spends the transient budget against accounts that all fail identically and the request ends as a 503 within seconds. The wait backs off (2s, 5s, 15s, 30s, then 60s), honors an upstream `retry-after` when one is sent, and stops at a wall-clock deadline set by `CODEX_MULTI_AUTH_MODEL_CAPACITY_RETRY_MS` (10 minutes by default, 1 hour maximum). Set that variable to `0` to restore the previous rotate-and-fail behavior. The responding account is left completely unpenalized: its pool token is refunded and it is never marked rate limited or cooled down, so selection runs normally on the next pass and may pick any healthy account. The wait is abandoned if the client disconnects, so no further upstream request is sent for a response nobody is reading. See [#689](https://github.com/ndycode/codex-multi-auth/issues/689).
344
+
345
+ Trust boundary: the loopback check bounds exposure to the local machine, and nothing more. It does not authenticate the process listening on that port, and plaintext HTTP is what a local inspection proxy needs, so any process that can bind the port you name receives the managed bearer token in cleartext. Set this variable only on a machine where you trust every local process that can bind a loopback port, and only for as long as you need the chain.
346
+
347
+ Installed wrappers may perform a best-effort daily npm version check during normal forwarded Codex startup. When a newer package is detected, the wrapper only prints a manual notice on an interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`: `npm install -g codex-multi-auth@latest`. It never runs npm install or update commands for you.
348
+
349
+ ---
350
+
351
+ ## Experimental Settings Highlights
352
+
353
+ The Settings menu now includes an `Experimental` section for staged features:
354
+
355
+ - preview-first sync into `oc-chatgpt-multi-auth`
356
+ - named local pool backup export with filename prompt
357
+ - refresh guard toggle and interval controls moved out of Backend Controls
358
+ - context budget guard: pause a session before it hits the model's context window, with independently configurable soft/hard thresholds (default 65% / 69%) — ships disabled; see [Context Budget Guard](docs/features.md#context-budget-guard-experimental)
359
+
360
+ These flows are intentionally non-destructive by default: sync previews before apply, destination-only accounts are preserved, and backup filename collisions fail safely.
361
+
362
+ ---
363
+
364
+ ## Troubleshooting
365
+
366
+ <details open>
367
+ <summary><b>60-second recovery</b></summary>
368
+
369
+ ```bash
370
+ codex-multi-auth doctor --fix
371
+ codex-multi-auth check
372
+ codex-multi-auth forecast --live
373
+ ```
374
+
375
+ If still broken:
376
+
377
+ ```bash
378
+ codex-multi-auth login
379
+ ```
380
+
381
+ </details>
382
+
383
+ <details>
384
+ <summary><b>Common symptoms</b></summary>
385
+
386
+ - `codex-multi-auth` unrecognized: run `where codex-multi-auth` or `which codex-multi-auth`, then follow `docs/troubleshooting.md` for install checks
387
+ - Switch succeeds but wrong account appears active: run `codex-multi-auth switch <index>`, then restart session
388
+ - Requests fail fast with a pool cooldown message: wait for the cooldown window or inspect `codex-multi-auth status`
389
+ - Requests fail fast after repeated upstream 5xx errors: inspect `codex-multi-auth report --json` for runtime traffic and cooldown details
390
+ - Storage cleanup fails with `EBUSY` / `EPERM` (Windows): run `codex-multi-auth doctor --fix` to retry, or manually remove `~/.codex/multi-auth/<project-key>/` and re-login
391
+ - OAuth callback on port `1455` fails: free the port and re-run `codex-multi-auth login`
392
+ - Login hangs in WSL, or installing in WSL breaks a working Windows install: Windows and WSL contend for callback port `1455`, and the browser opens on the Windows host either way — see [Windows and WSL side by side](docs/troubleshooting.md#windows-and-wsl-side-by-side), or use `codex-multi-auth login --device-auth`, which needs no callback port
393
+ - Browser launch is blocked or you are in a headless shell: prefer `codex-multi-auth login --device-auth`; use `codex-multi-auth login --manual` or `CODEX_AUTH_NO_BROWSER=1` only when you need the callback-paste fallback
394
+ - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account
395
+
396
+ </details>
397
+
398
+ <details>
399
+ <summary><b>Diagnostics pack</b></summary>
400
+
401
+ ```bash
402
+ codex-multi-auth list
403
+ codex-multi-auth status
404
+ codex-multi-auth check
405
+ codex-multi-auth verify-flagged --json
406
+ codex-multi-auth forecast --live
407
+ codex-multi-auth fix --dry-run
408
+ codex-multi-auth report --live --json
409
+ codex-multi-auth doctor --json
410
+ ```
411
+
412
+ </details>
413
+
414
+ ---
415
+
416
+ ## Documentation
417
+
418
+ - Docs portal: [docs/README.md](docs/README.md)
419
+ - Getting started: [docs/getting-started.md](docs/getting-started.md)
420
+ - Features: [docs/features.md](docs/features.md)
421
+ - Configuration: [docs/configuration.md](docs/configuration.md)
422
+ - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
423
+ - Commands reference: [docs/reference/commands.md](docs/reference/commands.md)
424
+ - Public API contract: [docs/reference/public-api.md](docs/reference/public-api.md)
425
+ - Error contracts: [docs/reference/error-contracts.md](docs/reference/error-contracts.md)
426
+ - Settings reference: [docs/reference/settings.md](docs/reference/settings.md)
427
+ - Storage paths: [docs/reference/storage-paths.md](docs/reference/storage-paths.md)
428
+ - Upgrade guide: [docs/upgrade.md](docs/upgrade.md)
429
+ - Privacy: [docs/privacy.md](docs/privacy.md)
430
+
431
+ ---
432
+
433
+ ## Release Notes
434
+
435
+ - Current stable: [docs/releases/v2.17.0.md](docs/releases/v2.17.0.md) — install via `npm i -g codex-multi-auth`
436
+ - Previous stable: [docs/releases/v2.8.3.md](docs/releases/v2.8.3.md)
437
+ - Previous stable: [docs/releases/v2.8.2.md](docs/releases/v2.8.2.md)
438
+ - Previous stable: [docs/releases/v2.7.1.md](docs/releases/v2.7.1.md)
439
+ - Previous stable: [docs/releases/v2.7.0.md](docs/releases/v2.7.0.md)
440
+ - Previous stable: [docs/releases/v2.6.0.md](docs/releases/v2.6.0.md)
441
+ - Previous stable: [docs/releases/v2.5.0.md](docs/releases/v2.5.0.md)
442
+ - Previous stable: [docs/releases/v2.4.0.md](docs/releases/v2.4.0.md)
443
+ - Previous stable: [docs/releases/v2.3.3.md](docs/releases/v2.3.3.md)
444
+ - Previous stable: [docs/releases/v2.3.2.md](docs/releases/v2.3.2.md)
445
+ - Previous stable: [docs/releases/v2.3.1.md](docs/releases/v2.3.1.md)
446
+ - Previous stable: [docs/releases/v2.3.0.md](docs/releases/v2.3.0.md)
447
+ - Previous stable: [docs/releases/v2.2.2.md](docs/releases/v2.2.2.md)
448
+ - Previous stable: [docs/releases/v2.2.1.md](docs/releases/v2.2.1.md)
449
+ - Previous stable: [docs/releases/v2.2.0.md](docs/releases/v2.2.0.md)
450
+ - Previous stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
451
+ - Earlier stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
452
+ - Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
453
+ - Earlier stable: [docs/releases/v2.1.8.md](docs/releases/v2.1.8.md)
454
+ - Earlier stable: [docs/releases/v2.1.7.md](docs/releases/v2.1.7.md)
455
+ - Earlier stable: [docs/releases/v2.1.6.md](docs/releases/v2.1.6.md)
456
+ - Earlier stable: [docs/releases/v2.1.5.md](docs/releases/v2.1.5.md)
457
+ - Earlier stable: [docs/releases/v2.1.4.md](docs/releases/v2.1.4.md)
458
+ - Earlier stable: [docs/releases/v2.1.3.md](docs/releases/v2.1.3.md)
459
+ - Earlier stable: [docs/releases/v2.1.2.md](docs/releases/v2.1.2.md)
460
+ - Earlier stable: [docs/releases/v2.1.1.md](docs/releases/v2.1.1.md)
461
+ - Earlier stable: [docs/releases/v2.1.0.md](docs/releases/v2.1.0.md)
462
+ - Earlier stable: [docs/releases/v1.3.2.md](docs/releases/v1.3.2.md)
463
+ - Stable archive: [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md)
464
+ - Full release archive: [docs/README.md#release-history](docs/README.md#release-history)
465
+ - Archived prerelease: [docs/releases/v0.1.0-beta.0.md](docs/releases/v0.1.0-beta.0.md)
466
+
467
+ ## License
468
+
469
+ MIT License. See [LICENSE](LICENSE).
470
+
471
+ <details>
472
+ <summary><b>Legal</b></summary>
473
+
474
+ - Not affiliated with OpenAI.
475
+ - "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
476
+ - You assume responsibility for your own usage and compliance.
477
+
478
+ </details>
479
+
480
+ ### Optional native desktop binding
481
+
482
+ Native desktop features such as Remote Control pairing need the real desktop
483
+ account identity. Use `codex-multi-auth rotation bind-app --native` to preserve
484
+ that login while routing inference through managed accounts. Add
485
+ `--catalog-account <index>` to use one account's live model catalog. This mode
486
+ requires file-backed desktop credentials; see the [rotation command reference](docs/reference/commands.md#native-provider-binding-opt-in)
487
+ for setup, limitations, and rollback.