> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costgraph.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CostGraph CLI command reference

> Find CLI commands grouped by authentication, costs, virtual tags, recommendations, configuration, and CI.

This reference covers CostGraph CLI 0.11.0. Commands are shown without the `costgraph` prefix. Add `--help` for the complete flag list.

A session comes from `costgraph auth login`. A key needs the scopes listed with its command. See [Credentials](https://docs.costgraph.ai/costgraph/cli/overview.md#credentials) for session precedence.

## Authentication

Run each command with the `costgraph` prefix. See [Install](https://docs.costgraph.ai/costgraph/cli/install.md#command-reference) for examples and flags.

**auth login** `command`

Opens browser sign-in and saves a session for one tenant.

**auth status** `command`

Reports the configured credential without contacting CostGraph. It does not verify scopes or access.

**auth logout** `command`

Deletes the saved session file. It does not revoke the session in CostGraph.

## Tenants

Choose which tenant your saved session uses. See [Install](https://docs.costgraph.ai/costgraph/cli/install.md#command-reference) for examples and flags.

**tenant list** `command`

Lists accessible tenant names and UUIDs. Accepts a session or an API key. Alias `tenant ls`.

**tenant use \[name-or-id]** `command`

Signs in again with that tenant preselected. Without an argument, opens a terminal picker.

## API keys

Run each command with the `costgraph` prefix. See [Api keys](https://docs.costgraph.ai/costgraph/cli/api-keys.md#command-reference) for examples and flags.

**api-keys scopes** `command`

Lists permissions supported by the deployment. Does not inspect an existing key. No sign-in required.

**api-keys create** `command`

Creates one key after browser approval. Returns `raw_api_key` once. Does not change the saved CLI login.

## Cost queries

Run each command with the `costgraph` prefix. `costs` is an alias for `cost`. See [Query costs](https://docs.costgraph.ai/costgraph/cli/query-costs.md#command-reference) for examples and flags.

**cost get \[name]** `command`

Queries grouped spend. Accepts a session or a key with `focus:read`.

**cost overview** `command`

Shows spend, period comparison, and provider totals. Requires a session. Bare `cost` uses month-to-date without prompting.

**cost providers** `command`

Ranks providers by spend. Requires a session. Alias `cost provider`.

## Terraform estimates

Run each command with the `costgraph` prefix. See [Terraform and ci](https://docs.costgraph.ai/costgraph/cli/terraform-and-ci.md#command-reference) for examples and flags.

**cost breakdown** `command`

Prices a Terraform plan JSON file. Requires a session or key with `pricing:read`.

**cost diff** `command`

Compares plan cost before and after a change. Requires a session or key with `pricing:read`.

**cost output** `command`

Combines CostGraph and Infracost estimates. No CostGraph credential needed without `--plan`. With `--plan`, existing-resource lookups need `focus:read`.

**cost setup-infracost** `command`

Prints environment variables for using CostGraph prices with Infracost. No existing credential required.

## Pull request comments

Both commands need a GitHub token with permission to comment on the pull request. See [Terraform and ci](https://docs.costgraph.ai/costgraph/cli/terraform-and-ci.md#command-reference) for examples and flags.

**cost comment github** `command`

Posts or updates the Terraform estimate comment. No dry-run option. `--plan` lookups need `focus:read`.

**cost ci comment github** `command`

Posts or updates CI cost. Requires a session or key with `focus:read`. Use `--dry-run` to preview.

## Virtual tags

All `tags` commands require a saved session. `tag` is an alias for `tags`. See [Virtual tags](https://docs.costgraph.ai/costgraph/cli/virtual-tags.md#command-reference) for examples and flags.

**tags list** `command`

Lists keys and rules. Use `--key` for one key, `--wide` for full predicates, or `--pick` to inspect a rule.

**tags view \[key]** `command`

Opens the interactive explorer. Bare `tags` opens it in a terminal and prints help otherwise.

**tags fields** `command`

Lists billing fields and coverage. Use `--all` to include fields below the usability threshold.

## Virtual tag previews

CLI 0.11.0 can preview rules but cannot save them. See [Virtual tags](https://docs.costgraph.ai/costgraph/cli/virtual-tags.md#command-reference) for examples and flags.

**tags create** `command`

Validates and previews a rule with `--dry-run`. Keep that flag for previews in scripts.

## Recommendations

These commands require a saved session. `recs` is an alias for `recommendations`. See [Recommendations](https://docs.costgraph.ai/costgraph/cli/recommendations.md#command-reference) for examples and flags.

**recommendations list** `command`

Lists rightsizing recommendations. Opens a browser in a terminal, a table in pipes, or JSON with `-o json`.

**recommendations summary** `command`

Totals monthly savings, coverage, and recommendation counts by action. Does not apply changes.

## Read configuration

Run each command with the `costgraph` prefix. See [Configuration](https://docs.costgraph.ai/costgraph/cli/configuration.md#command-reference) for examples and flags.

**config path** `command`

Prints the configuration file path.

**config list** `command`

Lists settings and their sources. Masks API key values.

**config get \<key>** `command`

Prints one setting as a value.

## Write configuration

These commands change the local configuration file. See [Configuration](https://docs.costgraph.ai/costgraph/cli/configuration.md#command-reference) for examples and flags.

**config init** `command`

Creates defaults. Refuses to overwrite an existing file unless you pass `--force`.

**config set \<key> \<value>** `command`

Changes a supported setting. An environment override still takes precedence.

## Shell completion

Completion commands print scripts. Follow each command's `--help` to install its output. See [Configuration](https://docs.costgraph.ai/costgraph/cli/configuration.md#command-reference) for examples and flags.

**completion bash** `command`

Generates Bash completion. Requires `bash-completion`.

**completion zsh** `command`

Generates zsh completion.

**completion fish** `command`

Generates fish completion.

**completion powershell** `command`

Generates PowerShell completion.

## Version and help

Run these commands from any directory. See [Overview](https://docs.costgraph.ai/costgraph/cli/overview.md#command-reference) for examples and flags.

**version** `command`

Prints the installed version, commit, and build time.

**help \[command]** `command`

Prints help for a command. You can also append `--help` to any command.

## Global flags

These flags apply across command groups. See [Overview](https://docs.costgraph.ai/costgraph/cli/overview.md#command-reference) for examples and flags.

**-o, --output** `string`

Selects `table` or `json` for data commands. Some commands use their own output formats.

**--config** `path`

Selects a configuration file for this command.

**-v, --verbose** `boolean`

Enables debug logging.

## Command groups

Run a group without a subcommand to discover its children. `cost comment`, `cost ci`, and `cost ci comment` group the GitHub comment commands.

Every `cost` subcommand inherits `--period`, `--month`, `--start`, `--end`, and `--no-interactive`. Period flags affect spend queries. They do not affect Terraform estimates or the CI `--since` window.

Configuration commands read or write local settings. Commands can also send usage telemetry unless you [disable it](https://docs.costgraph.ai/costgraph/cli/configuration.md#disable-usage-telemetry).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.