@nodaro/sdk 2.47.0 → 2.51.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.
Files changed (88) hide show
  1. package/dist/{chunk-KBHDUHKM.js → chunk-2SQ7V6EX.js} +2 -2
  2. package/dist/chunk-2SQ7V6EX.js.map +1 -0
  3. package/dist/{chunk-FIMBPKIH.cjs → chunk-4BAHF762.cjs} +43 -2
  4. package/dist/chunk-4BAHF762.cjs.map +1 -0
  5. package/dist/chunk-6FZN3QQO.cjs +146 -0
  6. package/dist/chunk-6FZN3QQO.cjs.map +1 -0
  7. package/dist/{chunk-5MOJSYHI.js → chunk-7QK2NXJA.js} +43 -2
  8. package/dist/chunk-7QK2NXJA.js.map +1 -0
  9. package/dist/{chunk-JTAW54UM.js → chunk-AEUPH7EE.js} +2 -2
  10. package/dist/{chunk-34PU2DAT.cjs.map → chunk-AEUPH7EE.js.map} +1 -1
  11. package/dist/{chunk-DIF7A5OH.cjs → chunk-E5MJK3W5.cjs} +2 -2
  12. package/dist/chunk-E5MJK3W5.cjs.map +1 -0
  13. package/dist/{chunk-I7AHLDXV.js → chunk-EC6MC46Y.js} +10 -10
  14. package/dist/{chunk-I7AHLDXV.js.map → chunk-EC6MC46Y.js.map} +1 -1
  15. package/dist/{chunk-NP6KDFIJ.cjs → chunk-HPSENMVN.cjs} +18 -18
  16. package/dist/{chunk-NP6KDFIJ.cjs.map → chunk-HPSENMVN.cjs.map} +1 -1
  17. package/dist/{chunk-XKDVEQVD.cjs → chunk-LTZKNAXM.cjs} +2 -2
  18. package/dist/chunk-LTZKNAXM.cjs.map +1 -0
  19. package/dist/{chunk-OWG3XAHQ.js → chunk-OCRUDBPG.js} +10 -6
  20. package/dist/chunk-OCRUDBPG.js.map +1 -0
  21. package/dist/{chunk-MYTMNPCP.cjs → chunk-OMX7JBGY.cjs} +3 -3
  22. package/dist/{chunk-MYTMNPCP.cjs.map → chunk-OMX7JBGY.cjs.map} +1 -1
  23. package/dist/{chunk-7LTVS75S.cjs → chunk-P6AM42UB.cjs} +2 -2
  24. package/dist/chunk-P6AM42UB.cjs.map +1 -0
  25. package/dist/{chunk-34PU2DAT.cjs → chunk-Q45PC4YD.cjs} +2 -2
  26. package/dist/chunk-Q45PC4YD.cjs.map +1 -0
  27. package/dist/{chunk-PQHZUWSL.js → chunk-THLTFB6I.js} +2 -2
  28. package/dist/chunk-THLTFB6I.js.map +1 -0
  29. package/dist/{chunk-GDDV5U32.cjs → chunk-TY2S25W5.cjs} +10 -6
  30. package/dist/chunk-TY2S25W5.cjs.map +1 -0
  31. package/dist/chunk-WYYDWJFF.js +144 -0
  32. package/dist/chunk-WYYDWJFF.js.map +1 -0
  33. package/dist/{chunk-FCYN4N3M.js → chunk-XISHBW5I.js} +3 -3
  34. package/dist/{chunk-FCYN4N3M.js.map → chunk-XISHBW5I.js.map} +1 -1
  35. package/dist/{chunk-XILR6TFO.js → chunk-YXVMQEJX.js} +2 -2
  36. package/dist/chunk-YXVMQEJX.js.map +1 -0
  37. package/dist/entries/billing.cjs +2 -2
  38. package/dist/entries/billing.d.cts +202 -3
  39. package/dist/entries/billing.d.ts +202 -3
  40. package/dist/entries/billing.js +1 -1
  41. package/dist/entries/cast-swap.cjs +2 -2
  42. package/dist/entries/cast-swap.d.cts +34 -31
  43. package/dist/entries/cast-swap.d.ts +34 -31
  44. package/dist/entries/cast-swap.js +1 -1
  45. package/dist/entries/client.cjs +14 -14
  46. package/dist/entries/client.js +9 -9
  47. package/dist/entries/core.cjs +5 -5
  48. package/dist/entries/core.js +1 -1
  49. package/dist/entries/credits.cjs +2 -2
  50. package/dist/entries/credits.d.cts +179 -1
  51. package/dist/entries/credits.d.ts +179 -1
  52. package/dist/entries/credits.js +1 -1
  53. package/dist/entries/jobs.cjs +2 -2
  54. package/dist/entries/jobs.d.cts +18 -7
  55. package/dist/entries/jobs.d.ts +18 -7
  56. package/dist/entries/jobs.js +1 -1
  57. package/dist/entries/node-presets.cjs +2 -2
  58. package/dist/entries/node-presets.d.cts +6 -0
  59. package/dist/entries/node-presets.d.ts +6 -0
  60. package/dist/entries/node-presets.js +1 -1
  61. package/dist/entries/trash.cjs +2 -2
  62. package/dist/entries/trash.d.cts +4 -1
  63. package/dist/entries/trash.d.ts +4 -1
  64. package/dist/entries/trash.js +1 -1
  65. package/dist/entries/trends.cjs +2 -2
  66. package/dist/entries/trends.d.cts +22 -13
  67. package/dist/entries/trends.d.ts +22 -13
  68. package/dist/entries/trends.js +1 -1
  69. package/dist/index.cjs +22 -22
  70. package/dist/index.d.cts +2 -2
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.js +9 -9
  73. package/package.json +3 -3
  74. package/dist/chunk-5MOJSYHI.js.map +0 -1
  75. package/dist/chunk-7LTVS75S.cjs.map +0 -1
  76. package/dist/chunk-DIF7A5OH.cjs.map +0 -1
  77. package/dist/chunk-FIMBPKIH.cjs.map +0 -1
  78. package/dist/chunk-GDDV5U32.cjs.map +0 -1
  79. package/dist/chunk-J4WFSKY6.js +0 -50
  80. package/dist/chunk-J4WFSKY6.js.map +0 -1
  81. package/dist/chunk-JTAW54UM.js.map +0 -1
  82. package/dist/chunk-KBHDUHKM.js.map +0 -1
  83. package/dist/chunk-NGKODS3J.cjs +0 -52
  84. package/dist/chunk-NGKODS3J.cjs.map +0 -1
  85. package/dist/chunk-OWG3XAHQ.js.map +0 -1
  86. package/dist/chunk-PQHZUWSL.js.map +0 -1
  87. package/dist/chunk-XILR6TFO.js.map +0 -1
  88. package/dist/chunk-XKDVEQVD.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNP6KDFIJ_cjs = require('../chunk-NP6KDFIJ.cjs');
