@faces-sh/cli 0.0.0-stage → 1.0.1

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.
Files changed (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/base.d.ts +26 -0
  6. package/dist/base.js +181 -0
  7. package/dist/benchmark.d.ts +21 -0
  8. package/dist/benchmark.js +95 -0
  9. package/dist/billing.d.ts +17 -0
  10. package/dist/billing.js +101 -0
  11. package/dist/catalog.d.ts +35 -0
  12. package/dist/catalog.js +242 -0
  13. package/dist/client.d.ts +98 -0
  14. package/dist/client.js +590 -0
  15. package/dist/commands/account/preferences.d.ts +20 -0
  16. package/dist/commands/account/preferences.js +190 -0
  17. package/dist/commands/account/state.d.ts +11 -0
  18. package/dist/commands/account/state.js +24 -0
  19. package/dist/commands/auth/connect.d.ts +17 -0
  20. package/dist/commands/auth/connect.js +190 -0
  21. package/dist/commands/auth/connections.d.ts +12 -0
  22. package/dist/commands/auth/connections.js +40 -0
  23. package/dist/commands/auth/disconnect.d.ts +15 -0
  24. package/dist/commands/auth/disconnect.js +49 -0
  25. package/dist/commands/auth/login.d.ts +13 -0
  26. package/dist/commands/auth/login.js +42 -0
  27. package/dist/commands/auth/logout.d.ts +11 -0
  28. package/dist/commands/auth/logout.js +14 -0
  29. package/dist/commands/auth/refresh.d.ts +11 -0
  30. package/dist/commands/auth/refresh.js +30 -0
  31. package/dist/commands/auth/register.d.ts +15 -0
  32. package/dist/commands/auth/register.js +98 -0
  33. package/dist/commands/auth/whoami.d.ts +11 -0
  34. package/dist/commands/auth/whoami.js +108 -0
  35. package/dist/commands/benchmark/get.d.ts +16 -0
  36. package/dist/commands/benchmark/get.js +42 -0
  37. package/dist/commands/benchmark/list.d.ts +13 -0
  38. package/dist/commands/benchmark/list.js +47 -0
  39. package/dist/commands/benchmark/start.d.ts +22 -0
  40. package/dist/commands/benchmark/start.js +80 -0
  41. package/dist/commands/billing/balance.d.ts +11 -0
  42. package/dist/commands/billing/balance.js +27 -0
  43. package/dist/commands/billing/card/default.d.ts +15 -0
  44. package/dist/commands/billing/card/default.js +33 -0
  45. package/dist/commands/billing/card/remove.d.ts +16 -0
  46. package/dist/commands/billing/card/remove.js +41 -0
  47. package/dist/commands/billing/card-setup.d.ts +13 -0
  48. package/dist/commands/billing/card-setup.js +41 -0
  49. package/dist/commands/billing/cards.d.ts +11 -0
  50. package/dist/commands/billing/cards.js +34 -0
  51. package/dist/commands/billing/llm-costs.d.ts +14 -0
  52. package/dist/commands/billing/llm-costs.js +95 -0
  53. package/dist/commands/billing/subscription/activate.d.ts +14 -0
  54. package/dist/commands/billing/subscription/activate.js +91 -0
  55. package/dist/commands/billing/subscription/cancel.d.ts +12 -0
  56. package/dist/commands/billing/subscription/cancel.js +54 -0
  57. package/dist/commands/billing/subscription/index.d.ts +11 -0
  58. package/dist/commands/billing/subscription/index.js +46 -0
  59. package/dist/commands/billing/subscription/plan.d.ts +16 -0
  60. package/dist/commands/billing/subscription/plan.js +86 -0
  61. package/dist/commands/billing/topup.d.ts +16 -0
  62. package/dist/commands/billing/topup.js +60 -0
  63. package/dist/commands/billing/usage.d.ts +15 -0
  64. package/dist/commands/billing/usage.js +68 -0
  65. package/dist/commands/catalog/backup.d.ts +11 -0
  66. package/dist/commands/catalog/backup.js +169 -0
  67. package/dist/commands/catalog/doctor.d.ts +14 -0
  68. package/dist/commands/catalog/doctor.js +303 -0
  69. package/dist/commands/catalog/list.d.ts +11 -0
  70. package/dist/commands/catalog/list.js +39 -0
  71. package/dist/commands/catalog/restore.d.ts +17 -0
  72. package/dist/commands/catalog/restore.js +259 -0
  73. package/dist/commands/causes.d.ts +27 -0
  74. package/dist/commands/causes.js +135 -0
  75. package/dist/commands/chat/chat.d.ts +42 -0
  76. package/dist/commands/chat/chat.js +363 -0
  77. package/dist/commands/chat/messages.d.ts +26 -0
  78. package/dist/commands/chat/messages.js +139 -0
  79. package/dist/commands/chat/responses.d.ts +27 -0
  80. package/dist/commands/chat/responses.js +150 -0
  81. package/dist/commands/chat/thread.d.ts +43 -0
  82. package/dist/commands/chat/thread.js +458 -0
  83. package/dist/commands/compile/all.d.ts +14 -0
  84. package/dist/commands/compile/all.js +186 -0
  85. package/dist/commands/compile/doc/create.d.ts +19 -0
  86. package/dist/commands/compile/doc/create.js +58 -0
  87. package/dist/commands/compile/doc/delete.d.ts +15 -0
  88. package/dist/commands/compile/doc/delete.js +33 -0
  89. package/dist/commands/compile/doc/edit.d.ts +19 -0
  90. package/dist/commands/compile/doc/edit.js +59 -0
  91. package/dist/commands/compile/doc/get.d.ts +15 -0
  92. package/dist/commands/compile/doc/get.js +43 -0
  93. package/dist/commands/compile/doc/index.d.ts +24 -0
  94. package/dist/commands/compile/doc/index.js +211 -0
  95. package/dist/commands/compile/doc/list.d.ts +15 -0
  96. package/dist/commands/compile/doc/list.js +46 -0
  97. package/dist/commands/compile/doc/make.d.ts +17 -0
  98. package/dist/commands/compile/doc/make.js +95 -0
  99. package/dist/commands/compile/doc/pause.d.ts +17 -0
  100. package/dist/commands/compile/doc/pause.js +74 -0
  101. package/dist/commands/compile/doc/reset.d.ts +15 -0
  102. package/dist/commands/compile/doc/reset.js +33 -0
  103. package/dist/commands/compile/import.d.ts +20 -0
  104. package/dist/commands/compile/import.js +138 -0
  105. package/dist/commands/compile/stats.d.ts +11 -0
  106. package/dist/commands/compile/stats.js +75 -0
  107. package/dist/commands/compile/status.d.ts +17 -0
  108. package/dist/commands/compile/status.js +110 -0
  109. package/dist/commands/compile/thread/create.d.ts +16 -0
  110. package/dist/commands/compile/thread/create.js +42 -0
  111. package/dist/commands/compile/thread/delete.d.ts +15 -0
  112. package/dist/commands/compile/thread/delete.js +33 -0
  113. package/dist/commands/compile/thread/edit.d.ts +19 -0
  114. package/dist/commands/compile/thread/edit.js +120 -0
  115. package/dist/commands/compile/thread/get.d.ts +15 -0
  116. package/dist/commands/compile/thread/get.js +48 -0
  117. package/dist/commands/compile/thread/list.d.ts +14 -0
  118. package/dist/commands/compile/thread/list.js +38 -0
  119. package/dist/commands/compile/thread/make.d.ts +17 -0
  120. package/dist/commands/compile/thread/make.js +87 -0
  121. package/dist/commands/compile/thread/message.d.ts +16 -0
  122. package/dist/commands/compile/thread/message.js +43 -0
  123. package/dist/commands/compile/thread/pause.d.ts +17 -0
  124. package/dist/commands/compile/thread/pause.js +75 -0
  125. package/dist/commands/compile/thread/replace.d.ts +27 -0
  126. package/dist/commands/compile/thread/replace.js +114 -0
  127. package/dist/commands/compile/thread/reset.d.ts +15 -0
  128. package/dist/commands/compile/thread/reset.js +33 -0
  129. package/dist/commands/compile/upload.d.ts +21 -0
  130. package/dist/commands/compile/upload.js +162 -0
  131. package/dist/commands/config/clear.d.ts +12 -0
  132. package/dist/commands/config/clear.js +17 -0
  133. package/dist/commands/config/set.d.ts +15 -0
  134. package/dist/commands/config/set.js +43 -0
  135. package/dist/commands/config/show.d.ts +11 -0
  136. package/dist/commands/config/show.js +19 -0
  137. package/dist/commands/decide.d.ts +35 -0
  138. package/dist/commands/decide.js +242 -0
  139. package/dist/commands/face/attributes.d.ts +11 -0
  140. package/dist/commands/face/attributes.js +44 -0
  141. package/dist/commands/face/avatar/delete.d.ts +15 -0
  142. package/dist/commands/face/avatar/delete.js +38 -0
  143. package/dist/commands/face/avatar/get.d.ts +20 -0
  144. package/dist/commands/face/avatar/get.js +100 -0
  145. package/dist/commands/face/avatar/list.d.ts +14 -0
  146. package/dist/commands/face/avatar/list.js +56 -0
  147. package/dist/commands/face/avatar/make.d.ts +16 -0
  148. package/dist/commands/face/avatar/make.js +64 -0
  149. package/dist/commands/face/avatar/upload.d.ts +15 -0
  150. package/dist/commands/face/avatar/upload.js +67 -0
  151. package/dist/commands/face/create.d.ts +23 -0
  152. package/dist/commands/face/create.js +122 -0
  153. package/dist/commands/face/delete.d.ts +15 -0
  154. package/dist/commands/face/delete.js +39 -0
  155. package/dist/commands/face/diff.d.ts +12 -0
  156. package/dist/commands/face/diff.js +50 -0
  157. package/dist/commands/face/edit.d.ts +25 -0
  158. package/dist/commands/face/edit.js +155 -0
  159. package/dist/commands/face/get.d.ts +16 -0
  160. package/dist/commands/face/get.js +145 -0
  161. package/dist/commands/face/groups.d.ts +15 -0
  162. package/dist/commands/face/groups.js +34 -0
  163. package/dist/commands/face/list.d.ts +23 -0
  164. package/dist/commands/face/list.js +168 -0
  165. package/dist/commands/face/lock.d.ts +15 -0
  166. package/dist/commands/face/lock.js +35 -0
  167. package/dist/commands/face/neighbors.d.ts +16 -0
  168. package/dist/commands/face/neighbors.js +63 -0
  169. package/dist/commands/face/publish.d.ts +16 -0
  170. package/dist/commands/face/publish.js +43 -0
  171. package/dist/commands/face/share.d.ts +22 -0
  172. package/dist/commands/face/share.js +104 -0
  173. package/dist/commands/face/sources.d.ts +21 -0
  174. package/dist/commands/face/sources.js +169 -0
  175. package/dist/commands/face/stats.d.ts +12 -0
  176. package/dist/commands/face/stats.js +46 -0
  177. package/dist/commands/face/tag/add.d.ts +15 -0
  178. package/dist/commands/face/tag/add.js +40 -0
  179. package/dist/commands/face/tag/all.d.ts +11 -0
  180. package/dist/commands/face/tag/all.js +31 -0
  181. package/dist/commands/face/tag/list.d.ts +14 -0
  182. package/dist/commands/face/tag/list.js +36 -0
  183. package/dist/commands/face/tag/remove.d.ts +16 -0
  184. package/dist/commands/face/tag/remove.js +44 -0
  185. package/dist/commands/face/tag/set.d.ts +15 -0
  186. package/dist/commands/face/tag/set.js +40 -0
  187. package/dist/commands/face/unlock.d.ts +15 -0
  188. package/dist/commands/face/unlock.js +35 -0
  189. package/dist/commands/face/unpublish.d.ts +14 -0
  190. package/dist/commands/face/unpublish.js +32 -0
  191. package/dist/commands/face/unshare.d.ts +18 -0
  192. package/dist/commands/face/unshare.js +66 -0
  193. package/dist/commands/fidelity/get.d.ts +15 -0
  194. package/dist/commands/fidelity/get.js +42 -0
  195. package/dist/commands/fidelity/pick.d.ts +19 -0
  196. package/dist/commands/fidelity/pick.js +70 -0
  197. package/dist/commands/fidelity/run.d.ts +20 -0
  198. package/dist/commands/fidelity/run.js +99 -0
  199. package/dist/commands/fidelity/save-thread.d.ts +15 -0
  200. package/dist/commands/fidelity/save-thread.js +35 -0
  201. package/dist/commands/fidelity/start.d.ts +17 -0
  202. package/dist/commands/fidelity/start.js +56 -0
  203. package/dist/commands/fidelity/turn.d.ts +17 -0
  204. package/dist/commands/fidelity/turn.js +48 -0
  205. package/dist/commands/group/add.d.ts +16 -0
  206. package/dist/commands/group/add.js +83 -0
  207. package/dist/commands/group/create.d.ts +16 -0
  208. package/dist/commands/group/create.js +68 -0
  209. package/dist/commands/group/delete.d.ts +15 -0
  210. package/dist/commands/group/delete.js +39 -0
  211. package/dist/commands/group/edit.d.ts +18 -0
  212. package/dist/commands/group/edit.js +75 -0
  213. package/dist/commands/group/get.d.ts +14 -0
  214. package/dist/commands/group/get.js +29 -0
  215. package/dist/commands/group/list.d.ts +11 -0
  216. package/dist/commands/group/list.js +39 -0
  217. package/dist/commands/group/members.d.ts +15 -0
  218. package/dist/commands/group/members.js +68 -0
  219. package/dist/commands/group/remove.d.ts +15 -0
  220. package/dist/commands/group/remove.js +55 -0
  221. package/dist/commands/group/tag/add.d.ts +15 -0
  222. package/dist/commands/group/tag/add.js +30 -0
  223. package/dist/commands/group/tag/list.d.ts +14 -0
  224. package/dist/commands/group/tag/list.js +36 -0
  225. package/dist/commands/group/tag/remove.d.ts +15 -0
  226. package/dist/commands/group/tag/remove.js +30 -0
  227. package/dist/commands/group/tag/set.d.ts +15 -0
  228. package/dist/commands/group/tag/set.js +30 -0
  229. package/dist/commands/keys/create.d.ts +17 -0
  230. package/dist/commands/keys/create.js +72 -0
  231. package/dist/commands/keys/list.d.ts +11 -0
  232. package/dist/commands/keys/list.js +24 -0
  233. package/dist/commands/keys/revoke.d.ts +15 -0
  234. package/dist/commands/keys/revoke.js +49 -0
  235. package/dist/commands/keys/update.d.ts +17 -0
  236. package/dist/commands/keys/update.js +41 -0
  237. package/dist/commands/models/list.d.ts +15 -0
  238. package/dist/commands/models/list.js +98 -0
  239. package/dist/commands/session/close.d.ts +16 -0
  240. package/dist/commands/session/close.js +36 -0
  241. package/dist/commands/session/compact.d.ts +15 -0
  242. package/dist/commands/session/compact.js +58 -0
  243. package/dist/commands/session/create.d.ts +15 -0
  244. package/dist/commands/session/create.js +45 -0
  245. package/dist/commands/session/get.d.ts +15 -0
  246. package/dist/commands/session/get.js +34 -0
  247. package/dist/commands/style/delete.d.ts +19 -0
  248. package/dist/commands/style/delete.js +94 -0
  249. package/dist/commands/style/make.d.ts +28 -0
  250. package/dist/commands/style/make.js +298 -0
  251. package/dist/commands/style/revert.d.ts +17 -0
  252. package/dist/commands/style/revert.js +66 -0
  253. package/dist/commands/style/status.d.ts +20 -0
  254. package/dist/commands/style/status.js +109 -0
  255. package/dist/commands/style/upload.d.ts +19 -0
  256. package/dist/commands/style/upload.js +100 -0
  257. package/dist/commands/style/versions.d.ts +15 -0
  258. package/dist/commands/style/versions.js +104 -0
  259. package/dist/commands/user/follow.d.ts +14 -0
  260. package/dist/commands/user/follow.js +38 -0
  261. package/dist/commands/user/followers.d.ts +14 -0
  262. package/dist/commands/user/followers.js +50 -0
  263. package/dist/commands/user/following.d.ts +14 -0
  264. package/dist/commands/user/following.js +50 -0
  265. package/dist/commands/user/get.d.ts +14 -0
  266. package/dist/commands/user/get.js +49 -0
  267. package/dist/commands/user/unfollow.d.ts +14 -0
  268. package/dist/commands/user/unfollow.js +38 -0
  269. package/dist/config.d.ts +32 -0
  270. package/dist/config.js +139 -0
  271. package/dist/decisions.d.ts +42 -0
  272. package/dist/decisions.js +262 -0
  273. package/dist/fidelity.d.ts +50 -0
  274. package/dist/fidelity.js +92 -0
  275. package/dist/group-catalog.d.ts +22 -0
  276. package/dist/group-catalog.js +133 -0
  277. package/dist/paths.d.ts +1 -0
  278. package/dist/paths.js +8 -0
  279. package/dist/poll.d.ts +26 -0
  280. package/dist/poll.js +75 -0
  281. package/dist/routing.d.ts +15 -0
  282. package/dist/routing.js +135 -0
  283. package/dist/session.d.ts +14 -0
  284. package/dist/session.js +18 -0
  285. package/dist/style.d.ts +46 -0
  286. package/dist/style.js +285 -0
  287. package/dist/utils.d.ts +149 -0
  288. package/dist/utils.js +865 -0
  289. package/oclif.manifest.json +11070 -0
  290. package/package.json +127 -4
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class BillingCardSetup extends BaseCommand {
3
+ static description: string;
4
+ static aliases: string[];
5
+ static flags: {
6
+ default: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,41 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { FacesAPIError } from '../../client.js';
4
+ export default class BillingCardSetup extends BaseCommand {
5
+ static description = 'Add a card: prints a secure link to save one. Nothing is charged. The new card becomes the default ' +
6
+ 'unless --no-default (the first card always does), and it is listed a few seconds after you finish.';
7
+ static aliases = ['billing:card:add'];
8
+ static flags = {
9
+ ...BaseCommand.baseFlags,
10
+ default: Flags.boolean({
11
+ description: 'Make the new card the default, which renewals and top-ups charge',
12
+ default: true,
13
+ allowNo: true,
14
+ }),
15
+ };
16
+ async run() {
17
+ const { flags } = await this.parse(BillingCardSetup);
18
+ const client = this.makeClient(flags);
19
+ let data;
20
+ try {
21
+ data = await client.post('/v1/billing/card-setup', flags.default ? { requireJwt: true } : { requireJwt: true, body: { make_default: false } });
22
+ }
23
+ catch (err) {
24
+ if (err instanceof FacesAPIError)
25
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
26
+ throw err;
27
+ }
28
+ if (!this.jsonEnabled()) {
29
+ if (typeof data.checkout_url === 'string') {
30
+ this.log('Save a card at this link (nothing is charged):');
31
+ this.log(` ${data.checkout_url}`);
32
+ this.log('');
33
+ this.log('It appears a few seconds after you finish. Check with: faces billing:cards');
34
+ }
35
+ else {
36
+ this.printHuman(data);
37
+ }
38
+ }
39
+ return data;
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class BillingCards extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ }
@@ -0,0 +1,34 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ import { FacesAPIError } from '../../client.js';
3
+ import { cardLine } from '../../billing.js';
4
+ export default class BillingCards extends BaseCommand {
5
+ static description = 'List your saved cards, newest first. The default card is the one the subscription renews on and a ' +
6
+ 'top-up charges unless it names another (--card).';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ };
10
+ async run() {
11
+ const { flags } = await this.parse(BillingCards);
12
+ const client = this.makeClient(flags);
13
+ let data;
14
+ try {
15
+ data = await client.get('/v1/billing/payment-methods');
16
+ }
17
+ catch (err) {
18
+ if (err instanceof FacesAPIError)
19
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
20
+ throw err;
21
+ }
22
+ if (!this.jsonEnabled()) {
23
+ const cards = data.payment_methods ?? [];
24
+ if (cards.length === 0) {
25
+ this.log('No saved cards. Add one with: faces billing:card-setup');
26
+ }
27
+ else {
28
+ for (const c of cards)
29
+ this.log(cardLine(c));
30
+ }
31
+ }
32
+ return data;
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class BillingLlmCosts extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ lab: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ private printTable;
13
+ private facesPrices;
14
+ }
@@ -0,0 +1,95 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { FacesAPIError } from '../../client.js';
4
+ import { table, usd } from '../../utils.js';
5
+ import { llmCostLab } from '../../billing.js';
6
+ export default class BillingLlmCosts extends BaseCommand {
7
+ static description = 'List available LLMs, their per-token costs and what you have spent on each. Models are listed once, ' +
8
+ 'under the id their lab gives them. Compile and cause prices, and what each plan includes, are listed ' +
9
+ 'after the table. For the full catalog, with endpoints and which models are Codex-eligible, see faces models:list.';
10
+ static flags = {
11
+ ...BaseCommand.baseFlags,
12
+ lab: Flags.string({
13
+ description: 'Filter by the lab that made the model (e.g. openai, anthropic, qwen)',
14
+ aliases: ['provider'],
15
+ }),
16
+ };
17
+ async run() {
18
+ const { flags } = await this.parse(BillingLlmCosts);
19
+ const client = this.makeClient(flags);
20
+ let data;
21
+ try {
22
+ data = await client.get('/v1/billing/llm-costs');
23
+ }
24
+ catch (err) {
25
+ if (err instanceof FacesAPIError)
26
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
27
+ throw err;
28
+ }
29
+ const lab = llmCostLab;
30
+ if (flags.lab && Array.isArray(data)) {
31
+ data = data.filter((row) => lab(row).toLowerCase() === flags.lab.toLowerCase());
32
+ }
33
+ if (!this.jsonEnabled())
34
+ await this.printTable(client, data, lab);
35
+ return data;
36
+ }
37
+ async printTable(client, rows, lab) {
38
+ if (!Array.isArray(rows) || rows.length === 0) {
39
+ this.log('No models.');
40
+ return;
41
+ }
42
+ const price = (v) => (typeof v === 'number' ? `$${v}` : '-');
43
+ const sorted = [...rows].sort((a, b) => lab(a).localeCompare(lab(b)) || Number(a.input_cost_per_million ?? 0) - Number(b.input_cost_per_million ?? 0));
44
+ const body = sorted.map((r) => {
45
+ const unit = typeof r.unit_cost_usd === 'number' && r.billing_unit ? `${price(r.unit_cost_usd)} per ${r.billing_unit}` : '';
46
+ return [String(r.llm_model), lab(r) || '-', unit ? '' : price(r.input_cost_per_million), unit ? '' : price(r.output_cost_per_million), unit, usd(r.user_total_cost_usd)];
47
+ });
48
+ for (const line of table(['MODEL', 'LAB', 'IN /1M', 'OUT /1M', 'OTHER', 'YOU SPENT'], body, new Set(['IN /1M', 'OUT /1M', 'YOU SPENT'])))
49
+ this.log(line);
50
+ this.log('');
51
+ const rates = new Set(rows.map((r) => `${r.markup_rate}|${r.prices_include_markup}`));
52
+ const [rate, included] = [rows[0].markup_rate, rows[0].prices_include_markup];
53
+ if (rates.size === 1 && typeof rate === 'number') {
54
+ const pct = `${Math.round(rate * 1000) / 10}%`;
55
+ this.log(included === true
56
+ ? `Prices are per million tokens and already include the ${pct} markup.`
57
+ : `Listed prices, per million tokens. Requests are charged at these plus a ${pct} markup.`);
58
+ }
59
+ else {
60
+ this.log('Prices are per million tokens. Markups differ by model; see markup_rate and prices_include_markup in --json.');
61
+ }
62
+ for (const line of await this.facesPrices(client))
63
+ this.log(line);
64
+ }
65
+ async facesPrices(client) {
66
+ let models;
67
+ try {
68
+ const raw = (await client.get('/v1/models', { params: { kind: 'compile,cause' } }));
69
+ models = (Array.isArray(raw) ? raw : (raw.data ?? []));
70
+ }
71
+ catch {
72
+ return [];
73
+ }
74
+ const lines = [];
75
+ for (const m of models) {
76
+ const per = m.input_cost_per_million_tokens;
77
+ if (typeof per !== 'number')
78
+ continue;
79
+ const markup = m.markup_applies === false ? ', no markup' : '';
80
+ if (m.kind === 'compile') {
81
+ const inc = m.included_tokens_per_month;
82
+ const plans = inc
83
+ ? Object.entries(inc).filter(([, n]) => typeof n === 'number' && n > 0).map(([p, n]) => `${p[0].toUpperCase()}${p.slice(1)} ${n.toLocaleString('en-US')}`)
84
+ : [];
85
+ lines.push(`Compiling (${m.id}): $${per} per million source tokens compiled${markup}.` +
86
+ (plans.length > 0 ? ` Included each month: ${plans.join(', ')} tokens; past that, credits pay.` : ''));
87
+ }
88
+ else if (m.kind === 'cause') {
89
+ const added = typeof m.added_tokens_per_request === 'number' ? ` plus ${m.added_tokens_per_request.toLocaleString('en-US')} tokens a request` : '';
90
+ lines.push(`Causes (${m.id}): $${per} per million input tokens${added}${markup}.`);
91
+ }
92
+ }
93
+ return lines.length > 0 ? ['', ...lines] : [];
94
+ }
95
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class BillingSubscriptionActivate extends BaseCommand {
3
+ static description: string;
4
+ static aliases: string[];
5
+ static examples: string[];
6
+ static flags: {
7
+ plan: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -0,0 +1,91 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ import { PAID_PLANS, PLAN_PRICE, planName } from '../../../billing.js';
5
+ export default class BillingSubscriptionActivate extends BaseCommand {
6
+ static description = 'Subscribe to Connect ($17/month) or Pro ($49/month) from the Free plan, or reactivate a subscription ' +
7
+ 'that is set to cancel. Already subscribed? Change plan with billing:subscription:plan instead.';
8
+ static aliases = ['billing:subscribe'];
9
+ static examples = [
10
+ '<%= config.bin %> <%= command.id %> --plan connect',
11
+ '<%= config.bin %> <%= command.id %> --plan pro',
12
+ ];
13
+ static flags = {
14
+ ...BaseCommand.baseFlags,
15
+ plan: Flags.string({
16
+ description: 'Plan to subscribe to. Default: the current plan when it is set to cancel (which reactivates it), otherwise connect.',
17
+ options: [...PAID_PLANS],
18
+ }),
19
+ };
20
+ async run() {
21
+ const { flags } = await this.parse(BillingSubscriptionActivate);
22
+ const client = this.makeClient(flags);
23
+ const json = this.jsonEnabled();
24
+ let sub;
25
+ try {
26
+ sub = await client.get('/v1/billing/subscription');
27
+ }
28
+ catch (err) {
29
+ if (err instanceof FacesAPIError)
30
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
31
+ throw err;
32
+ }
33
+ const plan = String(sub.plan ?? 'free');
34
+ const cancelAtPeriodEnd = sub.cancel_at_period_end === true;
35
+ const want = (flags.plan ?? (PAID_PLANS.includes(plan) && cancelAtPeriodEnd ? plan : 'connect'));
36
+ if (plan === want && !cancelAtPeriodEnd) {
37
+ if (!json)
38
+ this.log(`Already on the ${planName(want)} plan.`);
39
+ return { status: 'already_active', plan: want };
40
+ }
41
+ if (plan === want && cancelAtPeriodEnd) {
42
+ let data;
43
+ try {
44
+ data = await client.post('/v1/billing/subscription/reactivate', { requireJwt: true });
45
+ }
46
+ catch (err) {
47
+ if (err instanceof FacesAPIError)
48
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
49
+ throw err;
50
+ }
51
+ const result = data;
52
+ if (!json) {
53
+ this.log(`Reactivated. The ${planName(want)} plan continues. Next renewal: ${result.current_period_end ?? 'unknown'}.`);
54
+ }
55
+ return { status: 'reactivated', ...result };
56
+ }
57
+ if (plan !== 'free') {
58
+ if (plan === 'team')
59
+ this.error('Your plan is managed by Faces, so there is nothing to subscribe to.');
60
+ if (cancelAtPeriodEnd) {
61
+ this.error(`Your ${planName(plan)} plan is set to cancel. Keep it first with: faces billing:subscription:activate\n` +
62
+ `Then, to change to ${planName(want)}: faces billing:subscription:plan ${want}`);
63
+ }
64
+ this.error(`You already subscribe to ${planName(plan)}. To change to ${planName(want)}, with proration:\n` +
65
+ ` faces billing:subscription:plan ${want}`);
66
+ }
67
+ let data;
68
+ try {
69
+ data = await client.post(`/v1/billing/checkout?plan=${want}&source=cli`, { requireJwt: true });
70
+ }
71
+ catch (err) {
72
+ if (err instanceof FacesAPIError) {
73
+ if (err.statusCode === 409)
74
+ this.error(`HTTP 409: ${err.message}\nChange plan with: faces billing:subscription:plan ${want}`);
75
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
76
+ }
77
+ throw err;
78
+ }
79
+ const result = data;
80
+ const url = result.checkout_url;
81
+ if (!json) {
82
+ this.log(`${planName(want)}: ${PLAN_PRICE[want]}`);
83
+ this.log('');
84
+ this.log('Complete payment at this link (it takes a promo code too):');
85
+ this.log(` ${url}`);
86
+ this.log('');
87
+ this.log('After payment, check with: faces billing:subscription');
88
+ }
89
+ return { status: 'checkout_created', plan: want, checkout_url: url };
90
+ }
91
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class BillingSubscriptionCancel extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,54 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ import { planName } from '../../../billing.js';
5
+ export default class BillingSubscriptionCancel extends BaseCommand {
6
+ static description = 'Cancel your subscription (keeps access until period end)';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
10
+ };
11
+ async run() {
12
+ const { flags } = await this.parse(BillingSubscriptionCancel);
13
+ const client = this.makeClient(flags);
14
+ const json = this.jsonEnabled();
15
+ let sub;
16
+ try {
17
+ sub = await client.get('/v1/billing/subscription');
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
22
+ throw err;
23
+ }
24
+ const plan = sub.plan;
25
+ if (plan === 'free') {
26
+ if (!json)
27
+ this.log('No subscription to cancel: you are on the Free plan, which pays as it goes.');
28
+ return { status: 'no_subscription' };
29
+ }
30
+ const name = planName(plan);
31
+ if (sub.cancel_at_period_end) {
32
+ if (!json)
33
+ this.log(`Already canceled. ${name} access ends ${sub.current_period_end ?? 'at period end'}.`);
34
+ return { status: 'already_canceled', current_period_end: sub.current_period_end };
35
+ }
36
+ const periodEnd = sub.current_period_end ?? 'period end';
37
+ await this.confirmOrRefuse(`Cancel the ${name} plan? You'll keep access until ${periodEnd}.`, flags.yes);
38
+ let data;
39
+ try {
40
+ data = await client.post('/v1/billing/subscription/cancel', { requireJwt: true });
41
+ }
42
+ catch (err) {
43
+ if (err instanceof FacesAPIError)
44
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
45
+ throw err;
46
+ }
47
+ const result = data;
48
+ if (!json) {
49
+ this.log(`Canceled. ${name} access continues until ${result.current_period_end ?? 'period end'}.`);
50
+ this.log(`To reactivate before then: faces billing:subscription:activate --plan ${plan}`);
51
+ }
52
+ return { status: 'canceled', ...result };
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class BillingSubscription extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ }
@@ -0,0 +1,46 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ import { FacesAPIError } from '../../../client.js';
3
+ import { allowanceLines, planName } from '../../../billing.js';
4
+ export default class BillingSubscription extends BaseCommand {
5
+ static description = 'Show your plan (free, connect or pro), renewal date, and on a paid plan how much of each ' +
6
+ 'allowance is used: causes over 5 hours, the week and the month, and compiling over the month';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ };
10
+ async run() {
11
+ const { flags } = await this.parse(BillingSubscription);
12
+ const client = this.makeClient(flags);
13
+ let data;
14
+ try {
15
+ data = await client.get('/v1/billing/subscription');
16
+ }
17
+ catch (err) {
18
+ if (err instanceof FacesAPIError)
19
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
20
+ throw err;
21
+ }
22
+ if (!this.jsonEnabled()) {
23
+ const sub = data;
24
+ if (sub.cancel_at_period_end === true && sub.plan !== 'free') {
25
+ const ends = String(sub.current_period_end ?? 'the end of the period').replace('T', ' ').replace(/\.\d+$/, '');
26
+ this.log(`Set to cancel: the ${planName(String(sub.plan))} plan ends ${ends}, then the account moves to Free.`);
27
+ this.log('Keep it with: faces billing:subscription:activate');
28
+ this.log('');
29
+ }
30
+ const hidden = new Set(['allowances', 'rates']);
31
+ const rest = Object.fromEntries(Object.entries(sub).filter(([k]) => !hidden.has(k)));
32
+ this.printHuman(rest);
33
+ const lines = allowanceLines(sub);
34
+ if (lines.length > 0) {
35
+ this.log('');
36
+ for (const line of lines)
37
+ this.log(line);
38
+ }
39
+ else if (sub.plan === 'free') {
40
+ this.log('');
41
+ this.log('The Free plan has no allowances: it pays as it goes from credits (faces billing:balance).');
42
+ }
43
+ }
44
+ return data;
45
+ }
46
+ }
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class BillingSubscriptionPlan extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ static args: {
13
+ plan: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
14
+ };
15
+ run(): Promise<unknown>;
16
+ }
@@ -0,0 +1,86 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ import { PAID_PLANS, PLAN_PRICE, planName } from '../../../billing.js';
5
+ export default class BillingSubscriptionPlan extends BaseCommand {
6
+ static description = 'Switch a subscription between Connect ($17/month) and Pro ($49/month) in place. The difference is ' +
7
+ 'prorated on the default card, and the new allowances apply at once. From the Free plan, subscribe ' +
8
+ 'with billing:subscription:activate instead.';
9
+ static examples = [
10
+ '<%= config.bin %> <%= command.id %> pro',
11
+ '<%= config.bin %> <%= command.id %> connect --yes',
12
+ ];
13
+ static flags = {
14
+ ...BaseCommand.baseFlags,
15
+ yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
16
+ };
17
+ static args = {
18
+ plan: Args.string({ description: 'Plan to switch to', options: [...PAID_PLANS], required: true }),
19
+ };
20
+ async run() {
21
+ const { args, flags } = await this.parse(BillingSubscriptionPlan);
22
+ const client = this.makeClient(flags);
23
+ const json = this.jsonEnabled();
24
+ const want = args.plan;
25
+ let sub;
26
+ try {
27
+ sub = await client.get('/v1/billing/subscription');
28
+ }
29
+ catch (err) {
30
+ if (err instanceof FacesAPIError)
31
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
32
+ throw err;
33
+ }
34
+ const plan = String(sub.plan ?? 'free');
35
+ if (plan === want) {
36
+ if (!json)
37
+ this.log(`Already on the ${planName(want)} plan.`);
38
+ return { status: 'already_active', plan: want };
39
+ }
40
+ if (plan === 'free') {
41
+ this.error(`You have no subscription to switch. Subscribe with: faces billing:subscription:activate --plan ${want}`);
42
+ }
43
+ if (plan === 'team')
44
+ this.error('Your plan is managed by Faces, so it cannot be switched here.');
45
+ if (sub.cancel_at_period_end === true) {
46
+ this.error(`Your ${planName(plan)} plan is set to cancel, and a switch now would be charged while it still ends.\n` +
47
+ 'Keep it first with: faces billing:subscription:activate, then switch.');
48
+ }
49
+ await this.confirmOrRefuse(`Switch from ${planName(plan)} to ${planName(want)} (${PLAN_PRICE[want]})? The difference is prorated on your default card.`, flags.yes);
50
+ let data;
51
+ try {
52
+ data = await client.post(`/v1/billing/subscription/plan?plan=${want}`, { requireJwt: true });
53
+ }
54
+ catch (err) {
55
+ if (err instanceof FacesAPIError && err.statusCode >= 500) {
56
+ const now = await client.get('/v1/billing/subscription').catch(() => undefined);
57
+ if (now?.plan === want) {
58
+ if (!json)
59
+ process.stderr.write(`The server answered ${err.statusCode}, but the plan did change.\n`);
60
+ data = { plan: want, previous_plan: plan, status: now.status };
61
+ }
62
+ else {
63
+ this.error(`HTTP ${err.statusCode}: ${err.message}\n` +
64
+ `The plan is still ${planName(now?.plan ?? plan)}. Check with faces billing:subscription before trying again.`);
65
+ }
66
+ }
67
+ else if (err instanceof FacesAPIError) {
68
+ if (err.statusCode === 409 && err.errorCode === 'cancellation_pending') {
69
+ this.error(`HTTP 409: ${err.message}\nKeep it first with: faces billing:subscription:activate, then switch.`);
70
+ }
71
+ if (err.statusCode === 409 && plan === 'free') {
72
+ this.error(`HTTP 409: ${err.message}\nSubscribe with: faces billing:subscription:activate --plan ${want}`);
73
+ }
74
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
75
+ }
76
+ else {
77
+ throw err;
78
+ }
79
+ }
80
+ if (!json) {
81
+ this.log(`Switched from ${planName(data.previous_plan ?? plan)} to ${planName(data.plan ?? want)}. The new allowances apply now.`);
82
+ this.log('See them with: faces billing:subscription');
83
+ }
84
+ return data;
85
+ }
86
+ }
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class BillingTopup extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ amount: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
6
+ card: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ 'allow-duplicate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<unknown>;
15
+ private fail;
16
+ }
@@ -0,0 +1,60 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { FacesAPIError } from '../../client.js';
4
+ import { parseBudget } from '../../utils.js';
5
+ export default class BillingTopup extends BaseCommand {
6
+ static description = 'Top up your credit balance. Charges your default card, or the one --card names.';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ amount: Flags.string({ description: 'Top-up amount in USD (min $1)', required: true }),
10
+ card: Flags.string({ description: 'Charge this saved card (pm_..., from faces billing:cards) instead of the default' }),
11
+ yes: Flags.boolean({ description: 'Charge without asking first', default: false }),
12
+ 'allow-duplicate': Flags.boolean({
13
+ description: 'Charge even if this repeats a recent top-up. Without it a repeat is refused, so a retried command ' +
14
+ 'cannot charge twice. --yes does not imply it.',
15
+ default: false,
16
+ }),
17
+ };
18
+ async run() {
19
+ const { flags } = await this.parse(BillingTopup);
20
+ const client = this.makeClient(flags);
21
+ const amount = parseBudget(flags.amount, (m) => this.error(m), '--amount', 10_000);
22
+ if (amount < 1)
23
+ this.error('Minimum topup is $1.00 (--amount)');
24
+ await this.confirmOrRefuse(`Charge $${amount.toFixed(2)} to ${flags.card ?? 'your default card'}?`, flags.yes);
25
+ const payload = { amount_usd: amount };
26
+ if (flags.card)
27
+ payload.payment_method_id = flags.card;
28
+ if (flags['allow-duplicate'])
29
+ payload.allow_duplicate = true;
30
+ let data;
31
+ try {
32
+ data = await client.post('/v1/billing/topup', { requireJwt: true, body: payload });
33
+ }
34
+ catch (err) {
35
+ if (!(err instanceof FacesAPIError && err.statusCode === 409 && err.errorCode === 'duplicate_topup'))
36
+ this.fail(err, flags.card);
37
+ if (this.jsonEnabled() || !process.stdin.isTTY) {
38
+ this.error(`${err.message}\nNothing was charged. To charge it again anyway, re-run with --allow-duplicate.`);
39
+ }
40
+ await this.confirmOrRefuse(`${err.message}\nCharge $${amount.toFixed(2)} again anyway?`, false);
41
+ try {
42
+ data = await client.post('/v1/billing/topup', { requireJwt: true, body: { ...payload, allow_duplicate: true } });
43
+ }
44
+ catch (again) {
45
+ this.fail(again, flags.card);
46
+ }
47
+ }
48
+ if (!this.jsonEnabled())
49
+ this.printHuman(data);
50
+ return data;
51
+ }
52
+ fail(err, card) {
53
+ if (err instanceof FacesAPIError) {
54
+ if (err.statusCode === 404 && card)
55
+ this.error(`HTTP 404: ${err.message}\nList your cards with: faces billing:cards`);
56
+ this.error(`HTTP ${err.statusCode}: ${err.message}`);
57
+ }
58
+ throw err;
59
+ }
60
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class BillingUsage extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'group-by': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ to: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ private printTable;
15
+ }