Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

CLI reference

CLI overview

The nexus CLI does everything Nexus UI does, for people, scripts and agents.

View as Markdown

The nexus CLI is one client of the Nexus API, like Nexus UI. Every command takes --json, exits with a meaningful code and retries its writes safely, so scripts and AI agents can drive it as well as people.

Install

curl -fsSL https://api.nexus.inc/install.sh | bash

Needs curl. The installer downloads the CLI from Nexus Gateway, checks its SHA-256 checksum, and installs it to ~/.nexus/bin/nexus (NEXUS_INSTALL_DIR changes the folder). It installs the native binary for your machine when Gateway publishes one. Otherwise it installs the JavaScript CLI, which needs Node.js 22.6 or later. Then nexus update keeps it current, and nexus update --rollback goes back one version.

Grammar

nexus <command> [subcommand] [arguments] [options]
nexus <product> <verb> [capability] [--input value]

Gateway's own commands are fixed: auth, keys, team, members, spend, billing, chat, pages, skills, routines, agent, claude, sessions and the others nexus help lists. Product commands are discovered from the products registered on your Gateway: nexus help lists them, and nexus <product> --help shows a product's capabilities, verbs and inputs.

Output

On a terminal the CLI uses color, symbols and a spinner while it waits; piped, or with NO_COLOR or --no-color, it prints plain text. With --json, it prints only JSON on stdout, and nexus help --json lists every command, flag and exit code for scripts and agents. The exit codes are below; nexus claude and nexus codex exit with the agent's own code.

Global options

OptionMeaning
--jsonPrint only JSON on stdout; errors go to stderr as {"error": {"message", "hint"}}
--no-colorPlain text on a terminal too (also NO_COLOR)
--helpHelp for a command (also -h)
--versionThe CLI's version (also -v; with --json: {"version"})

Environment

VariableMeaning
NEXUS_URLThe Gateway URL when none is saved (the installer's wrapper sets it; default https://api.nexus.inc)
NEXUS_GATEWAYOne command against another Gateway, with its own sign-in (nexus auth login once per Gateway); the saved one stays the default
NEXUS_CONFIGThe CLI config file (default ~/.nexus/factory/config.json)
NEXUS_UI_URLWhere the CLI's Nexus UI links point, for the Gateway NEXUS_URL names (any Gateway when NEXUS_URL is unset)
NEXUS_TEAMThe team runs and agent sessions are attributed to (--team wins)
NEXUS_CLAUDE_AUTHGateway or subscription: the route nexus claude takes in this shell (a flag wins; unset: your saved route, nexus agents)
NEXUS_CODEX_AUTHGateway or subscription: the route nexus codex takes in this shell (a flag wins; unset: your saved route)
NEXUS_ANTIGRAVITY_AUTHSubscription, its only route: the route nexus agy takes in this shell (Antigravity runs on your Google AI plan)
NEXUS_CURSOR_AUTHSubscription: run nexus cursor-agent on your Cursor plan
NEXUS_RECORDINGS_DIRWhere nexus recordings reads screen recordings (default: Nexus for Mac's folder)
NEXUS_DESKTOP_BINThe binary nexus recordings frames runs (default: Nexus.app's nexus-desktop, else Nexus GPUI's nexus-desktop-gpui)
NEXUS_DESKTOP_SOCKETThe socket nexus sessions reaches Nexus for desktop through (default: the app's, in $XDG_RUNTIME_DIR or its data folder)
NEXUS_NO_UPDATE_CHECK1: never check for a newer CLI (also off with --json, in CI and when stdout is not a terminal)
NO_COLORPlain output on a terminal too
NEXUS_DEBUG1: print the stack trace with an error

Exit codes

CodeMeaning
0Success
1Failure: Gateway refused or failed the request, a run failed, you are not signed in, or Gateway could not be reached
2Usage error: an unknown command, a missing argument or an invalid flag