scalemax 0.1.38 → 0.1.39

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
@@ -1,382 +1,382 @@
1
- # ScaleMax CLI
2
-
3
- Universal installer for configuring AI coding clients to use the ScaleMax OpenAI- and Anthropic-compatible API gateway.
4
-
5
- ScaleMax CLI is designed to be run from any machine with Node.js installed:
6
-
7
- ```bash
8
- npx scalemax
9
- ```
10
-
11
- It detects supported AI coding clients, safely backs up existing config files, and writes ScaleMax-compatible configuration using your ScaleMax API key.
12
-
13
- ## Requirements
14
-
15
- - Node.js `18.19` or newer
16
- - macOS, Linux, or Windows
17
- - A ScaleMax API key
18
- - Network access to `https://api.scalemax.pro`
19
-
20
- The CLI identifies whether the supplied key belongs to the API-credit surface or the token-pack surface. It then stores and configures the matching base URL automatically; users do not need to choose it manually.
21
-
22
- ## Installation
23
-
24
- ### One-time run with npx
25
-
26
- ```bash
27
- npx scalemax
28
- ```
29
-
30
- ### Always use the latest published version
31
-
32
- ```bash
33
- npx scalemax@latest
34
- ```
35
-
36
- ### Global install
37
-
38
- ```bash
39
- npm install -g scalemax
40
- scalemax
41
- ```
42
-
43
- ## Quick Start
44
-
45
- ```bash
46
- npx scalemax
47
- ```
48
-
49
- If no ScaleMax configuration exists, the installer prompts:
50
-
51
- ```text
52
- Enter your ScaleMax API key:
53
- ```
54
-
55
- If configuration already exists, the installer preserves the existing flow:
56
-
57
- ```text
58
- ✓ Existing ScaleMax configuration detected.
59
-
60
- API key:
61
- ••••••••••••••••abcd
62
-
63
- 1. Keep existing key
64
- 2. Replace with new key
65
- 3. Remove configuration
66
- 4. Exit
67
- ```
68
-
69
- After authentication, ScaleMax CLI detects installed clients and lets you configure one client or all detected clients.
70
-
71
- ## Commands
72
-
73
- ```bash
74
- scalemax Interactive installer
75
- scalemax login Store or replace your ScaleMax API key
76
- scalemax logout Remove stored ScaleMax API key
77
- scalemax doctor Run diagnostics
78
- scalemax models List available ScaleMax models
79
- scalemax helper-bot Open the ScaleMax-only support assistant
80
- scalemax claude-tools Install bounded GitHub skill tools for Claude
81
- scalemax update Reconfigure detected clients with the stored key
82
- scalemax remove Remove ScaleMax-generated client configuration
83
- scalemax --help Show help
84
- scalemax --version Show installed version
85
- ```
86
-
87
- ## Authentication
88
-
89
- ScaleMax CLI stores your API key in a user-level configuration file:
90
-
91
- - macOS: `~/Library/Application Support/scalemax/config.json`
92
- - Linux: `$XDG_CONFIG_HOME/scalemax/config.json` or `~/.config/scalemax/config.json`
93
- - Windows: `%APPDATA%\scalemax\config.json`
94
-
95
- The file is written with private permissions where supported. The API key is never printed; existing keys are displayed only as a masked value such as `••••••••••••••••abcd`.
96
-
97
- For CI or non-interactive checks, you may provide the key through the environment:
98
-
99
- ```bash
100
- SCALEMAX_API_KEY=sm_live_xxx scalemax models
101
- ```
102
-
103
- ## ScaleMax Helper Bot
104
-
105
- Start an interactive ScaleMax installation, configuration, authentication, and troubleshooting session:
106
-
107
- ```bash
108
- npx scalemax@latest helper-bot
109
- ```
110
-
111
- Or ask one small question and exit:
112
-
113
- ```bash
114
- npx scalemax@latest helper-bot "Why is my ScaleMax API key rejected in Codex?"
115
- ```
116
-
117
- The helper uses the same stored key as the installer, verifies authentication, and detects the API-credit or token-pack base URL automatically. General support questions default to `gpt-5.4` when that model is available to the key; each response is capped at 512 tokens and interactive history is bounded to the latest two turns. To choose a different model from `scalemax models`, use:
118
-
119
- ```bash
120
- npx scalemax@latest helper-bot --model fable-5 "Help me configure ScaleMax in Cursor"
121
- ```
122
-
123
- Recognized setup, repair, and verification requests execute the CLI's allowlisted client operations directly. Requests such as `setup all providers`, `fix Hermes request failed`, `configure Claude Code`, `verify OpenCode`, and `setup vs code roo extension for claude` are handled by the controller before any model request. The controller detects the relevant client, runs a safe installer when the client has one, verifies existing ScaleMax configuration, repairs ScaleMax-managed files when verification fails, re-verifies, and reports each step.
124
-
125
- For Claude tool access, run `scalemax claude-tools`, or ask helper-bot to `install GitHub skill tools for Claude Desktop and Claude Code`. Claude Code receives Anthropic's official `example-skills@anthropic-agent-skills` plugin plus public-GitHub read permissions. Claude Desktop/Cowork receives a local MCP server with only three tools: `github_fetch`, `github_tree`, and `github_install_skill`. The MCP server accepts only public GitHub HTTPS hosts, limits downloads, rejects unsafe archive paths and symlinks, refuses to replace an existing skill, and can write only beneath `~/Claude/skills`. It does not expose a general shell, arbitrary URLs, or unrestricted filesystem access. Restart Claude Desktop after installation and use Cowork or Code; a normal Chat tab does not expose local tools.
126
- Only install skills from repositories you trust: a `SKILL.md` is instruction content that Claude may follow after installation, even though the bridge itself cannot execute arbitrary repository code.
127
-
128
- For Roo Code, helper-bot can install VS Code on Windows with the fixed Microsoft winget package, install the official Roo Code extension, write OpenAI and Claude ScaleMax profiles when the key exposes those families, and verify the import handoff. For DeepSeek V4 Flash, helper-bot creates an agent profile only when authenticated discovery reports `capabilities.tools=true`; otherwise it installs Continue's safe Chat/Edit fallback. For general troubleshooting that cannot be completed by a fixed client action, helper-bot sends a small `gpt-5.4` request grounded with bundled ScaleMax documentation about stored authentication, credit/token base URLs, provider scope, client setup, and common errors. The language model never generates or executes shell commands; only fixed ScaleMax client detection, installation, configuration, verification, and rollback operations are available to the controller.
129
-
130
- The helper refuses unrelated requests and redacts ScaleMax-style secrets from prompts, provider output, errors, and progress notifications. Use `/status` for non-secret connection details, `/help` for commands, and `/quit` to exit.
131
-
132
- ## Supported clients
133
-
134
- `scalemax` supports this client set whether it is run through a global install or with `npx`:
135
-
136
- - Codex
137
- - Cursor
138
- - Roo Code (VS Code)
139
- - Cline (CLI and VS Code)
140
- - Continue (VS Code)
141
- - TRAE SOLO
142
- - Claude Code
143
- - OpenCode
144
- - OpenClaw
145
- - Hermes
146
- - Cherry Studio
147
- - API Code
148
-
149
- For clients without a stable official config file, the installer writes a ScaleMax setup guide under `~/.scalemax/` instead of modifying private app storage.
150
-
151
- ### Codex
152
-
153
- ScaleMax configures the official Codex custom-provider interface in `~/.codex/config.toml` with `wire_api = "responses"`, and stores the selected key in Codex's private `~/.codex/auth.json`. Detection is semantic: unrelated or ChatGPT-authenticated Codex files are not reported as ScaleMax-configured. Only authenticated Codex/OpenAI-family models are eligible, the generated files are private, and verification performs a minimal `/v1/responses` request before reporting success.
154
-
155
- ### Claude Code
156
-
157
- ScaleMax updates `~/.claude/settings.json` with `ANTHROPIC_BASE_URL=https://api.scalemax.pro`, gateway model discovery, and a cached `apiKeyHelper` that reads a private `~/.claude/scalemax.key` file. The raw key is not stored in the settings JSON. Because Claude Code's gateway discovery only accepts IDs beginning with `claude` or `anthropic`, a catalog that includes Fable also receives a managed `ANTHROPIC_CUSTOM_MODEL_OPTION=fable-5` entry (with a friendly name and description), making `/model fable-5` selectable; any prior custom picker values are restored when ScaleMax configuration is removed. The Anthropic base URL intentionally has no `/v1` suffix because Claude Code adds `/v1/messages` itself. The CLI preserves unrelated settings, selects a live main model from the authenticated catalog (preferring `claude-opus-5`), pins authenticated Haiku for lightweight background work when available, and sets `CLAUDE_CODE_DISABLE_THINKING=1` because third-party Anthropic-compatible providers do not support Claude Code's proprietary extended-thinking control envelope. The ScaleMax gateway separately locks native Claude requests to provider-side `low` effort. Fable uses its verified translated controls and supports `low`, `medium`, `high`, and `max`, with `low` as the default. Haiku 4.5 omits the unsupported effort field. It verifies a one-token Messages request and, if verification fails, removes only the ScaleMax-managed changes. Claude Code picker aliases such as `claude-opus-5[1m]` are normalized by the gateway.
158
-
159
- ### OpenCode
160
-
161
- ScaleMax merges a named `scalemax` provider into `~/.config/opencode/opencode.json` (or the platform-equivalent config directory). It uses `https://api.scalemax.pro/v1`, reads its credential from the private `~/.config/opencode/scalemax.key` file through OpenCode's `{file:...}` substitution, keeps unrelated providers and the user's non-ScaleMax default model, and exposes only authenticated Codex/OpenAI-family models. A fresh ScaleMax setup uses an authenticated GPT mini model as `small_model` when available. Each generated model has an explicit output limit of at most 4096 tokens so OpenCode does not send an unsupported default limit. Its `tool_call` flag is taken from the authenticated ScaleMax model catalog; run `scalemax update` after a catalog or client update so agent tools stay aligned with the current route.
162
-
163
- ### OpenClaw
164
-
165
- ScaleMax partitions OpenClaw models into native `openai-responses` (`scalemax-codex`, `/v1`), OpenAI-compatible `openai-completions` (`scalemax-deepseek`, `/v1`), and `anthropic-messages` (`scalemax-claude`, origin) providers. `deepseek-v4-flash` is always isolated in the Chat Completions provider and never advertised through Responses. Its agent flags come only from authenticated catalog discovery: tools, forced `tool_choice`, reasoning, reasoning effort, streamed usage, and `reasoning_content` replay are each enabled only when the exact model advertises that capability. In particular, a tool-capable route is never forced to replay reasoning content unless `capabilities.reasoning_replay=true`; a fallback route remains explicitly tool-free. The API key and compatibility User-Agent are OpenClaw file-backed SecretRefs stored in private `0600` files under `~/.openclaw/secrets/`; neither value is embedded in the main provider JSON. Migration removes the obsolete mixed provider, preserves the active model family, and scrubs plaintext credentials from generated ScaleMax agent registries even when they contain an older key. Output is capped at 4096 tokens, private-network routing is denied for the public gateway, and unrelated providers and agent settings are preserved.
166
-
167
- ### Hermes
168
-
169
- ScaleMax creates family-specific Hermes providers in `~/.hermes/config.yaml` and stores one credential in `~/.hermes/.env` with private permissions. `scalemax-codex` uses Hermes's `codex_responses` transport at `/v1`; `scalemax-claude` uses `anthropic_messages` at the gateway origin; and an authenticated tool-capable `deepseek-v4-flash` route receives a separate `scalemax-deepseek` Chat Completions provider. A text-only DeepSeek route fails closed for Hermes agent mode. All providers use a scoped `ScaleMax-Hermes/1.0` user agent and a 4096-token output cap. Existing non-ScaleMax providers and defaults are preserved, and the obsolete mixed provider is migrated safely.
170
-
171
- ### Roo Code (VS Code)
172
-
173
- Roo Code stores provider profiles and secrets in VS Code extension storage, so ScaleMax does not mutate its private database. Instead, the CLI writes a private `0600` Roo settings-import file at `~/.scalemax/roo-code-import.json` and points the supported `roo-cline.autoImportSettingsPath` VS Code setting at it. Codex, Claude, and tool-capable DeepSeek profiles remain separate. DeepSeek is offered only when authenticated discovery reports `capabilities.tools=true`; otherwise Roo fails closed and points the user to Continue Chat/Edit. Reload VS Code once so Roo imports supported profiles into its SecretStorage. CLI verification intentionally reports the handoff as verified, not the extension runtime, until that reload occurs.
174
-
175
- ### Cline (CLI and VS Code)
176
-
177
- ScaleMax supports the verified Cline CLI `3.0.47` and VS Code extension `4.0.12` formats. The CLI surface uses Cline's built-in `openai-native` provider and Responses protocol. The extension uses its built-in OpenAI-compatible provider. Both receive the raw ScaleMax key and the matching credit or token base URL; ScaleMax never writes a custom `Authorization` or `x-api-key` header because Cline generates `Authorization: Bearer …` itself. Configuration is attempted only while Cline and VS Code are stopped, preserves unrelated state, uses private atomic files with backups and rollback, and fails closed on unknown versions or malformed/symlinked state.
178
-
179
- ### Continue (VS Code)
180
-
181
- Continue is the universal VS Code Chat/Edit route for `deepseek-v4-flash`. The CLI installs the official `Continue.continue` extension when VS Code is available, merges an OpenAI-compatible model into `~/.continue/config.yaml`, sets `useResponsesApi: false`, and keeps the authenticated ScaleMax key in private `~/.continue/.env` rather than the YAML. Existing Continue models and environment entries are preserved. Reload VS Code and select **ScaleMax DeepSeek V4 Flash**. For agent workflows, prefer Roo/OpenClaw/Hermes when the authenticated catalog reports `capabilities.tools=true`.
182
-
183
- ### Cursor BYOK routing on macOS
184
-
185
- Cursor can send named models through its own plan-gated router unless its local BYOK runtime is active. When you select Cursor, `npx scalemax`:
186
-
187
- 1. Fetches the complete authenticated model list from `https://api.scalemax.pro/v1/models`.
188
- 2. Asks before closing Cursor and modifying the application.
189
- 3. Verifies one known semantic patch anchor in each of three Cursor bundles before writing anything.
190
- 4. Stores backups outside `Cursor.app`, records SHA-256 hashes, and rolls back all files if any step fails.
191
- 5. Enables Cursor's local BYOK runtime without hard-coding GPT-5.5.
192
- 6. Stores the ScaleMax key in Cursor's native macOS protected-secret format and sets `useOpenAIKey=true` with `openAIBaseUrl=https://api.scalemax.pro/v1`.
193
- 7. Synchronizes every live ScaleMax model into Cursor's local-provider catalog while preserving the user's currently selected model.
194
-
195
- Automatic Cursor patching is currently verified on macOS only. Unknown, partial, or changed Cursor bundle signatures fail closed without modifying the app. Cursor updates can replace the patched bundles; rerun `npx scalemax@latest` after an update. `scalemax remove` restores only bundle versions and protected-state values managed by ScaleMax, and refuses to overwrite files changed afterward.
196
-
197
- For explicitly approved non-interactive automation, set `SCALEMAX_CURSOR_PATCH_CONSENT=1`. Without it, non-interactive Cursor modification is skipped safely.
198
-
199
- ## Examples
200
-
201
- List models:
202
-
203
- ```bash
204
- npx scalemax models
205
- ```
206
-
207
- The model list is fetched live from `https://api.scalemax.pro/v1/models` every time, so disabled or unsupported models disappear immediately without manual cache cleanup.
208
- The CLI authenticates the key before loading its model catalog. Safe GET checks receive one short, jittered retry on transient network, rate-limit, or server failures; model-generation POST requests are never retried by the installer. CLI requests honor `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` and automatically try the usable IPv4 or IPv6 route.
209
-
210
- Run diagnostics:
211
-
212
- ```bash
213
- npx scalemax doctor
214
- ```
215
-
216
- Configure all detected clients after login:
217
-
218
- ```bash
219
- npx scalemax update
220
- ```
221
-
222
- Remove ScaleMax-generated client config and restore backups when available:
223
-
224
- ```bash
225
- npx scalemax remove
226
- ```
227
-
228
- ## Updating
229
-
230
- With npx:
231
-
232
- ```bash
233
- npx scalemax@latest
234
- ```
235
-
236
- With a global install:
237
-
238
- ```bash
239
- npm update -g scalemax
240
- # or
241
- npm install -g scalemax@latest
242
- ```
243
-
244
- ## Removing configuration
245
-
246
- Remove only the stored ScaleMax API key:
247
-
248
- ```bash
249
- scalemax logout
250
- ```
251
-
252
- Remove ScaleMax-generated client configuration files and restore backups when possible:
253
-
254
- ```bash
255
- scalemax remove
256
- ```
257
-
258
- ## Troubleshooting
259
-
260
- ### `No ScaleMax API key found`
261
-
262
- Run:
263
-
264
- ```bash
265
- scalemax login
266
- ```
267
-
268
- ### `API check failed: HTTP 401`
269
-
270
- Your key is missing, expired, inactive, or mistyped. Run:
271
-
272
- ```bash
273
- scalemax login
274
- ```
275
-
276
- Then paste a valid ScaleMax API key.
277
-
278
- ### `npx` runs an old version
279
-
280
- Force latest:
281
-
282
- ```bash
283
- npx scalemax@latest
284
- ```
285
-
286
- Or clear the npm cache:
287
-
288
- ```bash
289
- npm cache verify
290
- ```
291
-
292
- ### `Could not reach the ScaleMax API`
293
-
294
- Use the latest CLI first:
295
-
296
- ```bash
297
- npx scalemax@latest
298
- ```
299
-
300
- ScaleMax automatically honors `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
301
- when a workplace or ISP requires an outbound proxy. It also falls back between
302
- IPv4 and IPv6. If the error specifically reports DNS or TLS, correct the
303
- device DNS/system clock or disable HTTPS inspection for `api.scalemax.pro`,
304
- then rerun the command. Never disable TLS verification.
305
-
306
- ### Client config looks wrong
307
-
308
- Run:
309
-
310
- ```bash
311
- scalemax doctor
312
- ```
313
-
314
- Then reconfigure:
315
-
316
- ```bash
317
- scalemax update
318
- ```
319
-
320
- ### Remove and start over
321
-
322
- ```bash
323
- scalemax remove
324
- scalemax logout
325
- npx scalemax@latest
326
- ```
327
-
328
- ## Release process for maintainers
329
-
330
- See `RELEASE.md` in the repository. In short:
331
-
332
- ```bash
333
- npm run version:patch # or version:minor / version:major
334
- npm run prepublishOnly
335
- npm publish
336
- ```
337
-
338
- Never publish over an existing npm version. Use semantic versioning for every release.
339
-
340
- ## Safety guarantees
341
-
342
- - Existing client configuration files are backed up before writes.
343
- - Writes are atomic.
344
- - Identical configurations are not rewritten or backed up again.
345
- - Invalid JSON/JSON5 client files fail closed instead of being replaced; valid JSON5 values are merged safely.
346
- - Backup directories are user-only and backup files are written with private permissions.
347
- - API keys are masked in terminal output.
348
- - Codex, Claude Code, OpenCode, OpenClaw, Hermes, and the Roo Code import handoff keep generated client credentials in private files rather than shared provider configuration blocks.
349
- - The published npm package contains only runtime files: `dist/`, `README.md`, `LICENSE`, and `package.json`.
350
- - Tests, TypeScript source, scripts, local caches, `.env` files, tarballs, and `node_modules` are excluded from the published package.
351
-
352
- ## FAQ
353
-
354
- ### Does `npx scalemax` install anything permanently?
355
-
356
- `npx` downloads and runs the CLI package. The CLI itself writes ScaleMax configuration only after you choose to configure clients.
357
-
358
- ### Can I use it without global install?
359
-
360
- Yes. Use:
361
-
362
- ```bash
363
- npx scalemax@latest
364
- ```
365
-
366
- ### Can I use a different API key later?
367
-
368
- Yes. Run:
369
-
370
- ```bash
371
- scalemax login
372
- ```
373
-
374
- or rerun the installer and choose `Replace with a new key`.
375
-
376
- ### Does it support Windows?
377
-
378
- Yes. The CLI uses Windows-aware config paths and writes `%APPDATA%\scalemax\config.json` for ScaleMax key storage.
379
-
380
- ### What endpoint does it configure?
381
-
382
- API-credit keys use `https://api.scalemax.pro/v1` for OpenAI-compatible clients and `https://api.scalemax.pro` for Anthropic-compatible clients. Token-pack keys use `https://api.scalemax.pro/token/v1` and `https://api.scalemax.pro/token` respectively. The CLI detects the key type and configures the correct surface automatically; the two key types are intentionally not interchangeable.
1
+ # ScaleMax CLI
2
+
3
+ Universal installer for configuring AI coding clients to use the ScaleMax OpenAI- and Anthropic-compatible API gateway.
4
+
5
+ ScaleMax CLI is designed to be run from any machine with Node.js installed:
6
+
7
+ ```bash
8
+ npx scalemax
9
+ ```
10
+
11
+ It detects supported AI coding clients, safely backs up existing config files, and writes ScaleMax-compatible configuration using your ScaleMax API key.
12
+
13
+ ## Requirements
14
+
15
+ - Node.js `18.19` or newer
16
+ - macOS, Linux, or Windows
17
+ - A ScaleMax API key
18
+ - Network access to `https://api.scalemax.pro`
19
+
20
+ The CLI identifies whether the supplied key belongs to the API-credit surface or the token-pack surface. It then stores and configures the matching base URL automatically; users do not need to choose it manually.
21
+
22
+ ## Installation
23
+
24
+ ### One-time run with npx
25
+
26
+ ```bash
27
+ npx scalemax
28
+ ```
29
+
30
+ ### Always use the latest published version
31
+
32
+ ```bash
33
+ npx scalemax@latest
34
+ ```
35
+
36
+ ### Global install
37
+
38
+ ```bash
39
+ npm install -g scalemax
40
+ scalemax
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```bash
46
+ npx scalemax
47
+ ```
48
+
49
+ If no ScaleMax configuration exists, the installer prompts:
50
+
51
+ ```text
52
+ Enter your ScaleMax API key:
53
+ ```
54
+
55
+ If configuration already exists, the installer preserves the existing flow:
56
+
57
+ ```text
58
+ ✓ Existing ScaleMax configuration detected.
59
+
60
+ API key:
61
+ ••••••••••••••••abcd
62
+
63
+ 1. Keep existing key
64
+ 2. Replace with new key
65
+ 3. Remove configuration
66
+ 4. Exit
67
+ ```
68
+
69
+ After authentication, ScaleMax CLI detects installed clients and lets you configure one client or all detected clients.
70
+
71
+ ## Commands
72
+
73
+ ```bash
74
+ scalemax Interactive installer
75
+ scalemax login Store or replace your ScaleMax API key
76
+ scalemax logout Remove stored ScaleMax API key
77
+ scalemax doctor Run diagnostics
78
+ scalemax models List available ScaleMax models
79
+ scalemax helper-bot Open the ScaleMax-only support assistant
80
+ scalemax claude-tools Install bounded GitHub skill tools for Claude
81
+ scalemax update Reconfigure detected clients with the stored key
82
+ scalemax remove Remove ScaleMax-generated client configuration
83
+ scalemax --help Show help
84
+ scalemax --version Show installed version
85
+ ```
86
+
87
+ ## Authentication
88
+
89
+ ScaleMax CLI stores your API key in a user-level configuration file:
90
+
91
+ - macOS: `~/Library/Application Support/scalemax/config.json`
92
+ - Linux: `$XDG_CONFIG_HOME/scalemax/config.json` or `~/.config/scalemax/config.json`
93
+ - Windows: `%APPDATA%\scalemax\config.json`
94
+
95
+ The file is written with private permissions where supported. The API key is never printed; existing keys are displayed only as a masked value such as `••••••••••••••••abcd`.
96
+
97
+ For CI or non-interactive checks, you may provide the key through the environment:
98
+
99
+ ```bash
100
+ SCALEMAX_API_KEY=sm_live_xxx scalemax models
101
+ ```
102
+
103
+ ## ScaleMax Helper Bot
104
+
105
+ Start an interactive ScaleMax installation, configuration, authentication, and troubleshooting session:
106
+
107
+ ```bash
108
+ npx scalemax@latest helper-bot
109
+ ```
110
+
111
+ Or ask one small question and exit:
112
+
113
+ ```bash
114
+ npx scalemax@latest helper-bot "Why is my ScaleMax API key rejected in Codex?"
115
+ ```
116
+
117
+ The helper uses the same stored key as the installer, verifies authentication, and detects the API-credit or token-pack base URL automatically. General support questions default to `gpt-5.4` when that model is available to the key; each response is capped at 512 tokens and interactive history is bounded to the latest two turns. To choose a different model from `scalemax models`, use:
118
+
119
+ ```bash
120
+ npx scalemax@latest helper-bot --model fable-5 "Help me configure ScaleMax in Cursor"
121
+ ```
122
+
123
+ Recognized setup, repair, and verification requests execute the CLI's allowlisted client operations directly. Requests such as `setup all providers`, `fix Hermes request failed`, `configure Claude Code`, `verify OpenCode`, and `setup vs code roo extension for claude` are handled by the controller before any model request. The controller detects the relevant client, runs a safe installer when the client has one, verifies existing ScaleMax configuration, repairs ScaleMax-managed files when verification fails, re-verifies, and reports each step.
124
+
125
+ For Claude tool access, run `scalemax claude-tools`, or ask helper-bot to `install GitHub skill tools for Claude Desktop and Claude Code`. Claude Code receives Anthropic's official `example-skills@anthropic-agent-skills` plugin plus public-GitHub read permissions. Claude Desktop/Cowork receives a local MCP server with only three tools: `github_fetch`, `github_tree`, and `github_install_skill`. The MCP server accepts only public GitHub HTTPS hosts, limits downloads, rejects unsafe archive paths and symlinks, refuses to replace an existing skill, and can write only beneath `~/Claude/skills`. It does not expose a general shell, arbitrary URLs, or unrestricted filesystem access. Restart Claude Desktop after installation and use Cowork or Code; a normal Chat tab does not expose local tools.
126
+ Only install skills from repositories you trust: a `SKILL.md` is instruction content that Claude may follow after installation, even though the bridge itself cannot execute arbitrary repository code.
127
+
128
+ For Roo Code, helper-bot can install VS Code on Windows with the fixed Microsoft winget package, install the official Roo Code extension, write OpenAI and Claude ScaleMax profiles when the key exposes those families, and verify the import handoff. For DeepSeek V4 Flash, helper-bot creates an agent profile only when authenticated discovery reports `capabilities.tools=true`; otherwise it installs Continue's safe Chat/Edit fallback. For general troubleshooting that cannot be completed by a fixed client action, helper-bot sends a small `gpt-5.4` request grounded with bundled ScaleMax documentation about stored authentication, credit/token base URLs, provider scope, client setup, and common errors. The language model never generates or executes shell commands; only fixed ScaleMax client detection, installation, configuration, verification, and rollback operations are available to the controller.
129
+
130
+ The helper refuses unrelated requests and redacts ScaleMax-style secrets from prompts, provider output, errors, and progress notifications. Use `/status` for non-secret connection details, `/help` for commands, and `/quit` to exit.
131
+
132
+ ## Supported clients
133
+
134
+ `scalemax` supports this client set whether it is run through a global install or with `npx`:
135
+
136
+ - Codex
137
+ - Cursor
138
+ - Roo Code (VS Code)
139
+ - Cline (CLI and VS Code)
140
+ - Continue (VS Code)
141
+ - TRAE SOLO
142
+ - Claude Code
143
+ - OpenCode
144
+ - OpenClaw
145
+ - Hermes
146
+ - Cherry Studio
147
+ - API Code
148
+
149
+ For clients without a stable official config file, the installer writes a ScaleMax setup guide under `~/.scalemax/` instead of modifying private app storage.
150
+
151
+ ### Codex
152
+
153
+ ScaleMax configures the official Codex custom-provider interface in `~/.codex/config.toml` with `wire_api = "responses"`, and stores the selected key in Codex's private `~/.codex/auth.json`. Detection is semantic: unrelated or ChatGPT-authenticated Codex files are not reported as ScaleMax-configured. Only authenticated Codex/OpenAI-family models are eligible, the generated files are private, and verification performs a minimal `/v1/responses` request before reporting success.
154
+
155
+ ### Claude Code
156
+
157
+ ScaleMax updates `~/.claude/settings.json` with `ANTHROPIC_BASE_URL=https://api.scalemax.pro`, gateway model discovery, and a cached `apiKeyHelper` that reads a private `~/.claude/scalemax.key` file. The raw key is not stored in the settings JSON. Because Claude Code's gateway discovery only accepts IDs beginning with `claude` or `anthropic`, catalogs that include Fable or Auto also receive a managed custom picker entry (`ANTHROPIC_CUSTOM_MODEL_OPTION=fable-5` or `auto`, with friendly names and descriptions), making `/model fable-5` and `/model auto` selectable; any prior custom picker values are restored when ScaleMax configuration is removed. The Anthropic base URL intentionally has no `/v1` suffix because Claude Code adds `/v1/messages` itself. The CLI preserves unrelated settings, selects a live main model from the authenticated catalog (preferring `claude-opus-5`), pins authenticated Haiku for lightweight background work when available, and sets `CLAUDE_CODE_DISABLE_THINKING=1` because third-party Anthropic-compatible providers do not support Claude Code's proprietary extended-thinking control envelope. The ScaleMax gateway separately locks native Claude requests to provider-side `low` effort. Fable uses its verified translated controls and supports `low`, `medium`, `high`, and `max`, with `low` as the default. Haiku 4.5 omits the unsupported effort field. It verifies a one-token Messages request and, if verification fails, removes only the ScaleMax-managed changes. Claude Code picker aliases such as `claude-opus-5[1m]` are normalized by the gateway.
158
+
159
+ ### OpenCode
160
+
161
+ ScaleMax merges a named `scalemax` provider into `~/.config/opencode/opencode.json` (or the platform-equivalent config directory). It uses `https://api.scalemax.pro/v1`, reads its credential from the private `~/.config/opencode/scalemax.key` file through OpenCode's `{file:...}` substitution, keeps unrelated providers and the user's non-ScaleMax default model, and exposes only authenticated Codex/OpenAI-family models. A fresh ScaleMax setup uses an authenticated GPT mini model as `small_model` when available. Each generated model has an explicit output limit of at most 4096 tokens so OpenCode does not send an unsupported default limit. Its `tool_call` flag is taken from the authenticated ScaleMax model catalog; run `scalemax update` after a catalog or client update so agent tools stay aligned with the current route.
162
+
163
+ ### OpenClaw
164
+
165
+ ScaleMax partitions OpenClaw models into native `openai-responses` (`scalemax-codex`, `/v1`), OpenAI-compatible `openai-completions` (`scalemax-deepseek`, `/v1`), and `anthropic-messages` (`scalemax-claude`, origin) providers. `deepseek-v4-flash` is always isolated in the Chat Completions provider and never advertised through Responses. Its agent flags come only from authenticated catalog discovery: tools, forced `tool_choice`, reasoning, reasoning effort, streamed usage, and `reasoning_content` replay are each enabled only when the exact model advertises that capability. In particular, a tool-capable route is never forced to replay reasoning content unless `capabilities.reasoning_replay=true`; a fallback route remains explicitly tool-free. The API key and compatibility User-Agent are OpenClaw file-backed SecretRefs stored in private `0600` files under `~/.openclaw/secrets/`; neither value is embedded in the main provider JSON. Migration removes the obsolete mixed provider, preserves the active model family, and scrubs plaintext credentials from generated ScaleMax agent registries even when they contain an older key. Output is capped at 4096 tokens, private-network routing is denied for the public gateway, and unrelated providers and agent settings are preserved.
166
+
167
+ ### Hermes
168
+
169
+ ScaleMax creates family-specific Hermes providers in `~/.hermes/config.yaml` and stores one credential in `~/.hermes/.env` with private permissions. `scalemax-codex` uses Hermes's `codex_responses` transport at `/v1`; `scalemax-claude` uses `anthropic_messages` at the gateway origin; and an authenticated tool-capable `deepseek-v4-flash` route receives a separate `scalemax-deepseek` Chat Completions provider. A text-only DeepSeek route fails closed for Hermes agent mode. All providers use a scoped `ScaleMax-Hermes/1.0` user agent and a 4096-token output cap. Existing non-ScaleMax providers and defaults are preserved, and the obsolete mixed provider is migrated safely.
170
+
171
+ ### Roo Code (VS Code)
172
+
173
+ Roo Code stores provider profiles and secrets in VS Code extension storage, so ScaleMax does not mutate its private database. Instead, the CLI writes a private `0600` Roo settings-import file at `~/.scalemax/roo-code-import.json` and points the supported `roo-cline.autoImportSettingsPath` VS Code setting at it. Codex, Claude, and tool-capable DeepSeek profiles remain separate. DeepSeek is offered only when authenticated discovery reports `capabilities.tools=true`; otherwise Roo fails closed and points the user to Continue Chat/Edit. Reload VS Code once so Roo imports supported profiles into its SecretStorage. CLI verification intentionally reports the handoff as verified, not the extension runtime, until that reload occurs.
174
+
175
+ ### Cline (CLI and VS Code)
176
+
177
+ ScaleMax supports the verified Cline CLI `3.0.47` and VS Code extension `4.0.12` formats. The CLI surface uses Cline's built-in `openai-native` provider and Responses protocol. The extension uses its built-in OpenAI-compatible provider. Both receive the raw ScaleMax key and the matching credit or token base URL; ScaleMax never writes a custom `Authorization` or `x-api-key` header because Cline generates `Authorization: Bearer …` itself. Configuration is attempted only while Cline and VS Code are stopped, preserves unrelated state, uses private atomic files with backups and rollback, and fails closed on unknown versions or malformed/symlinked state.
178
+
179
+ ### Continue (VS Code)
180
+
181
+ Continue is the universal VS Code Chat/Edit route for `deepseek-v4-flash`. The CLI installs the official `Continue.continue` extension when VS Code is available, merges an OpenAI-compatible model into `~/.continue/config.yaml`, sets `useResponsesApi: false`, and keeps the authenticated ScaleMax key in private `~/.continue/.env` rather than the YAML. Existing Continue models and environment entries are preserved. Reload VS Code and select **ScaleMax DeepSeek V4 Flash**. For agent workflows, prefer Roo/OpenClaw/Hermes when the authenticated catalog reports `capabilities.tools=true`.
182
+
183
+ ### Cursor BYOK routing on macOS
184
+
185
+ Cursor can send named models through its own plan-gated router unless its local BYOK runtime is active. When you select Cursor, `npx scalemax`:
186
+
187
+ 1. Fetches the complete authenticated model list from `https://api.scalemax.pro/v1/models`.
188
+ 2. Asks before closing Cursor and modifying the application.
189
+ 3. Verifies one known semantic patch anchor in each of three Cursor bundles before writing anything.
190
+ 4. Stores backups outside `Cursor.app`, records SHA-256 hashes, and rolls back all files if any step fails.
191
+ 5. Enables Cursor's local BYOK runtime without hard-coding GPT-5.5.
192
+ 6. Stores the ScaleMax key in Cursor's native macOS protected-secret format and sets `useOpenAIKey=true` with `openAIBaseUrl=https://api.scalemax.pro/v1`.
193
+ 7. Synchronizes every live ScaleMax model into Cursor's local-provider catalog while preserving the user's currently selected model.
194
+
195
+ Automatic Cursor patching is currently verified on macOS only. Unknown, partial, or changed Cursor bundle signatures fail closed without modifying the app. Cursor updates can replace the patched bundles; rerun `npx scalemax@latest` after an update. `scalemax remove` restores only bundle versions and protected-state values managed by ScaleMax, and refuses to overwrite files changed afterward.
196
+
197
+ For explicitly approved non-interactive automation, set `SCALEMAX_CURSOR_PATCH_CONSENT=1`. Without it, non-interactive Cursor modification is skipped safely.
198
+
199
+ ## Examples
200
+
201
+ List models:
202
+
203
+ ```bash
204
+ npx scalemax models
205
+ ```
206
+
207
+ The model list is fetched live from `https://api.scalemax.pro/v1/models` every time, so disabled or unsupported models disappear immediately without manual cache cleanup.
208
+ The CLI authenticates the key before loading its model catalog. Safe GET checks receive one short, jittered retry on transient network, rate-limit, or server failures; model-generation POST requests are never retried by the installer. CLI requests honor `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` and automatically try the usable IPv4 or IPv6 route.
209
+
210
+ Run diagnostics:
211
+
212
+ ```bash
213
+ npx scalemax doctor
214
+ ```
215
+
216
+ Configure all detected clients after login:
217
+
218
+ ```bash
219
+ npx scalemax update
220
+ ```
221
+
222
+ Remove ScaleMax-generated client config and restore backups when available:
223
+
224
+ ```bash
225
+ npx scalemax remove
226
+ ```
227
+
228
+ ## Updating
229
+
230
+ With npx:
231
+
232
+ ```bash
233
+ npx scalemax@latest
234
+ ```
235
+
236
+ With a global install:
237
+
238
+ ```bash
239
+ npm update -g scalemax
240
+ # or
241
+ npm install -g scalemax@latest
242
+ ```
243
+
244
+ ## Removing configuration
245
+
246
+ Remove only the stored ScaleMax API key:
247
+
248
+ ```bash
249
+ scalemax logout
250
+ ```
251
+
252
+ Remove ScaleMax-generated client configuration files and restore backups when possible:
253
+
254
+ ```bash
255
+ scalemax remove
256
+ ```
257
+
258
+ ## Troubleshooting
259
+
260
+ ### `No ScaleMax API key found`
261
+
262
+ Run:
263
+
264
+ ```bash
265
+ scalemax login
266
+ ```
267
+
268
+ ### `API check failed: HTTP 401`
269
+
270
+ Your key is missing, expired, inactive, or mistyped. Run:
271
+
272
+ ```bash
273
+ scalemax login
274
+ ```
275
+
276
+ Then paste a valid ScaleMax API key.
277
+
278
+ ### `npx` runs an old version
279
+
280
+ Force latest:
281
+
282
+ ```bash
283
+ npx scalemax@latest
284
+ ```
285
+
286
+ Or clear the npm cache:
287
+
288
+ ```bash
289
+ npm cache verify
290
+ ```
291
+
292
+ ### `Could not reach the ScaleMax API`
293
+
294
+ Use the latest CLI first:
295
+
296
+ ```bash
297
+ npx scalemax@latest
298
+ ```
299
+
300
+ ScaleMax automatically honors `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
301
+ when a workplace or ISP requires an outbound proxy. It also falls back between
302
+ IPv4 and IPv6. If the error specifically reports DNS or TLS, correct the
303
+ device DNS/system clock or disable HTTPS inspection for `api.scalemax.pro`,
304
+ then rerun the command. Never disable TLS verification.
305
+
306
+ ### Client config looks wrong
307
+
308
+ Run:
309
+
310
+ ```bash
311
+ scalemax doctor
312
+ ```
313
+
314
+ Then reconfigure:
315
+
316
+ ```bash
317
+ scalemax update
318
+ ```
319
+
320
+ ### Remove and start over
321
+
322
+ ```bash
323
+ scalemax remove
324
+ scalemax logout
325
+ npx scalemax@latest
326
+ ```
327
+
328
+ ## Release process for maintainers
329
+
330
+ See `RELEASE.md` in the repository. In short:
331
+
332
+ ```bash
333
+ npm run version:patch # or version:minor / version:major
334
+ npm run prepublishOnly
335
+ npm publish
336
+ ```
337
+
338
+ Never publish over an existing npm version. Use semantic versioning for every release.
339
+
340
+ ## Safety guarantees
341
+
342
+ - Existing client configuration files are backed up before writes.
343
+ - Writes are atomic.
344
+ - Identical configurations are not rewritten or backed up again.
345
+ - Invalid JSON/JSON5 client files fail closed instead of being replaced; valid JSON5 values are merged safely.
346
+ - Backup directories are user-only and backup files are written with private permissions.
347
+ - API keys are masked in terminal output.
348
+ - Codex, Claude Code, OpenCode, OpenClaw, Hermes, and the Roo Code import handoff keep generated client credentials in private files rather than shared provider configuration blocks.
349
+ - The published npm package contains only runtime files: `dist/`, `README.md`, `LICENSE`, and `package.json`.
350
+ - Tests, TypeScript source, scripts, local caches, `.env` files, tarballs, and `node_modules` are excluded from the published package.
351
+
352
+ ## FAQ
353
+
354
+ ### Does `npx scalemax` install anything permanently?
355
+
356
+ `npx` downloads and runs the CLI package. The CLI itself writes ScaleMax configuration only after you choose to configure clients.
357
+
358
+ ### Can I use it without global install?
359
+
360
+ Yes. Use:
361
+
362
+ ```bash
363
+ npx scalemax@latest
364
+ ```
365
+
366
+ ### Can I use a different API key later?
367
+
368
+ Yes. Run:
369
+
370
+ ```bash
371
+ scalemax login
372
+ ```
373
+
374
+ or rerun the installer and choose `Replace with a new key`.
375
+
376
+ ### Does it support Windows?
377
+
378
+ Yes. The CLI uses Windows-aware config paths and writes `%APPDATA%\scalemax\config.json` for ScaleMax key storage.
379
+
380
+ ### What endpoint does it configure?
381
+
382
+ API-credit keys use `https://api.scalemax.pro/v1` for OpenAI-compatible clients and `https://api.scalemax.pro` for Anthropic-compatible clients. Token-pack keys use `https://api.scalemax.pro/token/v1` and `https://api.scalemax.pro/token` respectively. The CLI detects the key type and configures the correct surface automatically; the two key types are intentionally not interchangeable.