CLI

Installation

Get l4 onto a laptop or a CI image with Homebrew, go install or a prebuilt archive, and confirm the install worked.

Homebrew is the recommended route on macOS and Linux. go install needs a Go toolchain. Every release on GitHub also ships static archives:

  • Linux: amd64, arm64
  • macOS: amd64, arm64
  • Windows: amd64, arm64

Install

MethodBinaries installedNeeds
Homebrewlevelfour and l4macOS or Linux
go installlevelfour onlya Go toolchain (1.26.3+)
Prebuilt archivelevelfour and l4no toolchain, just download and extract
brew install LevelFourAI/tap/levelfour

The tap ships a single levelfour cask, and it installs both binaries: levelfour and l4. Two binaries, same tool covers which name to use.

With a Go toolchain (1.26.3+):

go install github.com/LevelFourAI/levelfour-cli/cmd/levelfour@latest

The binary is named levelfour. Symlink to l4 if you want the short form:

ln -s "$(which levelfour)" "$(dirname "$(which levelfour)")/l4"
go install builds only levelfour. The verify step below and the rest of these docs say l4, so make the symlink or substitute the name as you read.

Archive naming: levelfour-cli_<version>_<os>_<arch>.tar.gz (.zip on Windows). Each archive contains both the levelfour and l4 binaries.

VERSION=0.1.0
curl -L https://github.com/LevelFourAI/levelfour-cli/releases/download/v${VERSION}/levelfour-cli_${VERSION}_linux_amd64.tar.gz \
  | tar xz
sudo mv levelfour l4 /usr/local/bin/

Set VERSION to the release you want. The example pulls the Linux amd64 archive.

Checksums for every release are signed under checksums.txt on the Release page.

Verify the installation

l4 --version
l4 version 0.1.0 (commit: 2e84aa4)
A version line is the proof: the shell found the binary and it answered. Your version and commit will differ from the example.

Shell completion

Generate completion scripts for your shell. For bash, zsh and fish, the first command turns completion on in the current session, and the second installs it for every new one:

source <(l4 completion bash)
l4 completion bash | sudo tee /etc/bash_completion.d/l4 > /dev/null

Updating

l4 checks for new versions in the background after each command and prints an update hint to stderr if a newer release is available. To upgrade, run the command for the way you installed it. Homebrew updates both binaries:

brew upgrade levelfour

CI and Docker images

The CLI is a single static Go binary with no runtime dependencies. To pin a version inside a CI image:

Dockerfile
ARG LEVELFOUR_CLI_VERSION=0.1.0
RUN curl -fsSL https://github.com/LevelFourAI/levelfour-cli/releases/download/v${LEVELFOUR_CLI_VERSION}/levelfour-cli_${LEVELFOUR_CLI_VERSION}_linux_amd64.tar.gz \
  | tar xz -C /usr/local/bin levelfour l4

For a workflow that runs l4, see CI/CD integration.

Next

  • CLI authentication is how l4 gets a credential, and which commands need a read-write key
  • Commands is the per-command reference, starting with l4 costs
  • Recipes has the end-to-end shell pipelines

On this page

Ask the FinOps Agent about your cloud spend