Skip to content

Commit 9abacb8

Browse files
committed
Expose full offer metadata and harden create parsing
1 parent 3eb2b0a commit 9abacb8

6 files changed

Lines changed: 636 additions & 11 deletions

File tree

src/VastAI.NET/Models/VastOffer.cs

Lines changed: 266 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,269 @@ public sealed record VastOffer(
1313
double InternetUpCostPerTb,
1414
double InternetDownCostPerTb,
1515
int ComputeCapability,
16-
string Country);
16+
string Country,
17+
VastRawJson? Raw = null)
18+
{
19+
/// <summary>Full raw Vast offer object so callers can inspect fields not yet normalized by this library.</summary>
20+
public VastRawJson Raw { get; init; } = Raw ?? VastRawJson.Empty;
21+
22+
/// <summary>Vast ask contract id. This is usually the id passed to create-instance.</summary>
23+
public string AskContractId { get; init; } = "";
24+
25+
/// <summary>Vast bundle id when the search endpoint returns one.</summary>
26+
public string BundleId { get; init; } = "";
27+
28+
/// <summary>Raw bundled_results value when Vast returns it.</summary>
29+
public string BundledResults { get; init; } = "";
30+
31+
/// <summary>NVLink bandwidth in GB/s.</summary>
32+
public double BwNvlinkGbPerSecond { get; init; }
33+
34+
/// <summary>Host CPU architecture, such as amd64 or arm64.</summary>
35+
public string CpuArch { get; init; } = "";
36+
37+
/// <summary>Total virtual CPU cores reported by Vast.</summary>
38+
public double CpuCores { get; init; }
39+
40+
/// <summary>Effective CPU cores allocated to this offer.</summary>
41+
public double CpuCoresEffective { get; init; }
42+
43+
/// <summary>CPU clock speed in GHz.</summary>
44+
public double CpuGhz { get; init; }
45+
46+
/// <summary>Host CPU model name.</summary>
47+
public string CpuName { get; init; } = "";
48+
49+
/// <summary>System RAM in GB, normalized from Vast payloads that may report MB or GB.</summary>
50+
public double CpuRamGb { get; init; }
51+
52+
/// <summary>Maximum credit discount rate for the offer.</summary>
53+
public double CreditDiscountMax { get; init; }
54+
55+
/// <summary>Maximum CUDA version considered usable for the offer.</summary>
56+
public double CudaMaxGood { get; init; }
57+
58+
/// <summary>Number of direct exposed ports available on the host.</summary>
59+
public int DirectPortCount { get; init; }
60+
61+
/// <summary>Disk read bandwidth in MB/s.</summary>
62+
public double DiskBwMbPerSecond { get; init; }
63+
64+
/// <summary>Disk or storage model name.</summary>
65+
public string DiskName { get; init; } = "";
66+
67+
/// <summary>Vast DLPerf score.</summary>
68+
public double DlPerf { get; init; }
69+
70+
/// <summary>Vast DLPerf per dollar per hour score.</summary>
71+
public double DlPerfPerDollarHour { get; init; }
72+
73+
/// <summary>Base hourly price before storage and other adjustments.</summary>
74+
public double DphBase { get; init; }
75+
76+
/// <summary>Total hourly price returned by Vast.</summary>
77+
public double DphTotal { get; init; }
78+
79+
/// <summary>NVIDIA driver version string.</summary>
80+
public string DriverVersion { get; init; } = "";
81+
82+
/// <summary>Numeric driver version when Vast returns it.</summary>
83+
public double DriverVersionNumber { get; init; }
84+
85+
/// <summary>Offer duration in seconds.</summary>
86+
public double DurationSeconds { get; init; }
87+
88+
/// <summary>Offer end date as a Unix timestamp when Vast returns it.</summary>
89+
public double EndDateUnixSeconds { get; init; }
90+
91+
/// <summary>Raw external-offer marker returned by Vast.</summary>
92+
public string External { get; init; } = "";
93+
94+
/// <summary>FLOPs per dollar per hour.</summary>
95+
public double FlopsPerDollarHour { get; init; }
96+
97+
/// <summary>Raw geolocation code returned by Vast.</summary>
98+
public double Geolocode { get; init; }
99+
100+
/// <summary>GPU architecture, normally nvidia or amd.</summary>
101+
public string GpuArch { get; init; } = "";
102+
103+
/// <summary>Whether the host GPU has an attached active display.</summary>
104+
public bool GpuDisplayActive { get; init; }
105+
106+
/// <summary>Fraction of the GPU resources offered.</summary>
107+
public double GpuFrac { get; init; }
108+
109+
/// <summary>GPU ids included in this offer.</summary>
110+
public IReadOnlyList<int> GpuIds { get; init; } = [];
111+
112+
/// <summary>PCIe lanes available to the GPU.</summary>
113+
public int GpuLanes { get; init; }
114+
115+
/// <summary>GPU memory bandwidth in GB/s.</summary>
116+
public double GpuMemBwGbPerSecond { get; init; }
117+
118+
/// <summary>GPU VRAM in GB, normalized from Vast payloads that may report MB or GB.</summary>
119+
public double GpuRamGb { get; init; }
120+
121+
/// <summary>Total GPU VRAM across all GPUs in GB, normalized from Vast payloads that may report MB or GB.</summary>
122+
public double GpuTotalRamGb { get; init; }
123+
124+
/// <summary>GPU power limit in watts.</summary>
125+
public double GpuMaxPowerWatts { get; init; }
126+
127+
/// <summary>GPU temperature limit in Celsius.</summary>
128+
public double GpuMaxTempCelsius { get; init; }
129+
130+
/// <summary>Whether the CPU supports AVX.</summary>
131+
public bool HasAvx { get; init; }
132+
133+
/// <summary>Vast host id.</summary>
134+
public string HostId { get; init; } = "";
135+
136+
/// <summary>Vast hosting type code.</summary>
137+
public int HostingType { get; init; }
138+
139+
/// <summary>Host name when Vast exposes it.</summary>
140+
public string Hostname { get; init; } = "";
141+
142+
/// <summary>Whether this offer is bid/interruptible pricing.</summary>
143+
public bool IsBid { get; init; }
144+
145+
/// <summary>Host logo path returned by Vast.</summary>
146+
public string Logo { get; init; } = "";
147+
148+
/// <summary>Vast machine id.</summary>
149+
public string MachineId { get; init; } = "";
150+
151+
/// <summary>Minimum bid price for interruptible rentals.</summary>
152+
public double MinBid { get; init; }
153+
154+
/// <summary>Motherboard model name when Vast reports it.</summary>
155+
public string MoboName { get; init; } = "";
156+
157+
/// <summary>Number of GPUs in the offer.</summary>
158+
public int NumGpus { get; init; }
159+
160+
/// <summary>Host OS version returned by Vast.</summary>
161+
public string OsVersion { get; init; } = "";
162+
163+
/// <summary>PCIe generation.</summary>
164+
public double PciGen { get; init; }
165+
166+
/// <summary>PCIe bandwidth in GB/s.</summary>
167+
public double PcieBwGbPerSecond { get; init; }
168+
169+
/// <summary>Public IP address when Vast returns it on an offer.</summary>
170+
public string PublicIpAddress { get; init; } = "";
171+
172+
/// <summary>Vast reliability multiplier.</summary>
173+
public double ReliabilityMult { get; init; }
174+
175+
/// <summary>Whether the offer is rentable.</summary>
176+
public bool Rentable { get; init; }
177+
178+
/// <summary>Whether the offer is already rented.</summary>
179+
public bool Rented { get; init; }
180+
181+
/// <summary>Vast search score.</summary>
182+
public double Score { get; init; }
183+
184+
/// <summary>Offer start date as a Unix timestamp when Vast returns it.</summary>
185+
public double StartDateUnixSeconds { get; init; }
186+
187+
/// <summary>Whether the offer includes a static IP.</summary>
188+
public bool StaticIp { get; init; }
189+
190+
/// <summary>Storage hourly cost.</summary>
191+
public double StorageCost { get; init; }
192+
193+
/// <summary>Total storage hourly cost.</summary>
194+
public double StorageTotalCost { get; init; }
195+
196+
/// <summary>Total FLOPs reported by Vast.</summary>
197+
public double TotalFlops { get; init; }
198+
199+
/// <summary>Verification status string, such as verified.</summary>
200+
public string Verification { get; init; } = "";
201+
202+
/// <summary>Verification code returned by Vast.</summary>
203+
public int VeriCode { get; init; }
204+
205+
/// <summary>VRAM hourly cost.</summary>
206+
public double VramCostPerHour { get; init; }
207+
208+
/// <summary>Host webpage returned by Vast.</summary>
209+
public string Webpage { get; init; } = "";
210+
211+
/// <summary>Whether the host has VMs enabled.</summary>
212+
public bool VmsEnabled { get; init; }
213+
214+
/// <summary>Expected reliability score when Vast returns it.</summary>
215+
public double ExpectedReliability { get; init; }
216+
217+
/// <summary>Whether Vast has VM-deverified the machine.</summary>
218+
public bool IsVmDeverified { get; init; }
219+
220+
/// <summary>Vast resource type, normally gpu.</summary>
221+
public string ResourceType { get; init; } = "";
222+
223+
/// <summary>Cluster id returned by Vast.</summary>
224+
public string ClusterId { get; init; } = "";
225+
226+
/// <summary>Available volume ask id.</summary>
227+
public string AvailVolAskId { get; init; } = "";
228+
229+
/// <summary>Available volume hourly price.</summary>
230+
public double AvailVolDph { get; init; }
231+
232+
/// <summary>Available volume size in GB.</summary>
233+
public double AvailVolSizeGb { get; init; }
234+
235+
/// <summary>Minimum network disk bandwidth.</summary>
236+
public double NwDiskMinBw { get; init; }
237+
238+
/// <summary>Maximum network disk bandwidth.</summary>
239+
public double NwDiskMaxBw { get; init; }
240+
241+
/// <summary>Average network disk bandwidth.</summary>
242+
public double NwDiskAvgBw { get; init; }
243+
244+
/// <summary>Row number returned by Vast search.</summary>
245+
public int Rn { get; init; }
246+
247+
/// <summary>Adjusted total hourly price.</summary>
248+
public double DphTotalAdjusted { get; init; }
249+
250+
/// <summary>Second reliability score returned by Vast.</summary>
251+
public double Reliability2 { get; init; }
252+
253+
/// <summary>Discount rate returned by Vast.</summary>
254+
public double DiscountRate { get; init; }
255+
256+
/// <summary>Discounted hourly price returned by Vast.</summary>
257+
public double DiscountedHourly { get; init; }
258+
259+
/// <summary>Discounted total hourly price returned by Vast.</summary>
260+
public double DiscountedDphTotal { get; init; }
261+
262+
/// <summary>Time remaining text for fixed-duration or bid offers.</summary>
263+
public string TimeRemaining { get; init; } = "";
264+
265+
/// <summary>Bid time remaining text returned by Vast.</summary>
266+
public string TimeRemainingIsBid { get; init; } = "";
267+
268+
/// <summary>Nested search pricing details returned by Vast.</summary>
269+
public VastOfferPricing? SearchPricing { get; init; }
270+
271+
/// <summary>Nested instance pricing details returned by Vast.</summary>
272+
public VastOfferPricing? InstancePricing { get; init; }
273+
}
274+
275+
/// <summary>Nested Vast pricing breakdown used by offer search and instance pricing objects.</summary>
276+
public sealed record VastOfferPricing(
277+
double GpuCostPerHour,
278+
double DiskHour,
279+
double TotalHour,
280+
double DiscountTotalHour,
281+
double DiscountedTotalPerHour);

0 commit comments

Comments
 (0)