@bman654/clodex 2.14.1 → 2.15.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
@@ -42,6 +42,7 @@ clodex claude # 5. launch Claude Code on an OpenAI model
42
42
  | OpenAI | API key | Fully supported by the clodex maintainer |
43
43
  | OpenAI (ChatGPT / Codex plan) | OAuth | Fully supported by the clodex maintainer |
44
44
  | OpenCode Go | API key | Community-supported — maintained by its contributor |
45
+ | Custom OpenAI-compatible server (OpenRouter, vLLM, …) | API key, or none | Community-supported — maintained by its contributor |
45
46
 
46
47
  **Community-supported** means the maintainer holds no account for that service,
47
48
  so it cannot be exercised against the live API here or debugged when the vendor
@@ -285,7 +286,7 @@ Two things worth knowing about the numbers:
285
286
  | Subcommand | Effect |
286
287
  | --- | --- |
287
288
  | *(none)* | Provider hub wizard |
288
- | `add` | Add OpenAI or OpenCode Go with an API key, or sign in with ChatGPT |
289
+ | `add` | Add OpenAI or OpenCode Go with an API key, add a custom OpenAI-compatible server by base URL, or sign in with ChatGPT |
289
290
  | `auth openai` | Sign in with ChatGPT/Codex-plan OAuth (device code; `--browser` for workspaces that disable device codes) |
290
291
  | `list` | Show configured providers |
291
292
  | `remove <id>` | Remove a provider by id |
@@ -293,6 +294,8 @@ Two things worth knowing about the numbers:
293
294
 
294
295
  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).
295
296
 
297
+ 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.
298
+
296
299
  ### `clodex install-vscode-launcher`
297
300
 
298
301
  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).
@@ -491,6 +491,17 @@ var PROVIDER_ID_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
491
491
  function isValidProviderId(id) {
492
492
  return PROVIDER_ID_PATTERN.test(id);
493
493
  }
494
+ function slugifyProviderId(displayName) {
495
+ const base = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
496
+ if (!base) return "custom-provider";
497
+ if (isValidProviderId(base)) return base;
498
+ const trimmed = base.replace(/^-+|-+$/g, "");
499
+ return isValidProviderId(trimmed) ? trimmed : `custom-${trimmed.slice(0, 40)}`;
500
+ }
501
+ function customProviderId(displayName) {
502
+ const slug = slugifyProviderId(displayName);
503
+ return slug.startsWith("custom-") ? slug : `custom-${slug}`;
504
+ }
494
505
 
495
506
  // src/registry/io.ts
496
507
  var DIR_MODE = 448;
@@ -2130,6 +2141,8 @@ export {
2130
2141
  storeActiveOAuthAccount,
2131
2142
  clearActiveOAuthAccount,
2132
2143
  isValidProviderId,
2144
+ slugifyProviderId,
2145
+ customProviderId,
2133
2146
  ensureSecureAppHome,
2134
2147
  loadRegistry,
2135
2148
  loadRegistryStrict,
@@ -2193,4 +2206,4 @@ export {
2193
2206
  planRestoreOnly,
2194
2207
  collectPristineFacts
2195
2208
  };
2196
- //# sourceMappingURL=chunk-3NCDMS7N.js.map
2209
+ //# sourceMappingURL=chunk-5TG736TX.js.map