The official command-line tool for LevelFour. Surfaces cloud cost recommendations, integrations, and live spending from the terminal, plus terminal-only features like local Terraform cost estimation and an interactive TUI for browsing recommendations.
Status: v0.x. The CLI surface is still stabilizing. Minor versions may include breaking changes until v1.0. Pin to an exact version in CI and review the release notes before upgrading.
brew install LevelFourAI/tap/levelfourgo install github.com/LevelFourAI/levelfour-cli/cmd/levelfour@latestBinaries for Linux, macOS, and Windows are attached to every release.
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 locallyThe package installs two interchangeable binaries: levelfour (long form) and l4 (short form, recommended for everyday use).
l4 resolves credentials in a fixed order:
--token/-tflagLEVELFOUR_TOKENenvironment variable- OS keychain (populated by
l4 auth login)
For CI:
- env:
LEVELFOUR_TOKEN: ${{ secrets.LEVELFOUR_TOKEN }}
run: l4 recommendations list --status available --jq '.data.items[].recommendation_id'Every command supports machine-readable output:
l4 costs summary --json # raw JSON
l4 recommendations list --jq '.data.items[].monthly_savings' # filter with jq
l4 costs breakdown --format csv # CSV for spreadsheetsSee output formats for the full matrix.
| Code | Meaning |
|---|---|
0 |
Success |
1 |
General error |
2 |
Issues found (l4 estimate --fail-above triggered, recommendations exceed threshold) |
4 |
Authentication required (no token, expired, or invalid) |
130 |
Interrupted (Ctrl+C) |
Stable; script against them.
Crash telemetry is opt-in and off by default. Enable with:
l4 telemetry enableWhat it sends: panic stack traces and the failing command name. Home paths are rewritten to ~, AWS access keys and known token env vars are redacted, and HTTP headers/cookies are stripped before transport. See l4 telemetry --help.
- docs.levelfour.ai/cli: full command reference and recipes
- docs.levelfour.ai/sdks/go: the Go SDK that powers the CLI
- api.md: underlying API methods
File CLI bugs at github.com/LevelFourAI/levelfour-cli/issues. Include l4 --version output and the failing command.
See CONTRIBUTING.md.
See SECURITY.md for the responsible-disclosure policy.
Apache-2.0; see LICENSE.