@bitkyc08/opencodex 2.7.40 → 2.7.41-preview.20260726

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 (110) hide show
  1. package/README.md +63 -12
  2. package/assets/claude-code-models.gif +0 -0
  3. package/gui/dist/assets/index-7RXBHYrB.js +65 -0
  4. package/gui/dist/assets/index-B2J4t3te.css +1 -0
  5. package/gui/dist/index.html +2 -2
  6. package/package.json +3 -2
  7. package/src/adapters/google.ts +48 -9
  8. package/src/adapters/kiro-events.ts +15 -3
  9. package/src/adapters/kiro.ts +292 -28
  10. package/src/adapters/openai-chat.ts +63 -15
  11. package/src/adapters/openai-responses.ts +18 -0
  12. package/src/bridge.ts +76 -21
  13. package/src/chat/outbound.ts +66 -34
  14. package/src/claude/auth-detect.ts +229 -0
  15. package/src/claude/auth-mode-migration.ts +32 -0
  16. package/src/claude/auth-mode.ts +62 -0
  17. package/src/claude/desktop-3p-guard.ts +35 -0
  18. package/src/claude/desktop-3p.ts +121 -21
  19. package/src/claude/desktop-health.ts +26 -0
  20. package/src/claude/desktop-profile.ts +263 -0
  21. package/src/claude/inbound-debug.ts +4 -0
  22. package/src/claude/model-info.ts +9 -3
  23. package/src/cli/account-extended.ts +34 -0
  24. package/src/cli/account.ts +3 -1
  25. package/src/cli/claude-desktop.ts +152 -0
  26. package/src/cli/claude.ts +37 -3
  27. package/src/cli/doctor.ts +187 -6
  28. package/src/cli/help.ts +13 -1
  29. package/src/cli/index.ts +151 -57
  30. package/src/cli/status-oauth.ts +68 -0
  31. package/src/cli/status.ts +4 -0
  32. package/src/codex/account-lifecycle.ts +31 -0
  33. package/src/codex/auth-api.ts +133 -26
  34. package/src/codex/auth-collision.ts +55 -11
  35. package/src/codex/auth-context.ts +50 -6
  36. package/src/codex/catalog/provider-fetch.ts +6 -2
  37. package/src/codex/home.ts +61 -1
  38. package/src/codex/inject.ts +28 -66
  39. package/src/codex/injected-marker.ts +72 -0
  40. package/src/codex/journal.ts +39 -3
  41. package/src/codex/main-account-cache.ts +25 -0
  42. package/src/codex/model-cache.ts +20 -1
  43. package/src/codex/paths.ts +5 -0
  44. package/src/codex/routing.ts +138 -11
  45. package/src/codex/subagent-model-fallback.ts +455 -0
  46. package/src/codex/sync.ts +17 -0
  47. package/src/combos/failover.ts +10 -2
  48. package/src/combos/index.ts +1 -0
  49. package/src/combos/types.ts +9 -0
  50. package/src/config.ts +117 -0
  51. package/src/grok/inject.ts +339 -0
  52. package/src/grok/status.ts +88 -0
  53. package/src/grok/sync.ts +66 -0
  54. package/src/lib/destination-policy.ts +13 -0
  55. package/src/lib/errors.ts +59 -0
  56. package/src/lib/privacy.ts +9 -0
  57. package/src/lib/process-control.ts +57 -4
  58. package/src/oauth/health.ts +375 -0
  59. package/src/oauth/index.ts +69 -22
  60. package/src/oauth/kiro.ts +5 -3
  61. package/src/oauth/log.ts +48 -0
  62. package/src/oauth/store.ts +55 -6
  63. package/src/providers/alibaba-region-backup.ts +75 -0
  64. package/src/providers/alibaba-region-migration.ts +143 -0
  65. package/src/providers/alibaba-region-startup.ts +36 -0
  66. package/src/providers/api-keys.ts +5 -5
  67. package/src/providers/derive.ts +22 -1
  68. package/src/providers/free-directory.ts +181 -0
  69. package/src/providers/key-failover.ts +2 -2
  70. package/src/providers/kiro-models.ts +3 -2
  71. package/src/providers/openai-tiers.ts +1 -1
  72. package/src/providers/provider-id-rewrite.ts +150 -0
  73. package/src/providers/registry.ts +49 -2
  74. package/src/responses/parser.ts +49 -20
  75. package/src/responses/state.ts +156 -2
  76. package/src/router.ts +73 -5
  77. package/src/server/chat-completions.ts +78 -22
  78. package/src/server/claude-messages.ts +8 -0
  79. package/src/server/images.ts +2 -1
  80. package/src/server/index.ts +50 -30
  81. package/src/server/live.ts +2 -1
  82. package/src/server/management/agent-settings-routes.ts +337 -18
  83. package/src/server/management/api-access.ts +141 -0
  84. package/src/server/management/combo-routes.ts +3 -3
  85. package/src/server/management/config-routes.ts +4 -4
  86. package/src/server/management/logs-usage-routes.ts +64 -4
  87. package/src/server/management/model-routes.ts +114 -8
  88. package/src/server/management/oauth-account-routes.ts +31 -5
  89. package/src/server/management/provider-routes.ts +42 -11
  90. package/src/server/management/shared.ts +81 -2
  91. package/src/server/management/system-routes.ts +6 -1
  92. package/src/server/management-api.ts +24 -7
  93. package/src/server/port-reclaim.ts +261 -0
  94. package/src/server/request-log.ts +11 -5
  95. package/src/server/responses/collaboration.ts +11 -6
  96. package/src/server/responses/compact.ts +2 -1
  97. package/src/server/responses/core.ts +358 -155
  98. package/src/server/responses/passthrough-error.ts +53 -0
  99. package/src/server/search.ts +2 -1
  100. package/src/server/system-env.ts +23 -6
  101. package/src/server/windows-tcp-drop.ts +174 -0
  102. package/src/service.ts +43 -3
  103. package/src/types.ts +74 -6
  104. package/src/update/index.ts +30 -19
  105. package/src/update/job.ts +30 -15
  106. package/src/usage/log.ts +158 -2
  107. package/src/usage/summary.ts +8 -4
  108. package/src/web-search/loop.ts +4 -1
  109. package/gui/dist/assets/index-CMip1DzF.css +0 -1
  110. package/gui/dist/assets/index-cydcmbzC.js +0 -52
