# l4 costs

> View cloud cost summaries, breakdowns, daily and monthly aggregations, and the filter dimensions you can drill into.

Source: https://docs.levelfour.ai/cli/commands/costs


`l4 costs` reads cloud spend from the terminal.

## Subcommands

| Command                   | Purpose                                                                    |
| ------------------------- | -------------------------------------------------------------------------- |
| [`summary`](#summary)     | KPI overview: monthly spend, forecast, total potential savings             |
| [`breakdown`](#breakdown) | Per-service breakdown with filters, multi-dimensional grouping, pagination |
| [`daily`](#daily)         | Daily costs aggregated per day for a date range                            |
| [`monthly`](#monthly)     | Monthly costs aggregated per month                                         |
| [`filters`](#filters)     | Distinct values for every filter dimension                                 |

## summary

```bash
l4 costs summary [--provider <id>]
```

Prints the top-line KPIs: monthly spend, forecast and total potential savings. Pass `--provider` to scope to one cloud (`aws`, `gcp`, `azure`, `k8s`).

```bash
l4 costs summary
l4 costs summary --provider aws
l4 costs summary --json
```

## breakdown

```bash
l4 costs breakdown [flags]
```

`--tui` opens the same rows in an interactive split-pane viewer, where you drill into a row and pivot grouping live. [Filtering and sorting](/guides/filtering-and-sorting#interactive-tui) lists its keys and shows how flags passed on the command line seed its starting state.

### Flags

| Flag                                | Description                                                                                                                                                        |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--provider <id>`                   | `aws`, `gcp`, `azure`, `k8s` (auto-detected if omitted)                                                                                                            |
| `--start <date>` / `--end <date>`   | Date range, ISO 8601                                                                                                                                               |
| `--preset <preset>`                 | `30D`, `6M`, `12M` (overrides `--start`/`--end`)                                                                                                                   |
| `--granularity <g>`                 | `daily` or `monthly`                                                                                                                                               |
| `--group-by <dim>`                  | Repeatable: `service`, `account_id`, `region`, `tag`, `virtual_tag`                                                                                                |
| `--service <s>`                     | Repeatable filter                                                                                                                                                  |
| `--region <r>`                      | Repeatable filter                                                                                                                                                  |
| `--account <a>`                     | Repeatable filter                                                                                                                                                  |
| `--environment <e>`                 | Repeatable filter                                                                                                                                                  |
| `--tag-key <k>` / `--tag-value <v>` | Required when `--group-by` includes `tag`                                                                                                                          |
| `--virtual-tag-key <k>`             | A virtual tag's name or id. Reports the spend its rules assigned rather than the raw bill. Required when `--group-by` includes `virtual_tag`, and one key per call |
| `--virtual-tag-value <v>`           | Repeatable. Keeps only these values of `--virtual-tag-key`, so `--group-by` then splits those alone. `__unallocated__` keeps the spend no rule assigned            |
| `--page` / `--page-size`            | Pagination (max 100 per page)                                                                                                                                      |
| `--sort-by <field>`                 | `cost`, `previous_cost`, `change_percentage`, `service`, `region`, `account_id`                                                                                    |
| `--sort-by-date <date>`             | Sort by a specific date column (overrides `--sort-by`)                                                                                                             |
| `--sort-order`                      | `asc` or `desc`                                                                                                                                                    |
| `--format`                          | `table`, `csv`, `raw` (default `table`)                                                                                                                            |
| `--tui`                             | Open the interactive split-pane viewer                                                                                                                             |

> **Note**
>
> `--page` and `--page-size` apply to `--format table`. `--format csv` and `--format raw` return the whole filtered set in one response.

### Examples

```bash
l4 costs breakdown
l4 costs breakdown --preset 30D
l4 costs breakdown --start 2026-01-01 --end 2026-01-31
l4 costs breakdown --group-by service --group-by region
l4 costs breakdown --service EC2 --service RDS
l4 costs breakdown --group-by tag --tag-key Environment --tag-value production
l4 costs breakdown --group-by virtual_tag --virtual-tag-key Teams
l4 costs breakdown --group-by service --virtual-tag-key Teams --virtual-tag-value data
l4 costs breakdown --granularity monthly --preset 6M
l4 costs breakdown --sort-by-date 2026-01-15 --sort-order desc
l4 costs breakdown --format csv > costs.csv
```

> **Note**
>
> Filter options cross-constrain each other, matching AWS Cost Explorer behavior: selecting a service narrows the regions and accounts you can subsequently filter on. [`l4 costs filters`](#filters) prints the current option list at any point.

## daily

```bash
l4 costs daily [--start <date>] [--end <date>] [--provider <id>]
```

Without `--start` and `--end`, the range is the trailing 30 days.

```bash
l4 costs daily
l4 costs daily --start 2026-01-01 --end 2026-01-31
l4 costs daily --json | jq '.data.data_points[]'
```

## monthly

```bash
l4 costs monthly [--provider <id>]
```

One row per month, covering all available history.

```bash
l4 costs monthly
l4 costs monthly --json | jq '.data.data_points[]'
```

## filters

```bash
l4 costs filters [dimension] [--start <date>] [--end <date>] [--provider <id>]
```

The dimensions are services, regions, accounts, tag keys and tag values. Without an argument, `filters` prints every one. Pass a dimension name to print just that one.

```bash
l4 costs filters
l4 costs filters service
l4 costs filters region --start 2026-01-01 --end 2026-01-31
l4 costs filters --json | jq '.data.services[]'
```

## Related

* [Filtering and sorting](/guides/filtering-and-sorting): these flags in use, the TUI keys, `--jq` pipelines, and the SDK equivalents
* [Output formats](/cli/output-formats): the global `--json`, `--jq`, `--template` and `--quiet` flags
* [`l4 integrations`](/cli/commands/integrations): which `--provider` values your organization actually has
* [Recipes](/cli/recipes): multi-step shell pipelines, mostly over `l4 recommendations`
* [`/api-reference/costs`](/api-reference/costs): the underlying REST endpoints