3
+ var chunkHPSENMVN_cjs = require('../chunk-HPSENMVN.cjs');
4
4
  require('../chunk-JTOEHQQJ.cjs');
5
5
  require('../chunk-W5VHATSR.cjs');
6
6
  require('../chunk-R63TTR35.cjs');
@@ -12,8 +12,8 @@ require('../chunk-WMT7HEBZ.cjs');
12
12
  require('../chunk-MBFUMWI5.cjs');
13
13
  require('../chunk-NKH2UFSD.cjs');
14
14
  require('../chunk-UIBYZNDR.cjs');
15
- require('../chunk-XKDVEQVD.cjs');
16
- require('../chunk-DIF7A5OH.cjs');
15
+ require('../chunk-LTZKNAXM.cjs');
16
+ require('../chunk-E5MJK3W5.cjs');
17
17
  require('../chunk-KMNSPC72.cjs');
18
18
  require('../chunk-NBVARNVA.cjs');
19
19
  require('../chunk-7YHIFCJ4.cjs');
@@ -26,7 +26,7 @@ require('../chunk-SYVNY3AH.cjs');
26
26
  require('../chunk-22P4X3N5.cjs');
27
27
  require('../chunk-7QOCWJKD.cjs');
28
28
  require('../chunk-ZCWKX4V6.cjs');
29
- require('../chunk-34PU2DAT.cjs');
29
+ require('../chunk-Q45PC4YD.cjs');
30
30
  require('../chunk-TK2CEVSK.cjs');
31
31
  require('../chunk-GVIFLUYZ.cjs');
32
32
  require('../chunk-CR5E2SF3.cjs');
@@ -34,7 +34,7 @@ require('../chunk-J5LGGCAS.cjs');
34
34
  require('../chunk-SF2CMKWA.cjs');
35
35
  require('../chunk-SBV5MWEL.cjs');
36
36
  require('../chunk-WUKIJJG2.cjs');
37
- require('../chunk-7LTVS75S.cjs');
37
+ require('../chunk-P6AM42UB.cjs');
38
38
  require('../chunk-2DZWWIJ4.cjs');
39
39
  require('../chunk-SS3B6PHT.cjs');
40
40
  require('../chunk-MQ74AKA2.cjs');
@@ -43,15 +43,15 @@ require('../chunk-43FVH6LJ.cjs');
43
43
  require('../chunk-YFS2LMG4.cjs');
44
44
  require('../chunk-OSMKIRKI.cjs');
45
45
  require('../chunk-FRQJNGJS.cjs');
46
- var chunkMYTMNPCP_cjs = require('../chunk-MYTMNPCP.cjs');
46
+ var chunkOMX7JBGY_cjs = require('../chunk-OMX7JBGY.cjs');
47
47
  require('../chunk-FM2KM5TY.cjs');
48
48
  require('../chunk-HGCVWOGK.cjs');
49
- require('../chunk-FIMBPKIH.cjs');
49
+ require('../chunk-4BAHF762.cjs');
50
50
  require('../chunk-A3S55XGF.cjs');
51
51
  require('../chunk-JOXZ4ZIF.cjs');
52
52
  require('../chunk-GA4LZZKQ.cjs');
53
- require('../chunk-NGKODS3J.cjs');
54
- require('../chunk-GDDV5U32.cjs');
53
+ require('../chunk-6FZN3QQO.cjs');
54
+ require('../chunk-TY2S25W5.cjs');
55
55
  require('../chunk-BPWUWUZ3.cjs');
