Skip to main content

CometAPI CLI — official command-line interface for the CometAPI AI gateway

Project description

CometAPI CLI

PyPI Python License: MIT

Official command-line interface for CometAPI — 500+ AI Model API, All In One API.

Access 500+ AI models at low cost, directly from the terminal. Chat, search models, check usage, and manage your account — all through a single API key.

Features: multi-model chat (streaming + REPL) · model search · account & usage stats · diagnostics · multi-format output (table/JSON/YAML/CSV/Markdown) · agent-native design · TOML config · shell completion

Installation

pip install cometapi-cli
pipx install cometapi-cli    # isolated environment
uv tool install cometapi-cli  # uv

Prerequisites: Python 3.10+ · Get your API key

Quick Start

# 1. Run the setup wizard
cometapi init

# 2. Chat with a model
cometapi chat "Explain quantum computing in one sentence"

# 3. List available models
cometapi models --search gpt --limit 10

Or configure manually:

export COMETAPI_KEY="your-api-key"               # https://www.cometapi.com/console/token
export COMETAPI_ACCESS_TOKEN="your-access-token"  # https://www.cometapi.com/console/personal (optional)

Commands

Command Description
chat [MESSAGE] Send a message or start interactive chat REPL (no args)
models List available models (--search, --limit)
balance Show account balance
account Show account profile (requires access token)
stats Show usage statistics (requires access token)
tokens List and search your API keys (requires access token)
logs Show usage logs with filters (requires access token)
tasks Show async task logs (requires access token)
init Interactive setup wizard
doctor Run diagnostics and health checks
repl Start interactive command shell
config Manage CLI configuration (show, set, unset, path)

Chat

cometapi chat "Hello!"                                          # Streaming
cometapi chat "Summarize this" --model claude-sonnet-4-6 --system "Be concise"
cometapi chat "Hello" --json                                    # JSON output
cometapi chat                                                   # Interactive REPL

Chat REPL commands: /model, /system, /clear, /history, /save, /tokens, /help, /exit

Models

cometapi models                        # List all
cometapi models --search claude        # Search by name
cometapi models --limit 5 --json       # JSON output

Logs

cometapi logs                          # Recent usage logs
cometapi logs --model gpt-5.4         # Filter by model
cometapi logs --start 2026-04-01       # Date filter
cometapi logs --export > usage.csv     # CSV export
cometapi logs --limit 50 --json        # JSON output

Tasks

cometapi tasks                         # Recent task logs
cometapi tasks --platform suno         # Filter by platform
cometapi tasks --status SUCCESS        # Filter by status
cometapi tasks --json                  # JSON output

Output Formats

All data commands support --json or --format:

cometapi models --json
cometapi models --format yaml
cometapi stats --format csv
cometapi account --format markdown

Shell Completion

cometapi --install-completion

Configuration

Config file: ~/.config/cometapi/config.toml

cometapi config show              # View current config
cometapi config set api_key sk-…  # Set a value
cometapi config unset api_key     # Remove a value
cometapi config path              # Show config file path

Priority: CLI flags > config file > environment variables > defaults

Key Env Variable Description
api_key COMETAPI_KEY API key (required)
access_token COMETAPI_ACCESS_TOKEN Access token for account commands
base_url COMETAPI_BASE_URL API base URL
default_model COMETAPI_DEFAULT_MODEL Default model (fallback: gpt-5.4)
output_format Default output format (table, json, yaml, csv, markdown)

Agent Integration

CometAPI CLI is designed to be agent-friendly:

  • All data commands support --json for structured, machine-readable output
  • Deterministic exit codes (0=success, 64=config missing, 77=auth error, 69=service unavailable)
  • Errors on stderr, data on stdout
  • See SKILL.md for the full agent skill definition

Development

git clone https://github.com/CometAPI/cometapi-cli.git
cd cometapi-cli
uv sync --extra dev

uv run pytest -v              # tests
uv run ruff check src/ tests/ # lint
uv run cometapi --version     # verify
Without uv (pip)
git clone https://github.com/CometAPI/cometapi-cli.git
cd cometapi-cli
pip install -e ".[dev]"
pytest -v

Security

  • API keys and access tokens are never logged or displayed in full — only the last 4 characters are shown
  • Config files are stored with restrictive permissions (0600)
  • Credentials should never be committed to version control
  • Create credentials at: API Key · Access Token
  • Disclaimer: You are responsible for all usage and charges incurred with your API keys

Troubleshooting

Error Solution
API key not configured Run cometapi init or set COMETAPI_KEY env var
Connection failed Run cometapi doctor to diagnose connectivity
Access token not configured Only needed for account/stats commands — run cometapi init to add one

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cometapi_cli-0.1.0.tar.gz (100.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cometapi_cli-0.1.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file cometapi_cli-0.1.0.tar.gz.

File metadata

  • Download URL: cometapi_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 100.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cometapi_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cdd735ae94298d3830b17b5b9ce89b542099ffedc311b51b7a55e7c6dc901947
MD5 ea4e076788bc02b5c26453b77093dd73
BLAKE2b-256 e138ff3cc62c2ed72c09287957fcaaacd22d4b29bb4c3b6a1c2a5976905d14cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for cometapi_cli-0.1.0.tar.gz:

Publisher: publish.yml on cometapi-dev/cometapi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cometapi_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cometapi_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cometapi_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc14dc2ddaaab7b361ac947e8037b2f6ff65ba9a59c106869dca2fefddf854f5
MD5 7e2484f362e39e35b59d4321bcc803e2
BLAKE2b-256 c194cbadfb2d928f9a2a1dc69592e4e73e402be1070995c46dc6e94c6ea080fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for cometapi_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on cometapi-dev/cometapi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page