# The LevelFour CLI: Cloud Costs and Savings From Your Terminal

> l4 brings costs, savings, commitments, and Terraform estimates to the terminal and to CI, with output built for scripts.

Source: https://levelfour.ai/blog/levelfour-cli

Updated: 2026-10-20

September 23, 2026. By Gabriel Nielsen.

Engineers check deploys, logs, and pull requests from a terminal. `l4`, the LevelFour CLI, puts cloud cost there too: what you spent, what you can save, and what a Terraform change will cost before you apply it.

## Install and sign in

```bash
brew install LevelFourAI/tap/levelfour
l4 auth login
l4 whoami
```

[`l4 auth login`](https://docs.levelfour.ai/cli/authentication) opens your browser and signs you in, and `l4 whoami` prints the identity and organization the credential resolved to. That login mints a read key. The commands that record a decision need a read-write key, which you create in the dashboard under [Settings > API Keys](https://docs.levelfour.ai/account/api-keys). In CI, set `LEVELFOUR_TOKEN` from a secret.

The install also ships a long-form `levelfour` binary for machines where `l4` collides with another tool, and the [installation docs](https://docs.levelfour.ai/cli/installation) cover `go install` and prebuilt archives for Linux and Windows.

## What it does

- Costs: [`l4 costs summary`](https://docs.levelfour.ai/cli/commands/costs) gives the overview, and `l4 costs breakdown --tui` opens an interactive view where you drill into a row and change the grouping.
- Savings: [`l4 recommendations list`](https://docs.levelfour.ai/cli/commands/recommendations) shows what LevelFour found, and with a read-write key, `rec accept` and `rec reject` record the decision and [`rec execute`](https://docs.levelfour.ai/cli/commands/recommendations/execute) starts the rollout.
- Commitments: coverage, utilization, renewals, and the terms that expire soon, for AWS and Google Cloud. Every [`l4 commitments`](https://docs.levelfour.ai/cli/commands/commitments) command is read-only.
- Tags: provider tags and virtual tags with their coverage and costs, and [`l4 tags preview`](https://docs.levelfour.ai/cli/commands/tags/preview), a dry run that shows the spend each value would take before you create or replace a virtual tag from a YAML file.
- Estimates: [`l4 estimate`](https://docs.levelfour.ai/cli/commands/estimate) prices the Terraform in a directory, and [`l4 diff`](https://docs.levelfour.ai/cli/commands/diff) prices what a change adds.
- AI agents: [`l4 mcp install`](https://docs.levelfour.ai/cli/commands/mcp/install) writes the LevelFour MCP server into Claude Code, Claude Desktop, Cursor, VS Code, and Windsurf in one command.

## Built for scripts

Every command takes the same [output flags](https://docs.levelfour.ai/cli/output-formats): `--json`, `--jq` to filter in process, and `--template` for Go templates. JSON paths and exit codes stay stable across releases: `2` means a check found something, and `4` means no credential resolved. This [recipe](https://docs.levelfour.ai/cli/recipes) lists the ten largest savings:

```bash
l4 recommendations list \
  --sort-by monthly_savings --sort-order desc \
  --page-size 10 \
  --jq '.data.data.items[] | {id: .recommendation_id, service, savings: .monthly_savings}'
```

## A cost gate in CI

Run `l4 estimate` in the pipeline with a threshold. The job exits with code `2` once the monthly total passes it, so the pipeline can stop before anything deploys. A job with no token exits `4`, so branch on `2` alone. `--format github-comment` shapes the estimate for a pull request comment, and the [CI/CD guide](https://docs.levelfour.ai/guides/ci-cd) has the GitHub Actions and GitLab CI jobs.

```bash
l4 estimate --fail-above 500 -q ./infra/
```

## Get started

The [CLI docs](https://docs.levelfour.ai/cli) cover installation, authentication, every command, and recipes tested against the live API. The CLI is open source on [GitHub](https://github.com/LevelFourAI/levelfour-cli), where you can file issues.

[Start with LevelFour](https://levelfour.ai/sign-up) and run your first `l4 costs summary` in minutes.

## Frequently asked questions

### How do I install the LevelFour CLI?

Run `brew install LevelFourAI/tap/levelfour` with Homebrew. The docs also cover `go install` and prebuilt archives, Windows included.

### Does the CLI change resources in my cloud?

No command touches your cloud account itself. With a read-write key, `rec accept` and `rec reject` record a decision in LevelFour, and `rec execute` starts its rollout there.

### Can I use the CLI as a cost check in CI?

Yes. `l4 estimate --fail-above` exits with code `2` when the monthly Terraform estimate passes your threshold, and `l4 diff` gates on what a change adds. [What is shift-left FinOps?](https://levelfour.ai/glossary/shift-left-finops.md).

## See what LevelFour can save you

[Start free trial](https://levelfour.ai/sign-up) · [Get in touch](https://levelfour.cal.com/)

## About LevelFour

The FinOps platform that actually cuts costs. One system of record for Cloud, SaaS, and AI spend. LevelFour applies each saving, or your engineers merge it as code.

- **Cloud Savings**: 30% success fee on savings found and applied. No hidden charges, only pay on what you actually save.
- **Pro**: $30 per month · Up to $2,500 spend/mo
- **Scale**: $200 per month · Up to $7,500 spend/mo
- **Enterprise**: Custom · Unlimited spend

[Pricing](https://levelfour.ai/pricing.md) · [Guide for agents (llms.txt)](https://levelfour.ai/llms.txt) · [Documentation](https://docs.levelfour.ai) · MCP server: `https://mcp.levelfour.ai/mcp`