56
56
  require('../chunk-HAKYPZLB.cjs');
57
57
 
@@ -59,23 +59,23 @@ require('../chunk-HAKYPZLB.cjs');
59
59
 
60
60
  Object.defineProperty(exports, "NodaroClient", {
61
61
  enumerable: true,
62
- get: function () { return chunkNP6KDFIJ_cjs.NodaroClient; }
62
+ get: function () { return chunkHPSENMVN_cjs.NodaroClient; }
63
63
  });
64
64
  Object.defineProperty(exports, "createClient", {
65
65
  enumerable: true,
66
- get: function () { return chunkNP6KDFIJ_cjs.createClient; }
66
+ get: function () { return chunkHPSENMVN_cjs.createClient; }
67
67
  });
68
68
  Object.defineProperty(exports, "CallbackAuth", {
69
69
  enumerable: true,
70
- get: function () { return chunkMYTMNPCP_cjs.CallbackAuth; }
70
+ get: function () { return chunkOMX7JBGY_cjs.CallbackAuth; }
71
71
  });
72
72
  Object.defineProperty(exports, "StaticTokenAuth", {
73
73
  enumerable: true,
74
- get: function () { return chunkMYTMNPCP_cjs.StaticTokenAuth; }
74
+ get: function () { return chunkOMX7JBGY_cjs.StaticTokenAuth; }
75
75
  });
76
76
  Object.defineProperty(exports, "supabaseAuth", {
77
77
  enumerable: true,
78
- get: function () { return chunkMYTMNPCP_cjs.supabaseAuth; }
78
+ get: function () { return chunkOMX7JBGY_cjs.supabaseAuth; }
79
79
  });
80
80
  //# sourceMappingURL=client.cjs.map
81
81
  //# sourceMappingURL=client.cjs.map
@@ -1,4 +1,4 @@
1
- export { NodaroClient, createClient } from '../chunk-I7AHLDXV.js';
1
+ export { NodaroClient, createClient } from '../chunk-EC6MC46Y.js';
2
2
  import '../chunk-WY4QRJZW.js';
3
3
  import '../chunk-ERLXU47J.js';
4
4
  import '../chunk-T7N7DFQJ.js';
@@ -10,8 +10,8 @@ import '../chunk-WS4ZQ4AA.js';
10
10
  import '../chunk-WVFAQBS7.js';
11
11
  import '../chunk-AUKHMT53.js';
12
12
  import '../chunk-M7VSFZMV.js';
13
- import '../chunk-KBHDUHKM.js';
14
- import '../chunk-XILR6TFO.js';
13
+ import '../chunk-2SQ7V6EX.js';
14
+ import '../chunk-YXVMQEJX.js';
15
15
  import '../chunk-HPXE3NZW.js';
16
16
  import '../chunk-WEQWU2IC.js';
17
17
  import '../chunk-KFZOJBI5.js';
@@ -24,7 +24,7 @@ import '../chunk-NCCBS6GU.js';
24
24
  import '../chunk-BQAW4RX2.js';
25
25
  import '../chunk-Y6V6CBY5.js';
26
26
  import '../chunk-YVU2M7MI.js';
27
- import '../chunk-JTAW54UM.js';
27
+ import '../chunk-AEUPH7EE.js';
28
28
  import '../chunk-GW76IRQD.js';
29
29
  import '../chunk-Z7LGWNI7.js';
30
30
  import '../chunk-7LSFG2AF.js';
@@ -32,7 +32,7 @@ import '../chunk-ALSLZG3U.js';
32
32
  import '../chunk-RBX3QTKB.js';
33
33
  import '../chunk-Z3ZKFI2M.js';
34
34
  import '../chunk-JDEZHITT.js';
35
- import '../chunk-PQHZUWSL.js';
35
+ import '../chunk-THLTFB6I.js';
36
36
  import '../chunk-P6E4QDJN.js';
37
37
  import '../chunk-E37CVHWW.js';
38
38
  import '../chunk-TVENC6PH.js';
@@ -41,15 +41,15 @@ import '../chunk-SFB4YLCS.js';
41
41
  import '../chunk-BU5A6K4C.js';
42
42
  import '../chunk-D2ILCSOQ.js';
43
43
  import '../chunk-7CUWAVWB.js';
44
- export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-FCYN4N3M.js';
44
+ export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-XISHBW5I.js';
45
45
  import '../chunk-L6T44A3G.js';
46
46
  import '../chunk-CK3AMMSC.js';
47
- import '../chunk-5MOJSYHI.js';
47
+ import '../chunk-7QK2NXJA.js';
48
48
  import '../chunk-65E3JBFZ.js';
49
49
  import '../chunk-7LODCIQK.js';
50
50
  import '../chunk-3QFTP5P5.js';
51
- import '../chunk-J4WFSKY6.js';
52
- import '../chunk-OWG3XAHQ.js';
51
+ import '../chunk-WYYDWJFF.js';
52
+ import '../chunk-OCRUDBPG.js';
53
53
  import '../chunk-KG4R454Z.js';
54
54
  import '../chunk-EJSGJDZY.js';
55
55
  //# sourceMappingURL=client.js.map
