@leaflow/sdk 0.47.0 → 0.48.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.
|
@@ -30,6 +30,8 @@ export type StartTopUpResult = operations["start-top-up"]["responses"][200]["con
|
|
|
30
30
|
export type StartTopUpBody = NonNullable<operations["start-top-up"]["requestBody"]>["content"]["application/json"];
|
|
31
31
|
/** `GET /account/v1/billing-accounts/{accountKey}/charges` 成功时的响应体。 */
|
|
32
32
|
export type ListChargesResult = operations["list-charges"]["responses"][200]["content"]["application/json"];
|
|
33
|
+
/** `GET /account/v1/billing-accounts/{accountKey}/charges/{chargeId}/usage` 成功时的响应体。 */
|
|
34
|
+
export type GetChargeUsageResult = operations["get-charge-usage"]["responses"][200]["content"]["application/json"];
|
|
33
35
|
/** `GET /account/v1/billing-accounts/{accountKey}/invoices` 成功时的响应体。 */
|
|
34
36
|
export type ListInvoicesResult = operations["list-invoices"]["responses"][200]["content"]["application/json"];
|
|
35
37
|
/** `GET /account/v1/billing-accounts/{accountKey}/invoices/{invoiceId}` 成功时的响应体。 */
|
|
@@ -282,6 +282,63 @@ export interface paths {
|
|
|
282
282
|
patch?: never;
|
|
283
283
|
trace?: never;
|
|
284
284
|
};
|
|
285
|
+
"/account/v1/billing-accounts/{accountKey}/charges/{chargeId}/usage": {
|
|
286
|
+
parameters: {
|
|
287
|
+
query?: never;
|
|
288
|
+
header?: never;
|
|
289
|
+
path?: never;
|
|
290
|
+
cookie?: never;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* What produced this charge
|
|
294
|
+
* @description Splits one charge back into the projects that produced it, and lists the resources it could
|
|
295
|
+
* have come from.
|
|
296
|
+
*
|
|
297
|
+
* ## Why this is not a field on the charge
|
|
298
|
+
*
|
|
299
|
+
* A charge has no project, and that is not an omission: the billing subject is the **account**,
|
|
300
|
+
* and the project is a dimension on each usage event. When three of an account's projects use
|
|
301
|
+
* the same product, their usage aggregates into one charge — that charge genuinely spans three
|
|
302
|
+
* projects, and stamping any single project id on it would be wrong.
|
|
303
|
+
*
|
|
304
|
+
* A split is also more useful than a label would be: it gives proportions, and proportions are
|
|
305
|
+
* what decide which project's resources to switch off.
|
|
306
|
+
*
|
|
307
|
+
* ## The quantity here is what was reported, not what was billed
|
|
308
|
+
*
|
|
309
|
+
* Conversion (machine-seconds to machine-hours) happens on the pricing side, and the engine
|
|
310
|
+
* does not echo `unit_config` back on a charge. So this figure times the unit price does not
|
|
311
|
+
* equal the total — a step is missing in between, and that step only becomes visible on the
|
|
312
|
+
* invoice, where the whole pricing configuration is frozen onto each line.
|
|
313
|
+
*
|
|
314
|
+
* Reported quantity is still the right number for "which project is burning this", which is
|
|
315
|
+
* what the split is for.
|
|
316
|
+
*
|
|
317
|
+
* ## The resource list says which, not how much
|
|
318
|
+
*
|
|
319
|
+
* Usage events carry no resource id — it is not a grouping dimension, and making it one would
|
|
320
|
+
* mean one time series per machine per hour. So the engine cannot attribute a charge to a
|
|
321
|
+
* machine. What it can be attributed to is a product, and which resources of that product
|
|
322
|
+
* exist is something billing knows from its own records.
|
|
323
|
+
*
|
|
324
|
+
* Destroyed resources are listed too: this period's charge includes the part they ran for.
|
|
325
|
+
* Leaving them out is what makes the numbers fail to add up for someone who deleted a machine
|
|
326
|
+
* mid-month — which is exactly the case they are trying to explain.
|
|
327
|
+
*
|
|
328
|
+
* ## A flat fee answers with an empty split
|
|
329
|
+
*
|
|
330
|
+
* There is no meter behind it, so there is nothing to attribute. That is an answer, not an
|
|
331
|
+
* error.
|
|
332
|
+
*/
|
|
333
|
+
get: operations["get-charge-usage"];
|
|
334
|
+
put?: never;
|
|
335
|
+
post?: never;
|
|
336
|
+
delete?: never;
|
|
337
|
+
options?: never;
|
|
338
|
+
head?: never;
|
|
339
|
+
patch?: never;
|
|
340
|
+
trace?: never;
|
|
341
|
+
};
|
|
285
342
|
"/account/v1/billing-accounts/{accountKey}/invoices": {
|
|
286
343
|
parameters: {
|
|
287
344
|
query?: never;
|
|
@@ -1413,6 +1470,51 @@ export interface components {
|
|
|
1413
1470
|
discounts?: string;
|
|
1414
1471
|
/** @description Free text from the charge, usually empty. Set on charges raised by hand. */
|
|
1415
1472
|
description?: string;
|
|
1473
|
+
/**
|
|
1474
|
+
* @description What one unit costs, as a decimal string. Absent when the line has no single unit price
|
|
1475
|
+
* — a flat fee, or a tiered price whose rate changes with volume.
|
|
1476
|
+
*
|
|
1477
|
+
* The conversion between reported and billed quantity is deliberately not here: the engine
|
|
1478
|
+
* does not echo it back on a charge, only on an invoice line. So a charge answers "what
|
|
1479
|
+
* does a unit cost", and an invoice answers "how the total was reached".
|
|
1480
|
+
*/
|
|
1481
|
+
unit_price?: string;
|
|
1482
|
+
};
|
|
1483
|
+
/** @description What produced one charge */
|
|
1484
|
+
ChargeUsage: {
|
|
1485
|
+
charge_id: string;
|
|
1486
|
+
/**
|
|
1487
|
+
* @description Total reported quantity for the period, as a decimal string. Empty on a charge with no
|
|
1488
|
+
* meter behind it.
|
|
1489
|
+
*
|
|
1490
|
+
* Reported, not billed: see the route's description.
|
|
1491
|
+
*/
|
|
1492
|
+
quantity: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* @description The same quantity split by project. Empty when the charge has no meter behind it — a
|
|
1495
|
+
* flat fee has nothing to attribute.
|
|
1496
|
+
*/
|
|
1497
|
+
by_project: components["schemas"]["ProjectUsage"][];
|
|
1498
|
+
/**
|
|
1499
|
+
* @description Resources of this product in the account's projects — candidates for what produced the
|
|
1500
|
+
* charge, not a per-resource breakdown. Absent when billing could not look them up; the
|
|
1501
|
+
* charge itself is still answered.
|
|
1502
|
+
*/
|
|
1503
|
+
resources?: components["schemas"]["ChargeResource"][];
|
|
1504
|
+
};
|
|
1505
|
+
ProjectUsage: {
|
|
1506
|
+
project_id: string;
|
|
1507
|
+
/** @description Decimal string. */
|
|
1508
|
+
quantity: string;
|
|
1509
|
+
};
|
|
1510
|
+
ChargeResource: {
|
|
1511
|
+
project_id: string;
|
|
1512
|
+
/** @description Which service holds it, and therefore which console manages it. */
|
|
1513
|
+
service: string;
|
|
1514
|
+
product_id: string;
|
|
1515
|
+
resource_id: string;
|
|
1516
|
+
/** @enum {string} */
|
|
1517
|
+
state: "pending" | "active" | "suspended" | "terminated";
|
|
1416
1518
|
};
|
|
1417
1519
|
ChargeList: {
|
|
1418
1520
|
currency: components["schemas"]["Currency"];
|
|
@@ -1452,6 +1554,33 @@ export interface components {
|
|
|
1452
1554
|
/** @description Before discounts and credit */
|
|
1453
1555
|
amount: string;
|
|
1454
1556
|
discounts_total?: string;
|
|
1557
|
+
/**
|
|
1558
|
+
* @description The billed quantity for this line, as a decimal string — after conversion. A machine
|
|
1559
|
+
* billed by the hour reports machine-seconds; this is machine-hours.
|
|
1560
|
+
*
|
|
1561
|
+
* It comes from the line's detailed segments summed together: the engine splits a line
|
|
1562
|
+
* into segments (different cost categories, different sub-periods) and the quantity lives
|
|
1563
|
+
* on those.
|
|
1564
|
+
*/
|
|
1565
|
+
quantity?: string;
|
|
1566
|
+
/**
|
|
1567
|
+
* @description What one unit cost, as a decimal string, frozen at billing time. Absent on a flat fee,
|
|
1568
|
+
* whose amount is the amount, and on tiered prices, whose rate changes with volume.
|
|
1569
|
+
*/
|
|
1570
|
+
unit_price?: string;
|
|
1571
|
+
/**
|
|
1572
|
+
* @description How reported quantity became billed quantity — 3600 for a machine billed by the hour
|
|
1573
|
+
* from machine-seconds, 1000000 for a price per million tokens.
|
|
1574
|
+
*
|
|
1575
|
+
* Without it, `quantity` disagrees with what the customer remembers doing, by whole orders
|
|
1576
|
+
* of magnitude, and there is nothing on the page that explains the gap.
|
|
1577
|
+
*/
|
|
1578
|
+
conversion_factor?: string;
|
|
1579
|
+
/**
|
|
1580
|
+
* @description What was done with the factor.
|
|
1581
|
+
* @enum {string}
|
|
1582
|
+
*/
|
|
1583
|
+
conversion_operation?: "divide" | "multiply";
|
|
1455
1584
|
/** @description How much of this line credit covered */
|
|
1456
1585
|
credits_total?: string;
|
|
1457
1586
|
total: string;
|
|
@@ -1986,6 +2115,43 @@ export interface operations {
|
|
|
1986
2115
|
};
|
|
1987
2116
|
};
|
|
1988
2117
|
};
|
|
2118
|
+
"get-charge-usage": {
|
|
2119
|
+
parameters: {
|
|
2120
|
+
query?: never;
|
|
2121
|
+
header?: never;
|
|
2122
|
+
path: {
|
|
2123
|
+
/**
|
|
2124
|
+
* @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
|
|
2125
|
+
* which is why the key is what addresses the account.
|
|
2126
|
+
*/
|
|
2127
|
+
accountKey: components["parameters"]["AccountKey"];
|
|
2128
|
+
/** @description Which charge, from the charges list */
|
|
2129
|
+
chargeId: string;
|
|
2130
|
+
};
|
|
2131
|
+
cookie?: never;
|
|
2132
|
+
};
|
|
2133
|
+
requestBody?: never;
|
|
2134
|
+
responses: {
|
|
2135
|
+
/** @description OK */
|
|
2136
|
+
200: {
|
|
2137
|
+
headers: {
|
|
2138
|
+
[name: string]: unknown;
|
|
2139
|
+
};
|
|
2140
|
+
content: {
|
|
2141
|
+
"application/json": components["schemas"]["ChargeUsage"];
|
|
2142
|
+
};
|
|
2143
|
+
};
|
|
2144
|
+
/** @description Error */
|
|
2145
|
+
default: {
|
|
2146
|
+
headers: {
|
|
2147
|
+
[name: string]: unknown;
|
|
2148
|
+
};
|
|
2149
|
+
content: {
|
|
2150
|
+
"application/json": components["schemas"]["Error"];
|
|
2151
|
+
};
|
|
2152
|
+
};
|
|
2153
|
+
};
|
|
2154
|
+
};
|
|
1989
2155
|
"list-invoices": {
|
|
1990
2156
|
parameters: {
|
|
1991
2157
|
query?: never;
|