@latens/sdk 0.0.0-stage → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +119 -2
- package/dist/calculator.d.ts +2 -0
- package/dist/calculator.js +30 -0
- package/dist/client.d.ts +93 -0
- package/dist/client.js +194 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/normalizer.d.ts +2 -0
- package/dist/normalizer.js +40 -0
- package/dist/sizing.d.ts +13 -0
- package/dist/sizing.js +248 -0
- package/dist/standing.d.ts +20 -0
- package/dist/standing.js +99 -0
- package/dist/types.d.ts +284 -0
- package/dist/types.js +1 -0
- package/openapi/openapi.v3.1.json +528 -0
- package/package.json +49 -4
- package/src/calculator.ts +43 -0
- package/src/client.ts +342 -0
- package/src/index.ts +6 -0
- package/src/normalizer.ts +43 -0
- package/src/sizing.ts +335 -0
- package/src/standing.ts +126 -0
- package/src/types.ts +335 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
export type ProviderId =
|
|
2
|
+
| "vast"
|
|
3
|
+
| "runpod"
|
|
4
|
+
| "cudo"
|
|
5
|
+
| "vultr"
|
|
6
|
+
| "akash"
|
|
7
|
+
| "lambda"
|
|
8
|
+
| "crusoe"
|
|
9
|
+
| "scaleway";
|
|
10
|
+
|
|
11
|
+
export type PricePrecision = "confirmed_offer" | "catalog_starting";
|
|
12
|
+
|
|
13
|
+
export type ProductCategory =
|
|
14
|
+
| "dedicated_instance"
|
|
15
|
+
| "secure_pod"
|
|
16
|
+
| "community_pod"
|
|
17
|
+
| "cloud_vm"
|
|
18
|
+
| "bare_metal"
|
|
19
|
+
| "decentralized_lease"
|
|
20
|
+
| "interruptible_spot";
|
|
21
|
+
|
|
22
|
+
export type HolderTierId = "open" | "verified" | "priority" | "institutional";
|
|
23
|
+
|
|
24
|
+
export type SettlementAsset = "USDG" | "LTNS" | "ETH" | "USD";
|
|
25
|
+
|
|
26
|
+
export interface LtnsTierSpec {
|
|
27
|
+
id: HolderTierId;
|
|
28
|
+
code: string;
|
|
29
|
+
label: string;
|
|
30
|
+
shortLabel: string;
|
|
31
|
+
minTokens: number;
|
|
32
|
+
supplySharePct: string;
|
|
33
|
+
deskQueueLabel: string;
|
|
34
|
+
deskPriorityRank: number;
|
|
35
|
+
deskFeeBps: number;
|
|
36
|
+
feeRebatePct: number;
|
|
37
|
+
brokerLimit15m: number;
|
|
38
|
+
agentReadRpm: number;
|
|
39
|
+
agentCalculateRpm: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface WalletTokenStanding {
|
|
43
|
+
walletAddress: string;
|
|
44
|
+
tokenAddress: string;
|
|
45
|
+
ticker: string;
|
|
46
|
+
chainId: number;
|
|
47
|
+
balanceWei: string;
|
|
48
|
+
balanceTokens: number;
|
|
49
|
+
balanceFormatted: string;
|
|
50
|
+
tier: LtnsTierSpec;
|
|
51
|
+
nextTier: LtnsTierSpec | null;
|
|
52
|
+
tokensToNextTier: number;
|
|
53
|
+
progressToNextPct: number;
|
|
54
|
+
source: "onchain_rpc" | "cache" | "fallback";
|
|
55
|
+
checkedAt: string;
|
|
56
|
+
buyUrl: string;
|
|
57
|
+
explorerUrl: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface TokenStandingResponse {
|
|
61
|
+
token: {
|
|
62
|
+
ticker: string;
|
|
63
|
+
contractAddress: string;
|
|
64
|
+
chainId: number;
|
|
65
|
+
chainName: string;
|
|
66
|
+
decimals: number;
|
|
67
|
+
totalSupply: number;
|
|
68
|
+
settlementExtraRebateBps: number;
|
|
69
|
+
buyUrl: string;
|
|
70
|
+
explorerUrl: string;
|
|
71
|
+
};
|
|
72
|
+
tiers: LtnsTierSpec[];
|
|
73
|
+
standing: WalletTokenStanding | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface NormalizedGpuOffer {
|
|
77
|
+
id: string;
|
|
78
|
+
provider: ProviderId;
|
|
79
|
+
provider_offer_id: string;
|
|
80
|
+
gpu_model: string;
|
|
81
|
+
gpu_raw_name: string;
|
|
82
|
+
manufacturer: "NVIDIA" | "AMD" | "Intel" | "Other";
|
|
83
|
+
gpu_count: number;
|
|
84
|
+
vram_per_gpu_gb: number;
|
|
85
|
+
total_vram_gb: number;
|
|
86
|
+
hourly_price_usd: number;
|
|
87
|
+
price_per_gpu_usd: number;
|
|
88
|
+
currency: "USD";
|
|
89
|
+
price_precision: PricePrecision;
|
|
90
|
+
product_category: ProductCategory;
|
|
91
|
+
region: string;
|
|
92
|
+
country_code: string | null;
|
|
93
|
+
availability_status: "available" | "limited" | "unavailable";
|
|
94
|
+
reliability_score: number | null;
|
|
95
|
+
storage_cost_per_gb_month_usd: number | null;
|
|
96
|
+
egress_cost_per_gb_usd: number | null;
|
|
97
|
+
cpu_cores: number | null;
|
|
98
|
+
system_ram_gb: number | null;
|
|
99
|
+
disk_space_gb: number | null;
|
|
100
|
+
cuda_version: string | null;
|
|
101
|
+
source_url: string;
|
|
102
|
+
fetched_at: string;
|
|
103
|
+
is_stale: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type AgentOffersSort = "price_asc" | "price_desc" | "vram_desc";
|
|
107
|
+
|
|
108
|
+
export type PriceHistoryWindow = "24h" | "7d" | "30d";
|
|
109
|
+
export type PriceHistoryInterval = "15m" | "1h" | "1d";
|
|
110
|
+
|
|
111
|
+
export interface GpuPriceHistoryQuery {
|
|
112
|
+
model: string;
|
|
113
|
+
window?: PriceHistoryWindow;
|
|
114
|
+
interval?: PriceHistoryInterval;
|
|
115
|
+
category?: ProductCategory | "all";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface PriceHistoryPoint {
|
|
119
|
+
t: string;
|
|
120
|
+
min: number;
|
|
121
|
+
median: number;
|
|
122
|
+
max: number;
|
|
123
|
+
offers: number;
|
|
124
|
+
providers: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface GpuPriceHistoryResponse {
|
|
128
|
+
object: "gpu_price_history";
|
|
129
|
+
read_only: boolean;
|
|
130
|
+
model: string;
|
|
131
|
+
matched_models?: string[];
|
|
132
|
+
window: PriceHistoryWindow;
|
|
133
|
+
interval: PriceHistoryInterval;
|
|
134
|
+
category: string;
|
|
135
|
+
first_recorded_at: string | null;
|
|
136
|
+
coverage_hours: number;
|
|
137
|
+
points: PriceHistoryPoint[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface AgentOffersQuery {
|
|
141
|
+
model?: string;
|
|
142
|
+
gpu_model?: string;
|
|
143
|
+
provider?: ProviderId | "all";
|
|
144
|
+
category?: ProductCategory | "all" | "all_dedicated";
|
|
145
|
+
min_vram_gb?: number;
|
|
146
|
+
max_price_per_gpu_usd?: number;
|
|
147
|
+
max_hourly_usd?: number;
|
|
148
|
+
gpu_count?: number;
|
|
149
|
+
region?: string;
|
|
150
|
+
available_only?: boolean;
|
|
151
|
+
sort?: AgentOffersSort;
|
|
152
|
+
offset?: number;
|
|
153
|
+
limit?: number;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface AgentCalculateInput {
|
|
157
|
+
offer_id?: string;
|
|
158
|
+
gpu_model?: string;
|
|
159
|
+
gpu_count?: number;
|
|
160
|
+
duration_hours: number;
|
|
161
|
+
hourly_price_per_gpu_usd?: number;
|
|
162
|
+
storage_gb?: number;
|
|
163
|
+
storage_cost_per_gb_month_usd?: number;
|
|
164
|
+
egress_gb?: number;
|
|
165
|
+
egress_cost_per_gb_usd?: number;
|
|
166
|
+
additional_flat_fees_usd?: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ComputeCostInput {
|
|
170
|
+
hourlyRatePerInstanceUsd: number;
|
|
171
|
+
instanceCount?: number;
|
|
172
|
+
durationHours: number;
|
|
173
|
+
storageGb?: number;
|
|
174
|
+
storageCostPerGbMonthUsd?: number;
|
|
175
|
+
egressGb?: number;
|
|
176
|
+
egressCostPerGbUsd?: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface ComputeCostBreakdown {
|
|
180
|
+
computeSubtotalUsd: number;
|
|
181
|
+
storageSubtotalUsd: number;
|
|
182
|
+
egressSubtotalUsd: number;
|
|
183
|
+
totalEstimatedUsd: number;
|
|
184
|
+
effectiveHourlyUsd: number;
|
|
185
|
+
currency: "USD";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export type LlmQuantization =
|
|
189
|
+
| "fp32"
|
|
190
|
+
| "fp16"
|
|
191
|
+
| "bf16"
|
|
192
|
+
| "fp8"
|
|
193
|
+
| "int8"
|
|
194
|
+
| "q8_0"
|
|
195
|
+
| "q4_k_m"
|
|
196
|
+
| "int4";
|
|
197
|
+
|
|
198
|
+
export type LlmWorkloadMode = "inference" | "lora_finetune" | "full_finetune";
|
|
199
|
+
|
|
200
|
+
export interface LlmSizingInput {
|
|
201
|
+
parameterCountBillions: number;
|
|
202
|
+
quantization?: LlmQuantization;
|
|
203
|
+
mode?: LlmWorkloadMode;
|
|
204
|
+
contextLength?: number;
|
|
205
|
+
batchSize?: number;
|
|
206
|
+
kvCacheQuantization?: "fp16" | "fp8" | "int8";
|
|
207
|
+
headroomPct?: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface LlmSizingRecommendation {
|
|
211
|
+
gpuModel: string;
|
|
212
|
+
gpuCount: number;
|
|
213
|
+
vramPerGpuGb: number;
|
|
214
|
+
totalVramGb: number;
|
|
215
|
+
estimatedUtilizationPct: number;
|
|
216
|
+
notes: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface LlmSizingResult {
|
|
220
|
+
parameterCountBillions: number;
|
|
221
|
+
quantization: LlmQuantization;
|
|
222
|
+
mode: LlmWorkloadMode;
|
|
223
|
+
contextLength: number;
|
|
224
|
+
batchSize: number;
|
|
225
|
+
kvCacheQuantization: "fp16" | "fp8" | "int8";
|
|
226
|
+
weightsGb: number;
|
|
227
|
+
kvCacheGb: number;
|
|
228
|
+
trainingOverheadGb: number;
|
|
229
|
+
runtimeOverheadGb: number;
|
|
230
|
+
minimumVramGb: number;
|
|
231
|
+
recommendedVramGb: number;
|
|
232
|
+
recommendedConfigs: LlmSizingRecommendation[];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface OfferTcoComparisonOptions {
|
|
236
|
+
durationHours: number;
|
|
237
|
+
minTotalVramGb?: number;
|
|
238
|
+
storageGb?: number;
|
|
239
|
+
egressGb?: number;
|
|
240
|
+
defaultStorageCostPerGbMonthUsd?: number;
|
|
241
|
+
defaultEgressCostPerGbUsd?: number;
|
|
242
|
+
availableOnly?: boolean;
|
|
243
|
+
confirmedOnly?: boolean;
|
|
244
|
+
holderTier?: HolderTierId;
|
|
245
|
+
settlementAsset?: SettlementAsset;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface RankedGpuOfferTco {
|
|
249
|
+
offerId: string;
|
|
250
|
+
provider: ProviderId;
|
|
251
|
+
gpuModel: string;
|
|
252
|
+
gpuCount: number;
|
|
253
|
+
totalVramGb: number;
|
|
254
|
+
region: string;
|
|
255
|
+
pricePrecision: PricePrecision;
|
|
256
|
+
productCategory: ProductCategory;
|
|
257
|
+
hourlyPriceUsd: number;
|
|
258
|
+
pricePerGpuUsd: number;
|
|
259
|
+
breakdown: ComputeCostBreakdown;
|
|
260
|
+
deskFeeBps: number;
|
|
261
|
+
estimatedDeskFeeUsd: number;
|
|
262
|
+
totalWithDeskFeeUsd: number;
|
|
263
|
+
savingsVsMostExpensiveUsd: number;
|
|
264
|
+
sourceUrl: string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface OfferTcoComparisonResult {
|
|
268
|
+
durationHours: number;
|
|
269
|
+
evaluatedCount: number;
|
|
270
|
+
eligibleCount: number;
|
|
271
|
+
holderTier: HolderTierId;
|
|
272
|
+
settlementAsset: SettlementAsset;
|
|
273
|
+
effectiveDeskFeeBps: number;
|
|
274
|
+
cheapestTotalUsd: number;
|
|
275
|
+
mostExpensiveTotalUsd: number;
|
|
276
|
+
spreadMultiplier: number;
|
|
277
|
+
ranked: RankedGpuOfferTco[];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface X402QuoteRequestInput {
|
|
281
|
+
walletAddress?: string;
|
|
282
|
+
offerId?: string;
|
|
283
|
+
gpuModel?: string;
|
|
284
|
+
gpuCount?: number;
|
|
285
|
+
minVramGb?: number;
|
|
286
|
+
durationHours?: number;
|
|
287
|
+
diskGb?: number;
|
|
288
|
+
dockerImage?: string;
|
|
289
|
+
runtype?: "ssh_direct" | "ssh" | "jupyter_direct";
|
|
290
|
+
paymentAsset?: "LTNS" | "USDG" | "ETH";
|
|
291
|
+
sshPublicKey: string;
|
|
292
|
+
maxSpendUsd?: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface X402QuoteChallenge {
|
|
296
|
+
object: "x402_payment_required";
|
|
297
|
+
x402Version: number;
|
|
298
|
+
error: string;
|
|
299
|
+
message: string;
|
|
300
|
+
quote: {
|
|
301
|
+
id: string;
|
|
302
|
+
rentalCode: string;
|
|
303
|
+
offerId: string;
|
|
304
|
+
gpuModel: string;
|
|
305
|
+
gpuCount: number;
|
|
306
|
+
vramPerGpuGb: number;
|
|
307
|
+
region: string;
|
|
308
|
+
durationHours: number;
|
|
309
|
+
diskGb: number;
|
|
310
|
+
dockerImage: string;
|
|
311
|
+
hourlyPriceUsd: number;
|
|
312
|
+
platformFeeBps: number;
|
|
313
|
+
totalUsd: number;
|
|
314
|
+
holderTier: HolderTierId;
|
|
315
|
+
paymentAsset: "LTNS" | "USDG" | "ETH";
|
|
316
|
+
paymentAmountRaw: string;
|
|
317
|
+
paymentAmountFormatted: string;
|
|
318
|
+
treasuryWallet: string;
|
|
319
|
+
escrowContract: string | null;
|
|
320
|
+
escrowLeaseId: string;
|
|
321
|
+
quoteExpiresAt: string;
|
|
322
|
+
};
|
|
323
|
+
accepts: Array<Record<string, unknown>>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface X402ExecutionReceipt {
|
|
327
|
+
object: "x402_execution_receipt";
|
|
328
|
+
settled: boolean;
|
|
329
|
+
rental: Record<string, unknown>;
|
|
330
|
+
credentials: {
|
|
331
|
+
rentalAccessToken: string;
|
|
332
|
+
pollEndpoint: string;
|
|
333
|
+
authorizationHeader: string;
|
|
334
|
+
};
|
|
335
|
+
}
|