@oneie/sdk 0.17.5 → 0.17.6
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/dist/billing.d.ts +244 -14
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +374 -55
- package/dist/billing.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/generated/schemas/index.d.ts +2 -2
- package/dist/generated/schemas.d.ts +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/meta.d.ts +13 -0
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +11 -0
- package/dist/meta.js.map +1 -1
- package/dist/prices/vendors.d.ts +7 -0
- package/dist/prices/vendors.d.ts.map +1 -0
- package/dist/prices/vendors.js +229 -0
- package/dist/prices/vendors.js.map +1 -0
- package/dist/prices.d.ts +41 -0
- package/dist/prices.d.ts.map +1 -0
- package/dist/prices.js +79 -0
- package/dist/prices.js.map +1 -0
- package/dist/receiver-layers.d.ts +26 -0
- package/dist/receiver-layers.d.ts.map +1 -1
- package/dist/receiver-layers.js +54 -5
- package/dist/receiver-layers.js.map +1 -1
- package/dist/receivers.d.ts +437 -63
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +566 -129
- package/dist/receivers.js.map +1 -1
- package/dist/secrets-give.d.ts +1 -1
- package/dist/secrets-give.d.ts.map +1 -1
- package/dist/secrets-give.js +1 -1
- package/dist/secrets-give.js.map +1 -1
- package/dist/secrets-list.d.ts +169 -0
- package/dist/secrets-list.d.ts.map +1 -0
- package/dist/secrets-list.js +13 -0
- package/dist/secrets-list.js.map +1 -0
- package/dist/secrets-one-vault.d.ts +33 -1
- package/dist/secrets-one-vault.d.ts.map +1 -1
- package/dist/secrets-one-vault.js +42 -2
- package/dist/secrets-one-vault.js.map +1 -1
- package/dist/secrets.d.ts +9 -0
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +12 -0
- package/dist/secrets.js.map +1 -1
- package/dist/work-contract-grammar.json +36 -5
- package/dist/work-contract.d.ts +24 -0
- package/dist/work-contract.d.ts.map +1 -1
- package/dist/work-contract.js +55 -0
- package/dist/work-contract.js.map +1 -1
- package/package.json +6 -2
package/dist/billing.d.ts
CHANGED
|
@@ -2,17 +2,68 @@
|
|
|
2
2
|
* Billing helpers — pure, no I/O.
|
|
3
3
|
*
|
|
4
4
|
* CREDITS_PER_USD: the canonical credit rate.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* estimateCallUsd: what a model call cost ONE, from the live OpenRouter blob
|
|
6
|
+
* (cache- and tier-aware), the vendor table, or the last-resort constant.
|
|
7
|
+
* creditsForCost: the ONE rounding from dollars of cost to whole credits.
|
|
8
|
+
* spend / computeBurn: the row every door writes — cost + margins, in integers.
|
|
9
|
+
* unitPrice / priceUnits: media, voice, tool and direct-provider prices (prices.ts).
|
|
10
|
+
* Policy: text/billing-prices.md.
|
|
11
|
+
*/
|
|
12
|
+
import { unitPrice, priceUnits, VENDOR_ASOF, type PriceUnit, type UnitPrice } from './prices.js';
|
|
13
|
+
export { unitPrice, priceUnits, VENDOR_ASOF };
|
|
14
|
+
export type { PriceUnit, UnitPrice };
|
|
15
|
+
/**
|
|
16
|
+
* One entry of OpenRouter's `pricing.overrides[]`. It carries conditions and the
|
|
17
|
+
* prices that replace the base while ALL of them hold:
|
|
18
|
+
* - `minPromptTokens` — a long prompt moves the call to this tier;
|
|
19
|
+
* - `utcStart` / `utcEnd` — a daily UTC window, HHMM numbers (1500 = 15:00),
|
|
20
|
+
* half-open `[start, end)`, wrapping past midnight when start > end
|
|
21
|
+
* (minimax-m3.1-flash is half price 15:00-01:00).
|
|
22
|
+
* An entry with neither condition never applies (the sync drops it).
|
|
23
|
+
*/
|
|
24
|
+
export type RateOverride = {
|
|
25
|
+
minPromptTokens?: number;
|
|
26
|
+
utcStart?: number;
|
|
27
|
+
utcEnd?: number;
|
|
28
|
+
promptPrice?: string;
|
|
29
|
+
completionPrice?: string;
|
|
30
|
+
cacheReadPrice?: string;
|
|
31
|
+
cacheWritePrice?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* One model in the `openrouter:models:v1` blob. Every price is USD per unit as a
|
|
35
|
+
* string, exactly as OpenRouter gives it. Only `id` is required: a blob written
|
|
36
|
+
* before the cache/tier fields existed still prices, at prompt/completion alone.
|
|
7
37
|
*/
|
|
8
38
|
export type RateModel = {
|
|
9
39
|
id: string;
|
|
40
|
+
name?: string;
|
|
10
41
|
promptPrice?: string;
|
|
11
42
|
completionPrice?: string;
|
|
43
|
+
cacheReadPrice?: string;
|
|
44
|
+
cacheWritePrice?: string;
|
|
45
|
+
reasoningPrice?: string;
|
|
46
|
+
webSearchPrice?: string;
|
|
47
|
+
imagePrice?: string;
|
|
48
|
+
imageOutputPrice?: string;
|
|
49
|
+
audioPrice?: string;
|
|
50
|
+
requestPrice?: string;
|
|
51
|
+
overrides?: RateOverride[];
|
|
12
52
|
};
|
|
13
53
|
export type RateBlob = {
|
|
14
54
|
models: RateModel[];
|
|
55
|
+
fetchedAt?: number;
|
|
15
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Which of two copies of the price blob to price from: the one with the later
|
|
59
|
+
* `fetchedAt`. A copy with no stamp is the pre-2026-11-08 shape (no cache,
|
|
60
|
+
* reasoning or tier prices) and loses to any stamped copy. Ties and two
|
|
61
|
+
* unstamped copies keep `first`. Why it exists: `openrouter:models:v1` is
|
|
62
|
+
* rewritten hourly in the OLD shape by a writer that is not this repo's current
|
|
63
|
+
* sync (measured 2026-11-09: v1 had no cache price and no stamp while
|
|
64
|
+
* `lastgood` had both), so "v1 first" priced every cached token at list.
|
|
65
|
+
*/
|
|
66
|
+
export declare function fresherRateBlob(first: RateBlob | null | undefined, second: RateBlob | null | undefined): RateBlob | null;
|
|
16
67
|
/**
|
|
17
68
|
* The credit rate. One thousand credits to the dollar, so 1 credit = $0.001.
|
|
18
69
|
* This is the only place the rate is declared. Import it, never retype it.
|
|
@@ -25,11 +76,99 @@ export declare function creditsForUsd(usd: number): number;
|
|
|
25
76
|
/** Convert cents to credits. Stripe amounts arrive in cents. */
|
|
26
77
|
export declare function creditsForCents(cents: number): number;
|
|
27
78
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
79
|
+
* Dollars of COST to whole credits — the one rounding a burn takes. UP, so a
|
|
80
|
+
* fraction of a credit is never given away; 1e-9 absorbs float noise so an
|
|
81
|
+
* exact $0.003 is 3, not 4. Never negative, never NaN. Purchases round to
|
|
82
|
+
* nearest (`creditsForUsd`); cost rounds up, here, once.
|
|
83
|
+
*/
|
|
84
|
+
export declare function creditsForCost(usd: number): number;
|
|
85
|
+
/** Where a price came from. `actual` = the provider's reported cost (usage.cost). */
|
|
86
|
+
export type RateSource = 'actual' | 'live' | 'vendor' | 'fallback';
|
|
87
|
+
/** USD per token (and per web search) for one call, after tier selection. */
|
|
88
|
+
export type Rates = {
|
|
89
|
+
prompt: number;
|
|
90
|
+
completion: number;
|
|
91
|
+
cacheRead: number;
|
|
92
|
+
cacheWrite: number;
|
|
93
|
+
/** null = reasoning tokens bill at the completion rate (they are inside tokensOut). */
|
|
94
|
+
reasoning: number | null;
|
|
95
|
+
webSearch: number;
|
|
96
|
+
};
|
|
97
|
+
/** `endpoint/<name>` is the tenant's own service (channels CLAUDE.md § Provider routing): ONE pays nothing. */
|
|
98
|
+
export declare function isTenantEndpoint(model: string): boolean;
|
|
99
|
+
/** HHMM for a clock time in UTC: 15:30 is 1530. */
|
|
100
|
+
export declare function utcHhmm(at: number): number;
|
|
101
|
+
/**
|
|
102
|
+
* Resolve a model id to per-token USD rates. The order, and why:
|
|
103
|
+
* 1. `endpoint/<name>` → $0 (the tenant's own service).
|
|
104
|
+
* 2. the blob, by the exact id — what ONE pays when the call routes through
|
|
105
|
+
* OpenRouter, tiers included. Tried BEFORE the vendor table: the table holds
|
|
106
|
+
* direct-OpenAI rows for `gpt-6-astra` without the >272K tier, and pricing an
|
|
107
|
+
* OpenRouter call from them would re-create the long-prompt undercharge.
|
|
108
|
+
* 3. the blob without an `openrouter/` prefix (a caller that passes the AI SDK
|
|
109
|
+
* provider prefix). Exact first, so OpenRouter's own `openrouter/*` ids match.
|
|
110
|
+
* 4. the vendor table, split at the first `/` (`cerebras/gpt-oss-120b`,
|
|
111
|
+
* `anthropic/claude-opus-4-8`); `@cf/…` ids under cloudflare-workers-ai.
|
|
112
|
+
* 5. a direct-provider id's open-model twin on OpenRouter (groq/x → any
|
|
113
|
+
* `<vendor>/x`) — a near price, still marked `fallback` so it is counted.
|
|
114
|
+
* 6. the constant, marked `fallback`.
|
|
115
|
+
*
|
|
116
|
+
* `at` (ms, default now) picks a time-of-day override window (UTC); tests pin it.
|
|
117
|
+
*/
|
|
118
|
+
export declare function resolveRates(model: string, blob?: RateBlob | null, promptTokens?: number, at?: number): {
|
|
119
|
+
rates: Rates;
|
|
120
|
+
source: Exclude<RateSource, 'actual'>;
|
|
121
|
+
};
|
|
122
|
+
export type CallUsage = {
|
|
123
|
+
model: string;
|
|
124
|
+
/** TOTAL prompt tokens, cached and cache-written included — OpenRouter's prompt_tokens. */
|
|
125
|
+
tokensIn: number;
|
|
126
|
+
/** TOTAL output tokens, reasoning included — OpenRouter's completion_tokens. */
|
|
127
|
+
tokensOut: number;
|
|
128
|
+
/** The cached part of tokensIn (prompt_tokens_details.cached_tokens). */
|
|
129
|
+
cacheReadTokens?: number;
|
|
130
|
+
/** The part of tokensIn written to the cache (prompt_tokens_details.cache_write_tokens). */
|
|
131
|
+
cacheWriteTokens?: number;
|
|
132
|
+
/** The reasoning part of tokensOut (completion_tokens_details.reasoning_tokens). */
|
|
133
|
+
reasoningTokens?: number;
|
|
134
|
+
webSearches?: number;
|
|
135
|
+
/**
|
|
136
|
+
* The prompt size that picks the long-prompt tier: the LARGEST single call's
|
|
137
|
+
* prompt in this row. A row that sums a multi-step turn or run (chat turns,
|
|
138
|
+
* /run) is not one call — OpenRouter tiers each call by its own prompt, so the
|
|
139
|
+
* summed tokensIn would price two 55K steps of a model tiered at 100K at tier
|
|
140
|
+
* rates. Absent, the row is one call and tokensIn picks. Known limit: a row
|
|
141
|
+
* whose steps straddle the threshold prices every step at the largest step's
|
|
142
|
+
* tier (an over-estimate, bounded by that one tier).
|
|
143
|
+
*/
|
|
144
|
+
tierPromptTokens?: number;
|
|
145
|
+
/** When the call happened (ms). Picks a time-of-day price window; default now. */
|
|
146
|
+
at?: number;
|
|
147
|
+
blob?: RateBlob | null;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* What one model call cost ONE in USD, before any margin, UNROUNDED.
|
|
151
|
+
*
|
|
152
|
+
* Cache-aware: tokensIn is the total prompt, and the cached part is priced at the
|
|
153
|
+
* cache-read rate, the cache-written part at the cache-write rate, the rest at the
|
|
154
|
+
* prompt rate — grok serves ~80% of a chat prompt from cache at 15% of list, and
|
|
155
|
+
* pricing all of it at list charged tenants ~2x the provider's bill. Tier-aware:
|
|
156
|
+
* the override tier is chosen by tokensIn. Reasoning tokens are carved out of
|
|
157
|
+
* tokensOut only when the model publishes a reasoning price; otherwise they stay
|
|
158
|
+
* at the completion rate, so nothing is counted twice.
|
|
31
159
|
*/
|
|
32
|
-
export declare function
|
|
160
|
+
export declare function estimateCallUsd(p: CallUsage): {
|
|
161
|
+
usd: number;
|
|
162
|
+
source: Exclude<RateSource, 'actual'>;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A model's base-tier price in credits per 1k tokens — the rate columns a burn
|
|
166
|
+
* row carries (rate_in_per_1k / rate_out_per_1k) and the pre-flight's estimate.
|
|
167
|
+
* Same resolution as `estimateCallUsd` (blob → vendor → twin → constant), so a
|
|
168
|
+
* negative "router" price and a direct-provider id no longer land on the
|
|
169
|
+
* $2.50/$12.50 constant.
|
|
170
|
+
*/
|
|
171
|
+
export declare function rateFor(modelId: string, kvBlob?: RateBlob | null, promptTokens?: number): {
|
|
33
172
|
input_per_1k: number;
|
|
34
173
|
output_per_1k: number;
|
|
35
174
|
};
|
|
@@ -44,6 +183,35 @@ export type BillingBurn = {
|
|
|
44
183
|
recipient: string | null;
|
|
45
184
|
model: string | null;
|
|
46
185
|
};
|
|
186
|
+
/** The platform margin on a metered call when no plan says otherwise. Policy: text/billing-prices.md. */
|
|
187
|
+
export declare const DEFAULT_PLATFORM_MARGIN_PCT = 10;
|
|
188
|
+
/** The lowest platform margin any plan or config may set. */
|
|
189
|
+
export declare const PLATFORM_FLOOR_PCT = 5;
|
|
190
|
+
/**
|
|
191
|
+
* The platform margin each billing plan pays, in percent of cost. THE one table:
|
|
192
|
+
* web (`lib/billing.ts` debitPool, recordRefusedBurn) and channels (`burn.ts`
|
|
193
|
+
* writeBurn) both resolve through `platformMarginPct`, and web's `billing-config.ts`
|
|
194
|
+
* re-exports it. Keyed by `owners.plan` of the group whose balance PAYS (the
|
|
195
|
+
* funder, not the child that spent). Every plan ships at 10% — no plan price is
|
|
196
|
+
* decided here. To give a plan another margin, change its number (see
|
|
197
|
+
* text/billing-prices.md § Per-plan platform margin). A plan not listed pays
|
|
198
|
+
* DEFAULT_PLATFORM_MARGIN_PCT; the PLATFORM_FLOOR_PCT floor holds for every plan.
|
|
199
|
+
*/
|
|
200
|
+
export declare const PLAN_PLATFORM_MARGIN_PCT: Readonly<Record<string, number>>;
|
|
201
|
+
/**
|
|
202
|
+
* The platform margin percent for a plan NAME, floored. An unknown, empty or
|
|
203
|
+
* null plan, or a table value that is not a finite number, gets exactly today's
|
|
204
|
+
* 10%. `table` is injectable so a test can set a plan to 20% without editing the
|
|
205
|
+
* real one.
|
|
206
|
+
*/
|
|
207
|
+
export declare function platformMarginPct(plan: string | null | undefined, table?: Readonly<Record<string, number>>): number;
|
|
208
|
+
/**
|
|
209
|
+
* The platform margin, in credits, a plan changes on a priced row, or null when
|
|
210
|
+
* the plan pays today's default (the row's margin stands, byte for byte). The
|
|
211
|
+
* writers call it after the funder is known: the burn was priced before that, at
|
|
212
|
+
* the default. Never negative; a cost of 0 has no margin.
|
|
213
|
+
*/
|
|
214
|
+
export declare function planMarginOverride(costCredits: number, plan: string | null | undefined, table?: Readonly<Record<string, number>>): number | null;
|
|
47
215
|
export type ComputeBurnInput = {
|
|
48
216
|
upstream: number;
|
|
49
217
|
workspace: string;
|
|
@@ -51,12 +219,28 @@ export type ComputeBurnInput = {
|
|
|
51
219
|
reason: string;
|
|
52
220
|
model?: string;
|
|
53
221
|
recipient?: string;
|
|
222
|
+
/** The paying group's plan: picks its platform margin from PLAN_PLATFORM_MARGIN_PCT. `config.platform_margin_pct` wins when given. */
|
|
223
|
+
plan?: string | null;
|
|
54
224
|
config?: {
|
|
55
225
|
platform_margin_pct?: number;
|
|
56
226
|
platform_floor_pct?: number;
|
|
57
227
|
markup_pct?: number;
|
|
58
228
|
};
|
|
59
229
|
};
|
|
230
|
+
/**
|
|
231
|
+
* A margin on an integer cost: CEIL, never floor. Flooring rounded the platform
|
|
232
|
+
* margin to 0 on every burn under 10 credits (prod credit_burns id 2486: cost 2,
|
|
233
|
+
* margin 0) and the agency margin to 0 under 5 credits at 20% markup. 1e-9
|
|
234
|
+
* absorbs float noise so an exact 10.0 stays 10. A cost of 0 has no margin.
|
|
235
|
+
*/
|
|
236
|
+
export declare function marginFor(costCredits: number, pct: number): number;
|
|
237
|
+
/**
|
|
238
|
+
* The row's money, in integers: amount = cost + agency_margin + platform_margin +
|
|
239
|
+
* recipient_share EXACTLY (text/billing-plan.md). Margins are taken on the
|
|
240
|
+
* integer cost, so the only rounding of money is the one that made `upstream`
|
|
241
|
+
* (creditsForCost). Consequence, stated as policy: the smallest metered call is
|
|
242
|
+
* cost 1 + platform margin 1 = 2 credits ($0.002).
|
|
243
|
+
*/
|
|
60
244
|
export declare function computeBurn(p: ComputeBurnInput): BillingBurn;
|
|
61
245
|
/**
|
|
62
246
|
* The monthly cap on a sponsored child — a workspace whose credits are paid from
|
|
@@ -102,43 +286,89 @@ export declare function budgetVerdict(p: {
|
|
|
102
286
|
needed: number;
|
|
103
287
|
sponsored: boolean;
|
|
104
288
|
}): BudgetVerdict;
|
|
105
|
-
/** `live` = the blob carried the model · `fallback` = rateFor's last-resort constant. */
|
|
106
|
-
export type RateSource = 'live' | 'fallback';
|
|
107
289
|
export type SpendInput = {
|
|
108
290
|
workspace: string;
|
|
109
291
|
reason: string;
|
|
110
292
|
model: string;
|
|
293
|
+
/** TOTAL prompt tokens, cached included. */
|
|
111
294
|
tokensIn: number;
|
|
112
295
|
/** The provider's total output, reasoning INCLUDED — most of a cheap reasoning model's bill. */
|
|
113
296
|
tokensOut: number;
|
|
297
|
+
cacheReadTokens?: number;
|
|
298
|
+
cacheWriteTokens?: number;
|
|
299
|
+
reasoningTokens?: number;
|
|
300
|
+
webSearches?: number;
|
|
301
|
+
/** The largest single call's prompt in a multi-call row — picks the tier (CallUsage.tierPromptTokens). */
|
|
302
|
+
tierPromptTokens?: number;
|
|
303
|
+
/** When the call happened (ms) — picks a time-of-day price window (CallUsage.at). Default now. */
|
|
304
|
+
at?: number;
|
|
305
|
+
/**
|
|
306
|
+
* What the provider says the call cost (OpenRouter usage.cost). When present
|
|
307
|
+
* (finite, > 0) it IS the charge basis; the catalog estimate is kept beside it
|
|
308
|
+
* for the drift report. OpenRouter's usage.cost excludes its 5.5% credit
|
|
309
|
+
* purchase fee — the platform margin covers that (text/billing-prices.md).
|
|
310
|
+
*/
|
|
311
|
+
costUsd?: number | null;
|
|
114
312
|
/** The parsed `openrouter:models:v1` blob, already read by the caller. */
|
|
115
313
|
blob?: RateBlob | null;
|
|
116
314
|
parent?: string;
|
|
117
315
|
recipient?: string;
|
|
316
|
+
plan?: string | null;
|
|
118
317
|
config?: ComputeBurnInput['config'];
|
|
119
318
|
};
|
|
120
319
|
export type Spend = {
|
|
121
320
|
burn: BillingBurn;
|
|
122
321
|
tokensIn: number;
|
|
123
322
|
tokensOut: number;
|
|
323
|
+
/** Credits per 1k at the tier the call was priced at — the row's rate columns. */
|
|
124
324
|
rate: {
|
|
125
325
|
input_per_1k: number;
|
|
126
326
|
output_per_1k: number;
|
|
127
327
|
};
|
|
128
328
|
rateSource: RateSource;
|
|
329
|
+
/** The catalog estimate in USD, unrounded, pre-margin (est_usd). */
|
|
330
|
+
estUsd: number;
|
|
331
|
+
/** The USD the cost credits were rounded from: the provider's cost, else estUsd. */
|
|
332
|
+
basisUsd: number;
|
|
129
333
|
};
|
|
130
334
|
/**
|
|
131
335
|
* Price one model call — the ONE price every door writes (text/billing.md
|
|
132
|
-
* § The ledger).
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
336
|
+
* § The ledger, text/billing-prices.md).
|
|
337
|
+
*
|
|
338
|
+
* Charge basis: the provider's reported cost when the caller has it
|
|
339
|
+
* (rate_source 'actual'), else the cache- and tier-aware catalog estimate
|
|
340
|
+
* ('live' blob, 'vendor' table, or 'fallback' constant). Rounded to credits once
|
|
341
|
+
* (creditsForCost), never below 1 credit for a call ONE paid a provider for —
|
|
342
|
+
* a :free model still costs the 1-credit floor. `endpoint/<name>` costs ONE
|
|
343
|
+
* nothing and writes a 0-credit attribution row.
|
|
137
344
|
*
|
|
138
345
|
* Pure. It returns the row; the door persists it (web `debitPool`, channels
|
|
139
|
-
* `recordBurn`). `null` when
|
|
346
|
+
* `recordBurn`). `null` when nothing was spent — no tokens and no cost.
|
|
140
347
|
*/
|
|
141
348
|
export declare function spend(p: SpendInput): Spend | null;
|
|
349
|
+
/**
|
|
350
|
+
* Price a call measured in units rather than tokens — an image, video seconds,
|
|
351
|
+
* TTS characters, a voice minute, an email, a crawl page, a search task. The
|
|
352
|
+
* provider's reported cost wins when present; else the vendor table. A unit the
|
|
353
|
+
* table cannot price leaves the row at the 1-credit floor with rate_source
|
|
354
|
+
* 'fallback' and names it in `missing`, so an unpriced door is visible, never free.
|
|
355
|
+
*/
|
|
356
|
+
export declare function spendUnits(p: {
|
|
357
|
+
workspace: string;
|
|
358
|
+
reason: string;
|
|
359
|
+
provider: string;
|
|
360
|
+
sku: string;
|
|
361
|
+
units: Partial<Record<PriceUnit, number>>;
|
|
362
|
+
variant?: string;
|
|
363
|
+
costUsd?: number | null;
|
|
364
|
+
parent?: string;
|
|
365
|
+
recipient?: string;
|
|
366
|
+
plan?: string | null;
|
|
367
|
+
config?: ComputeBurnInput['config'];
|
|
368
|
+
}): (Omit<Spend, 'tokensIn' | 'tokensOut' | 'rate'> & {
|
|
369
|
+
missing: PriceUnit[];
|
|
370
|
+
unitCount: number;
|
|
371
|
+
}) | null;
|
|
142
372
|
/**
|
|
143
373
|
* The model a turn RUNS on and is PRICED at when nothing nearer named one.
|
|
144
374
|
*
|
package/dist/billing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAEhG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAC7C,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;AAEpC;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAA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