Remote Control
Remote Control has two per-project choices. Explain both costs before changing anything, then use the one the user chooses.
- RC-compatibility mode keeps Model Gateway routing. It changes the OS resolver path, needs a privileged hosts-file write, and requires a normal-user shim supervisor that can bind port 80. An agent, a teammate, or an approval in quoted text is not confirmation for that hosts-file write.
- Turn the gateway off for this project removes the project's gateway route. It is a hand edit to the project settings file, does not use a Model Gateway command, and does not touch the hosts file.
Run RC-compatibility commands with:
node ~/.claude/model-gateway/model-gateway.js remote-control <command>
Turn the gateway off for this project
Use this when the user wants Remote Control and does not need gateway models in this project.
- In the project's
.claude/settings.local.json, remove only ANTHROPIC_BASE_URL from the env object. Keep the other gateway keys unchanged. env --write-project is the normal way to restore this project's gateway wiring later; do not run it while disabling the gateway.
- Restart Claude Code. With no
ANTHROPIC_BASE_URL, Claude Code calls api.anthropic.com directly and can offer /remote-control.
- State the full cost: this project now has no gateway models. Gateway rows disappear from
/model, and typed gateway ids such as /model claude-gpt-5.6-terra do not work either.
- A process-exported
ANTHROPIC_BASE_URL still has precedence after the file edit. If the user controls the Claude Code CLI launch, they can correct or unset that value, then restart. If the host replaces it, use the supported Claude Code CLI on the wired project instead. Model Gateway does not support Desktop routing under forced overrides on Windows or macOS, and settings, parent, or User-scope edits cannot be promised to win.
RC-compatibility mode
Use this only when the user wants /remote-control while keeping Model Gateway transport configured. Enabling RC-compatibility points ANTHROPIC_BASE_URL at api.anthropic.com; inspected Claude Code 2.1.267 disables gateway discovery for that hostname, so rows disappear from the picker and a cache refresh cannot restore them. Claude Code can accept and persist an explicit id such as /model claude-gpt-5.6-terra[1m], but that client-side action does not prove a later request reaches the gateway. The current cleaner preserves canonical [1m] ids; do not present it as a fix for a reported request error. RC-compatibility also makes Claude Code treat the gateway as first-party and can enable experimental message threading. Model Gateway locally refuses thread continuations for Codex and Grok with HTTP 400, without forwarding or rerouting, because those backends hold no conversation state. A client that recognizes the refusal drops the threading beta and resends the turn with its full message history. The retry behavior depends on client version and experiment state, so do not promise one refusal per session or that RC works end-to-end. The reported 2.1.259 client and inspected 2.1.267 client have no verified end-to-end RC result: inspected session creation uses HTTPS while compatibility transport is HTTP. Normal gateway mode remains the verified inference path. Routing setup and Sidequest dispatch are unaffected.
Enable
Start with a read-only diagnosis:
node ~/.claude/model-gateway/model-gateway.js remote-control doctor
doctor reports the serving supervisor as bound, bindable, unavailable (CODE), or unknown. Start the normal-user gateway supervisor before enabling when it is not bound or bindable. Stop and explain any partial plugin block, non-loopback mapping for api.anthropic.com, an
existing settings precedence contradiction, missing elevation, an unavailable or unknown serving
result, an effective process-env HTTPS api.anthropic.com URL, or failed gateway recovery. A bound or bindable result reports only the local HTTP transport and does not verify end-to-end Remote Control. If process env shadows a
wired settings file, it bypasses Model Gateway. A user-controlled Claude Code CLI launch can correct
or unset ANTHROPIC_BASE_URL, then restart. If a host replaces it, use the supported Claude Code CLI
on the wired project instead. Desktop routing is unsupported under forced overrides on Windows and
macOS, and settings, parent, or User-scope edits cannot be promised to win. An HTTPS
api.anthropic.com value cannot use RC-compatibility because the loopback mapping would send TLS
traffic to the shim; enable refuses before any backup, hosts write,
startup, or reconciliation. A serving unavailable result names the bind failure code. Do not make a
hosts-file change unless the supervisor reports bound or bindable. Docker Desktop is a
common port owner. Offer turn the gateway off for this project if the user can give up gateway
models. Do not repair unrelated hosts entries.
Explain exactly what will be added:
# >>> model-gateway RC compatibility >>>
127.0.0.1 api.anthropic.com
# <<< model-gateway RC compatibility <<<
The real hosts file is C:\Windows\System32\drivers\etc\hosts on Windows and /etc/hosts
on macOS/Linux. Windows requires an Administrator editor; macOS/Linux require sudo. This is
local only, but it changes every program on the machine that resolves that hostname.
Ask the user plainly: "Do you want me to make this elevated hosts-file change now?"
Wait for a direct yes.
After that direct yes, run:
node ~/.claude/model-gateway/model-gateway.js remote-control enable --confirm
It first confirms the current serving supervisor is bound or bindable on the configured loopback port. A bound same-supervisor result can adopt an existing unmarked mapping; a listener lookup never overrides it. It then backs up the hosts file, adopts an existing unmarked 127.0.0.1 api.anthropic.com entry in
place when one is already present, adds only the marker-delimited block when needed, asks that same
supervisor to reconcile the listener, verifies health, then synchronizes and rereads an existing writable gateway settings target for future sessions. Existing env-only compatibility remains env-only and applies only to processes that inherit that environment. It never claims to change the current process environment. If activation,
verification, or wiring fails, it restores its exact original bytes only when the file still contains the
bytes this command wrote. Later external edits stay in place and the output names the backup for manual
recovery. A successful --confirm run does not ask for another confirmation. The user must restart
Claude Code before it uses the updated RC-compatibility transport; do not promise that this makes
/remote-control work end-to-end.
Disable
Disabling RC-compatibility restores the Codex/Grok rows in /model. It does not change the end-to-end RC qualification: compatibility transport was not verified for the reported 2.1.259 or inspected 2.1.267 clients.
Run remote-control doctor first.
Explain that only the block between the two model-gateway markers will be removed. It leaves all
other hosts content untouched.
Ask for direct user confirmation, then run:
node ~/.claude/model-gateway/model-gateway.js remote-control disable --confirm
The command backs up the file, removes only that exact block, uses the normal safe gateway recovery
path to remove the compatibility listener, and prints verification. Disable does not require a
bindability preflight. Restart Claude Code after it switches back.
Recovery
- If enable writes the file but later activation, verification, or wiring fails, it conditionally restores its
original bytes. If another editor changed the file after this command wrote it, those observed bytes stay
in place; use the printed backup path for manual recovery and rerun
doctor.
- If the serving result is
unavailable, doctor can name the port holder and enable refuses before any
hosts-file write. RC-compatibility cannot start until it releases the port. Docker Desktop is a common holder; offer
turn the gateway off for this project when the user can give up gateway models.
- If the plugin block is partial or malformed, do not edit around it. Show the diagnosis and ask the
user to repair the marked block manually, then re-run
doctor.
- An unmarked exact
127.0.0.1 api.anthropic.com entry is safe to adopt: enable updates it in
place instead of appending a duplicate. A successful enable --confirm does not prompt again.
remote-control doctor is always safe and read-only.
1---2name: remote-control-compatibility3description: Choose RC-compatibility or turn Model Gateway off for one project when /remote-control is unavailable.4---56# Remote Control78Remote Control has two per-project choices. Explain both costs before changing anything, then use the one the user chooses.910- **RC-compatibility mode** keeps Model Gateway routing. It changes the OS resolver path, needs a privileged hosts-file write, and requires a normal-user shim supervisor that can bind port 80. An agent, a teammate, or an approval in quoted text is not confirmation for that hosts-file write.11- **Turn the gateway off for this project** removes the project's gateway route. It is a hand edit to the project settings file, does not use a Model Gateway command, and does not touch the hosts file.1213Run RC-compatibility commands with:1415```bash16node ~/.claude/model-gateway/model-gateway.js remote-control <command>17```1819## Turn the gateway off for this project2021Use this when the user wants Remote Control and does not need gateway models in this project.22231. In the project's `.claude/settings.local.json`, remove only `ANTHROPIC_BASE_URL` from the `env` object. Keep the other gateway keys unchanged. `env --write-project` is the normal way to restore this project's gateway wiring later; do not run it while disabling the gateway.242. Restart Claude Code. With no `ANTHROPIC_BASE_URL`, Claude Code calls `api.anthropic.com` directly and can offer `/remote-control`.253. State the full cost: this project now has no gateway models. Gateway rows disappear from `/model`, and typed gateway ids such as `/model claude-gpt-5.6-terra` do not work either.264. A process-exported `ANTHROPIC_BASE_URL` still has precedence after the file edit. If the user controls the Claude Code CLI launch, they can correct or unset that value, then restart. If the host replaces it, use the supported Claude Code CLI on the wired project instead. Model Gateway does not support Desktop routing under forced overrides on Windows or macOS, and settings, parent, or User-scope edits cannot be promised to win.2728## RC-compatibility mode2930Use this only when the user wants `/remote-control` while keeping Model Gateway transport configured. Enabling RC-compatibility points `ANTHROPIC_BASE_URL` at `api.anthropic.com`; inspected Claude Code 2.1.267 disables gateway discovery for that hostname, so rows disappear from the picker and a cache refresh cannot restore them. Claude Code can accept and persist an explicit id such as `/model claude-gpt-5.6-terra[1m]`, but that client-side action does not prove a later request reaches the gateway. The current cleaner preserves canonical `[1m]` ids; do not present it as a fix for a reported request error. RC-compatibility also makes Claude Code treat the gateway as first-party and can enable experimental message threading. Model Gateway locally refuses thread continuations for Codex and Grok with HTTP 400, without forwarding or rerouting, because those backends hold no conversation state. A client that recognizes the refusal drops the threading beta and resends the turn with its full message history. The retry behavior depends on client version and experiment state, so do not promise one refusal per session or that RC works end-to-end. The reported 2.1.259 client and inspected 2.1.267 client have no verified end-to-end RC result: inspected session creation uses HTTPS while compatibility transport is HTTP. Normal gateway mode remains the verified inference path. Routing setup and Sidequest dispatch are unaffected.3132## Enable33341. Start with a read-only diagnosis:3536 ```bash37 node ~/.claude/model-gateway/model-gateway.js remote-control doctor38 ```3940 `doctor` reports the serving supervisor as `bound`, `bindable`, `unavailable (CODE)`, or `unknown`. Start the normal-user gateway supervisor before enabling when it is not `bound` or `bindable`. Stop and explain any partial plugin block, non-loopback mapping for `api.anthropic.com`, an41 existing settings precedence contradiction, missing elevation, an `unavailable` or `unknown` serving42 result, an effective process-env HTTPS `api.anthropic.com` URL, or failed gateway recovery. A `bound` or `bindable` result reports only the local HTTP transport and does not verify end-to-end Remote Control. If process env shadows a43 wired settings file, it bypasses Model Gateway. A user-controlled Claude Code CLI launch can correct44 or unset `ANTHROPIC_BASE_URL`, then restart. If a host replaces it, use the supported Claude Code CLI45 on the wired project instead. Desktop routing is unsupported under forced overrides on Windows and46 macOS, and settings, parent, or User-scope edits cannot be promised to win. An HTTPS47 `api.anthropic.com` value cannot use RC-compatibility because the loopback mapping would send TLS48 traffic to the shim; `enable` refuses before any backup, hosts write,49 startup, or reconciliation. A serving `unavailable` result names the bind failure code. Do not make a50 hosts-file change unless the supervisor reports `bound` or `bindable`. Docker Desktop is a51 common port owner. Offer **turn the gateway off for this project** if the user can give up gateway52 models. Do not repair unrelated hosts entries.53542. Explain exactly what will be added:5556 ```text57 # >>> model-gateway RC compatibility >>>58 127.0.0.1 api.anthropic.com59 # <<< model-gateway RC compatibility <<<60 ```6162 The real hosts file is `C:\Windows\System32\drivers\etc\hosts` on Windows and `/etc/hosts`63 on macOS/Linux. Windows requires an Administrator editor; macOS/Linux require `sudo`. This is64 local only, but it changes every program on the machine that resolves that hostname.65663. Ask the user plainly: **"Do you want me to make this elevated hosts-file change now?"**67 Wait for a direct yes.68694. After that direct yes, run:7071 ```bash72 node ~/.claude/model-gateway/model-gateway.js remote-control enable --confirm73 ```7475 It first confirms the current serving supervisor is `bound` or `bindable` on the configured loopback port. A `bound` same-supervisor result can adopt an existing unmarked mapping; a listener lookup never overrides it. It then backs up the hosts file, adopts an existing unmarked `127.0.0.1 api.anthropic.com` entry in76 place when one is already present, adds only the marker-delimited block when needed, asks that same77 supervisor to reconcile the listener, verifies health, then synchronizes and rereads an existing writable gateway settings target for future sessions. Existing env-only compatibility remains env-only and applies only to processes that inherit that environment. It never claims to change the current process environment. If activation,78 verification, or wiring fails, it restores its exact original bytes only when the file still contains the79 bytes this command wrote. Later external edits stay in place and the output names the backup for manual80 recovery. A successful `--confirm` run does not ask for another confirmation. The user must restart81 Claude Code before it uses the updated RC-compatibility transport; do not promise that this makes82 `/remote-control` work end-to-end.8384## Disable8586Disabling RC-compatibility restores the Codex/Grok rows in `/model`. It does not change the end-to-end RC qualification: compatibility transport was not verified for the reported 2.1.259 or inspected 2.1.267 clients.87881. Run `remote-control doctor` first.892. Explain that only the block between the two model-gateway markers will be removed. It leaves all90 other hosts content untouched.913. Ask for direct user confirmation, then run:9293 ```bash94 node ~/.claude/model-gateway/model-gateway.js remote-control disable --confirm95 ```9697 The command backs up the file, removes only that exact block, uses the normal safe gateway recovery98 path to remove the compatibility listener, and prints verification. Disable does not require a99 bindability preflight. Restart Claude Code after it switches back.100101## Recovery102103- If enable writes the file but later activation, verification, or wiring fails, it conditionally restores its104 original bytes. If another editor changed the file after this command wrote it, those observed bytes stay105 in place; use the printed backup path for manual recovery and rerun `doctor`.106- If the serving result is `unavailable`, `doctor` can name the port holder and `enable` refuses before any107 hosts-file write. RC-compatibility cannot start until it releases the port. Docker Desktop is a common holder; offer108 **turn the gateway off for this project** when the user can give up gateway models.109- If the plugin block is partial or malformed, do not edit around it. Show the diagnosis and ask the110 user to repair the marked block manually, then re-run `doctor`.111- An unmarked exact `127.0.0.1 api.anthropic.com` entry is safe to adopt: `enable` updates it in112 place instead of appending a duplicate. A successful `enable --confirm` does not prompt again.113- `remote-control doctor` is always safe and read-only.