Skip to main content
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 for session precedence.

Authentication

Run each command with the costgraph prefix. See Install for examples and flags.
command
Opens browser sign-in and saves a session for one tenant.
command
Reports the configured credential without contacting CostGraph. It does not verify scopes or access.
command
Deletes the saved session file. It does not revoke the session in CostGraph.

Tenants

Choose which tenant your saved session uses. See Install for examples and flags.
command
Lists accessible tenant names and UUIDs. Accepts a session or an API key. Alias tenant ls.
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 for examples and flags.
command
Lists permissions supported by the deployment. Does not inspect an existing key. No sign-in required.
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 for examples and flags.
command
Queries grouped spend. Accepts a session or a key with focus:read.
command
Shows spend, period comparison, and provider totals. Requires a session. Bare cost uses month-to-date without prompting.
command
Ranks providers by spend. Requires a session. Alias cost provider.

Terraform estimates

Run each command with the costgraph prefix. See Terraform and ci for examples and flags.
command
Prices a Terraform plan JSON file. Requires a session or key with pricing:read.
command
Compares plan cost before and after a change. Requires a session or key with pricing:read.
command
Combines CostGraph and Infracost estimates. No CostGraph credential needed without --plan. With --plan, existing-resource lookups need focus:read.
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 for examples and flags.
command
Posts or updates the Terraform estimate comment. No dry-run option. --plan lookups need focus:read.
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 for examples and flags.
command
Lists keys and rules. Use --key for one key, --wide for full predicates, or --pick to inspect a rule.
command
Opens the interactive explorer. Bare tags opens it in a terminal and prints help otherwise.
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 for examples and flags.
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 for examples and flags.
command
Lists rightsizing recommendations. Opens a browser in a terminal, a table in pipes, or JSON with -o json.
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 for examples and flags.
command
Prints the configuration file path.
command
Lists settings and their sources. Masks API key values.
command
Prints one setting as a value.

Write configuration

These commands change the local configuration file. See Configuration for examples and flags.
command
Creates defaults. Refuses to overwrite an existing file unless you pass --force.
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 for examples and flags.
command
Generates Bash completion. Requires bash-completion.
command
Generates zsh completion.
command
Generates fish completion.
command
Generates PowerShell completion.

Version and help

Run these commands from any directory. See Overview for examples and flags.
command
Prints the installed version, commit, and build time.
command
Prints help for a command. You can also append --help to any command.

Global flags

These flags apply across command groups. See Overview for examples and flags.
string
Selects table or json for data commands. Some commands use their own output formats.
path
Selects a configuration file for this command.
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.