Skip to main content
Configure the CLI for your deployment and choose how commands return their results. Settings and saved browser credentials live in separate files.

Inspect configuration

Use these commands to inspect local settings.

Configuration file path

Print the configuration file path.
The default path is ~/.config/costgraph/config.toml.

Effective settings

Print the effective settings and their sources.
The table identifies each setting, its value, and whether it comes from the environment, a file, or a default. API-key values are masked.

One setting

To read one setting, pass its name.

Set a file value

Create a configuration file with defaults if you do not already have one.
The command refuses to overwrite an existing file. Its --force option replaces that file with defaults. The following command changes the saved default output format.
An environment variable still overrides the corresponding file value. Use costgraph config list to check which value applies.

Configure a self-hosted deployment

Set COSTGRAPH_API_URL before signing in or creating an API key. Use your deployment’s API address, rather than its dashboard address.
A saved browser session belongs to the deployment where you approved it. Sign out before switching an existing installation to another deployment, then sign in to that deployment. The management API and pricing service have separate settings. Changing COSTGRAPH_API_URL does not change COSTGRAPH_PRICING_URL.

Supported settings

The following table maps file settings to their environment variables. For a setting with a command-line flag, the flag takes precedence over its environment variable and file value. For example, -o table overrides COSTGRAPH_OUTPUT=json. There is no global --api-url flag. Use COSTGRAPH_API_KEY or your CI secret store instead of saving a key in the configuration file. A saved browser session takes precedence over the API key. Refer to Credentials for how the CLI chooses its credential.

Select configuration and credential files

The following options control where the CLI reads its files. If these directory overrides are absent, the CLI uses ~/.config/costgraph. Credentials default to credentials.toml in that directory. Changing --config alone does not select a different saved browser session. To use a separate configuration file for a command, pass its path.

Choose an output format

Data commands such as cost get, tags list, and recommendations list support table and json output. Add -o json for structured data.
JSON output disables the interactive cost browser. Supply the arguments and flags the command needs. A missing value can cause an error rather than a prompt. Local commands such as config path and config get print a path or value. Completion commands print a shell script. Cost-estimate commands also have format-specific options. Check the Command reference rather than assuming every command returns JSON. During sign-in and key approval, browser instructions go to standard error so a script can capture the JSON result from standard output. Refer to Capture the key in a script.

Generate shell completion

The CLI generates completion scripts for Bash, fish, PowerShell, and zsh. The following command writes a zsh completion script to a local file.
This creates the file but does not install it into your shell. Run costgraph completion zsh --help for the instructions for your system. Replace zsh with bash, fish, or powershell for the other supported scripts.

Disable usage telemetry

To disable CLI telemetry for the current shell, set the following variable.
You can also set telemetry.enabled to false in the file. DO_NOT_TRACK=true disables telemetry even when another setting enables it.

Check the installed release

Run the following command to print the installed version.
If a documented command or flag is missing, compare that version with the release you intended to install. Refer to Install and sign in for upgrade and PATH checks.

Command reference

Commands are shown without the costgraph prefix. Add --help for the complete flag list.

Read local settings

Run each command with the costgraph prefix.
command
Prints the configuration file path.
command
Lists settings and their sources. Masks API key values.
command
Prints one setting as a value.

Write local settings

These commands change the local configuration file.
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 and version

Completion commands print scripts. Follow each command’s --help to install its output.
command
Generates Bash completion. Requires bash-completion.
command
Generates zsh completion.
command
Generates fish completion.
command
Generates PowerShell completion.
command
Prints the version, commit, and build time.