b3iq CLI
Install the b3iq CLI to manage your machines, models, runtimes, logs, and SSH access from the terminal or a script.
The b3iq CLI manages your machines, models, runtimes, and SSH access from a
terminal or a script: the same account and endpoints as the HTTP APIs, wrapped
in commands built for humans and agents alike.
b3iq is the account-level CLI covered on this page. It talks to the
control plane and manages your whole fleet remotely. It's a different tool
from b3iq-host, the local daemon CLI that runs on a machine itself; see
CLI Commands for that one.
Install
bashpnpm add --global @b3labs/b3iq-cli
Requires Node 22.23.4 or newer on 22.x, 24.22.1 or newer on 24.x, or any release from 25 on. The package ships a compiled executable; no B3IQ source checkout or build toolchain is required.
The first public release of @b3labs/b3iq-cli
is 0.1.0, and it contains every command on this page. Check your
installation with b3iq --version.
This page covers setup, client compatibility limits, skills, media and rollback. Desktop setups are experimental on macOS. Anthropic does not officially support non-Claude gateway models.
Owned models in coding clients
Prepare the serving context
models context needs a host/inference release that supports
model.context.configure. It uses your machine-management key (b3iq login,
or a Machines & SSH key in B3IQ_TOKEN); an Inference API key cannot call it.
bashb3iq models context 'YOUR_INSTALLED_MODEL' --machine 'YOUR_MACHINE' --json
For installed Ollama text models, this preserves an explicit operator window or selects up to 131,072 tokens within the model maximum. It requires known hardware capacity and tool support, checks runtime safety limits, allocates the window, verifies it through Ollama /api/ps, then saves it. Automatic setup needs at least 32,768 tokens; Claude Code needs 100,000. Other backends are refused until their allocation can be verified.
Use --tokens <count> to change an existing choice. The result includes
previous_override_tokens: restore a nonzero value with --tokens, or use
--reset for zero. Reset clears context while retaining other override metadata.
--no-wait returns a command ID for commands get <id> --machine <id> --json.
Allocation changes the model's RAM/VRAM budget and can evict idle Ollama models.
Run it when B3IQ chat traffic is idle. A failed verification or save leaves the
prior configuration effective; the attempted allocation can remain in memory.
Wait for inference models --machine <id> to report the verified window before
launching the client. Setup does not run models context for you. If the
personal machine list does not include the machine, the CLI says so and does not
offer models context as the next command. B3IQ_ORG_ID does not widen a
personal token to organization machines; b3iq login with the organization chosen in the browser does. An administrator who already manages
the machine can grant personal owner access on the staff Owners tab. A missing
match is not proof that grant is what you need, and it is not proof the id
does not exist.
On October 16, 2026, Codex Desktop setup for qwen3.8:27b-bf16 on
b3iq_a81534a5128404d7 stopped at a generic 32K refusal. Discovery had reported
a 4096-token window, image input, and tool calling. models context then said
No machine matches that id. The machine was organization-owned and absent from
the personal list. After a personal owner grant, the same context command
completed with verified: true and context_window_tokens: 131072. The CLI
prints the check it made and the next command for both failures.
Launch the client
Customers use a distributed CLI package and a dashboard API key. They do not need the private B3IQ repository or a source build. Install the current release:
bashpnpm add --global @b3labs/b3iq-clib3iq --versionb3iq --help
Create an API key at Dashboard → Keys → API keys
and supply it as B3IQ_GATEWAY_API_KEY through your secret manager. This key is
separate from the key machine-management commands use (b3iq login, or a
Machines & SSH key in B3IQ_TOKEN).
Do not put it in command arguments or committed settings.
bashb3iq inference modelscd '/path/to/your/project'b3iq inference codex --model 'YOUR_SERVED_MODEL_ID'b3iq inference claude --model 'YOUR_SERVED_MODEL_ID'b3iq inference opencode --model 'YOUR_SERVED_MODEL_ID'
Use the exact text-model ID returned by discovery. The gateway and serving host
must support the native-client endpoints and verified context/tool metadata; CLI
installation does not update them. These launchers configure terminal sessions.
Plain codex or claude continues using existing settings.
For one-time native activation, b3iq inference setup codex --model ... registers
an opt-in CLI profile and reports codex --profile b3iq-.... Claude setup reports
a native command with session-only settings, MCP and skill flags. Neither changes
normal user settings. These terminal setups do not add optional B3IQ entries to
the Codex or Claude desktop model menus. Do not merge the generated model/provider
settings into global configuration; that would change normal defaults.
The saved file ~/.b3iq/gateway-key contains the same key created at
Dashboard → Keys → API keys; it is not a separate key.
If the key is not already in your environment, run this block in your own macOS
zsh terminal, then paste the key at the hidden prompt and press Return:
zsh{ read -rs 'b3iq_api_key?Paste your B3IQ API key: ' printf '\n' printf '%s' "$b3iq_api_key" | b3iq inference key-save unset b3iq_api_key}
The CLI creates the directory and saves the key with mode 0600; it does not
change client defaults. B3IQ_GATEWAY_API_KEY takes precedence over the saved file
when set. Verify discovery with b3iq inference models, adding
--machine YOUR_PERMITTED_NODE_ID to pin that request.
Desktop deployment prerequisites
Wait for the updated control-plane and public gateway deployments before setup.
The Codex approval fix also requires the matching host and inference plugin
release on the serving machine. Merging source does not publish those binaries
or the npm package. Install a compiled CLI build containing the desktop commands
below and save the dashboard API key with b3iq inference key-save.
Desktop setup does not update the serving machine.
Codex's --activate opens a separate B3IQ instance. Claude's --activate saves
its provider choice and asks you to reopen Claude; open -a Claude does that on
macOS. Omitting --activate saves the setup without switching either app.
Codex desktop: preserve normal defaults while B3IQ runs
On macOS, save a separate B3IQ desktop launcher after saving the API key:
bashb3iq inference setup codex --desktop --install \ --model 'YOUR_SERVED_MODEL_ID' \ --machine YOUR_PERMITTED_NODE_ID
The receipt's activation_command opens the separate instance. On later starts,
double-click desktop_setup.installed_launcher in Finder; it is saved under
~/Applications. Add --activate to the setup command to open it immediately.
Your normal desktop and plain codex keep their defaults while B3IQ is active.
The separate instance has its own settings and history. Select your local project
and the B3IQ · model ID entry there. Filesystem tools run on your computer.
Without --install, the shortcut stays in the private generated directory.
The instance uses workspace-write sandboxing and on-request approvals. It does
not copy normal account tokens, trusted projects, MCP settings, plugins or
approval rules. Keep its config and state separate from your normal Codex home.
The saved API key supplies inference and media credentials.
This integration is experimental. It uses separate engine and desktop data
paths exposed by the installed macOS app; the launcher checks for those settings
before opening it. Engine discovery and file-tool checks passed on desktop
26.1002.52244 / engine 0.162.0-alpha.2. One user-operated GUI mock test completed
onboarding, model selection and an exact-content local file write. Live Qwen,
real-key GUI inference and repeated GUI cold starts remain unqualified.
The normal desktop picker does not gain a B3IQ entry. For an app installed outside
/Applications/ChatGPT.app or /Applications/Codex.app, add
--desktop-app '/absolute/path/to/Codex.app'.
Keep the installed CLI and generated directories in place. Setup refuses to replace user-edited files. To remove it, close the B3IQ instance and remove only its reported shortcut and generated directory after saving needed conversations. There is no normal-default restoration step and no local proxy to run.
Claude desktop: save, activate and restore
The experimental desktop integration requires the updated control-plane and frontend gateway deployments plus the compiled CLI containing these commands. In our Desktop 2.37337.1 test, discovery rejected the real Qwen ID and accepted an opaque routing alias. The dedicated endpoint uses that alias with an explicit B3IQ · real model ID label; normal API clients keep the real served model ID. Requests handled by this endpoint route to the selected owned model, with no Anthropic inference fallback. This does not describe all background app traffic or guarantee compatibility with other Desktop versions. Anthropic does not support non-Claude gateway models. The tested desktop surface is Code with local tools; Cowork and automatic large-context compaction are not qualified.
Save the API key using the stdin recipe above. On macOS, open Help → Troubleshooting → Enable Developer Mode, then Developer → Configure Third-Party Inference once to initialize the library. Quit Claude, then run:
bashb3iq inference setup claude --desktop --install \ --model 'qwen3-coder-next:q8_0' --machine YOUR_PERMITTED_NODE_ID
Replace the placeholder with your full permitted machine ID. Setup fills the
model-specific endpoint, helper executable/arguments, machine header and model
entry. It saves a separate inactive configuration and preserves normal defaults.
Omit --install to export JSON only. The receipt's desktop_setup.ui_fields
contains exact values, including helper arguments as a copyable JSON array.
No API key is printed or embedded. Desktop setup and its --saved credential helper both use the saved key file, so a different terminal environment key cannot qualify the connection. Managed preferences can override local
configuration; automatic activation refuses managed devices.
Reopen the configuration window and select the reported name in the top-right saved-configuration dropdown beside Export, initially labelled Default. Keep Provider set to Gateway. Test script, model discovery and inference before use. Do not click Apply Changes when only inspecting the inactive entry.
To activate explicitly, quit Claude and run:
bashb3iq inference setup claude --desktop --install --activate \ --model 'qwen3-coder-next:q8_0' --machine YOUR_PERMITTED_NODE_ID
Reopen Claude normally, select your local project in Code, and confirm the B3IQ-labelled model. The provider selection persists; no launch command is needed on subsequent starts. This switches the desktop provider rather than adding Qwen beside subscription models. Local files remain local; the GPU host serves inference. To restore the provider recorded before activation, quit Claude and run:
bashb3iq inference restore claude --desktop
Restoration works offline, preserves new saved entries and unrelated preferences, and handles an empty original Default configuration. It refuses to overwrite a later user-selected configuration or a changed original entry. Manual Apply Changes does not create the CLI's recovery journal. Use explicit CLI activation when you want CLI-managed restoration.
| Connection field | Generated value |
|---|---|
| Provider / credential kind / auth scheme | Gateway / Helper script / Bearer |
| Gateway base URL | Model-specific URL, https://b3iq.org/v1/claude-desktop/<encoded-model>; copy the exact generated value |
| Helper script | Absolute Node executable from the installed CLI's receipt |
| Helper script arguments | Absolute installed CLI entrypoint, inference, credential, --saved, as separate entries |
| Custom inference headers | x-b3iq-node-id → your full permitted machine ID |
| Models | Generated alias and B3IQ/real-model label; 1M disabled, effort capped to low |
| Gateway API key / artifact preview iframe origin | Leave blank |
| Stream idle timeout | Default 300 seconds |
Claude appends /v1/models, /v1/messages and /v1/messages/count_tokens to the
base URL. The helper supplies the saved key through a private pipe; never run
b3iq inference credential in a captured terminal. Exports contain helper paths
and the machine routing ID. Claude's sensitive-values warning includes that
header; a manually entered static key would also appear in an export.
The model must be serving text/tool calling with at least 100K configured context; the tested Qwen profile uses 131,072. Output is capped at 8,192. The catalog reports the served window, but Code may still display 200K. Token counting returns a conservative byte-based estimate including tools, not exact tokenizer usage. Actual response usage is unchanged. Compact early on long conversations; automatic compaction at the served boundary needs desktop acceptance.
Setup refuses an incompatible gateway before saving. For a 404, verify the exact machine ID, key node scope and serving metadata; a typo can fail with a valid key. Anthropic's configuration reference and model guide explain provider settings and labels. The sections below cover installation and rollback without requiring a source checkout.
OpenCode setup defaults to major version 2; use --client-version 1 for a version
1 client. For OpenCode desktop, save the API key privately and explicitly
install persistent settings:
bashprintf '%s' "$B3IQ_GATEWAY_API_KEY" | b3iq inference key-saveb3iq inference setup opencode --desktop --install --model 'YOUR_SERVED_MODEL_ID'
This merges B3IQ provider/media MCP settings into OpenCode's global JSON/JSONC
configuration and reports a private backup when a config already exists. It
preserves default models, built-in agent settings, other providers and permissions. Restart the app and its background
server if necessary, open your own project, and choose B3IQ's exact model ID.
The saved key works without a terminal environment. OpenCode's native instruction
and skill discovery remains available, including ~/.agents/skills and project
skills. The packaged guide covers versions, overrides and rollback. GUI selection
and real-model behavior require separate live verification.
Sign in
Run b3iq login
With no arguments, login starts a browser device flow: the terminal
prints a short code and opens your browser to approve it.
Approve the code in the dashboard
Confirm the code matches what your terminal shows, choose your personal
account or one of your organizations, then approve. The CLI
polls in the background and saves the credential to ~/.b3iq/config.json
(mode 0600) once you approve: an API key for your personal account, or
one bound to the organization you chose. Either key expires after 90 days,
and every command warns in the last 14. Run b3iq login again to renew it.
Non-interactive / CI login
Set B3IQ_TOKEN in the environment, which skips the browser flow entirely,
or save a key from a pipe with b3iq login --token-stdin < key.txt. A key
given as a command-line argument is refused: it would land in shell history.
For a script or CI job, create an API key with Machines & SSH access at
Dashboard → Keys → API keys.
A CLI from before API key logins is refused on the approval page, which tells
you to update it (npm i -g @b3labs/b3iq-cli) and run b3iq login again. A
CLI token (b3iq_pat_) saved by such a CLI stopped working when CLI tokens were
retired: commands fail with token_retired, and b3iq login replaces it.
Sign in for an organization
A personal login sees your own machines only. To manage and SSH to the machines
an organization owns, run b3iq login as usual and pick the organization on the
approval page. The page lists your personal account and every organization where
your role can manage machines, the same organizations as the dashboard's
switcher.
bashb3iq login # choose the account in the browserb3iq whoami # your account, and the organization the key is bound tob3iq machines list # that organization's machines
Choosing an organization saves an API key bound to it, acting as you. The key:
- reaches that one organization. Setting
B3IQ_ORG_IDto another one is refused. - can do what your role in the organization allows on its machines (view, manage, SSH, and adding your own SSH key to a machine) and nothing else: no account settings, API keys or billing.
- is checked against your membership on every request, and stops working when you leave the organization or an admin removes you.
- expires after 90 days. Run
b3iq loginagain to renew it. - is listed on the organization's API keys page.
b3iq logout --revokeends it from the CLI, and a member who can manage the organization's keys can revoke it on that page.
b3iq models list without --machine and b3iq logs read your personal
account, so they need a personal login. With an organization login,
b3iq status shows the organization's machines without the model summary.
To switch back to your own machines, run b3iq login again and keep the
personal account.
b3iq logout forgets the saved token; b3iq logout --revoke also revokes it
server-side. It revokes the saved login, even when B3IQ_TOKEN is set. Every key
a personal login saves is listed on your personal account's
Keys → API keys page as
b3iq CLI on <hostname>, where you can revoke any of them individually.
Command reference
| Command | Purpose |
|---|---|
| b3iq login [--token-stdin] | Sign in via the browser device flow, or non-interactively with an API key piped to --token-stdin or set as B3IQ_TOKEN |
| b3iq logout [--revoke] | Forget the saved token; --revoke also revokes it server-side |
| b3iq whoami | Show the signed-in account, and the organization an org login is bound to |
| b3iq status | Fleet overview: machines online and servable models |
| b3iq machines list [--quiet] | List your machines (--quiet ⇒ node ids only) |
| b3iq machines get <machine> | One machine's detail |
| b3iq models list [--machine <m>] | Servable models fleet-wide, or one machine's full install catalog with --machine |
| b3iq models install <model> --machine <m> [--no-wait] | Install a model onto a machine |
| b3iq models remove <model> --machine <m> [--no-wait] | Uninstall a model from a machine (also accepts: uninstall) |
| b3iq runtimes list [--machine <m>] | Engines a machine runs, with endpoint and whether it self-heals if it crashes |
| b3iq runtimes restart <runtime> --machine <m> [--no-wait] | Restart one runtime on a machine |
| b3iq logs [--limit N] [--follow] | Recent inference requests (default 50, max 200; --follow tails new ones) |
| b3iq ssh [<machine>] [-- cmd] | Open an SSH session or run one remote command from a terminal, straight to the machine when it answers and over the tunnel otherwise; print the ssh invocation when piped |
| b3iq forward <machine> <port>… | Forward local ports to the machine over SSH; the ports stay open and the connection comes back after a drop. Ctrl-C to stop |
| b3iq ssh-keys local | The SSH public keys on this computer (~/.ssh/*.pub and ssh-agent), with fingerprints |
| b3iq ssh-keys list [--machine <m>] | Your SSH keys and where each is installed; with a machine, every key it installs |
| b3iq ssh-keys add [--key <file.pub|fingerprint>] [--machine <m>] [--no-wait] [--enable-ssh] | Add one of your public keys, wait until the machine has it, and print the b3iq ssh command |
| b3iq ssh enable|disable <machine> | Turn the machine's SSH hostname on or off |
| b3iq cp <src> <machine>:<dst> | Copy a file or directory to a machine (or back, with <machine>:<src> <dst>) over several SSH lanes at once; resumable, every chunk sha256-checked on the destination after fsync |
| b3iq config [default-machine <id>] | View config, or set the default machine used when a machine argument is omitted |
| b3iq doctor | Check auth, API reachability, and cloudflared |
models install, models remove, and runtimes restart wait for the change
to finish by default. Model installs get up to 45 minutes since a download
can run to many GB. Pass --no-wait to get the command ID back immediately.
A timed-out wait does not cancel the queued operation, so check its state
with commands get before retrying.
A machine boots with monitoring only. Models and runtimes belong to the
inference plugin, so models list --machine and runtimes list are empty
until it is installed.
Plugins, commands and qualification
Install or remove plugins, read a machine's command history, and re-run its hardware qualification. The machine dashboard shows the same provisioning and command progress.
| Command | Purpose |
|---|---|
| b3iq machines qualify <machine> [--no-wait] | Re-run hardware qualification |
| b3iq machines guests <machine> [--quiet] | A KVM host's guests and cards: every guest for its owner, your own guest on one you rent |
| b3iq plugins list [--machine <m>] | List available or installed plugins |
| b3iq plugins install <plugin> --machine <m> [--no-wait] | Install a plugin |
| b3iq plugins remove <plugin> --machine <m> [--no-wait] | Remove a plugin and what it installed |
| b3iq commands list --machine <m> [--limit N] | List recent commands |
| b3iq commands get <command-id> --machine <m> | Read command status, progress, and result |
Output contract
- stdout is data, stderr is logs. Parse stdout and ignore (or surface) stderr. Progress lines, spinners, and hints never touch stdout.
- JSON is automatic when piped. If stdout isn't a TTY, every command emits
JSON.
--jsonforces it anywhere;--prettyforces the human-readable table even when piped (the two flags can't combine).--quiet(-q) prints only ids, one per line, regardless of JSON mode: built forfor id in $(b3iq machines list --quiet)loops. - Exit codes are stable. Branch on them, not on message text:
| Exit code | Reason |
|---|---|
| 0 | ok |
| 1 | usage: bad arguments, or an ambiguous/missing machine selector |
| 2 | api: the request reached the API and failed |
| 3 | auth: not logged in, or the token was rejected |
| 4 | rate-limited |
Machine selectors
Any <machine> argument accepts a node id, an id prefix, or a case-insensitive
substring of the machine's name. An exact id or name match always wins, so a
full id is never ambiguous; a substring that matches more than one machine
errors (exit 1) and lists the candidates.
Set a default so you can drop the argument entirely:
bashb3iq config default-machine <id>
Every command that resolves a machine falls back to the default when the
<machine> argument (or --machine) is omitted.
SSH access
bashb3iq ssh [<machine>] [-- cmd]
Opens a session without you ever writing an SSH config or a ProxyCommand.
Leave out the machine and, from a terminal, the CLI lists your machines and
rentals and asks which one (a default set with b3iq config default-machine
skips the question).
The CLI resolves the machine's SSH-lane hostname and connects through a
cloudflared-brokered tunnel as the b3iq user. Install cloudflared locally
first (brew install cloudflared, or check with b3iq doctor). A machine in
a B3IQ facility is reached through a jump host instead, which needs no
cloudflared.
The SSH lane has to be turned on for the machine first:
bashb3iq ssh enable my-box # or Turn on the SSH hostname on the machine's page; b3iq ssh disable turns it off
If it's off, b3iq ssh fails and names that command.
Add your SSH key
b3iq ssh logs in with one of your SSH keys, so the machine needs its public
half. b3iq ssh-keys puts it there from the terminal:
bashb3iq ssh-keys local # the public keys on this computerb3iq ssh-keys add --machine my-box # pick one; waits until my-box has itb3iq ssh-keys add --key ~/.ssh/id_ed25519.pub --machine my-box
ssh-keys local lists ~/.ssh/*.pub and the keys ssh-agent holds, with each
key's type, SHA256 fingerprint and comment. ssh-keys add asks which one to use
when there are several, or takes --key with a .pub file or a fingerprint. It
reads public keys only. Given the path of a private key, it uses the .pub file
next to it, and refuses if there isn't one.
With a personal login the key is added to your account, like Keys → SSH keys
in the dashboard, and every machine you own installs it. With an organization
login it's added to the machine you name. The command waits until the machine
reports the key installed (up to three minutes, --no-wait to skip), then prints
the b3iq ssh command to use. If the machine's SSH lane is off, it asks whether to
turn it on (--enable-ssh does so without asking).
b3iq ssh-keys list shows your keys and where each is installed. With
--machine, it shows every key that machine installs and marks yours.
Args after -- forward straight to ssh. From a terminal, a trailing
command runs on the machine and returns:
bashb3iq ssh my-box -- nvidia-smi
In --json mode or when stdout isn't a TTY, b3iq ssh prints the resolved
ssh invocation and runs nothing, the trailing command included. A script or
an agent runs the printed invocation itself:
bashb3iq ssh my-box --json -- nvidia-smi > ssh.jsonlog=$(mktemp)eval "ssh -E $log -o LogLevel=DEBUG1 -o ControlPath=none -o BatchMode=yes $(jq -r '.ssh_args | @sh' ssh.json)"rc=$?grep -Ev '^(debug|Authenticated to|Transferred|Bytes per second)' "$log" >&2if [ "$rc" = 255 ] && ! grep -q '^Authenticated to' "$log" && jq -e .fallback ssh.json >/dev/null; then eval "ssh -o BatchMode=yes $(jq -r '.fallback.ssh_args | @sh' ssh.json)" rc=$?firm -f "$log"(exit "$rc")
The block exits with the remote command's code, or 255 when ssh itself failed.
The JSON carries transport (cloudflared or bastion, or direct with
direct SSH on), hostname, user, ssh_args and fallback. The CLI picks
direct only when the machine's sshd answered a probe just now, and then
fallback holds the tunnel invocation to run only when the first run exits
255 before it logged in (its -E log, with ControlPath=none, has no
Authenticated to). A remote
command that exits 255, or a link that drops mid-command, must not be run
again over the tunnel. Otherwise fallback is null. BatchMode=yes makes ssh fail instead of
asking for a password.
On a KVM host you rent, each rental runs in its own virtual machine with every
GPU, and b3iq ssh opens yours: it logs in as the user your virtual machine
was created with (renter), and the JSON adds guest_id. The host is not in
b3iq machines list, because it stays its owner's; b3iq ssh and
b3iq machines guests find it among your rentals.
Direct SSH (early access)
Direct SSH is in early access: staff turn it on per account. An organization
login has it when the person who logged in does. With it on,
and when the machine reports an address where its sshd takes connections,
b3iq ssh tries that address first and connects straight to it as b3iq. If
nothing answers there within a few seconds, or the connection fails before you
are logged in, it says so and uses the tunnel instead. The direct path only
accepts a host key the machine itself reported, so an address that now belongs
to a different machine is refused rather than trusted. If the key at the address
is not one of those, the CLI says so and uses the tunnel.
A machine reports its addresses only while its host firewall allows SSH on its
public interface; b3iq-host-firewall keeps that closed by default, so most
sessions still go over the tunnel.
--tunnel skips the direct path. --direct uses only the direct path and
fails when the account doesn't have it, the machine has no address that
answers, or the key there is not one the machine reported.
An interactive shell that drops because the network went away reconnects; with
direct SSH on, it tries the direct address again first. It keeps trying for
about three minutes, waiting 1, 2 and 5 seconds and then every 10 seconds, and
says how long it has been trying and how long it will keep going: a machine's
tunnel can take a minute or more to come back after its network does. It stops
at once if the machine refuses your key or its host key does not match, since
waiting will not fix either. Ctrl-C during the wait stops it.
Logging out normally ends the command. A session that runs a remote command is
never re-run, and --no-reconnect turns reconnecting off. Ctrl-C that stops a
session (a port forward, say) ends b3iq ssh too. Typing ~. looks like the
server closing the connection, so a shell ended that way reconnects; use
exit or --no-reconnect. Passing -v, -E, -q, -y or -S to ssh turns off
the fallback and reconnecting for that run, since those hide or move the log
b3iq ssh reads to tell a failed login from a finished session. With no
fallback, that run also skips the direct path and uses the tunnel, unless you
pass --direct. For the same
reason it sets ControlPath=none, so a ControlMaster in your SSH config is
not reused.
A reconnect opens a new shell, so whatever ran in the old one is gone. To keep
it, pass --tmux: the shell runs in a tmux session on the machine
(tmux new -A -s b3iq, or --tmux=<name> for another session), and each
reconnect attaches to it again. Set B3IQ_SSH_TMUX=1 to use it for every
interactive shell; a run with a remote command, or without a terminal, ignores it. On a
machine without tmux you get a plain shell and a note saying so. If the machine
does not know your terminal type (Ghostty, kitty, WezTerm or Alacritty, for
example), tmux runs as xterm-256color instead of refusing to start.
If sessions keep dropping, --tunnel-log <file> (or B3IQ_SSH_TUNNEL_LOG) has
cloudflared write a debug log to that file. It shows why the tunnel connection
closed; send it to support with the time of the drop. Only sessions over the
Cloudflare Tunnel write it, and the CLI warns when a session may take another path.
Copying files
bashb3iq cp <src> <machine>:<dst> [--lanes N] [--direct|--tunnel] [--identity <key>] [--no-resume]b3iq cp <machine>:<src> <dst> [same options]
b3iq cp copies a file or a directory to or from a machine, on the same paths
as b3iq ssh. It follows cp -r: into an existing directory under the
source's name, otherwise to the destination path itself. my-box: alone is the
home directory. Modes, modification times and symlinks are kept.
bashb3iq cp ./dataset my-box:/data/b3iq cp my-box:/data/ckpt.safetensors .
text› Copying 1 file (2.00 GiB) to my-box over the Cloudflare Tunnel, 8 lanes.↑ 1.21 GiB / 2.00 GiB 60% 41.8 MB/s 8 lanes 1/1 files ETA 20 s✓ Copied 1 file, 2.00 GiB in 51.3 s (41.9 MB/s). Verified chunk by chunk on the destination.
One SSH connection moves at most about 2 MiB per round trip, so scp,
sftp and rsync stop near 21 MB/s on a 75 ms link however fast the
network is. Several SSH connections side by side add up: about 142 MB/s with
8 straight to a machine. Through a Cloudflare Tunnel the machine's tunnel
sets the ceiling: about 70–80 MB/s on QUIC, cloudflared's default, and a
full 1 GbE port or more on HTTP/2. b3iq cp uses 8 lanes on every path;
--lanes (1–32) changes it.
- Checked. Every 8 MiB chunk is hashed with sha256 where it is read. A file is
written next to its destination as
.<name>.b3iq-part, re-read on the destination after fsync and compared chunk by chunk before it is renamed into place. - Resumable. Run the same command again after an interruption and it moves
only what is missing.
--no-resumestarts over. - Lanes reconnect. A lane that drops hands its chunks to the others and reconnects, trying the direct path and the tunnel again.
- On the machine each lane runs a small Python 3 helper through
ssh; nothing is installed. - Keys.
sshnever prompts. If your~/.ssh/configlimits the keys it offers for the machine (IdentitiesOnly), pass yours with--identity. - Output. Progress goes to stderr. The result (bytes, seconds, MB/s, lanes, path, sha256 for one file, anything that failed) is JSON on stdout when piped.
Port forwarding
bashb3iq forward <machine> <port>… [--direct|--tunnel]
b3iq forward makes ports on the machine reachable on your computer, and
keeps them that way when the connection drops. It runs until you press Ctrl-C.
bashb3iq forward my-box 8265 10001:127.0.0.1:10001
text› connecting to my-box (ssh-node-….b3iq.org) over the Cloudflare Tunnel as b3iq…✓ Connected. Forwarding 127.0.0.1:8265 → 127.0.0.1:8265 on the machine, 127.0.0.1:10001 → 127.0.0.1:10001 on the machine. Ctrl-C to stop.
Each port takes one of these forms. Both hosts default to 127.0.0.1, so a
forwarded port is not reachable from your network unless you give a bind
address. IPv6 addresses go in brackets.
| Form | Local | On the machine |
|---|---|---|
8265 | 127.0.0.1:8265 | 127.0.0.1:8265 |
10001:8265 | 127.0.0.1:10001 | 127.0.0.1:8265 |
10001:127.0.0.1:10001 | 127.0.0.1:10001 | 127.0.0.1:10001 |
0.0.0.0:10001:127.0.0.1:10001 | 0.0.0.0:10001 | 127.0.0.1:10001 |
It reaches the machine the way b3iq ssh does: straight to its address when
direct SSH is on for your account and the machine answers there, otherwise
over the tunnel (--direct and --tunnel force one). Unlike b3iq ssh, it
always sends keepalives and always reconnects, with or without direct SSH.
When the connection drops, b3iq forward says so and reconnects on the same
schedule as b3iq ssh: for about three minutes, 1, 2 and 5 seconds apart and
then every 10 seconds. The local ports stay open the whole time, and a
connection you open during the gap waits and goes through once the forward is
back. When it is back it prints Reconnected after 42 s. If it gives up, or
the machine refuses your key, it exits 255.
It checks what it can and tells you:
- A local port that is already taken, or that needs more privileges, is an error before it connects. Pick another local port.
- When nothing is listening on the machine's side, or the machine's sshd does
not allow forwarding, each failed connection prints a line naming the forward,
for example
A connection through 127.0.0.1:10001 → 127.0.0.1:10001 on the machine failed on the machine (connect failed: Connection refused).Forwarding carries on. - If ssh logs in but cannot set up a forward at all, it says why and stops without retrying.
Ctrl-C, or SIGTERM from a script or service manager, stops ssh and closes
the local ports. b3iq forward does not run on Windows yet; there,
b3iq ssh <machine> -- -N -L <local>:<host>:<remote> forwards without the
reconnecting.
Headless & agent use
The CLI is built to be driven by a script or an agent as easily as by a human. See the output contract above. A few recipes:
bashexport B3IQ_TOKEN=... # an API key with Machines & SSH access; no login step neededb3iq status --json | jq .machines_onlineb3iq machines list --quiet # node ids, one per linefor id in $(b3iq machines list --quiet); do b3iq machines get "$id" --json | jq '{id:.node.node_id, up:.liveness, state, serving}'doneb3iq models list --machine <id> --json # what a machine can serveb3iq runtimes list --machine <id> --json # its serving runtimesb3iq doctor --json # preflight: auth, API, cloudflared
machines get --json nests the node record, so the id is .node.node_id.
The rows of machines list --json carry node_id at the top level.
No command changes state as a side effect of reading. These change a machine:
models install, models remove, and runtimes restart. The development-only
plugin and qualification commands also change machine state. login, logout
and config manage local credentials/configuration; logout --revoke also
revokes the token server-side.
The CLI package ships an AGENTS.md with the full agent guide: setup, the
fields to read before trusting a machine, and the commands that block.
Config
| Env var | Purpose |
|---|---|
| B3IQ_TOKEN | An API key with Machines & SSH access, from Keys → API keys; skips the browser login flow entirely |
| B3IQ_API_URL | Overrides the control-plane base URL (defaults to https://control-plane.b3iq.org). It must be https, or http on localhost, 127.0.0.1 or [::1] |
| B3IQ_ORG_ID | Overrides the organization saved by an organization login. A personal key is refused with one (exit 3), and an org login's key with a different organization's id is refused too |
| B3IQ_CONFIG_DIR | Keeps the config, gateway key and saved files in this directory instead of ~/.b3iq |
| B3IQ_DASHBOARD_URL | Dashboard origin for the b3iq login approval link. Defaults to the dashboard of the control plane you sign in to (b3iq.org in production, dev.b3iq.org on preview), or, when B3IQ_API_URL is localhost, 127.0.0.1 or [::1], to the local dashboard pnpm dev:dashboard pairs with that port (worker 8787+10n, dashboard 5175+10n) |
Env vars always win over the saved config file (~/.b3iq/config.json, or config.json in B3IQ_CONFIG_DIR, mode
0600), which in turn wins over the built-in defaults.

