Skip to main content
The CometAPI CLI reads settings from a TOML config file, environment variables, and command-line flags. When the same setting is available from multiple sources, the priority order is: CLI flags > config file > environment variables > defaults

Config file

Location: ~/.config/cometapi/config.toml Run the setup wizard to create the config file interactively:
cometapi init
Or manage individual settings with the config subcommand:
# View current configuration
cometapi config show

# Set a value
cometapi config set api_key sk-...

# Remove a value
cometapi config unset api_key

# Show the config file path
cometapi config path

Available settings

Config keyEnvironment variableDescription
api_keyCOMETAPI_KEYAPI key (required for all commands)
access_tokenCOMETAPI_ACCESS_TOKENAccess token for account-level commands
base_urlCOMETAPI_BASE_URLAPI base URL (default: https://api.cometapi.com/v1)
default_modelCOMETAPI_DEFAULT_MODELDefault model for chat (fallback: gpt-5.4)
output_formatDefault output format: table, json, yaml, csv, or markdown

Credentials

The CLI uses two types of credentials:

API key

Required for all commands. The API key authenticates requests to the CometAPI model endpoints. Create an API key at CometAPI Console → API Keys. Set it in one of these ways:
export COMETAPI_KEY="<COMETAPI_KEY>"

Access token

Optional. The access token is required for account-level commands: account, stats, tokens, logs, and tasks. Generate an access token at CometAPI Console → Personal Settings. Set it in one of these ways:
export COMETAPI_ACCESS_TOKEN="your-access-token"

Security

The CLI applies the following security practices:
  • API keys and access tokens are never logged or displayed in full. Only the last 4 characters are shown in diagnostics output.
  • The config file is created with restrictive permissions (0600) — readable only by the file owner.
  • Credentials should never be committed to version control. Add the config file path to your .gitignore if applicable.
You are responsible for all usage and charges incurred with your API keys. Keep your keys secure and rotate them if you suspect unauthorized access.

Troubleshooting

ErrorSolution
API key not configuredRun cometapi init or set the COMETAPI_KEY environment variable
Connection failedRun cometapi doctor to diagnose connectivity
Access token not configuredOnly needed for account/stats/tokens/logs/tasks. Run cometapi init to add one