Environment variables
The Infracost CLI reads a number of environment variables to customize its behavior. Most settings are also available as flags on individual commands; flags take precedence over environment variables, which take precedence over values stored in your infracost.yml.
Run infracost <command> --help to see the flags for a specific command, and infracost doctor to verify which configuration sources are currently active.
Authentication
INFRACOST_CLI_AUTHENTICATION_TOKEN
A service account or personal access token used to authenticate non-interactive CLI runs (e.g. CI/CD). When set, the CLI skips the browser-based login flow.
For local development, prefer running infracost auth login once — the resulting token is cached and reused.
Organization
INFRACOST_CLI_ORG
Equivalent to the global --org flag. Sets the organization slug or ID that the command runs against. If unset, the CLI uses the org saved by infracost org switch.
Output and logging
INFRACOST_CLI_LOG_LEVEL
Controls log verbosity. Common values: debug, info, warn (default), error. Setting this to debug is the most useful first step when troubleshooting. Equivalent to the --log-level flag.
INFRACOST_CLI_LOG_JSON
Set to true to emit logs and command results as JSON. Equivalent to the global --json flag.
INFRACOST_CLI_LLM
Set to true to emit command results in a compact, token-efficient format intended for piping into an LLM. Equivalent to the global --llm flag.
Currency
INFRACOST_CLI_CURRENCY
The ISO 4217 currency code that prices should be converted to (e.g. USD, EUR, GBP). Cloud vendors publish prices in USD; the CLI converts them at the current exchange rate. Equivalent to the --currency flag on infracost scan and infracost price.
You can also set currency: <code> in your infracost.yml, which takes precedence over both this environment variable and any organization default.
Local cache
Scan results are cached locally so subsequent infracost inspect queries are instant.
INFRACOST_CLI_CACHE_DIRECTORY
Override the directory where scan results are cached. Defaults to a per-user location under your OS's standard config directory.
INFRACOST_CLI_CACHE_TTL
How long cached scan results remain valid. Accepts any Go duration string (e.g. 30m, 1h, 24h). Defaults to 1h.
Terraform-related variables
The CLI honors the standard Terraform environment variables such as TF_CLI_CONFIG_FILE, TF_WORKSPACE, and TF_VAR_*. Use them the same way you would when running Terraform directly.
For private module access (Terraform Cloud, GitLab, JFrog, etc.) use the terraform.defaults.cloud and terraform.defaults.spacelift blocks in your infracost.yml — see Terraform private modules.