package/README.md CHANGED
@@ -1,16 +1,41 @@
1
1
  <h3 align="center">make codex open!</h3>
2
- <p align="center"><b>Universal provider proxy for OpenAI Codex &amp; Claude Code</b> — use any LLM with Codex CLI, App, SDK, and Claude Code.</p>
3
- <p align="center"><code>npm install -g @bitkyc08/opencodex</code> · <code>ocx start</code> · <b>localhost:10100</b></p>
2
+ <p align="center"><b>Universal provider proxy for OpenAI Codex, Claude Code, Claude Desktop &amp; Grok Build</b><br>
3
+ Two commands, and every one of them runs any LLM you point it at.</p>
4
4
 
5
5
  <p align="center">
6
+ <a href="https://x.com/claudeebum"><img src="https://img.shields.io/badge/%40claudeebum-000000?logo=x&logoColor=white" alt="Follow @claudeebum on X"></a>
6
7
  <a href="https://www.npmjs.com/package/@bitkyc08/opencodex"><img src="https://img.shields.io/npm/v/@bitkyc08/opencodex?color=cb3837&label=npm&logo=npm" alt="npm version"></a>
7
8
  <a href="https://github.com/lidge-jun/opencodex/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@bitkyc08/opencodex?color=blue" alt="license"></a>
8
9
  <img src="https://img.shields.io/node/v/@bitkyc08/opencodex?logo=node.js&label=node" alt="node version">
9
10
  </p>
10
11
 
