Output formats
Every command supports a consistent set of global output flags. The default is a human-readable table, color-themed for the terminal.
| Flag | Output |
|---|---|
| (default) | Human-readable, colored, table-formatted |
--json | Pretty-printed JSON |
--jq <expr> | JSON filtered through a jq expression in-process |
--template <tpl> | Output formatted with a Go text/template |
--csv | CSV (only honored by l4 export * commands) |
--quiet / -q | No output; the exit code is the signal |
--no-color | Disable ANSI colors (also NO_COLOR=1) |
--web / -w | Open the equivalent dashboard URL instead |
--json
Use for piping to other tools or for stable machine-readable output. The JSON envelope is the same shape returned by the underlying API:
l4 recommendations list --json{
"data": {
"success": true,
"data": {
"total_savings": 23545.31,
"items": [...],
"pagination": {
"total_items": 204,
"total_pages": 41,
"current_page": 1,
"page_size": 5,
"has_next": true,
"has_previous": false
}
},
"timestamp": "2026-04-27T11:00:00Z"
}
}JSON paths are stable across releases — script against them.
--jq
--jq filters the JSON output through an embedded jq expression in a single process — faster than spawning jq separately and works in environments where jq isn't installed:
l4 recommendations list --jq '.data.data.items[] | {id: .recommendation_id, savings: .monthly_savings}'Equivalent to:
l4 recommendations list --json | jq '.data.data.items[] | {id: .recommendation_id, savings: .monthly_savings}'For complex multi-step pipelines (slurps, branches, table formatting), prefer the explicit pipe so each stage is debuggable. See Recipes.
--template
Format with a Go text/template for predictable text output:
l4 costs summary --template '{{ range .data.providers }}{{ .provider_name }}: ${{ .monthly_spending }}/mo{{ "\n" }}{{ end }}'Useful when downstream tools want a plain-text shape that isn't quite CSV.
--csv
Only honored by l4 export * commands; on other commands a warning is printed and the format falls back to the default. Use this for spreadsheet imports:
l4 export costs --period 90d --format csv > costs.csv
l4 export recommendations --format csv > recommendations.csv--quiet
Suppresses all stdout/stderr; the exit code is the only signal. Useful as a boolean check or as a CI guardrail:
l4 estimate --fail-above 500 -q ./infra/ && echo "Within budget" || echo "Over budget"--quiet is mutually exclusive with --json, --jq, --template, and --csv — combining them is a usage error.
--web
Skip the terminal output entirely and open the equivalent page in the dashboard:
l4 recommendations view REC-001 --webThe CLI computes the dashboard URL by replacing api. with dashboard. in the active API base.
Disabling color
Two equivalent ways:
l4 costs summary --no-color
NO_COLOR=1 l4 costs summaryThe CLI also auto-disables color when stdout is not a TTY (e.g. piped or redirected), so you usually don't need to set this manually.