@bman654/clodex 2.16.0 → 2.18.0

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
@@ -22,8 +22,8 @@ Contributions are welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md) for how t
22
22
  npm install -g @bman654/clodex # 1. install the CLI (Node 22+)
23
23
  clodex providers auth openai # 2. sign in with your ChatGPT/Codex plan (device-code OAuth)
24
24
  clodex models # 3. pick favorite models and aliases
25
- clodex models --alias sol=clodex:openai-oauth:gpt-5.6-sol
26
- clodex models --alias luna=clodex:openai-oauth:gpt-5.6-luna
25
+ clodex models --alias sol=clodex:openai-oauth:gpt-6-sol
26
+ clodex models --alias luna=clodex:openai-oauth:gpt-6-luna
27
27
  clodex models --alias terra=clodex:openai-oauth:gpt-5.6-terra
28
28
  clodex patch # 4. (optional) patch Claude Code so those models are first-class
29
29
  clodex claude # 5. launch Claude Code on an OpenAI model
@@ -80,7 +80,7 @@ Clodex avoids this. In proxy mode it uses an HTTP proxy to intercept requests bo
80
80
 
81
81
  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.
82
82
 
83
- - **`--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.
83
+ - **`--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-6-sol` or `/model sol` after patching.
84
84
  - **`--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.
85
85
 
86
86
  > [!TIP]
