cometapi-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: cometapi-cli
3
+ Version: 0.1.0
4
+ Summary: CometAPI CLI — official command-line interface for the CometAPI AI gateway
5
+ Project-URL: Homepage, https://github.com/CometAPI/cometapi-cli
6
+ Project-URL: Repository, https://github.com/CometAPI/cometapi-cli
7
+ Project-URL: Documentation, https://docs.cometapi.com
8
+ Project-URL: Changelog, https://github.com/CometAPI/cometapi-cli/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/CometAPI/cometapi-cli/issues
10
+ Author-email: CometAPI <support@cometapi.com>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: ai,api-gateway,chat,cli,cometapi,llm,openai,streaming
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Internet
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: prompt-toolkit>=3.0
29
+ Requires-Dist: pyyaml>=6.0
30
+ Requires-Dist: rich>=13.0
31
+ Requires-Dist: tomli-w>=1.0
32
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
33
+ Requires-Dist: typer>=0.12
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.8; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # CometAPI CLI
40
+
41
+ [![PyPI](https://img.shields.io/pypi/v/cometapi-cli)](https://pypi.org/project/cometapi-cli/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/cometapi-cli)](https://pypi.org/project/cometapi-cli/)
43
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
44
+
45
+ > **Official command-line interface for [CometAPI](https://cometapi.com)** — 500+ AI Model API, All In One API.
46
+
47
+ 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.
48
+
49
+ **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
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install cometapi-cli
55
+ ```
56
+
57
+ ```bash
58
+ pipx install cometapi-cli # isolated environment
59
+ uv tool install cometapi-cli # uv
60
+ ```
61
+
62
+ **Prerequisites**: Python 3.10+ · [Get your API key](https://www.cometapi.com/console/token)
63
+
64
+ ## Quick Start
65
+
66
+ ```bash
67
+ # 1. Run the setup wizard
68
+ cometapi init
69
+
70
+ # 2. Chat with a model
71
+ cometapi chat "Explain quantum computing in one sentence"
72
+
73
+ # 3. List available models
74
+ cometapi models --search gpt --limit 10
75
+ ```
76
+
77
+ Or configure manually:
78
+
79
+ ```bash
80
+ export COMETAPI_KEY="your-api-key" # https://www.cometapi.com/console/token
81
+ export COMETAPI_ACCESS_TOKEN="your-access-token" # https://www.cometapi.com/console/personal (optional)
82
+ ```
83
+
84
+ ## Commands
85
+
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `chat [MESSAGE]` | Send a message or start interactive chat REPL (no args) |
89
+ | `models` | List available models (`--search`, `--limit`) |
90
+ | `balance` | Show account balance |
91
+ | `account` | Show account profile (requires access token) |
92
+ | `stats` | Show usage statistics (requires access token) |
93
+ | `tokens` | List and search your API keys (requires access token) |
94
+ | `logs` | Show usage logs with filters (requires access token) |
95
+ | `tasks` | Show async task logs (requires access token) |
96
+ | `init` | Interactive setup wizard |
97
+ | `doctor` | Run diagnostics and health checks |
98
+ | `repl` | Start interactive command shell |
99
+ | `config` | Manage CLI configuration (`show`, `set`, `unset`, `path`) |
100
+
101
+ ### Chat
102
+
103
+ ```bash
104
+ cometapi chat "Hello!" # Streaming
105
+ cometapi chat "Summarize this" --model claude-sonnet-4-6 --system "Be concise"
106
+ cometapi chat "Hello" --json # JSON output
107
+ cometapi chat # Interactive REPL
108
+ ```
109
+
110
+ **Chat REPL commands**: `/model`, `/system`, `/clear`, `/history`, `/save`, `/tokens`, `/help`, `/exit`
111
+
112
+ ### Models
113
+
114
+ ```bash
115
+ cometapi models # List all
116
+ cometapi models --search claude # Search by name
117
+ cometapi models --limit 5 --json # JSON output
118
+ ```
119
+
120
+ ### Logs
121
+
122
+ ```bash
123
+ cometapi logs # Recent usage logs
124
+ cometapi logs --model gpt-5.4 # Filter by model
125
+ cometapi logs --start 2026-04-01 # Date filter
126
+ cometapi logs --export > usage.csv # CSV export
127
+ cometapi logs --limit 50 --json # JSON output
128
+ ```
129
+
130
+ ### Tasks
131
+
132
+ ```bash
133
+ cometapi tasks # Recent task logs
134
+ cometapi tasks --platform suno # Filter by platform
135
+ cometapi tasks --status SUCCESS # Filter by status
136
+ cometapi tasks --json # JSON output
137
+ ```
138
+
139
+ ### Output Formats
140
+
141
+ All data commands support `--json` or `--format`:
142
+
143
+ ```bash
144
+ cometapi models --json
145
+ cometapi models --format yaml
146
+ cometapi stats --format csv
147
+ cometapi account --format markdown
148
+ ```
149
+
150
+ ### Shell Completion
151
+
152
+ ```bash
153
+ cometapi --install-completion
154
+ ```
155
+
156
+ ## Configuration
157
+
158
+ Config file: `~/.config/cometapi/config.toml`
159
+
160
+ ```bash
161
+ cometapi config show # View current config
162
+ cometapi config set api_key sk-… # Set a value
163
+ cometapi config unset api_key # Remove a value
164
+ cometapi config path # Show config file path
165
+ ```
166
+
167
+ **Priority**: CLI flags > config file > environment variables > defaults
168
+
169
+ | Key | Env Variable | Description |
170
+ |-----|-------------|-------------|
171
+ | `api_key` | `COMETAPI_KEY` | API key (required) |
172
+ | `access_token` | `COMETAPI_ACCESS_TOKEN` | Access token for account commands |
173
+ | `base_url` | `COMETAPI_BASE_URL` | API base URL |
174
+ | `default_model` | `COMETAPI_DEFAULT_MODEL` | Default model (fallback: `gpt-5.4`) |
175
+ | `output_format` | — | Default output format (`table`, `json`, `yaml`, `csv`, `markdown`) |
176
+
177
+ ## Agent Integration
178
+
179
+ CometAPI CLI is designed to be agent-friendly:
180
+
181
+ - All data commands support `--json` for structured, machine-readable output
182
+ - Deterministic exit codes (0=success, 64=config missing, 77=auth error, 69=service unavailable)
183
+ - Errors on stderr, data on stdout
184
+ - See [SKILL.md](SKILL.md) for the full agent skill definition
185
+
186
+ ## Development
187
+
188
+ ```bash
189
+ git clone https://github.com/CometAPI/cometapi-cli.git
190
+ cd cometapi-cli
191
+ uv sync --extra dev
192
+
193
+ uv run pytest -v # tests
194
+ uv run ruff check src/ tests/ # lint
195
+ uv run cometapi --version # verify
196
+ ```
197
+
198
+ <details>
199
+ <summary>Without uv (pip)</summary>
200
+
201
+ ```bash
202
+ git clone https://github.com/CometAPI/cometapi-cli.git
203
+ cd cometapi-cli
204
+ pip install -e ".[dev]"
205
+ pytest -v
206
+ ```
207
+
208
+ </details>
209
+
210
+ ## Security
211
+
212
+ - API keys and access tokens are **never** logged or displayed in full — only the last 4 characters are shown
213
+ - Config files are stored with restrictive permissions (`0600`)
214
+ - Credentials should **never** be committed to version control
215
+ - Create credentials at: [API Key](https://www.cometapi.com/console/token) · [Access Token](https://www.cometapi.com/console/personal)
216
+ - **Disclaimer**: You are responsible for all usage and charges incurred with your API keys
217
+
218
+ ## Troubleshooting
219
+
220
+ | Error | Solution |
221
+ |-------|----------|
222
+ | `API key not configured` | Run `cometapi init` or set `COMETAPI_KEY` env var |
223
+ | `Connection failed` | Run `cometapi doctor` to diagnose connectivity |
224
+ | `Access token not configured` | Only needed for `account`/`stats` commands — run `cometapi init` to add one |
225
+
226
+ ## License
227
+
228
+ MIT
@@ -0,0 +1,27 @@
1
+ cometapi_cli/__init__.py,sha256=lv0NDx348LemOymOagNAd60v2BIPG3JVB5L7unHswJU,92
2
+ cometapi_cli/app.py,sha256=0rUJ975zKApr5Htr1pVoAUgFUi0TXqYVFV8Z6MEUG6Y,2743
3
+ cometapi_cli/client.py,sha256=4JkMSrjWwAQV8tmlwplZQ75gzt3zHno8ASKLgMCpYkU,9658
4
+ cometapi_cli/config.py,sha256=oJXQidKCOsKNYPnE8OfLLoOfsv0MSZEDICB6VShJRSA,3307
5
+ cometapi_cli/console.py,sha256=HFSU1gL9SDmwjBvgVgDraoaU50oTwCRpsAwYXYlVP9o,163
6
+ cometapi_cli/constants.py,sha256=EV2i-ag4ss1xGrU1CLiF9iPz8ggzNm4-U3wpYCC2pys,1601
7
+ cometapi_cli/errors.py,sha256=MQ3VXefVhdIFa4uUmoLf_O5d1EFuu9PfGYrBGuq-mSA,3703
8
+ cometapi_cli/formatters.py,sha256=QrXpsQHRYiJ49Rwz_7dOMoKxCcnRPumZMrxH21ZQaMw,4573
9
+ cometapi_cli/main.py,sha256=4NmO8MAAc_H30hahT6VNrdGdlaFlQ99AixKcRV5iDXE,168
10
+ cometapi_cli/commands/__init__.py,sha256=mihzLmD4ADkH9WnCBP2p1fn95lU3GyzTliAJ1XL5Ngg,29
11
+ cometapi_cli/commands/account.py,sha256=OGPRaNwiQ0IdSajiR1XV0NAYSYftvK4tZVYBCNMjQWQ,1222
12
+ cometapi_cli/commands/balance.py,sha256=xGvHu3LXMqfcWUHRj4hHkV_NSJG_Mdzj0RTV-TTIG2s,1798
13
+ cometapi_cli/commands/chat.py,sha256=4XqzaQzKwU00YYR0RAMYcjnqZKU3vKmUFDZxe2ml854,3856
14
+ cometapi_cli/commands/chat_repl.py,sha256=b9lkYnbbaOb0AlSpRcq3wWHmnhtTXvaqeJiUImsMEBY,8176
15
+ cometapi_cli/commands/config_cmd.py,sha256=W_TAHlti9AbeSdvEiXA9dy3p5-ckXm80HHzwJ8I2d3g,5953
16
+ cometapi_cli/commands/doctor.py,sha256=Ue8uDi1TaZ1BJhIwveOuZhhyBw0Hob4XEerS6WBoYkw,5302
17
+ cometapi_cli/commands/logs.py,sha256=O4tdtazEgWP2pl0T0a4oDsi1aV6mVkxR-BH_V-2ZZPM,11377
18
+ cometapi_cli/commands/models.py,sha256=pUblCx3HBzOyskQJ7cfgxa-SCEHX73pVjSxHckEEr0A,1297
19
+ cometapi_cli/commands/repl.py,sha256=foKPox6Hn3iEjh_nftnRWpvVjsNx0ZngSPhKDbKpViA,4295
20
+ cometapi_cli/commands/stats.py,sha256=LfmmQX5iTJkkEvcg-NOjQRRjUXueUazMSnwz9YwazLs,1353
21
+ cometapi_cli/commands/tasks.py,sha256=9gArl6qOhyG0T47KNdOjx44-vKQiI2cf1CYQQiW_k9k,4539
22
+ cometapi_cli/commands/tokens.py,sha256=H74PFD5nYiwZrdP1PHxRevyfWtzIttfORundudCPjOc,2984
23
+ cometapi_cli-0.1.0.dist-info/METADATA,sha256=ckfVsPTkEUfWW4zbcAsQC7nwAgTJF4m5dYZOLVjxqmQ,7637
24
+ cometapi_cli-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
25
+ cometapi_cli-0.1.0.dist-info/entry_points.txt,sha256=xoiE2ZVNNWXTq0JRBtzC8hJ2JkdKuaBNz_fEd8OJpLs,50
26
+ cometapi_cli-0.1.0.dist-info/licenses/LICENSE,sha256=-rBwHQzkmLbty07abmGvQvsRrvDeEQUkPDhNJfTcjdE,1065
27
+ cometapi_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ cometapi = cometapi_cli.app:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CometAPI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.