11
- <p align="center">
12
- <img src="assets/banner.png" alt="opencodex — Universal provider proxy for Codex, use any LLM" width="820">
13
- </p>
12
+ ```bash
13
+ npm install -g @bitkyc08/opencodex
14
+ ocx start # proxy + dashboard on localhost:10100
15
+ ```
16
+
17
+ <table align="center">
18
+ <tr>
19
+ <td width="50%" align="center">
20
+ <img src="assets/claude-code-models.gif" alt="Claude Code running a routed model through opencodex — the status bar shows gpt-5.6-luna-medium as the active model" width="410"><br>
21
+ <sub><b>Claude Code, running any model.</b><br>The picker is stock Claude Code. The brain behind it isn't.</sub>
22
+ </td>
23
+ <td width="50%" align="center">
24
+ <img src="assets/demo.gif" alt="opencodex demo — running a task in the Codex app on a routed non-OpenAI model" width="410"><br>
25
+ <sub><b>Codex, running any model.</b><br>Pick a provider and go — same workflow, different brain.</sub>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td width="50%" align="center">
30
+ <img src="assets/claude-desktop-subagent.gif" alt="Claude Desktop answering as Claude Opus 4.8, then dispatching a GPT-5.6 Sol subagent through opencodex" width="410"><br>
31
+ <sub><b>Claude Desktop, running any model.</b><br>Opus answers, then hands the task to a GPT-5.6 Sol subagent.</sub>
32
+ </td>
33
+ <td width="50%" align="center">
34
+ <img src="assets/grok-build-subagent.gif" alt="Grok Build running GPT-5.6 Sol through opencodex and calling a Kimi K3 subagent" width="410"><br>
35
+ <sub><b>Grok Build, running any model.</b><br>Sol drives the session and calls a Kimi K3 subagent.</sub>
36
+ </td>
37
+ </tr>
38
+ </table>
14
39
 
15
40
  <p align="center">
16
41
  <a href="README.md">English</a> · <a href="readme/README.ko.md">한국어</a> · <a href="readme/README.zh-CN.md">简体中文</a> · <a href="readme/README.ru.md">Русский</a> · <a href="readme/README.ja.md">日本語</a> · 📖 <a href="https://opencodex.me/"><b>Full documentation →</b></a>
@@ -20,14 +45,13 @@
20
45
  <img src="assets/architecture.png" alt="opencodex architecture — Codex CLI routes through opencodex proxy to any LLM provider" width="820">
21
46
  </p>
22
47
 
23
- Use Claude, Gemini, Grok, GLM, DeepSeek, Kimi, Qwen, Ollama, or any other LLM with Codex — and with **Claude Code** — without waiting for anyone to add support.
48
+ Use Claude, Gemini, Grok, GLM, DeepSeek, Kimi, Qwen, Ollama, or any other LLM with Codex — and with **Claude Code**, **Claude Desktop**, and **Grok Build** — without waiting for anyone to add support.
24
49
 
25
- opencodex is a lightweight local proxy that translates Codex's Responses API into whatever your provider speaks. Streaming, tool calls, reasoning tokens, images — everything works, in both directions.
50
+ Subagents cross the boundary too: Claude Desktop can answer as Opus and hand the next step to a
51
+ GPT-5.6 Sol subagent, and Grok Build can drive a session on Sol while calling Kimi K3 — each side
52
+ keeping its own native UI.
26
53
 
27
- <p align="center">
28
- <img src="assets/demo.gif" alt="opencodex demo — running a task in the Codex app on a routed non-OpenAI model" width="820">
29
- </p>
30
- <p align="center"><sub><b>Codex, running any model.</b> Pick a provider and go — same Codex workflow, different brain.</sub></p>
54
+ opencodex is a lightweight local proxy that translates Codex's Responses API into whatever your provider speaks. Streaming, tool calls, reasoning tokens, images — everything works, in both directions.
31
55
 
32
56
  It can also manage a **ChatGPT account pool** for Codex auth. Add multiple ChatGPT / Codex accounts,
33
57
  refresh their 5h / weekly / 30d quota in the dashboard, and let new sessions auto-route to the
@@ -228,7 +252,7 @@ next Codex session. opencodex keeps these behaviors:
228
252
  ## Highlights
229
253
 
230
254
  - **Use any LLM with Codex.** 5 protocol adapters cover Anthropic Messages, Google Gemini, Azure, OpenAI Responses passthrough, and every OpenAI-compatible Chat Completions endpoint — that's 40+ providers out of the box.
