CLI Overview
l4 is the official LevelFour command-line tool. It surfaces the same data as the dashboard — recommendations, costs, integrations — plus terminal-only features like local Terraform cost estimation, structured output for scripting, and an interactive TUI for browsing recommendations.
Installation
brew install LevelFourAI/tap/levelfourSee Installation for go install, GitHub releases, and shell completion.
Quick start
l4 auth login # browser-based authentication
l4 whoami # confirm identity
l4 costs summary # KPI overview
l4 recommendations list --status available # pending savings opportunities
l4 estimate ./infra/ # estimate Terraform costs locallyTwo binaries, same tool
The package installs two binaries with identical behavior:
levelfour— long form, useful whenl4collides with another tool on yourPATHl4— short form, recommended for everyday use
Throughout the docs we use l4. Substitute levelfour if you prefer.
Command groups
| Group | Commands |
|---|---|
| Core | costs, recommendations, integrations, status, estimate, diff, export, api, whoami |
| Authentication | auth login, auth logout, auth status, login (alias) |
| Configuration | config, completion |
Run l4 <command> --help (or --help on any subcommand) for the full flag list.
Global flags
| Flag | Effect |
|---|---|
--json | Output 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 |
--csv | CSV output (export commands only) |
--quiet / -q | Suppress output; communicate via exit code |
--no-color | Disable ANSI colors (also honored: NO_COLOR env var) |
--web / -w | Open the equivalent dashboard URL instead of printing |
--token <key> / -t | One-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.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Issues found — e.g. l4 estimate --fail-above triggered, or recommendations exceed a threshold in CI |
4 | Authentication required — no token, expired token, or invalid token |
130 | Interrupted (SIGINT, e.g. Ctrl+C) |
These are stable — script against them.
Where authentication is stored
l4 resolves credentials in this order on every command:
- The
--token/-tflag - The
LEVELFOUR_TOKENenvironment variable - The OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Vault) — populated by
l4 auth login
In CI, set LEVELFOUR_TOKEN from a secret. Locally, l4 auth login is the friendliest path.
Reporting issues
File CLI bugs at github.com/LevelFourAI/levelfour-cli/issues. Include l4 --version output and the failing command.