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/levelfourSee Installation for go install, prebuilt archives including Windows, and shell completion.
Sign in
l4 auth loginThis opens your browser and signs you in. See Authentication for CI, where there is no browser to open.
Confirm identity
l4 whoami4 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 uselevelfour: long form, useful whenl4collides with another tool on yourPATH
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 |
| Recommendation writes | rec accept, rec reject, rec execute |
| Agent integration | mcp install, mcp uninstall, mcp status, mcp serve |
| Authentication | auth login, auth logout, auth status, login (alias) |
| Configuration | config, 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
| 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. The NO_COLOR environment variable does the same |
--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 for what each one emits.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Issues found (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.
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,--templateand--csvemit - Commands is the per-command reference
- Recipes has shell pipelines validated against the live API
- MCP is the same data inside an assistant