231
- - **Use any LLM with Claude Code too.** The same daemon serves the Anthropic Messages API (`/v1/messages` + `count_tokens`): `ocx claude` launches Claude Code fully wired, and routed models appear in its native `/model` picker via gateway model discovery (`claude-ocx-<provider>--<model>` aliases, Claude Code 2.1.129+). Configure slots and model maps on the dashboard's Claude page.
255
+ - **Use any LLM with Claude Code too.** The same daemon serves the Anthropic Messages API (`/v1/messages` + `count_tokens`): `ocx claude` launches Claude Code fully wired, and routed models appear in its native `/model` picker via gateway model discovery (`claude-ocx-<provider>--<model>` aliases, Claude Code 2.1.129+). Configure slots and model maps on the dashboard's Claude page. The Claude page also carries a separate Desktop profile with Opus, Fable, Sonnet, and Haiku families, accessible drag/keyboard controls, and JSON import/export.
232
256
  - **Use any LLM with GitHub Copilot App too.** Point Copilot's Model providers at `http://127.0.0.1:10100/v1` — OpenCodex serves OpenAI-compatible `GET /v1/models` and `POST /v1/chat/completions` so routed models sync into the app. See [docs/github-copilot-app.md](docs/github-copilot-app.md).
233
257
  - **Pool ChatGPT accounts safely.** Keep existing Codex threads on one account while new sessions
234
258
  can auto-pick a lower-usage account from the pool, with quota refresh and non-PII request labels.
@@ -292,10 +316,34 @@ ocx logout <provider> # remove a stored login
292
316
  ocx account <list|current|use> # list/switch accounts & API-key pools (masked; also refresh/auto-switch/remove/add-key)
293
317
  ocx gui # open the web dashboard
294
318
  ocx claude [args...] # launch Claude Code wired to the proxy (model discovery on)
319
+ ocx claude desktop # save and apply the Claude Desktop four-family profile
295
320
  ocx service [install|start|stop|status|uninstall] # install/update/start background service
296
321
  ocx update [--tag preview] # update opencodex; preview installs stay on @preview
297
322
  ```
298
323
 
324
+ ### Claude Desktop profile
325
+
326
+ The dashboard's **Claude → Desktop** view sorts routes into four families: Opus, Fable, Sonnet,
327
+ and Haiku. New routes start in Opus, and the first Opus route is the initial application default.
328
+ Every non-empty family has one default. You can drag a route, or use its visible move control with
329
+ a mouse, touch, or keyboard. **Save and apply** writes the profile to Claude Desktop. JSON export
330
+ and import are available for backup or moving the same setup to another machine.
331
+
332
+ ```bash
333
+ ocx claude desktop [apply] # save and apply the current profile
334
+ ocx claude desktop show [--json] # inspect routes, families, and defaults
335
+ ocx claude desktop move <route> <family> [--default]
336
+ ocx claude desktop default <family> <route|none>
337
+ ocx claude desktop export <path|-> # use - to write JSON to stdout
338
+ ocx claude desktop import <path> [--apply] # validate, then save; optionally apply
339
+ ```
340
+
341
+ Families are `opus`, `fable`, `sonnet`, and `haiku`. Non-Anthropic routes receive stable
342
+ Claude-shaped aliases with a synthetic 2026 date slot; that date is an internal slot, not the
343
+ model's release date. Real Anthropic Claude routes keep their real model ids. Use `none` only for
344
+ an empty family; a non-empty family always needs a default. The older apply forms
345
+ `ocx claude desktop --static`, `--hybrid`, and `--discovery-only` remain supported.
346
+
299
347
  ### Autostart: service vs shim
300
348
 
301
349
  opencodex has two ways to auto-start the proxy:
@@ -456,6 +504,9 @@ lives in [`SECURITY.md`](./SECURITY.md).
456
504
 
457
505
  ## Development
458
506
 
507
+ Source development requires the `bun` CLI on your `PATH`. This is separate from the published npm
508
+ package's bundled Bun runtime, which is used only by installed `ocx` commands.
509
+
459
510
  ```bash
460
511
  git clone https://github.com/lidge-jun/opencodex.git
461
512
  cd opencodex
Binary file