@@ -124,8 +124,8 @@ Launch Claude Code bridged to configured model providers. Unrecognized flags (an
124
124
  | `--dry-run` | Run the wizard but print a launch preview instead of launching (never persists anything) |
125
125
  | `--trace` | Write debug logs to `~/.clodex/logs/` and show errors on exit |
126
126
  | `--fast` | Request Codex fast mode (`service_tier=priority`) for ChatGPT/Codex OAuth routes; equivalent to `CLODEX_SERVICE_TIER=fast` |
127
- | `--provider <id>` | Boot provider id (`openai`, `openai-oauth`, or `opencode-go`); with `--model`, skips the wizard |
128
- | `--model <id>` | Boot model id; with `--provider`, skips the wizard |
127
+ | `--provider <id>` | Endpoint mode only: boot provider id (`openai`, `openai-oauth`, or `opencode-go`); with `--model`, skips the wizard |
128
+ | `--model <id>` | Endpoint mode only: boot model id; with `--provider`, skips the wizard |
129
129
  | `--context <model=stop>` | Use a different share of a model's context window for this launch only; never saved. Reaches Claude Code through the exported catalog, so a binary patched by `clodex patch` keeps its baked window until the stop is saved and the patch re-run |
130
130
  | `--help`, `--version` | Help / version |
131
131
 
@@ -203,6 +203,8 @@ On Windows, when Claude Code was installed with `npm install -g`, the `claude` o
203
203
 
204
204
  The patch map is built from your favorites and aliases; context windows come from provider metadata. A pristine per-version backup is kept — recorded against the install it was made for, so a machine with two installs of one Claude Code version restores each from its own bytes — and a manifest (`~/.clodex/patch-state.json`) makes re-runs no-ops until your config or Claude Code version changes — then the binary is restored first and re-patched fresh. `clodex claude` checks patch freshness at launch and offers to re-patch (a non-blocking notice when not interactive). Re-run `clodex patch` after every `claude` update.
205
205
 
206
+ If an editor has the Claude Code extension installed at a different version from the Claude Code `clodex patch` just patched — the extension and the CLI update independently, so they can end up on different versions — `clodex patch` warns and prints the commands that align them (for example `npm install -g @anthropic-ai/claude-code@2.1.276` then `clodex patch` for a global npm install, or `claude install 2.1.276` for a native install; any other install, such as Claude Code's own `~/.claude/local` install or a project's `node_modules`, is named with its path so you can update it with the tool that installed it). An editor launching Claude Code through `clodex-claude` runs the patched install only when the two builds match, so until then its model picker drops the clodex models. The editors checked are VS Code, VS Code Insiders, the VS Code remote server (`~/.vscode-server`), VSCodium, Cursor and Windsurf, each in its default extensions directory under your home; nothing is printed when none of them has the extension. The check compares version numbers only, so no warning does not prove the builds match, and it never modifies the extension directory.
207
+
206
208
  #### Local patches (trusted code)
207
209
 
208
210
  Local patches are an explicitly enabled extension layer for private transforms that do not belong in clodex itself. Put one self-contained ES module at `~/.clodex/local-patches.mjs` (or `$CLODEX_HOME/local-patches.mjs`) and opt in with `clodex patch --enable-local-patches`. It must be a regular UTF-8 file no larger than 1 MiB. File presence alone never loads it.
@@ -238,7 +240,7 @@ Manage favorite models (max 20) and short aliases. Favorites feed the endpoint-m
238
240
  | --- | --- |
239
241
  | *(none)* | Interactive manager: search all providers or browse one at a time |
240
242
  | `--list` | Print the exact `clodex:<provider-id>:<model-id>` names (and aliases) without opening the manager |
241
- | `--alias <name=target>` | Save a short name for a favorite, e.g. `--alias sol=clodex:openai-oauth:gpt-5.6-sol` (the `clodex:` prefix is optional in the target) |
243
+ | `--alias <name=target>` | Save a short name for a favorite, e.g. `--alias sol=clodex:openai-oauth:gpt-6-sol` (the `clodex:` prefix is optional in the target) |
242
244
  | `--unalias <name>` | Remove a saved short name |
243
245
  | `--context <model=stop>` | Choose how much of a model's context window to use: `standard`, `max`, `default` to clear, or a token count such as `500k`. Applies to this run unless `--save` is given |
244
246
  | `--save` | With `--context`: store the stop as that model's default |
@@ -251,9 +253,13 @@ A context window is a cost dial as much as a capacity number. OpenAI prices GPT-
251
253
  and later prompts above **272,000 input tokens at 2x input and 1.5x output for the
252
254
  full request**, which is why the Codex catalog reports a 272,000 window rather than
253
255
  the model's ceiling. Newer families inherit the same boundary, so a model released
254
- after this was written is covered without a clodex update. Clodex follows that: the
255
- default `standard` stop stays under the line, and a larger window is something you
256
- ask for.
256
+ after this was written is covered without a clodex update. For ChatGPT/Codex-plan
257
+ models whose catalog reports that window, the default `standard` stop stays at the
258
+ line and a larger window is something you ask for. **OpenAI API-key models retain
259
+ their full API context window by default**, so their `standard` stop can already
260
+ exceed the pricing boundary. Choose a smaller numeric stop if you want to limit
261
+ exposure to the higher rate, for example
262
+ `clodex models --context clodex:openai:gpt-6-sol=250k --save`.
257
263
 
258
264
  ```sh
259
265
  clodex models --context sol=max --save # this model's default, with a cost warning
@@ -266,7 +272,9 @@ window a client should fill, and the account ceiling a larger stop can reach. A
266
272
  above the ceiling is clamped and says so. When a request's own reported token count
267
273
  crosses the boundary, clodex warns once per model for the life of the process,
268
274
  because the client's token count and the provider's differ after translation and only
269
- the provider's settles it.
275
+ the provider's settles it. This warning covers both OpenAI API keys and ChatGPT/Codex
276
+ plans, including model lists saved before pricing warnings were supported; no manual
277
+ model refresh is needed.
270
278
 
271
279
  Two things worth knowing about the numbers:
272
280
 
@@ -302,13 +310,24 @@ Two things worth knowing about the numbers:
302
310
  | `remove <id>` | Remove a provider by id |
303
311
  | `refresh-models [id]` | Update cached model lists |
304
312
 
313
+ For ChatGPT-plan models using Responses-Lite (the catalog's `use_responses_lite` flag),
314
+ refresh warns when the catalog requires a newer Codex client version than clodex sends.
315
+ Those models stay cached but are hidden from clodex's selectable catalog to avoid version
316
+ rejections. Update clodex to a release supporting the required version to make them
317
+ available again. Saved favorites and aliases are preserved but unavailable while their
318
+ models are hidden. Older caches without this metadata need a refresh for newly discovered
319
+ models. Known built-in models use their seeded minimums when absent from the cache and
320
+ their seeded flags when discovery omits them. Models not using Responses-Lite do not send
321
+ this version header and are not hidden by this check. This check does not establish your
322
+ account's model entitlement.
323
+
305
324
  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, Chat Completions, and Responses models; entries whose transport has not been verified against the live endpoint are left out. See [OpenCode Go provider](docs/opencode-go.md).
306
325
 
307
326
  A **custom OpenAI-compatible server** is any OpenAI-style API, given by its base URL (the part before `/chat/completions`), such as `https://openrouter.ai/api/v1`. `providers add` asks for a name, the base URL and an API key (leave it empty for a local server without auth), lists the server's models to check the connection, and saves the provider as `custom-<name>`. Its models then appear in `clodex models`; once saved as favorites they are addressed as `clodex:custom-<name>:<model>` and can be given a short alias with `clodex models --alias`. The base URL is checked before anything is saved: plain `http://` is accepted only after you confirm it, and only for loopback or private-network addresses, and an `https://` URL whose host is, or resolves to, a loopback (`127.0.0.0/8`, `::1`), private, link-local, unique-local, carrier-grade-NAT or well-known cloud-metadata address is refused. A model's id and name are stored with surrounding whitespace trimmed, and a model whose trimmed id or name still contains a control character is skipped, whether the list is fetched by `providers add` or by `providers refresh-models`, and error text from the server is shown with control characters replaced by spaces. Only the OpenAI-compatible kind is offered in the menu.
308
327
 
309
328
  ### `clodex install-vscode-launcher`
310
329
 
311
- Windows only. Builds `%USERPROFILE%\.clodex\bin\clodex-claude.exe`, the executable the Claude Code VS Code extension can use as its `claudeCode.claudeProcessWrapper`, so chats in the editor launch Claude Code through `clodex-claude` (on Windows npm installs that wrapper as three script shims — extensionless, `.cmd`, `.ps1` — and no executable the extension can spawn). It compiles a short C# source shipped in the package with the compiler already inside the .NET Framework — nothing is downloaded — and prints the setting to paste; it never edits VS Code or Claude settings. The paths to `node.exe` and the clodex install are compiled in, so re-run it after switching Node versions or moving clodex. Setup guide: [docs/windows-setup.md](docs/windows-setup.md).
330
+ Windows only. Builds `%USERPROFILE%\.clodex\bin\clodex-claude.exe`, the executable the Claude Code VS Code extension can use as its `claudeCode.claudeProcessWrapper`, so chats in the editor launch Claude Code through `clodex-claude` (on Windows npm installs that wrapper as three script shims — extensionless, `.cmd`, `.ps1` — and no executable the extension can spawn). It compiles a short C# source shipped in the package with the compiler already inside the .NET Framework — nothing is downloaded — and prints the setting to paste; it never edits VS Code or Claude settings. The paths to `node.exe` and the clodex install are compiled in, so re-run it after switching Node versions or moving clodex. Like `clodex patch`, it warns when an installed Claude Code extension is a different version from the Claude Code clodex last patched (on any platform). Setup guide: [docs/windows-setup.md](docs/windows-setup.md).
312
331
 
313
332
  ### Root
314
333
 
@@ -367,7 +386,7 @@ clodex --version # version
367
386
  this pre-dispatch intent, not proof of wire serialization. If the provider
368
387
  SDK reports that it omitted the tier for a model, clodex warns once and the
369
388
  backend default remains in use.
370
- - **Outbound proxy:** when `HTTP_PROXY`/`HTTPS_PROXY` (and optionally `NO_PROXY`) are set in clodex's environment, all clodex-originated network calls honor them — OAuth sign-in and token refresh, model-list and models.dev refreshes, upstream OpenAI API calls, and the ChatGPT/Codex OAuth WebSocket transport (tunneled via HTTP CONNECT).
389
+ - **Outbound proxy:** when `HTTP_PROXY`/`HTTPS_PROXY` (and optionally `NO_PROXY`) are set in clodex's environment, all clodex-originated network calls honor them — OAuth sign-in and token refresh, model-list and models.dev refreshes, upstream OpenAI API calls, and the ChatGPT/Codex OAuth WebSocket transport (tunneled via HTTP CONNECT). In proxy mode this also covers the web traffic Claude Code itself makes through the clodex proxy, so web fetches and searches work behind a corporate proxy instead of failing on a blocked direct connection.
371
390
  - **Provider timeouts:** `CLODEX_UPSTREAM_IDLE_TIMEOUT_MS` controls how long an
372
391
  SDK-backed translated stream may produce no event (default `120000`; range
373
392
  `10000`–`3600000` ms). `CLODEX_UPSTREAM_TOTAL_TIMEOUT_MS` limits each call
@@ -1752,8 +1752,8 @@ function computeWrapperEnv(baseEnv, state) {
1752
1752
  // src/patch-manifest.ts
1753
1753
  import { readFileSync as readFileSync5 } from "fs";
1754
1754
  import { join as join5 } from "path";
1755
- function getPatchManifestPath() {
1756
- return join5(getAppHome(), "patch-state.json");
1755
+ function getPatchManifestPath(env = process.env) {
1756
+ return join5(getAppHome(env), "patch-state.json");
1757
1757
  }
1758
1758
  function readPatchManifest(path = getPatchManifestPath()) {
1759
1759
  try {
@@ -2206,4 +2206,4 @@ export {
2206
2206
  planRestoreOnly,
2207
2207
  collectPristineFacts
2208
2208
  };
2209
- //# sourceMappingURL=chunk-5TG736TX.js.map
2209
+ //# sourceMappingURL=chunk-YGEPQOPA.js.map