@@ -1,26 +1,26 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-X7XP5WBP.cjs');
4
- var chunkMYTMNPCP_cjs = require('../chunk-MYTMNPCP.cjs');
4
+ var chunkOMX7JBGY_cjs = require('../chunk-OMX7JBGY.cjs');
5
5
  require('../chunk-FM2KM5TY.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "CallbackAuth", {
10
10
  enumerable: true,
11
- get: function () { return chunkMYTMNPCP_cjs.CallbackAuth; }
11
+ get: function () { return chunkOMX7JBGY_cjs.CallbackAuth; }
12
12
  });
13
13
  Object.defineProperty(exports, "NodaroClientCore", {
14
14
  enumerable: true,
15
- get: function () { return chunkMYTMNPCP_cjs.NodaroClientCore; }
15
+ get: function () { return chunkOMX7JBGY_cjs.NodaroClientCore; }
16
16
  });
17
17
  Object.defineProperty(exports, "StaticTokenAuth", {
18
18
  enumerable: true,
19
- get: function () { return chunkMYTMNPCP_cjs.StaticTokenAuth; }
19
+ get: function () { return chunkOMX7JBGY_cjs.StaticTokenAuth; }
20
20
  });
21
21
  Object.defineProperty(exports, "supabaseAuth", {
22
22
  enumerable: true,
23
- get: function () { return chunkMYTMNPCP_cjs.supabaseAuth; }
23
+ get: function () { return chunkOMX7JBGY_cjs.supabaseAuth; }
24
24
  });
25
25
  //# sourceMappingURL=core.cjs.map
26
26
  //# sourceMappingURL=core.cjs.map
@@ -1,5 +1,5 @@
1
1
  import '../chunk-AUDHV3OE.js';
2
- export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-FCYN4N3M.js';
2
+ export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-XISHBW5I.js';
3
3
  import '../chunk-L6T44A3G.js';
4
4
  //# sourceMappingURL=core.js.map
5
5
  //# sourceMappingURL=core.js.map
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-ALUUBPDG.cjs');
4
- var chunkFIMBPKIH_cjs = require('../chunk-FIMBPKIH.cjs');
4
+ var chunk4BAHF762_cjs = require('../chunk-4BAHF762.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "CreditsResource", {
9
9
  enumerable: true,
10
- get: function () { return chunkFIMBPKIH_cjs.CreditsResource; }
10
+ get: function () { return chunk4BAHF762_cjs.CreditsResource; }
11
11
  });
12
12
  //# sourceMappingURL=credits.cjs.map
13
13
  //# sourceMappingURL=credits.cjs.map
@@ -202,6 +202,157 @@ interface CreditTransactionsOptions {
202
202
  /** The `nextCursor` of the previous page. */
203
203
  cursor?: string;
204
204
  }
