Skip to main content
bt is Braintrust’s command-line interface for working from the terminal. Use it to authenticate, select projects, manage Braintrust resources, run evaluations, query logs, and configure coding-agent tracing. Commands support both interactive use and automated workflows in scripts or CI.
To get started with the bt CLI, follow the CLI quickstart. If you’re moving from a version with bt auth commands, follow Migrate bt.

Authentication and profiles

bt can authenticate in three ways:
  • Environment API key: BRAINTRUST_API_KEY supplies an API key directly from the environment.
  • Saved OAuth profile: A reusable login created through browser-based Braintrust authentication.
  • Saved API key profile: An API key stored by bt for repeated use.
The CLI quickstart walks through configuring each authentication method and selecting an active organization and project. A profile is a saved login containing credentials and connection details for one Braintrust app URL. You can use one profile with every organization its credentials can access. Most people need only one profile. Add another when you sign in with different credentials or connect to a different Braintrust app URL. Run bt login to save a profile, bt profiles to list, rename, or delete profiles, and bt status --all to verify saved credentials. bt switch selects the active organization and project. When it authenticates with a saved profile, it also makes that profile active. Later commands use this context by default. Run bt status to see what’s active, or override the organization or project for one command with --org or --project. bt stores profile metadata locally and credentials in your system’s secure credential store when available. If secure storage is unavailable, it uses a local credentials file.

Credential precedence

When more than one credential source is present, bt makes two decisions in turn. First, whether to use an API key or a saved profile:
  1. Passing --profile or --prefer-profile on the command line makes bt use a saved profile and ignore BRAINTRUST_API_KEY.
  2. Otherwise, BRAINTRUST_API_KEY from the environment wins.
  3. Otherwise, bt uses a saved profile, selected by the rules below.
Then, when using a saved profile, which one:
  1. The --profile NAME flag.
  2. The BRAINTRUST_PROFILE environment variable.
  3. The profile saved by bt switch, if it matches the requested app URL.
  4. The only compatible profile for the app URL and organization, if exactly one is saved.
  5. An interactive picker, if several profiles are compatible and bt is running in an interactive terminal. In CI or other non-interactive environments, set BRAINTRUST_PROFILE or pass --profile to avoid an ambiguous-profile error.
Run bt status to see the active organization, project, and selected profile. Run bt status --all to verify saved profiles and report missing, expired, or invalid credentials.
Having a saved login is not the same as selecting one. Only the --profile or --prefer-profile flag suppresses BRAINTRUST_API_KEY. Setting BRAINTRUST_PROFILE does not, so an API key in the environment still wins over it.

Commands

Global flags

Most bt commands accept these global flags. Commands that only manage login state, such as bt login, accept the credential-related flags but not organization or project selection flags. After argument parsing, errors from commands run with --json use an error.message field. If the server returns structured details, they appear under error.details. By default, bt uses the authentication app URL for browser links, such as when opening a project. If your deployment uses a different address to access Braintrust in a browser, set --app-public-url so those links point to that address. This option requires bt v0.19.3 or later and does not change authentication or API requests.

Environment variables

These variables configure common CLI behavior and selected commands. Run bt <command> --help for that command’s complete flag and environment-variable mappings.
bt does not automatically load .env files. Set environment variables explicitly in your shell, through --env-file <PATH>, or with a tool like direnv before running bt commands.

Troubleshooting

Open a new shell. Ensure ~/.local/bin (or $XDG_BIN_HOME if set) is in your PATH.
On SSH, bt auto-detects and prints the auth URL instead of opening a browser. Use --no-browser to force this behavior. The OAuth callback times out after 5 minutes. On remote hosts, paste the final callback URL from your local browser if the localhost callback can’t be delivered.
Run bt profiles list to list saved profiles, or bt status --all to verify their credentials. Specify one with --profile or BRAINTRUST_PROFILE. If you recently migrated from a version with bt auth commands, see the CLI migration guide.
Run bt status to see the active organization and project and where that context was set.
Run bt status --all to verify saved profiles, inspect the configured context, and check whether BRAINTRUST_API_KEY is overriding saved profiles. The command reports the override but does not validate the environment API key. Unset it, pass --profile <NAME>, or pass --prefer-profile to use a saved profile instead. See Credential precedence for the full order.
Run bt login --refresh --profile <name> to refresh the expired OAuth profile. If refresh fails, run bt login --oauth --profile <name> to authenticate that profile again. These commands replaced bt auth refresh and bt auth login in v0.16.0. See the CLI migration guide.
bt stores credentials in your system’s secure credential store:
  • macOS: system keychain (via security)
  • Linux: libsecret / secret-tool if available; otherwise a 0600-permission plaintext file
  • Windows: local credentials file (keychain integration not yet implemented)
If your installed version does not recognize bt update, run bt self update once. Versions before v0.16.0 used the older command. See bt update for package-manager installs and Windows upgrades.
macOS and Linux:
Windows (PowerShell):