Sophon Docs
Command Line

Configuration & AuthenticationNEW

CLI config file, environment variables, gateway connection, output formats, and signing in.

The CLI stores its settings in a small JSON file, reads a handful of environment overrides, and connects to a Sophon Gateway over HTTP. This page covers all three, plus how output formats and authentication work.

Config File

CLI settings live in:

~/.sophon/config/cli.json

The file is created the first time you run sophon config set (or sophon onboard). Missing or corrupt files fall back to built-in defaults, so it is safe to delete.

KeyDefaultDescription
gatewayUrlhttp://localhost:8080Base URL of the Gateway the CLI talks to.
authToken(not set)Bearer token for remote/self-hosted gateways. Personal tier needs none.
defaultAgentdefaultAgent used when a command doesn't name one.
defaultFormattableOutput format: table, json, or csv.
themedarkLegacy console styling: dark or light. The four interactive themes (indigo-core, deep-void, graphite, daylight) are selected with the SOPHON_THEME environment variable instead — see Themes.
v2(unset → on)The enhanced interactive experience. On by default — set false to fall back to the legacy prompt.
pinnedInput(unset → on)Pin the input zone to the bottom of the chat REPL. Set false to use the classic framed prompt even on capable terminals.
defaultThinking(unset → auto)Extended-thinking level: auto, off, fast, or full. Written by the /thinking command in the REPL.
greeting(unset → on)Show the per-day greeting in the header card.
tokensFooter(unset → on)Show the tokens / status footer ribbon.

The enhanced interactive surface (themed UI, pinned input, multi-line editor, slash menu, branded panels) is on by default. To opt out, set SOPHON_CLI_V2=0 or "v2": false in cli.json. To keep the enhanced UI but drop the pinned input zone, set SOPHON_CLI_PINNED=0 or "pinnedInput": false.

sophon config

Manage cli.json without editing it by hand:

sophon config path             # print the config file path
sophon config list             # show all effective values
sophon config get <key>        # read one key
sophon config set <key> <val>  # set a key and save
sophon config reset            # delete the file (restore defaults)
sophon config validate         # check the config is well-formed
sophon config set gatewayUrl https://sophon.example.com
sophon config set defaultAgent research
sophon config set defaultFormat json

config validate flags an empty or non-absolute gatewayUrl and an unrecognized defaultFormat.

Global Options

These flags work on every command and override the config file for that run:

OptionDescription
--gateway-url, -gGateway URL (default http://localhost:8080).
--format, -fOutput format: table, json, or csv.
--jsonShorthand for --format json.
--no-colorDisable colored output (also honors NO_COLOR).
--verbose, -vEnable verbose output.
--versionPrint the CLI version.
sophon agents list -g https://sophon.example.com --json

Environment Variables

Environment overrides win over cli.json and are the recommended way to configure the CLI in CI or headless environments:

VariableOverridesDescription
SOPHON_GATEWAY_URLgatewayUrlGateway base URL.
SOPHON_AUTH_TOKENauthTokenBearer token for remote gateways.
SOPHON_FORMATdefaultFormatOutput format.
SOPHON_THEMETheme name: indigo-core, deep-void, graphite, or daylight. Resolution order: env → terminal background probe → indigo-core.
SOPHON_CLI_V2v20 disables the enhanced experience (on by default).
SOPHON_CLI_PINNEDpinnedInput0 disables the pinned input zone (on by default on capable terminals).
NO_COLORNO_COLOR=1 (or any value) strips all color from output.
SOPHON_DEBUGEnable debug diagnostics.

Connecting to a Gateway

Every command needs a reachable Gateway. By default the CLI targets a local instance at http://localhost:8080.

Local Gateway — start one with sophon start for a full self-hosted deployment, then run commands with no extra flags.

Remote / self-hosted Gateway — point the CLI at the remote URL and supply a token:

sophon config set gatewayUrl https://sophon.example.com
sophon config set authToken <token>

Or, for CI and headless runs, use environment variables instead of writing to disk:

export SOPHON_GATEWAY_URL=https://sophon.example.com
export SOPHON_AUTH_TOKEN=$SOPHON_TOKEN
sophon agents list --json

Run sophon doctor to confirm the gateway is reachable and your auth, providers, and config check out. See Self-hosting Configuration for the server side.

Authentication

On the personal tier there is no login — the Gateway auto-authenticates you as admin. sophon login simply reports "Personal tier — no login required."

For multi-user gateways:

sophon login      # prompts for email + password
sophon register   # create a new account
sophon logout     # clear the saved token
sophon whoami     # show the current user

whoami reports the personal-tier auto-admin when not logged in, and otherwise prints your display name and email.

For CI or headless agents, skip the interactive login and pass a token via SOPHON_AUTH_TOKEN (with SOPHON_GATEWAY_URL). See Scripting & Automation.

Output Formats

The CLI renders results as a table by default. Switch with --format (or -f), or use --json as a shortcut:

sophon agents list                 # table (default)
sophon agents list --format csv    # CSV
sophon agents list --json          # JSON (same as --format json)

Set a persistent default with sophon config set defaultFormat json or SOPHON_FORMAT. JSON and CSV are the formats to reach for in Scripting & Automation.

Data Directory

All CLI and Gateway state lives under ~/.sophon:

~/.sophon/
└── config/
    ├── cli.json              # CLI settings (this page)
    ├── cli-history.jsonl     # REPL command history
    └── models.json           # LLM provider keys (encrypted)

The CLI shares this directory with the Gateway, so provider keys configured elsewhere are available here too. For the full server-side layout, see Self-hosting Configuration.