@bman654/clodex 2.5.2 → 2.6.1

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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40bman654%2Fclodex.svg)](https://www.npmjs.com/package/@bman654/clodex)
4
4
 
5
- **clodex** lets you use your ChatGPT/Codex plan or OpenAI models with Claude Code as if they were Anthropic models.
5
+ **clodex** lets you use your ChatGPT/Codex plan, OpenAI API models, or OpenCode Go models with Claude Code as first-class model choices.
6
6
  You can use them anywhere you use Anthropic models like Opus and Sonnet — as the main session model, and in subagents, workflows, and agent teams. Clodex integrates them directly into Claude Code, using Claude Code's system prompt.
7
7
  It works with your existing Claude Code plan as well as your Codex plans WITHOUT violating Anthropic's ToS.
8
8
  No messing with CMUX or child codex processes or any of that stuff.
@@ -32,9 +32,23 @@ clodex claude # 5. launch Claude Code on an OpenAI model
32
32
  1. **Install** — puts the `clodex` command on your PATH.
33
33
  2. **Sign in** — opens a device-code OAuth flow for your ChatGPT/Codex plan; the token is stored in your OS credential store. (API-key users: `clodex providers add` instead.)
34
34
  3. **Pick models** — an interactive manager for favorites (max 20) and short aliases like `sol` so you do not need to type the long names. Favorites drive the `/model` switch menu, proxy-mode routing, and the patcher.
35
- 4. **Patch** *(optional but recommended for proxy mode)* — bakes your favorites and aliases into the Claude Code binary so they pass model validation, appear in `/model`, and report their real context windows. Re-run after each `claude` update; `clodex patch --restore` undoes it. This step is required if you want to use your OpenAI models as subagents via the Agent tool.
35
+ 4. **Patch** *(optional but recommended for proxy mode)* — bakes your favorites and aliases into the Claude Code binary so they pass model validation, appear in `/model`, and report their real context windows. Re-run after each `claude` update; `clodex patch --restore` undoes it. This step is required if you want to use clodex-routed models as subagents via the Agent tool.
36
36
  5. **Launch** — starts Claude Code bridged to the model you choose.
37
37
 
38
+ ## Supported providers
39
+
40
+ | Provider | Auth | Support |
41
+ |---|---|---|
42
+ | OpenAI | API key | Fully supported by the clodex maintainer |
43
+ | OpenAI (ChatGPT / Codex plan) | OAuth | Fully supported by the clodex maintainer |
44
+ | OpenCode Go | API key | Community-supported — maintained by its contributor |
45
+
46
+ **Community-supported** means the maintainer holds no account for that service,
47
+ so it cannot be exercised against the live API here or debugged when the vendor
48
+ changes something. Such an integration is reviewed and tested like everything
49
+ else and shipped gladly — it just depends on its contributor when upstream
50
+ moves. New providers land under this tier by default.
51
+
38
52
  ## Difference between Clodex and other solutions
39
53
 
40
54
  | Feature | Clodex | relay-ai | CLIProxyAPI | Various process-based solutions |
@@ -45,8 +59,8 @@ clodex claude # 5. launch Claude Code on an OpenAI model
45
59
  | Claude Code aware of true model context window size | ✅ | ❌ | ❌ | n/a |
46
60
  | Supports Agent tool | ✅ | ❌ | ✅ | ❌ |
47
61
  | Supports use in Dynamic Workflows | ✅ | ✅ | ✅ | ❌ |
48
- | OpenAI models use Claude Code skills/tools | ✅ | ✅ | ✅ | ❌ |
49
- | OpenAI models use Claude Code system prompt | ✅ | ✅ | ✅ | ❌ |
62
+ | Routed models use Claude Code skills/tools | ✅ | ✅ | ✅ | ❌ |
63
+ | Routed models use Claude Code system prompt | ✅ | ✅ | ✅ | ❌ |
50
64
  | Supports use in skill/agent frontmatter | ✅ | ❌ | ✅ | ❌ |
51
65
  | Supports OpenAI prompt caching | ✅ | ❌ | ? | ✅ |
52
66
  | Uses Websockets to talk to OpenAI API | ✅ | ❌ | ? | ✅ |
@@ -65,17 +79,17 @@ Clodex avoids this. In proxy mode it uses an HTTP proxy to intercept requests bo
65
79
 
66
80
  Both `clodex claude` and `clodex server` support two bridge modes. A mode flag applies to **that run only**; to change a command's default, add `--save-mode` (e.g. `clodex claude --endpoint --save-mode`). With no flag and nothing saved, both commands default to **proxy** mode, which works with your existing Claude auth.
67
81
 
68
- - **`--proxy`** (the default): a selective man-in-the-middle proxy for `api.anthropic.com`. Claude Code keeps its normal Anthropic login — Anthropic models work untouched — while models named `clodex:<provider-id>:<model-id>` (or their saved aliases) route to OpenAI. Switch with `/model clodex:openai-oauth:gpt-5.6-sol` or `/model sol` after patching.
82
+ - **`--proxy`** (the default): a selective man-in-the-middle proxy for `api.anthropic.com`. Claude Code keeps its normal Anthropic login — Anthropic models work untouched — while models named `clodex:<provider-id>:<model-id>` (or their saved aliases) route to the selected configured provider. Switch with `/model clodex:openai-oauth:gpt-5.6-sol` or `/model sol` after patching.
69
83
  - **`--endpoint`**: clodex runs a local Anthropic-format gateway and launches Claude Code with `ANTHROPIC_BASE_URL` pointed at it. All traffic goes through the gateway. With favorites saved, the gateway is multi-route and Claude Code's `/model` menu lists your starting model plus favorites for live switching.
70
84
 
71
85
  > [!TIP]
72
- > Proxy mode allows you to continue using your Claude Code plan: login to claude code like normal and the proxy will intercept requests and leave requests for Anthropic models untouched, while requests for your favorite OpenAI models will be re-routed to OpenAI.
86
+ > Proxy mode allows you to continue using your Claude Code plan: login to claude code like normal and the proxy will intercept requests and leave requests for Anthropic models untouched, while requests for your favorite clodex models are routed to their configured providers.
73
87
 
74
88
  ```mermaid
75
89
  flowchart LR
76
90
  CC["Claude Code<br/>(own Anthropic login)"] -->|"HTTPS via HTTPS_PROXY,<br/>trusts the clodex CA"| MITM["clodex MITM proxy"]
77
91
  MITM --> DEC{"model is clodex:...<br/>or a saved alias?"}
78
- DEC -->|"yes — translated request,<br/>clodex-managed OpenAI credentials"| OAI["OpenAI<br/>(OAuth: Responses WebSocket /<br/>API key: HTTPS)"]
92
+ DEC -->|"yes — routed request,<br/>clodex-managed provider credentials"| UP["Configured provider<br/>(OpenAI / OpenCode Go)"]
79
93
  DEC -->|"no — passed through untouched,<br/>Claude Code's Anthropic credentials ride along"| ANT["api.anthropic.com"]
80
94
  ```
81
95
 
@@ -86,7 +100,7 @@ flowchart LR
86
100
  CC["Claude Code<br/>(ANTHROPIC_BASE_URL + local API key,<br/>no Anthropic account credentials)"] -->|"Anthropic-format /v1/messages<br/>+ local API key"| GW["clodex gateway<br/>(:17645/anthropic)"]
87
101
  CC -->|"GET /v1/models at startup"| GW
88
102
  GW -->|"model catalog with context windows<br/>(feeds the /model menu)"| CC
89
- GW -->|"translated request,<br/>clodex-managed OpenAI credentials"| OAI["OpenAI"]
103
+ GW -->|"routed request,<br/>clodex-managed provider credentials"| UP["Configured provider"]
90
104
  ```
91
105
 
92
106
  > [!TIP]
@@ -96,17 +110,17 @@ flowchart LR
96
110
 
97
111
  ### `clodex claude [options] [claude-flags]`
98
112
 
99
- Launch Claude Code bridged to OpenAI models. Unrecognized flags (and everything after `--`) pass through to Claude Code (`-c`, `--resume`, `--print`, …).
113
+ Launch Claude Code bridged to configured model providers. Unrecognized flags (and everything after `--`) pass through to Claude Code (`-c`, `--resume`, `--print`, …).
100
114
 
101
115
  | Flag | Effect |
102
116
  | --- | --- |
103
117
  | `--endpoint` | Endpoint bridge mode for this run: local gateway + `ANTHROPIC_BASE_URL` |
104
- | `--proxy` | Proxy bridge mode for this run: keep Claude Code's Anthropic auth; `clodex:` models route to OpenAI (default when nothing is saved) |
118
+ | `--proxy` | Proxy bridge mode for this run: keep Claude Code's Anthropic auth; `clodex:` models route to configured providers (default when nothing is saved) |
105
119
  | `--save-mode` | With `--endpoint`/`--proxy`: save that mode as the `claude` default |
106
120
  | `--dry-run` | Run the wizard but print a launch preview instead of launching (never persists anything) |
107
121
  | `--trace` | Write debug logs to `~/.clodex/logs/` and show errors on exit |
108
122
  | `--fast` | Request Codex fast mode (`service_tier=priority`) for ChatGPT/Codex OAuth routes; equivalent to `CLODEX_SERVICE_TIER=fast` |
109
- | `--provider <id>` | Boot provider id (`openai` or `openai-oauth`); with `--model`, skips the wizard |
123
+ | `--provider <id>` | Boot provider id (`openai`, `openai-oauth`, or `opencode-go`); with `--model`, skips the wizard |
110
124
  | `--model <id>` | Boot model id; with `--provider`, skips the wizard |
111
125
  | `--help`, `--version` | Help / version |
112
126
 
@@ -222,13 +236,13 @@ Manage favorite models (max 20) and short aliases. Favorites feed the endpoint-m
222
236
  | Subcommand | Effect |
223
237
  | --- | --- |
224
238
  | *(none)* | Provider hub wizard |
225
- | `add` | Add OpenAI with an API key (choose OAuth or API key) |
239
+ | `add` | Add OpenAI or OpenCode Go with an API key, or sign in with ChatGPT |
226
240
  | `auth openai` | Sign in with ChatGPT/Codex-plan OAuth (device code) |
227
241
  | `list` | Show configured providers |
228
242
  | `remove <id>` | Remove a provider by id |
229
243
  | `refresh-models [id]` | Update cached model lists |
230
244
 
231
- Providers supported: `openai` (API key, platform.openai.com) and `openai-oauth` (ChatGPT/Codex plan).
245
+ Providers supported: `openai` (API key, platform.openai.com), `openai-oauth` (ChatGPT/Codex plan), and `opencode-go` (OpenCode Go API key). OpenCode Go exposes its Anthropic Messages and Chat Completions models; Responses-only entries are intentionally excluded. See [OpenCode Go provider](docs/opencode-go.md).
232
246
 
233
247
  ### Root
234
248
 
@@ -297,7 +311,7 @@ clodex --version # version
297
311
 
298
312
  ## Known limitations
299
313
 
300
- - Cost display inside Claude Code is inaccurate for OpenAI models (Claude Code applies its own pricing table).
314
+ - Cost display inside Claude Code is inaccurate for routed third-party models (Claude Code applies its own pricing table).
301
315
  - In the endpoint-mode switch menu, the displayed context window reflects the launch model and does not update on live `/model` switches (Claude Code fetches window metadata once at startup). Proxy mode with `clodex patch` reports correct per-model windows.
302
316
  - ChatGPT/Codex OAuth requires `store:false` upstream; some OpenAI cache controls are intentionally omitted on OAuth routes because they returned empty responses during compatibility testing.
303
317