205
+ /** How `credits.usageSummary()` groups the series over time. */
206
+ type UsageSummaryBucket = "day" | "week" | "month";
207
+ interface UsageSummaryOptions {
208
+ /** An ISO-8601 timestamp, or a date alone (`"2026-10-01"`: that whole UTC day), inclusive; default the last 30 days up to now. A period of at most a year. */
209
+ from?: string;
210
+ to?: string;
211
+ /** Default `"day"`. Buckets are UTC. */
212
+ bucket?: UsageSummaryBucket;
213
+ }
214
+ interface UsageSummaryTotals {
215
+ /** Credits spent on runs in the period: each run's charge (a running hold counts; a refunded run does not). */
216
+ used: number;
217
+ /** Credits bought: packs, loads, subscription grants. */
218
+ purchased: number;
219
+ /** Credits granted free, net: sign-up and admin adjustments, a grant taken back subtracted. */
220
+ granted: number;
221
+ /** Credits given back for a refunded run or by Stripe (a hold released when a run settled below it is not a refund). */
222
+ refunded: number;
223
+ /** Runs that were charged or are still running. */
224
+ runs: number;
225
+ /** `used / runs`, one decimal; 0 with no runs. */
226
+ avgPerRun: number;
227
+ }
228
+ interface UsageByModel {
229
+ model: string;
230
+ provider: string | null;
231
+ credits: number;
232
+ runs: number;
233
+ /** Of `totals.used`, 0–1. */
234
+ share: number;
235
+ }
236
+ interface UsageByCategory {
237
+ /** `"image"`, `"video"`, `"audio"` or `"other"`. */
238
+ category: string;
239
+ credits: number;
240
+ runs: number;
241
+ }
242
+ interface UsageOverTime {
243
+ /** The bucket's first day in UTC (`"2026-10-26"`; a week by its Monday; a month as `"2026-10"`). The first bucket of a period may be a partial week or month. */
244
+ bucket: string;
245
+ used: number;
246
+ purchased: number;
247
+ runs: number;
248
+ }
249
+ /** The spend of one session or one workflow. */
250
+ interface UsageByGroup {
251
+ id: string;
252
+ /** The session's title or the workflow's name; `null` when it has none or is gone. */
253
+ name: string | null;
254
+ /** The tool the session belongs to; `null` on a workflow. */
255
+ tool: string | null;
256
+ credits: number;
257
+ runs: number;
258
+ /** The models used, by spend. */
259
+ models: string[];
260
+ /** ISO-8601: the latest run. */
261
+ lastAt: string;
262
+ }
263
+ /** The answer of `credits.usageSummary()`. */
264
+ interface UsageSummary {
265
+ period: {
266
+ from: string;
267
+ to: string;
268
+ bucket: UsageSummaryBucket;
269
+ };
270
+ totals: UsageSummaryTotals;
271
+ /** The model with the most spend; `null` with no runs. */
272
+ mostUsed: UsageByModel | null;
273
+ /** By spend. */
274
+ byModel: UsageByModel[];
275
+ byCategory: UsageByCategory[];
276
+ /** Every bucket of the period, empty ones included, oldest first. */
277
+ overTime: UsageOverTime[];
278
+ bySession: UsageByGroup[];
279
+ byWorkflow: UsageByGroup[];
280
+ /** A read hit the server's row cap: the figures under-report; narrow the period. */
281
+ truncated: boolean;
282
+ /** A side read failed on the server (the jobs, or a session's or workflow's name): a grouping is missing or unnamed; the totals are whole. */
283
+ partial: boolean;
284
+ }
285
+ /** What a movement of the balance was; `app` is credits earned from, or paid for, a published app. */
286
+ type CreditHistoryKind = "usage" | "purchase" | "grant" | "refund" | "app" | "adjustment" | "expiry";
287
+ /** The job behind a usage row of {@link CreditHistoryEntry}. */
288
+ interface CreditHistoryJob {
289
+ id: string;
290
+ /** The node type that ran (`generate-image`, `image-to-video`, …); `null` when the job is gone. */
291
+ type: string | null;
292
+ status: string | null;
293
+ startedAt: string | null;
294
+ completedAt: string | null;
295
+ /** From start to completion; `null` until it completes. */
296
+ durationMs: number | null;
297
+ workflowId: string | null;
298
+ sessionId: string | null;
299
+ }
300
+ /** One movement of the balance (`credits.history()`). */
301
+ interface CreditHistoryEntry {
302
+ id: string;
303
+ /** ISO-8601. Also the paging cursor. */
304
+ at: string;
305
+ kind: CreditHistoryKind;
306
+ /** The ledger's own word: `usage`, `one_time_purchase`, `subscription_renewal`, `signup_grant`, `refund`, `admin_adjustment`, `expiry`, … */
307
+ source: string;
308
+ /** The movement, signed: a run's hold negative, a purchase positive. */
309
+ amount: number;
310
+ /** The balance right after this movement. */
311
+ balanceAfter: number;
312
+ /** Which pool moved; `"mixed"` when both did. */
313
+ pool: "subscription" | "topup" | "mixed";
314
+ description: string | null;
315
+ /** The model that ran, on a row with a job; `null` otherwise. */
316
+ model: string | null;
317
+ provider: string | null;
318
+ /**
319
+ * The job's charge, on its reserve row only (the hold taken when the run
320
+ * was accepted): the settled charge, the hold while the run is open, `0`
321
+ * once refunded. `null` on every other row — a refund, a metered overrun
322
+ * line, a purchase — so summing it over a list counts each job once. Read
323
+ * this for spend, not `amount`.
324
+ */
325
+ charge: number | null;
326
+ /** The run's credit status (`"reserved"`, `"committed"` or `"refunded"`), beside `charge`; `null` elsewhere. */
327
+ status: string | null;
328
+ /** On a row with a job; `type` and the rest `null` when the job is gone or not the person's. */
329
+ job: CreditHistoryJob | null;
330
+ /** Stripe's hosted receipt, on a purchase that has one. */
331
+ receiptUrl: string | null;
332
+ }
333
+ /** A page of {@link CreditHistoryEntry}, newest first. */
334
+ interface CreditHistoryPage {
335
+ data: CreditHistoryEntry[];
336
+ /** Pass as `cursor` for the next page; `null` when there are no more rows. */
337
+ nextCursor: string | null;
338
+ }
339
+ /** What narrows the history. */
340
+ interface CreditHistoryFilters {
341
+ kind?: CreditHistoryKind;
342
+ /** A model identifier: only runs of that model. */
343
+ model?: string;
344
+ /** ISO-8601 bounds on `at`, inclusive. */
345
+ from?: string;
346
+ to?: string;
347
+ /** Words looked for in the description, case-insensitively. */
348
+ q?: string;
349
+ }
350
+ interface CreditHistoryOptions extends CreditHistoryFilters {
351
+ /** Rows per page, 1–100 (server default 50). */
352
+ limit?: number;
353
+ /** The `nextCursor` of the previous page, as given (opaque; another string is refused with 400). */
354
+ cursor?: string;
355
+ }
205
356
  declare class CreditsResource {
206
357
  private client;
207
358
  constructor(client: NodaroClientCore);
@@ -219,6 +370,33 @@ declare class CreditsResource {
219
370
  * Cloud-only route: a self-hosted instance answers 404.
220
371
  */
221
372
  transactions(options?: CreditTransactionsOptions): Promise<CreditTransactionsPage>;
373
+ /**
374
+ * `GET /v1/credits/usage-summary` → the period's credit usage summed the
375
+ * way a billing screen draws it: totals, the spend by model and by
376
+ * category, a series over time (`bucket`: day, week or month, no holes),
377
+ * and the spend by session and by workflow. The last 30 days unless
378
+ * `from` / `to` say otherwise; a period of at most a year (400 beyond).
379
+ * Cloud-only route: a self-hosted instance answers 404.
380
+ */
381
+ usageSummary(options?: UsageSummaryOptions): Promise<UsageSummary>;
382
+ /**
383
+ * `GET /v1/credits/history` → one page of every movement of the balance,
384
+ * newest first — runs, purchases, grants, refunds, adjustments, expiries —
385
+ * each with the balance after it; a job's reserve row carries its model,
386
+ * its `charge` (the settled charge, the hold while the run is open, `0`
387
+ * once refunded — read that for spend, not `amount`) and its job. Filter by
388
+ * `kind`, `model`, `from` / `to` and `q`; pass the page's `nextCursor` (an
389
+ * opaque string) as `cursor` for the next page (`null` at the end).
390
+ * Cloud-only route: a self-hosted instance answers 404.
391
+ */
392
+ history(options?: CreditHistoryOptions): Promise<CreditHistoryPage>;
393
+ /**
394
+ * `GET /v1/credits/history?format=csv` → the whole filtered history as a
395
+ * CSV file (the same fields as {@link history}, one line per movement,
396
+ * newest first), at most 5,000 rows — the last line says when it was cut.
397
+ * Hand the text to the person as `credit-history.csv`.
398
+ */
399
+ exportHistory(filters?: CreditHistoryFilters): Promise<string>;
222
400
  /**
223
401
  * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor
224
402
  * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers
@@ -269,4 +447,4 @@ declare class CreditsResource {
269
447
  markWelcomeOfferSeen(): Promise<WelcomeOfferSeenResult>;
270
448
  }
271
449
 
272
- export { type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
450
+ export { type CreditHistoryEntry, type CreditHistoryFilters, type CreditHistoryJob, type CreditHistoryKind, type CreditHistoryOptions, type CreditHistoryPage, type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UsageByCategory, type UsageByGroup, type UsageByModel, type UsageOverTime, type UsageSummary, type UsageSummaryBucket, type UsageSummaryOptions, type UsageSummaryTotals, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
@@ -202,6 +202,157 @@ interface CreditTransactionsOptions {
202
202
  /** The `nextCursor` of the previous page. */
203
203
  cursor?: string;
204
204
  }
205
+ /** How `credits.usageSummary()` groups the series over time. */
206
+ type UsageSummaryBucket = "day" | "week" | "month";
207
+ interface UsageSummaryOptions {
208
+ /** An ISO-8601 timestamp, or a date alone (`"2026-10-01"`: that whole UTC day), inclusive; default the last 30 days up to now. A period of at most a year. */
209
+ from?: string;
210
+ to?: string;
211
+ /** Default `"day"`. Buckets are UTC. */
212
+ bucket?: UsageSummaryBucket;
213
+ }
214
+ interface UsageSummaryTotals {
215
+ /** Credits spent on runs in the period: each run's charge (a running hold counts; a refunded run does not). */
216
+ used: number;
217
+ /** Credits bought: packs, loads, subscription grants. */
218
+ purchased: number;
219
+ /** Credits granted free, net: sign-up and admin adjustments, a grant taken back subtracted. */
220
+ granted: number;
221
+ /** Credits given back for a refunded run or by Stripe (a hold released when a run settled below it is not a refund). */
222
+ refunded: number;
223
+ /** Runs that were charged or are still running. */
224
+ runs: number;
225
+ /** `used / runs`, one decimal; 0 with no runs. */
226
+ avgPerRun: number;
227
+ }
228
+ interface UsageByModel {
229
+ model: string;
230
+ provider: string | null;
231
+ credits: number;
232
+ runs: number;
233
+ /** Of `totals.used`, 0–1. */
234
+ share: number;
235
+ }
236
+ interface UsageByCategory {
237
+ /** `"image"`, `"video"`, `"audio"` or `"other"`. */
238
+ category: string;
239
+ credits: number;
240
+ runs: number;
241
+ }
242
+ interface UsageOverTime {
243
+ /** The bucket's first day in UTC (`"2026-10-26"`; a week by its Monday; a month as `"2026-10"`). The first bucket of a period may be a partial week or month. */
244
+ bucket: string;
245
+ used: number;
246
+ purchased: number;
247
+ runs: number;
248
+ }
249
+ /** The spend of one session or one workflow. */
250
+ interface UsageByGroup {
251
+ id: string;
252
+ /** The session's title or the workflow's name; `null` when it has none or is gone. */
253
+ name: string | null;
254
+ /** The tool the session belongs to; `null` on a workflow. */
255
+ tool: string | null;
256
+ credits: number;
257
+ runs: number;
258
+ /** The models used, by spend. */
259
+ models: string[];
260
+ /** ISO-8601: the latest run. */
261
+ lastAt: string;
262
+ }
263
+ /** The answer of `credits.usageSummary()`. */
264
+ interface UsageSummary {
265
+ period: {
266
+ from: string;
267
+ to: string;
268
+ bucket: UsageSummaryBucket;
269
+ };
270
+ totals: UsageSummaryTotals;
271
+ /** The model with the most spend; `null` with no runs. */
272
+ mostUsed: UsageByModel | null;
273
+ /** By spend. */
274
+ byModel: UsageByModel[];
275
+ byCategory: UsageByCategory[];
276
+ /** Every bucket of the period, empty ones included, oldest first. */
277
+ overTime: UsageOverTime[];
278
+ bySession: UsageByGroup[];
279
+ byWorkflow: UsageByGroup[];
280
+ /** A read hit the server's row cap: the figures under-report; narrow the period. */
281
+ truncated: boolean;
282
+ /** A side read failed on the server (the jobs, or a session's or workflow's name): a grouping is missing or unnamed; the totals are whole. */
283
+ partial: boolean;
284
+ }
285
+ /** What a movement of the balance was; `app` is credits earned from, or paid for, a published app. */
286
+ type CreditHistoryKind = "usage" | "purchase" | "grant" | "refund" | "app" | "adjustment" | "expiry";
287
+ /** The job behind a usage row of {@link CreditHistoryEntry}. */
288
+ interface CreditHistoryJob {
289
+ id: string;
290
+ /** The node type that ran (`generate-image`, `image-to-video`, …); `null` when the job is gone. */
291
+ type: string | null;
292
+ status: string | null;
293
+ startedAt: string | null;
294
+ completedAt: string | null;
295
+ /** From start to completion; `null` until it completes. */
296
+ durationMs: number | null;
297
+ workflowId: string | null;
298
+ sessionId: string | null;
299
+ }
300
+ /** One movement of the balance (`credits.history()`). */
301
+ interface CreditHistoryEntry {
302
+ id: string;
303
+ /** ISO-8601. Also the paging cursor. */
304
+ at: string;
305
+ kind: CreditHistoryKind;
306
+ /** The ledger's own word: `usage`, `one_time_purchase`, `subscription_renewal`, `signup_grant`, `refund`, `admin_adjustment`, `expiry`, … */
307
+ source: string;
308
+ /** The movement, signed: a run's hold negative, a purchase positive. */
309
+ amount: number;
310
+ /** The balance right after this movement. */
311
+ balanceAfter: number;
312
+ /** Which pool moved; `"mixed"` when both did. */
313
+ pool: "subscription" | "topup" | "mixed";
314
+ description: string | null;
315
+ /** The model that ran, on a row with a job; `null` otherwise. */
316
+ model: string | null;
317
+ provider: string | null;
318
+ /**
319
+ * The job's charge, on its reserve row only (the hold taken when the run
320
+ * was accepted): the settled charge, the hold while the run is open, `0`
321
+ * once refunded. `null` on every other row — a refund, a metered overrun
322
+ * line, a purchase — so summing it over a list counts each job once. Read
323
+ * this for spend, not `amount`.
324
+ */
325
+ charge: number | null;
326
+ /** The run's credit status (`"reserved"`, `"committed"` or `"refunded"`), beside `charge`; `null` elsewhere. */
327
+ status: string | null;
328
+ /** On a row with a job; `type` and the rest `null` when the job is gone or not the person's. */
329
+ job: CreditHistoryJob | null;
330
+ /** Stripe's hosted receipt, on a purchase that has one. */
331
+ receiptUrl: string | null;
332
+ }
333
+ /** A page of {@link CreditHistoryEntry}, newest first. */
334
+ interface CreditHistoryPage {
335
+ data: CreditHistoryEntry[];
336
+ /** Pass as `cursor` for the next page; `null` when there are no more rows. */
337
+ nextCursor: string | null;
338
+ }
339
+ /** What narrows the history. */
340
+ interface CreditHistoryFilters {
341
+ kind?: CreditHistoryKind;
342
+ /** A model identifier: only runs of that model. */
343
+ model?: string;
344
+ /** ISO-8601 bounds on `at`, inclusive. */
345
+ from?: string;
346
+ to?: string;
347
+ /** Words looked for in the description, case-insensitively. */
348
+ q?: string;
349
+ }
350
+ interface CreditHistoryOptions extends CreditHistoryFilters {
351
+ /** Rows per page, 1–100 (server default 50). */
352
+ limit?: number;
353
+ /** The `nextCursor` of the previous page, as given (opaque; another string is refused with 400). */
354
+ cursor?: string;
355
+ }
205
356
  declare class CreditsResource {
206
357
  private client;
207
358
  constructor(client: NodaroClientCore);
@@ -219,6 +370,33 @@ declare class CreditsResource {
219
370
  * Cloud-only route: a self-hosted instance answers 404.
220
371
  */
221
372
  transactions(options?: CreditTransactionsOptions): Promise<CreditTransactionsPage>;
373
+ /**
374
+ * `GET /v1/credits/usage-summary` → the period's credit usage summed the
375
+ * way a billing screen draws it: totals, the spend by model and by
376
+ * category, a series over time (`bucket`: day, week or month, no holes),
377
+ * and the spend by session and by workflow. The last 30 days unless
378
+ * `from` / `to` say otherwise; a period of at most a year (400 beyond).
379
+ * Cloud-only route: a self-hosted instance answers 404.
380
+ */
381
+ usageSummary(options?: UsageSummaryOptions): Promise<UsageSummary>;
382
+ /**
383
+ * `GET /v1/credits/history` → one page of every movement of the balance,
384
+ * newest first — runs, purchases, grants, refunds, adjustments, expiries —
385
+ * each with the balance after it; a job's reserve row carries its model,
386
+ * its `charge` (the settled charge, the hold while the run is open, `0`
387
+ * once refunded — read that for spend, not `amount`) and its job. Filter by
388
+ * `kind`, `model`, `from` / `to` and `q`; pass the page's `nextCursor` (an
389
+ * opaque string) as `cursor` for the next page (`null` at the end).
390
+ * Cloud-only route: a self-hosted instance answers 404.
391
+ */
392
+ history(options?: CreditHistoryOptions): Promise<CreditHistoryPage>;
393
+ /**
394
+ * `GET /v1/credits/history?format=csv` → the whole filtered history as a
395
+ * CSV file (the same fields as {@link history}, one line per movement,
396
+ * newest first), at most 5,000 rows — the last line says when it was cut.
397
+ * Hand the text to the person as `credit-history.csv`.
398
+ */
399
+ exportHistory(filters?: CreditHistoryFilters): Promise<string>;
222
400
  /**
223
401
  * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor
224
402
  * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers
@@ -269,4 +447,4 @@ declare class CreditsResource {
269
447
  markWelcomeOfferSeen(): Promise<WelcomeOfferSeenResult>;
270
448
  }
271
449
 
272
- export { type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
450
+ export { type CreditHistoryEntry, type CreditHistoryFilters, type CreditHistoryJob, type CreditHistoryKind, type CreditHistoryOptions, type CreditHistoryPage, type CreditTransaction, type CreditTransactionsOptions, type CreditTransactionsPage, CreditsResource, type FreeGrantState, type ModelCostError, type ModelCostResult, type ModelCostsResult, type SignupGrantClaimResult, type SignupKeys, type UsageByCategory, type UsageByGroup, type UsageByModel, type UsageOverTime, type UsageSummary, type UsageSummaryBucket, type UsageSummaryOptions, type UsageSummaryTotals, type UserBalance, type WelcomeOfferClaimInput, type WelcomeOfferClaimResult, type WelcomeOfferSeenResult, type WelcomeOfferState };
@@ -1,4 +1,4 @@
1
1
  import '../chunk-V4GPQ6Y2.js';
2
- export { CreditsResource } from '../chunk-5MOJSYHI.js';
2
+ export { CreditsResource } from '../chunk-7QK2NXJA.js';
3
3
  //# sourceMappingURL=credits.js.map
4
4
  //# sourceMappingURL=credits.js.map
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-EHRWTYGR.cjs');
4
- var chunk7LTVS75S_cjs = require('../chunk-7LTVS75S.cjs');
4
+ var chunkP6AM42UB_cjs = require('../chunk-P6AM42UB.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "JobsResource", {
9
9
  enumerable: true,
10
- get: function () { return chunk7LTVS75S_cjs.JobsResource; }
10
+ get: function () { return chunkP6AM42UB_cjs.JobsResource; }
11
11
  });
12
12
  //# sourceMappingURL=jobs.cjs.map
13
13
  //# sourceMappingURL=jobs.cjs.map
@@ -133,17 +133,28 @@ interface Job {
133
133
  * `usage_logs.status`. `null` when there is no usage log to report. Never
134
134
  * changes the meaning of `credits` (the reserved amount) below. */
135
135
  credit_status?: CreditStatus | null;
136
- /** The credits HELD when the job was accepted. Never changes — a job can
137
- * settle below it; read {@link Job.credits_charged} for what it cost. */
136
+ /** The credits the job itself HELD when it was accepted. Never changes — a
137
+ * job can settle below it; read {@link Job.credits_charged} for what it cost. */
138
138
  credits: number | null;
139
139
  /**
140
- * What the job actually cost once its hold settled. Can be lower than
141
- * `credits` (the unused part goes back to the balance), `0` when the hold was
142
- * refunded, `null` while the job is still running or when it reserved
143
- * nothing of its own. Sum this — not `credits` — to total spend. Returned by
144
- * `get()` and `list()`.
140
+ * What the job actually cost once its hold settled, INCLUDING the steps it
141
+ * ran: a job that runs other jobs for you (a Nodaro Motion run's reference
142
+ * preparation, mask and video) is charged for each, and they are not listed
143
+ * on their own. A step adds its charge once it settles. Can be lower than
144
+ * {@link Job.credits_held} (the unused part goes back to the balance). `0`
145
+ * when the run's own hold was refunded, plus any settled steps (a refunded
146
+ * Nodaro Motion run whose reference and mask steps committed reads
147
+ * `credit_status: "refunded"` with `credits_charged: 165`). `null` while the
148
+ * job's own hold is still open (even when some steps have settled), when
149
+ * nothing in the run was reserved, or when its steps could not be read for a
150
+ * moment (unknown — never a lower figure). Sum this — not `credits` — to
151
+ * total spend. Returned by `get()` and `list()`.
145
152
  */
146
153
  credits_charged?: number | null;
154
+ /** The run's hold: the job's own `credits` plus its steps' holds (equals `credits` for a job with no steps). */
155
+ credits_held?: number | null;
156
+ /** What went back from `credits_held` once every hold in the run settled; `null` until then. */
157
+ credits_released?: number | null;
147
158
  job_type: string | null;
148
159
  created_at: string;
149
160
  started_at: string | null;