Developers

Environment and diagnostics

cademi env shows the settings the CLI is using and where each one comes from, and cademi doctor checks the configuration, the network, and the credentials. This page also lists every environment variable the CLI reads.

cademi env

cademi env
cademi env base_url
cademi env --json

cademi env prints one row per setting with its value and its source. With a setting name, it prints only the value, for use in scripts; an unknown name exits with code 2. --json prints an array of objects with name, value, source, and, when the value comes from an environment variable, variable. Secrets are never printed, only whether they are set and where.

For example, with CADEMI_API_KEY set and no saved profile:

NAME            VALUE                                          SOURCE
config_dir      /Users/you/Library/Application Support/cademi  default
profile         -                                              unset
base_url        https://api.cademi.com.br                      default
auth_mode       key (autonomous)                               env (CADEMI_API_KEY)
credential      set                                            env (CADEMI_API_KEY)
max_retries     3                                              default
max_retry_wait  60s                                            default
lang            en-US                                          env (LANG)
color           auto (on in a terminal)                        default
auto_update     on                                             default
update_channel  stable                                         default
update_url      https://cli.cademi.dev                         default
listen_secret   ephemeral per run                              unset
version         0.5.2                                          build
api_release     3.19.0                                         build
os_arch         darwin/arm64                                   build
executable      /Users/you/.cademi/bin/cademi                  build
install_method  script                                         build
SettingMeaning
config_dirDirectory of the configuration file and the update state.
profileProfile in use.
base_urlAPI URL of the requests.
auth_modehuman (OAuth) (the administrator's OAuth session) or key (autonomous) (credential only).
credentialWhether the secret is available: in autonomous mode, with the credential ID; in human mode, the OAuth session, with the administrator.
client_request_idThe value of CADEMI_CLIENT_REQUEST_ID, sent in the X-Client-Request-Id header. Shown only when it is set.
max_retries, max_retry_waitHow many times a request is retried, and the longest wait before a retry (CADEMI_MAX_RETRIES, CADEMI_MAX_RETRY_WAIT).
environmentproduction or sandbox, as saved in the profile. Shown only for saved profiles, and not when CADEMI_API_KEY is set.
platform (source profile)Your account's address, saved in the profile by cademi auth login --platform and reused by the next login in human mode. Shown only when the profile has one.
langLanguage requested for API messages.
colorWhether the CLI uses colors.
auto_update, update_channel, update_urlAutomatic updates, their channel, and where releases are downloaded from.
listen_secretWhere the signing secret of cademi listen comes from.
version, api_release, os_arch, executable, install_methodThe build of the CLI and where it is installed. os_arch is the operating system and architecture, such as darwin/arm64.

The source is one of flag, env (with the variable name), config (the configuration file), profile, keychain, build, default, or unset.

cademi bug reuses these settings: it opens a GitHub issue with them already filled in, without config_dir, executable, profile, credential, and platform, so you can report a bug in the CLI without copying them by hand. See Report a problem.

Precedence

When a setting can come from several places, the first one found wins:

  1. A command-line flag, such as --profile or --base-url.
  2. An environment variable, such as CADEMI_PROFILE or CADEMI_BASE_URL.
  3. The configuration file or the active profile.
  4. The built-in default.

CADEMI_API_KEY is the exception: when it is set, it replaces the credentials of every profile (Authentication). The API URL still follows the order above.

Environment variables

VariableEffect
CADEMI_API_KEYCredential secret for autonomous mode. Takes precedence over every profile, and the keychain is not used.
CADEMI_PROFILEProfile to use when the command has no --profile.
CADEMI_BASE_URLAPI URL, overriding the profile. --base-url takes precedence.
CADEMI_CONFIG_DIRConfiguration directory. Defaults to cademi inside the system configuration directory: ~/Library/Application Support/cademi on macOS, $XDG_CONFIG_HOME/cademi or ~/.config/cademi on Linux, and %AppData%\cademi on Windows.
CADEMI_LANGLanguage of API messages: pt, en, es, or fr, with or without a region (pt_BR.UTF-8 works). When it is not set, the CLI reads LC_ALL, LC_MESSAGES, and LANG, in that order, and uses the first one that is set. If that value is not one of these languages, the CLI sends no language preference and the API answers in en-US.
CADEMI_LISTEN_SECRETSigning secret of cademi listen --forward-to, instead of the one saved in the profile.
CADEMI_CLIENT_REQUEST_IDYour own identifier for the requests of a command, such as a job or run ID: 1 to 64 characters, using letters, digits, ., _, and -. The CLI sends it in the X-Client-Request-Id header of every request. The API returns it in the response and records it in the request log, as client_request_id in cademi integrations requests list. It does not replace the request_id the API assigns.
CADEMI_MAX_RETRIESHow many times the CLI retries a request (Writes, retries, and idempotency). Defaults to 3. 0 turns retries off.
CADEMI_MAX_RETRY_WAITLongest wait the API can ask for before a retry, as a number with a unit, such as 30s, 2m, or 1m30s. Defaults to 60s. A 429 that asks for a longer wait fails right away with exit code 7. A 500, 502, 503, or 504 that asks for a longer wait is retried after this limit.
CADEMI_DISABLE_AUTOUPDATEAny value turns off automatic updates.
CIAny value turns off automatic updates.
CADEMI_UPDATE_URLBase URL of a mirror for cademi update and automatic updates. Defaults to https://cli.cademi.dev. Signatures are verified the same way.
NO_COLORAny value turns off colors. TERM=dumb has the same effect.
CLAUDE_CONFIG_DIRClaude Code directory used by cademi skills, instead of ~/.claude. The skill goes in its skills/cademi-cli subdirectory.
XDG_CONFIG_HOMEBase of the configuration files that cademi mcp install changes: the OpenCode user file, and on Linux the VS Code user file. Defaults to ~/.config. On Linux, it also sets the default configuration directory (see CADEMI_CONFIG_DIR).

CADEMI_CLIENT_REQUEST_ID, CADEMI_MAX_RETRIES, and CADEMI_MAX_RETRY_WAIT apply to every command that calls the API except cademi auth login. When one of them has an invalid value, those commands exit with code 2 before sending any request, and cademi doctor reports it as a failed profile check.

The install scripts read their own variables, listed in Installation.

cademi doctor

cademi doctor
cademi doctor --json

cademi doctor runs a series of checks and prints one line per check, marked ✓ (ok), ! (warning), or ✗ (failure):

CheckWhat it verifies
configThe configuration file can be read, and how many profiles it has.
profileA profile or CADEMI_API_KEY is available, and the mode in use.
keychainThe profile's secrets can be read from the keychain.
networkThe API URL is reachable, with the latency and TLS version.
clockThe local clock is within 1 minute of the server's. A larger difference is a warning, because OAuth tokens and signatures may fail.
oauthIn human mode, the authorization server metadata is valid.
credentialIn autonomous mode, the credential is accepted, with its ID, name, environment, and status. In human mode, the access token is accepted by GET /capabilities, with the administrator, the account, and the environment.
api releaseThe server's API release compared with the release the CLI was built for. A newer server is a warning: update the CLI, and use cademi api for new operations in the meantime. An older server is also a warning, because some commands may not exist on it yet. A different major version is a failure.
deprecationsShown as a warning only when the API announces deprecated operations, with how many there are. See them with cademi account capabilities get --jq .deprecations.

A failed check that prevents the next ones, such as a missing profile or an unreachable API URL, ends the run. The command exits with code 1 when any check fails. With --json, it prints an array of objects with name, status (ok, warn, or fail), and detail.

On a machine without credentials:

✓ config         /Users/you/Library/Application Support/cademi/config.toml (0 profiles)
✗ profile        no profile configured: run `cademi auth login` or set CADEMI_API_KEY
Error: some checks failed

Debugging requests

--debug logs every HTTP request to standard error: method, URL, status code, duration, and request_id. Credentials and tokens are never logged. Include the request_id when you contact Cademí support about a call.

cademi --debug content products list

On this page