CLI

CLI Overview

l4 runs LevelFour from the terminal. The official client reaches the same costs, recommendations and integrations as the dashboard, and adds what only a terminal can do: local Terraform cost estimation, structured output for scripting, and an interactive TUI for browsing recommendations.

Quick start

Install

brew install LevelFourAI/tap/levelfour

See Installation for go install, prebuilt archives including Windows, and shell completion.

Sign in

l4 auth login

This opens your browser and signs you in. See Authentication for CI, where there is no browser to open.

Confirm identity

l4 whoami
Your identity and organization printing back is the proof that a credential resolved and is bound to an organization. Exit code 4 instead means no credential resolved.

Run something

l4 costs summary
l4 recommendations list --status available
l4 estimate ./infra/

l4 costs summary is the KPI overview, l4 recommendations list --status available shows pending savings opportunities, and l4 estimate ./infra/ estimates Terraform costs locally. Recipes has longer pipelines.

Two binaries, same tool

A single brew install LevelFourAI/tap/levelfour ships two interchangeable binaries with identical behavior, both from the one cask:

  • l4: short form, recommended for everyday use
  • levelfour: long form, useful when l4 collides with another tool on your PATH

Throughout the docs we use l4. Substitute levelfour if you prefer.

Command groups

GroupCommands
Corecosts, recommendations, integrations, status, estimate, diff, export, api, whoami
Recommendation writesrec accept, rec reject, rec execute
Agent integrationmcp install, mcp uninstall, mcp status, mcp serve
Authenticationauth login, auth logout, auth status, login (alias)
Configurationconfig, telemetry, completion

Run l4 <command> --help (or --help on any subcommand) for the full flag list. rec and recs are aliases for recommendations.

Global flags

FlagEffect
--jsonOutput as JSON for piping to jq or other tools
--jq <expr>Filter the JSON output with a jq expression in-process
--template <tpl>Format output with a Go text template
--csvCSV output (export commands only)
--quiet / -qSuppress output; communicate via exit code
--no-colorDisable ANSI colors. The NO_COLOR environment variable does the same
--web / -wOpen the equivalent dashboard URL instead of printing
--token <key> / -tOne-shot token override
--api <url>Point at a non-default API base URL

--quiet is mutually exclusive with --json, --jq, --template, and --csv. See Output formats for what each one emits.

Exit codes

CodeMeaning
0Success
1General error
2Issues found (l4 estimate --fail-above triggered, or recommendations exceed a threshold in CI)
4Authentication required (no token, expired token, or invalid token)
130Interrupted (SIGINT, e.g. Ctrl+C)

These are stable. Script against them.

Credentials

l4 looks for a credential in the --token flag, then the LEVELFOUR_TOKEN environment variable, then the OS keychain. Set LEVELFOUR_TOKEN from a secret in CI. On a laptop, run l4 auth login.

Authentication has the full resolution order, the keychain each platform uses, and the troubleshooting table.

Reporting issues

File CLI bugs at github.com/LevelFourAI/levelfour-cli/issues. Include l4 --version output and the failing command.

Next

  • Installation has go install, prebuilt archives, CI images and shell completion
  • Authentication is the credential order in full, and the read-write key the write commands need
  • Output formats is what --json, --jq, --template and --csv emit
  • Commands is the per-command reference
  • Recipes has shell pipelines validated against the live API
  • MCP is the same data inside an assistant