Skip to main content

Commands overview

CommandDescriptionAuth
chat [MESSAGE]Send a message or start interactive REPLAPI key
modelsList and search available modelsAPI key
balanceShow account balanceAPI key (or access token)
accountShow account profileAccess token
statsShow usage statisticsAccess token
tokensList and search your API keysAccess token
logsBrowse usage logs with filtersAccess token
tasksShow async task logsAccess token
initInteractive setup wizard
doctorRun diagnostics and health checksAPI key
configManage CLI configuration
replStart interactive command shellAPI key
Commands marked Access token require the COMETAPI_ACCESS_TOKEN environment variable or the access_token config key. See the configuration guide for details.

Chat

Send a single message or start the multi-turn interactive REPL.
# Single message (streaming by default)
cometapi chat "Explain quantum computing in one sentence"

# Override model and add a system prompt
cometapi chat "Summarize this" --model claude-sonnet-4-6 --system "Be concise"

# Disable streaming
cometapi chat "Hello" --no-stream

# JSON output (full API response)
cometapi chat "Hello" --json

# Interactive REPL (omit message)
cometapi chat
OptionShortDescription
--model-mModel to use (default: from config)
--system-sSystem prompt
--temperature-tSampling temperature (0.0–2.0)
--max-tokensMax tokens in response
--stream/--no-streamEnable or disable streaming (default: stream)
--format-fOutput format
--jsonOutput as JSON

Models

List available models with optional search and limit.
# List all models
cometapi models

# Search by keyword
cometapi models --search gemini

# Limit results and output as JSON
cometapi models --search gpt --limit 10 --json
OptionShortDescription
--search-sFilter models by keyword
--limit-lMaximum number of results
--format-fOutput format
--jsonOutput as JSON

Balance

Show your CometAPI account balance.
# Default: account-level balance (falls back to per-key billing)
cometapi balance

# Force account-level view
cometapi balance --source account

# Force API key billing view
cometapi balance --source key

# JSON output
cometapi balance --json
OptionShortDescription
--source-sData source: account (full account) or key (current API key).
--format-fOutput format
--jsonOutput as JSON

Account

Show your account profile. Requires an access token.
cometapi account
cometapi account --json
OptionShortDescription
--format-fOutput format
--jsonOutput as JSON

Stats

Show usage statistics for the current month. Requires an access token.
cometapi stats
cometapi stats --json
Output includes: request count, usage amount, success rate, and predicted days of balance remaining.
OptionShortDescription
--format-fOutput format
--jsonOutput as JSON

Tokens

List and search your API keys. Requires an access token.
# List API keys (paginated)
cometapi tokens

# Search by keyword
cometapi tokens --search raycast

# JSON output
cometapi tokens --json
OptionShortDescription
--search-sSearch keyword
--page-pPage number
--page-sizeResults per page
--format-fOutput format
--jsonOutput as JSON

Logs

Browse usage logs with filters. Requires an access token.
# Recent logs
cometapi logs

# Filter by model
cometapi logs --model gpt-5.4

# Filter by date range
cometapi logs --start 2026-04-01 --end 2026-04-14

# Filter by log type
cometapi logs --type consume

# Export as CSV
cometapi logs --export > usage.csv

# JSON output with limit
cometapi logs --limit 50 --json
OptionShortDescription
--model-mFilter by model ID
--token-nameFilter by API key name
--type-tLog type: consume, topup, error, refund, system, manage
--startStart date (YYYY-MM-DD)
--endEnd date (YYYY-MM-DD)
--group-gFilter by group
--limit-lMax number of entries
--page-pPage number
--page-sizeResults per page
--exportOutput as CSV to stdout
--format-fOutput format
--jsonOutput as JSON

Tasks

Show async task logs for platforms such as Suno, Midjourney, Luma, and Kling. Requires an access token.
# Recent tasks
cometapi tasks

# Filter by platform
cometapi tasks --platform suno

# Filter by status
cometapi tasks --status SUCCESS

# JSON output
cometapi tasks --json
OptionShortDescription
--platformFilter by platform name
--statusFilter by status
--limit-lMax number of entries
--format-fOutput format
--jsonOutput as JSON

Doctor

Run diagnostics to verify CLI configuration and API connectivity.
cometapi doctor
cometapi doctor --json
The doctor checks:
  • Config file existence and readability
  • API key availability and source (config, env, or missing)
  • Access token availability
  • Network connectivity to the CometAPI endpoint
  • API authentication validity
OptionShortDescription
--format-fOutput format
--jsonOutput as JSON

Config

Manage CLI configuration stored in ~/.config/cometapi/config.toml.
# Show current config
cometapi config show

# Set a value
cometapi config set api_key sk-...
cometapi config set default_model claude-sonnet-4-6
cometapi config set output_format json

# Remove a value
cometapi config unset api_key

# Show config file path
cometapi config path
See the configuration guide for all available keys.

Init

Run the interactive setup wizard to configure your API key and access token.
cometapi init
The wizard writes settings to ~/.config/cometapi/config.toml.

Repl

Start a full interactive command shell where you can run any CLI command without the cometapi prefix.
cometapi repl

Output formats

All data commands support --json or --format:
cometapi models --json
cometapi models --format yaml
cometapi stats --format csv
cometapi account --format markdown
FormatDescription
tableRich table in the terminal (default)
jsonJSON output
yamlYAML output
csvComma-separated values
markdownMarkdown table
Set a default format for all commands via config:
cometapi config set output_format json

Shell completion

Install shell completion for tab-complete support:
cometapi --install-completion
Supported shells: Bash, Zsh, Fish.

Exit codes

CodeMeaning
0Success
1General error
2Invalid arguments
64Configuration missing
69Service unavailable
77Authentication error