@aexhq/cli 0.45.0 → 0.47.0
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.
- package/README.md +43 -28
- package/package.json +2 -2
- package/src/index.mjs +6 -3
package/README.md
CHANGED
|
@@ -1,39 +1,54 @@
|
|
|
1
1
|
# Aex CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Manage your Aex API keys, account and usage from the terminal. To run an agent, use the
|
|
4
|
+
[SDK quickstart](https://aex.dev/docs).
|
|
5
|
+
|
|
6
|
+
## Get started
|
|
7
|
+
|
|
8
|
+
Requires Node.js 22 or newer:
|
|
5
9
|
|
|
6
10
|
```sh
|
|
7
|
-
npm install -g @aexhq/cli@0.
|
|
11
|
+
npm install -g @aexhq/cli@0.47.0
|
|
8
12
|
aex login
|
|
9
13
|
aex keys create "My application"
|
|
10
|
-
aex keys list
|
|
11
|
-
aex keys rename KEY_ID "New name"
|
|
12
|
-
aex keys revoke KEY_ID
|
|
13
|
-
aex account
|
|
14
|
-
aex billing
|
|
15
|
-
aex usage
|
|
16
|
-
aex docs
|
|
17
|
-
aex logout
|
|
18
14
|
```
|
|
19
15
|
|
|
20
|
-
`login` opens your browser
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
`login` opens your browser. Sign in, confirm the account, and return to the terminal on the same
|
|
17
|
+
computer. Save the new key's token as `AEX_API_KEY` in your application's server environment.
|
|
18
|
+
The secret is shown only once.
|
|
19
|
+
|
|
20
|
+
## Common commands
|
|
21
|
+
|
|
22
|
+
| Task | Command |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| List keys | `aex keys list` |
|
|
25
|
+
| Rename a key | `aex keys rename KEY_ID "New name"` |
|
|
26
|
+
| Revoke a key | `aex keys revoke KEY_ID` |
|
|
27
|
+
| Read account details | `aex account` |
|
|
28
|
+
| Check credits, prices and limits | `aex billing` |
|
|
29
|
+
| Read account usage | `aex usage` |
|
|
30
|
+
| Read one session's usage | `aex usage SESSION_ID` |
|
|
31
|
+
| Open the docs | `aex docs` |
|
|
32
|
+
| Sign out | `aex logout` |
|
|
33
|
+
|
|
34
|
+
Results are JSON on stdout; errors and login progress go to stderr. Account logins expire after
|
|
35
|
+
seven days; run `aex login` again. Use `--no-browser` to print the login URL instead.
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
token is returned once. Existing keys expose only their metadata and prefix.
|
|
28
|
-
`billing` reports preview or prepaid status, available and reserved credits, prices and the monthly
|
|
29
|
-
spend limit. `billing ledger`, `billing topups` and `billing refunds` show account history.
|
|
30
|
-
`billing set PRICEBOOK MICRO_USD` accepts the offered prices and sets the monthly limit.
|
|
31
|
-
`billing topup CENTS KEY` returns a Stripe Checkout URL; `billing refund TOPUP CENTS KEY`
|
|
32
|
-
requests return of unused credits. Reuse the operation key for the same payment intent.
|
|
37
|
+
## Billing
|
|
33
38
|
|
|
39
|
+
`aex billing ledger`, `aex billing topups` and `aex billing refunds` show account history.
|
|
40
|
+
`aex billing set PRICEBOOK MICRO_USD` accepts the offered prices and sets a monthly limit.
|
|
41
|
+
One dollar is 1,000,000 micro-USD.
|
|
42
|
+
|
|
43
|
+
`aex billing topup CENTS KEY` returns a Checkout URL; `aex billing refund TOPUP CENTS KEY`
|
|
44
|
+
requests a refund of unused credits. Reuse the same operation key when recovering the same
|
|
45
|
+
payment request. See [billing](https://github.com/aexhq/aex/blob/main/docs/billing.md).
|
|
46
|
+
|
|
47
|
+
## Automation and configuration
|
|
48
|
+
|
|
49
|
+
Use `AEX_ACCOUNT_TOKEN` for account automation; a workload API key cannot manage other keys.
|
|
34
50
|
The credential file is `~/.aex/account.json` on Unix or `%LOCALAPPDATA%/.aex/account.json`
|
|
35
|
-
on Windows
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
selects the matching login website for a self-hosted installation.
|
|
51
|
+
on Windows. `AEX_CONFIG_DIR` overrides the directory.
|
|
52
|
+
|
|
53
|
+
For self-hosting, `AEX_API_URL` or `--api-url` selects the API and `--site-url` selects its login
|
|
54
|
+
website. Stored credentials are bound to their API origin.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aexhq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Aex account and API key management from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"tag": "next"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aexhq/sdk": "0.
|
|
27
|
+
"@aexhq/sdk": "0.80.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "node --test test/*.test.mjs"
|
package/src/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ const help = `Usage: aex <command>
|
|
|
20
20
|
billing refund <topup> <cents> <key> Request a refund of unused credits
|
|
21
21
|
billing topups Show payments and receipt links
|
|
22
22
|
billing refunds Show refund status
|
|
23
|
-
usage
|
|
23
|
+
usage [session-id] Show account usage or one session's token usage
|
|
24
24
|
docs Open the documentation
|
|
25
25
|
|
|
26
26
|
Results are JSON on stdout; login progress and errors go to stderr.
|
|
@@ -33,7 +33,10 @@ async function main() {
|
|
|
33
33
|
if (values.help || !positionals.length) { process.stdout.write(help); return; }
|
|
34
34
|
const [command, operation, ...args] = positionals;
|
|
35
35
|
const expected = { "keys list": 0, "keys create": 1, "keys rename": 2, "keys revoke": 1, "billing ledger":0, "billing set":2, "billing topup":2, "billing refund":3, "billing topups":0, "billing refunds":0 };
|
|
36
|
-
|
|
36
|
+
const invalid = command === "usage" ? positionals.length > 2
|
|
37
|
+
: command === "keys" || (command === "billing" && operation) ? expected[`${command} ${operation}`] !== args.length
|
|
38
|
+
: !["login", "logout", "account", "billing", "docs"].includes(command) || positionals.length !== 1;
|
|
39
|
+
if (invalid) throw new Error("Unknown command or incorrect arguments. Run aex --help.");
|
|
37
40
|
const explicitApi = values["api-url"] ?? process.env.AEX_API_URL;
|
|
38
41
|
const siteUrl = origin(values["site-url"] ?? "https://aex.dev");
|
|
39
42
|
if (command === "docs") {
|
|
@@ -76,7 +79,7 @@ async function main() {
|
|
|
76
79
|
else if (operation === "refund") result = await client.billing.refund({topup:args[0],amount_cents:integer(args[1])},args[2]);
|
|
77
80
|
else result = await client.billing[operation]();
|
|
78
81
|
}
|
|
79
|
-
else if (command === "usage") result = await client.account.usage();
|
|
82
|
+
else if (command === "usage") result = operation ? await client.account.modelUsage(operation) : await client.account.usage();
|
|
80
83
|
else if (operation === "list") result = await client.keys.list();
|
|
81
84
|
else if (operation === "create") result = await client.keys.create({ name: args[0] });
|
|
82
85
|
else if (operation === "rename") result = await client.keys.update(args[0], { name: args[1] });
|