CLI reference
Reference for every openllm command and flag: client launchers, daemon control, provider sign-in, the MCP server, config keys, and environment variables.
openllm runs your AI clients through OpenLLM, manages the local daemon, and serves the OpenLLM MCP server. The short alias ollm runs the same binary. It runs on macOS and Linux.
Install it with the one-line installer. See Install for options.
curl -fsSL https://www.openllm.sh/install | bashEvery command accepts -h or --help.
Global flags
OpenLLM's own flags go before the client name. Everything after the client name is passed to the client unchanged, so openllm claude -d passes -d to Claude Code.
| Flag | What it does |
|---|---|
-d | Skip every approval prompt in the client (for example openllm -d claude) |
--new | Always start a fresh session |
--attach [id] | Attach to a running session, the best match or a specific id |
-p <prompt> | One-shot prompt; the reply goes to stdout. See One-shot prompt. |
-m <model> | Model for -p (default ultra) |
--json | Print the -p result as one JSON object |
-h, --help | Show help |
-v, --version | Print the CLI version |
Commands
| Command | What it does |
|---|---|
openllm claude | Run Claude Code through OpenLLM |
openllm codex | Run Codex through OpenLLM |
openllm grok | Run Grok Build through OpenLLM |
openllm hermes | Run Hermes through OpenLLM |
openllm opencode | Run OpenCode through OpenLLM |
openllm chatgpt | Install the OpenLLM ChatGPT Mac-app launcher |
openllm raycast | Apply OpenLLM to Raycast |
openllm -p | One-shot prompt |
openllm start | Start the daemon, with credential setup when needed |
openllm stop | Stop the daemon |
openllm restart | Restart the daemon |
openllm status | Show the daemon status |
openllm sessions | List, attach to, or kill local sessions |
openllm auto-update | Read or change daemon automatic updates |
openllm auth | Manage provider sign-ins on this machine |
openllm login | Save or replace your OpenLLM API key |
openllm config | Print the resolved configuration |
openllm mcp | Run the MCP server over stdio |
openllm exec | Run a hook utility |
openllm setup | Add openllm to your PATH and install completion |
openllm completion | Print or install shell completion |
openllm update | Update the daemon and the CLI |
openllm self-update | Update only the CLI binary |
openllm doctor | Diagnose the daemon and install state |
openllm uninstall | Remove the daemon and the CLI |
openllm api | Print the OpenAPI spec |
openllm version | Print the CLI version |
openllm help | Show help |
Clients
Session clients (claude, codex, grok, hermes, opencode) apply OpenLLM for one run and never modify the client's own config. The client must already be installed.
The CLI picks the gateway on every launch: your local daemon if it answers, otherwise the hosted gateway, which hands subscription models to one of your online devices. To force one, set OPENLLM_GATEWAY=local or OPENLLM_GATEWAY=cloud.
See Clients for setup guides.
openllm claude
openllm [-d] [--new|--attach [id]] claude [...args]Runs Claude Code through OpenLLM. Your ~/.claude config is never modified.
-dadds--dangerously-skip-permissions.- When Claude Code sessions are already running on this machine, the CLI offers them before starting a new one.
openllm claude --resumeopenllm codex
openllm [-d] [--new|--attach [id]] codex [...args]Runs Codex through OpenLLM. Your ~/.codex/config.toml is never modified.
-dadds--dangerously-bypass-approvals-and-sandbox.
openllm codexopenllm grok
openllm [-d] [--new|--attach [id]] grok [...args]Runs Grok Build through OpenLLM. Your ~/.grok config and auth.json are never modified.
-dadds--always-approve.
openllm -d grokopenllm hermes
openllm hermes [...args]
openllm hermes install | uninstall | statusRuns the Hermes TUI through OpenLLM.
installwrites a stickyopenllmprofile (for Hermes gateway and cron use) without touching your default config.uninstallrestores the previous sticky profile.statusreports whether the sticky profile is wired.--no-persistuses a one-run overlay and skips the sticky profile.-dadds--yolo.
openllm hermes -z "Summarize this repo"openllm opencode
openllm [--new|--attach [id]] opencode [...args]Runs OpenCode through OpenLLM. Your ~/.config/opencode config is never modified.
openllm opencodeopenllm chatgpt
openllm chatgpt [--with-chatgpt-auth|--without-chatgpt-auth] [uninstall|status]Installs an OpenLLM ChatGPT launcher in /Applications. Open it instead of ChatGPT to run the ChatGPT Mac app through OpenLLM. Your chats and ~/.codex are not changed. macOS only; requires /Applications/ChatGPT.app.
uninstallremoves the launcher and everything it wrote.statusreports whether the launcher is installed.--with-chatgpt-authkeeps the app's ChatGPT sign-in (dictation, connectors).--without-chatgpt-authruns the app with no ChatGPT account. Without either flag, the install asks or keeps your previous choice.
openllm chatgpt --without-chatgpt-authopenllm raycast
openllm raycast [uninstall|status]Raycast runs continuously, so OpenLLM is applied to its config once. The base URL is your local daemon if it answers, otherwise the hosted gateway, and it stays fixed until you re-run openllm raycast. macOS only.
- With no argument, applies or refreshes the config. Safe to re-run.
uninstallremoves exactly what was applied.statusreports whether OpenLLM is wired in.
openllm raycast statusOne-shot prompt
openllm -p <prompt> [-m <model>] [-s <system>] [--no-stream] [--output-format text|json|stream-json]Sends one prompt and streams the reply to stdout. Requires an API key.
-p -, or piped stdin with no-pat all (for exampleopenllm -m lite), reads the prompt from stdin.-m,--modelpicks a model or alias (defaultultra).-s,--systemsets a system prompt.--no-streamwaits for the full reply.--output-format json(or--json) prints one result object withtext,model,resolved_model,usage, andattempted_fallbacks.stream-jsonprints one JSON object per line. In JSON modes, errors print as{"type":"error",…}with exit code 1.
git diff | openllm -p - -m liteDaemon
The daemon runs subscription and local models on this machine. See Devices.
The daemon is the same binary. The installer also links it as openllmd in ~/.openllm/bin, so commands shown in the app such as openllmd sessions on and openllmd logs work there too.
openllm start
openllm startStarts the daemon. If no API key is saved, it guides you through sign-in and asks for your sk-llm- key first.
openllm startopenllm stop
openllm stopStops the daemon. A stopped daemon doesn't count toward your device limit.
openllm stopopenllm restart
openllm restartRestarts the daemon, for example after you finish credential setup.
openllm restartopenllm status
openllm statusShows the daemon's service registration, supervisor state, a live status check, and its file paths.
openllm statusopenllm sessions
openllm sessions [list]
openllm sessions attach <id>
openllm sessions kill <id>Lists, attaches to, or kills the live client sessions on this machine, including ones started from the browser.
list(the default) shows running sessions.attach <id>joins a live session alongside any other viewer.kill <id>ends a session.
openllm sessions listTo let the browser open remote terminal sessions on this machine, use openllmd sessions on or openllm login --pty-sessions. They are off after a plain install; Add a device in the dashboard turns them on unless you switch Remote terminal off.
openllm auto-update
openllm auto-update <on|off|status>Reads or changes whether the daemon updates itself in the background. It is on by default.
openllm auto-update statusProviders & auth
openllm auth
openllm auth <providers|status|usage|refresh|login|submit-code|cancel|logout> [provider] [--json]Manages subscription sign-ins on this machine through each vendor's own CLI. It does not sign you in to your OpenLLM account.
providerslists this daemon's providers and their login methods.status [provider] [--flow-id <id>]reads sign-in state, or checks a login in progress.usage [provider]reads cached usage without refreshing anything.refresh [provider]refreshes usage.login <provider> [--method browser|device]starts the vendor's sign-in.submit-code <provider> --flow-id <id>sends a paste-back code, read from stdin.cancel <provider> [--flow-id <id>]cancels a pending sign-in.logout <provider>signs out of the provider on this machine.
Starting a login is not the same as a successful sign-in. Check status afterward. See Subscriptions.
openllm auth login claude_codeopenllm login
openllm login [--key <sk-llm-…>] [--start] [--pty-sessions|--no-pty-sessions] [--json]Saves your OpenLLM API key to ~/.openllm/.env, replacing any existing key. Without --key, it reads the key from piped stdin or asks for it with hidden input. A running daemon restarts to pick it up. Create keys on the Devices & keys page.
--startalso starts the daemon when it isn't running.--pty-sessionsallows remote terminal sessions on this machine;--no-pty-sessionsdisallows them.--jsonprints{"saved":true,"daemon":…}on stdout.
echo "$OPENLLM_API_KEY" | openllm login --startopenllm config
openllm config --jsonPrints the resolved configuration as JSON: gateway origin, env file, daemon port, whether a key is configured, and the key's public id. The secret is never printed.
openllm config --jsonMCP & memory
openllm mcp
openllm mcp [--only openllm|openllm-memory]Runs the OpenLLM MCP server over stdio. It serves gateway tools (openllm) and memory tools (openllm-memory). Requires a configured API key. --only limits it to one group, for debugging. See MCP server and Memory.
openllm mcpopenllm exec
openllm exec memory <recall|extract>Runs a hook utility. Client hooks use it for automatic memory: recall reads a hook event on stdin, and extract starts background memory extraction. You don't normally run it by hand.
openllm exec memory recall < event.jsonSetup & maintenance
openllm setup
openllm setupLinks openllm and ollm onto your PATH (/usr/local/bin or ~/.local/bin), adds a managed block to your shell rc, and installs shell completion. Safe to re-run. If openllm isn't found after install, run ~/.openllm/bin/openllm setup and open a new terminal.
~/.openllm/bin/openllm setupopenllm completion
openllm completion <bash|zsh|fish|install>Prints a completion script for a shell, or install wires it into your shell config.
openllm completion installopenllm update
openllm updateUpdates the whole product: reruns the installer from your configured gateway so the daemon and CLI match. Keeps your env file and does not edit your shell.
openllm updateopenllm self-update
openllm self-updateUpdates only the CLI binary to the gateway's pinned release, after verifying its SHA-256.
openllm self-updateopenllm doctor
openllm doctor [--fix] [--ai] [--model <alias>] [-c]
openllm doctor report [--dry-run]
openllm doctor opt-out | opt-in --yes | reporting-statusChecks the daemon's health and finds leftover install state. Without flags it changes nothing.
--fixremoves OpenLLM-owned leftovers and managed regions. Your own settings in those files are kept.--aiadds an AI diagnosis (modellite) that sends the redacted report and recent daemon logs through your gateway.--model <alias>picks another model and implies--ai.-c,--copycopies the report to the clipboard.reportasks the daemon to upload its sanitized diagnostic events. It does not read raw daemon logs.--dry-runpreviews the export without uploading.opt-out,opt-in --yes, andreporting-statuscontrol and show diagnostic reporting.
openllm doctor --fixopenllm uninstall
openllm uninstall [--yes] [--keep-logins|--remove-logins]Removes the daemon and the CLI from this machine. It stops the service, reverses Raycast, ChatGPT launcher, and Hermes wiring, removes the PATH links and shell-rc block, and deletes CLI state under ~/.openllm.
--yes,-yskips the confirmation. Without it, a terminal is required.--keep-loginskeeps your subscription sign-ins for a reinstall.--remove-loginsremoves them (the default with--yes).
openllm uninstall --keep-loginsopenllm api
openllm api --specPrints the OpenAPI spec embedded in the CLI, the same document the gateway serves at /api/swagger. See API reference.
openllm api --spec > openapi.jsonopenllm version
openllm versionPrints the CLI version.
openllm versionopenllm help
openllm helpShows the command list, flags, and config variables.
openllm helpConfiguration file
The CLI and the daemon share ~/.openllm/.env. Each value is read from the process environment first, then this file.
| Key | What it does | Default |
|---|---|---|
OPENLLM_API_KEY | Your sk-llm- key. Written by the installer, openllm start, and openllm login. | none |
OPENLLM_CLOUD_ORIGIN | Gateway origin | https://www.openllm.sh |
OPENLLM_DAEMON_PORT | Port the daemon listens on, on 127.0.0.1 | 8787 |
OPENLLM_DEVICE_ID | Random per-machine id the daemon creates on first start | generated |
OPENLLM_DAEMON_AUTO_UPDATE | Daemon self-update, 1 or 0. Set with openllm auto-update. | 1 |
OPENLLM_DAEMON_PTY_SESSIONS | Remote terminal sessions, 1 or 0 | 0 |
OPENLLM_SESSION_IDLE_TIMEOUT_MIN | Minutes before an idle detached session is closed; 0 disables | 60 |
OPENLLM_LOG_LEVEL | Daemon log level: error, warn, info, or debug | info |
Environment variables
These are read from the process environment only, not from ~/.openllm/.env.
| Variable | What it does |
|---|---|
OPENLLM_GATEWAY | local or cloud. Forces the gateway a client uses. By default the CLI uses the local daemon when it answers. |
MEMORY_AUTO_SAVE | Set to 0 to stop saving memories automatically. |
MEMORY_AUTO_RECALL | Set to 0 to stop recalling memories automatically. |
MEMORY_AUTO_MODEL | Model for memory extraction (default lite). |
Last updated on
API reference
Reference for the OpenLLM API at https://www.openllm.sh/v1: authentication, OpenAI and Anthropic endpoints, streaming, idempotency, and response headers.
Errors
Every OpenLLM API error type, such as free_tier_exhausted or subscription_requires_daemon, with its HTTP status, cause, and what to do about it.