runpod_sdk/model/
common.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4#[cfg(feature = "strum")]
5use strum::{Display, EnumString};
6
7/// Compute type for Pod resources.
8///
9/// Determines whether a Pod will have GPU or CPU compute resources attached.
10/// When set to `GPU`, the Pod will have GPU resources and GPU-related properties
11/// will be considered. When set to `CPU`, only CPU-related properties will be used.
12#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Serialize, Deserialize)]
13#[cfg_attr(feature = "strum", derive(Display, EnumString))]
14#[serde(rename_all = "UPPERCASE")]
15#[cfg_attr(feature = "strum", strum(serialize_all = "UPPERCASE"))]
16pub enum ComputeType {
17    /// GPU-based compute resources.
18    #[default]
19    Gpu,
20    /// CPU-based compute resources.
21    Cpu,
22}
23
24/// RunPod cloud deployment type.
25///
26/// Determines which RunPod cloud environment the Pod will be deployed to.
27/// Secure Cloud offers guaranteed availability and enterprise features,
28/// while Community Cloud offers lower costs with potentially less reliability.
29#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Serialize, Deserialize)]
30#[cfg_attr(feature = "strum", derive(Display, EnumString))]
31#[serde(rename_all = "UPPERCASE")]
32#[cfg_attr(feature = "strum", strum(serialize_all = "UPPERCASE"))]
33pub enum CloudType {
34    /// Secure Cloud deployment with guaranteed resources and enterprise features.
35    #[default]
36    Secure,
37    /// Community Cloud deployment with lower costs and shared resources.
38    Community,
39}
40
41/// Current operational status of a Pod.
42///
43/// Represents the lifecycle state of a Pod, indicating whether it's actively
44/// running, has exited gracefully, or has been forcibly terminated.
45#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Serialize, Deserialize)]
46#[cfg_attr(feature = "strum", derive(Display, EnumString))]
47#[serde(rename_all = "UPPERCASE")]
48#[cfg_attr(feature = "strum", strum(serialize_all = "UPPERCASE"))]
49pub enum PodStatus {
50    /// Pod is currently running and operational.
51    #[default]
52    Running,
53    /// Pod has finished execution and exited normally.
54    Exited,
55    /// Pod has been forcibly terminated or stopped.
56    Terminated,
57}
58
59/// Available CUDA versions for GPU Pods.
60///
61/// Specifies which CUDA runtime version should be available on the GPU Pod.
62/// This is only relevant for GPU Pods and determines software compatibility.
63#[derive(Debug, Clone, Default, Copy, PartialEq, Eq, Serialize, Deserialize)]
64pub enum CudaVersion {
65    #[serde(rename = "12.8")]
66    V12_8,
67    #[serde(rename = "12.7")]
68    V12_7,
69    #[serde(rename = "12.6")]
70    V12_6,
71    #[serde(rename = "12.5")]
72    V12_5,
73    #[serde(rename = "12.4")]
74    V12_4,
75    #[serde(rename = "12.3")]
76    V12_3,
77    #[serde(rename = "12.2")]
78    V12_2,
79    #[serde(rename = "12.1")]
80    V12_1,
81    #[serde(rename = "12.0")]
82    #[default]
83    V12_0,
84    #[serde(rename = "11.8")]
85    V11_8,
86}
87
88/// Available GPU hardware types for GPU Pods.
89///
90/// Represents the specific GPU models that can be attached to a Pod.
91/// Each GPU type has different performance characteristics, memory capacity,
92/// and pricing. The availability of each type varies by data center and time.
93#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
94pub enum GpuTypeId {
95    #[serde(rename = "NVIDIA GeForce RTX 4090")]
96    NvidiaGeForceRtx4090,
97    #[serde(rename = "NVIDIA A40")]
98    NvidiaA40,
99    #[serde(rename = "NVIDIA RTX A5000")]
100    NvidiaRtxA5000,
101    #[serde(rename = "NVIDIA GeForce RTX 3090")]
102    NvidiaGeForceRtx3090,
103    #[serde(rename = "NVIDIA RTX A4500")]
104    NvidiaRtxA4500,
105    #[serde(rename = "NVIDIA RTX A6000")]
106    NvidiaRtxA6000,
107    #[serde(rename = "NVIDIA L40S")]
108    NvidiaL40S,
109    #[serde(rename = "NVIDIA L4")]
110    NvidiaL4,
111    #[serde(rename = "NVIDIA H100 80GB HBM3")]
112    NvidiaH100_80GbHbm3,
113    #[serde(rename = "NVIDIA RTX 4000 Ada Generation")]
114    NvidiaRtx4000Ada,
115    #[serde(rename = "NVIDIA A100 80GB PCIe")]
116    NvidiaA100_80GbPcie,
117    #[serde(rename = "NVIDIA A100-SXM4-80GB")]
118    NvidiaA100Sxm4_80Gb,
119    #[serde(rename = "NVIDIA RTX A4000")]
120    NvidiaRtxA4000,
121    #[serde(rename = "NVIDIA RTX 6000 Ada Generation")]
122    NvidiaRtx6000Ada,
123    #[serde(rename = "NVIDIA RTX 2000 Ada Generation")]
124    NvidiaRtx2000Ada,
125    #[serde(rename = "NVIDIA H200")]
126    NvidiaH200,
127    #[serde(rename = "NVIDIA L40")]
128    NvidiaL40,
129    #[serde(rename = "NVIDIA H100 NVL")]
130    NvidiaH100Nvl,
131    #[serde(rename = "NVIDIA H100 PCIe")]
132    NvidiaH100Pcie,
133    #[serde(rename = "NVIDIA GeForce RTX 3080 Ti")]
134    NvidiaGeForceRtx3080Ti,
135    #[serde(rename = "NVIDIA GeForce RTX 3080")]
136    NvidiaGeForceRtx3080,
137    #[serde(rename = "NVIDIA GeForce RTX 3070")]
138    NvidiaGeForceRtx3070,
139    #[serde(rename = "Tesla V100-PCIE-16GB")]
140    TeslaV100Pcie16Gb,
141    #[serde(rename = "AMD Instinct MI300X OAM")]
142    AmdInstinctMi300XOam,
143    #[serde(rename = "NVIDIA RTX A2000")]
144    NvidiaRtxA2000,
145    #[serde(rename = "Tesla V100-FHHL-16GB")]
146    TeslaV100Fhhl16Gb,
147    #[serde(rename = "NVIDIA GeForce RTX 4080 SUPER")]
148    NvidiaGeForceRtx4080Super,
149    #[serde(rename = "Tesla V100-SXM2-16GB")]
150    TeslaV100Sxm2_16Gb,
151    #[serde(rename = "NVIDIA GeForce RTX 4070 Ti")]
152    NvidiaGeForceRtx4070Ti,
153    #[serde(rename = "Tesla V100-SXM2-32GB")]
154    TeslaV100Sxm2_32Gb,
155    #[serde(rename = "NVIDIA RTX 4000 SFF Ada Generation")]
156    NvidiaRtx4000SffAda,
157    #[serde(rename = "NVIDIA RTX 5000 Ada Generation")]
158    NvidiaRtx5000Ada,
159    #[serde(rename = "NVIDIA GeForce RTX 5090")]
160    NvidiaGeForceRtx5090,
161    #[serde(rename = "NVIDIA A30")]
162    NvidiaA30,
163    #[serde(rename = "NVIDIA GeForce RTX 4080")]
164    NvidiaGeForceRtx4080,
165    #[serde(rename = "NVIDIA GeForce RTX 5080")]
166    NvidiaGeForceRtx5080,
167    #[serde(rename = "NVIDIA GeForce RTX 3090 Ti")]
168    NvidiaGeForceRtx3090Ti,
169    #[serde(rename = "NVIDIA B200")]
170    NvidiaB200,
171}
172
173/// Available CPU flavor configurations for CPU Pods.
174///
175/// Represents different CPU configurations available for CPU-only Pods.
176/// Each flavor provides different combinations of cores, memory, and performance
177/// characteristics optimized for various workload types.
178#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
179#[cfg_attr(feature = "strum", derive(Display, EnumString))]
180#[serde(rename_all = "lowercase")]
181#[cfg_attr(feature = "strum", strum(serialize_all = "lowercase"))]
182pub enum CpuFlavorId {
183    /// 3rd generation CPU configuration - compute optimized.
184    Cpu3c,
185    /// 3rd generation CPU configuration - general purpose.
186    Cpu3g,
187    /// 3rd generation CPU configuration - memory optimized.
188    Cpu3m,
189    /// 5th generation CPU configuration - compute optimized.
190    Cpu5c,
191    /// 5th generation CPU configuration - general purpose.
192    #[default]
193    Cpu5g,
194    /// 5th generation CPU configuration - memory optimized.
195    Cpu5m,
196}
197
198/// RunPod data center locations.
199///
200/// Represents the geographic locations where RunPod has data centers.
201/// The choice of data center affects latency, regulatory compliance,
202/// and resource availability. Costs may also vary by location.
203#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
204pub enum DataCenterId {
205    #[serde(rename = "EU-RO-1")]
206    EuRo1,
207    #[serde(rename = "CA-MTL-1")]
208    CaMtl1,
209    #[serde(rename = "EU-SE-1")]
210    EuSe1,
211    #[serde(rename = "US-IL-1")]
212    UsIl1,
213    #[serde(rename = "EUR-IS-1")]
214    EurIs1,
215    #[serde(rename = "EU-CZ-1")]
216    EuCz1,
217    #[serde(rename = "US-TX-3")]
218    UsTx3,
219    #[serde(rename = "EUR-IS-2")]
220    EurIs2,
221    #[serde(rename = "US-KS-2")]
222    UsKs2,
223    #[serde(rename = "US-GA-2")]
224    UsGa2,
225    #[serde(rename = "US-WA-1")]
226    UsWa1,
227    #[serde(rename = "US-TX-1")]
228    UsTx1,
229    #[serde(rename = "CA-MTL-3")]
230    CaMtl3,
231    #[serde(rename = "EU-NL-1")]
232    EuNl1,
233    #[serde(rename = "US-TX-4")]
234    UsTx4,
235    #[serde(rename = "US-CA-2")]
236    UsCa2,
237    #[serde(rename = "US-NC-1")]
238    UsNc1,
239    #[serde(rename = "OC-AU-1")]
240    OcAu1,
241    #[serde(rename = "US-DE-1")]
242    UsDe1,
243    #[serde(rename = "EUR-IS-3")]
244    EurIs3,
245    #[serde(rename = "CA-MTL-2")]
246    CaMtl2,
247    #[serde(rename = "AP-JP-1")]
248    ApJp1,
249    #[serde(rename = "EUR-NO-1")]
250    EurNo1,
251    #[serde(rename = "EU-FR-1")]
252    EuFr1,
253    #[serde(rename = "US-KS-3")]
254    UsKs3,
255    #[serde(rename = "US-GA-1")]
256    UsGa1,
257}
258
259/// Detailed information about GPU resources attached to a Pod.
260///
261/// Contains comprehensive details about the GPU configuration including
262/// hardware specifications, pricing across different billing periods,
263/// and availability in different cloud types.
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(rename_all = "camelCase")]
266pub struct GpuInfo {
267    /// Unique identifier for this GPU type.
268    pub id: String,
269    /// Number of GPUs of this type attached to the Pod.
270    pub count: i32,
271    /// Human-readable display name for the GPU type.
272    pub display_name: String,
273    /// Hourly price per GPU in RunPod credits for Secure Cloud.
274    pub secure_price: f64,
275    /// Hourly price per GPU in RunPod credits for Community Cloud.
276    pub community_price: f64,
277    /// Monthly rate per GPU in RunPod credits (30-day billing).
278    pub one_month_price: f64,
279    /// Quarterly rate per GPU in RunPod credits (90-day billing).
280    pub three_month_price: f64,
281    /// Semi-annual rate per GPU in RunPod credits (180-day billing).
282    pub six_month_price: f64,
283    /// Weekly rate per GPU in RunPod credits (7-day billing).
284    pub one_week_price: f64,
285    /// Spot pricing per GPU hour in RunPod credits for Community Cloud.
286    pub community_spot_price: f64,
287    /// Spot pricing per GPU hour in RunPod credits for Secure Cloud.
288    pub secure_spot_price: f64,
289}
290
291/// Detailed information about CPU resources for a Pod.
292///
293/// Contains specifications about the CPU configuration including
294/// core count, threading capabilities, and organizational grouping.
295#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(rename_all = "camelCase")]
297pub struct CpuType {
298    /// Unique identifier for this CPU type.
299    pub id: String,
300    /// Human-readable display name for the CPU type.
301    pub display_name: String,
302    /// Number of physical CPU cores available.
303    pub cores: f64,
304    /// Number of threads supported per physical core.
305    pub threads_per_core: f64,
306    /// Group identifier for organizing similar CPU types.
307    pub group_id: String,
308}
309
310/// Detailed information about the physical machine hosting a Pod.
311///
312/// Contains comprehensive details about the hardware infrastructure,
313/// networking capabilities, pricing, and operational status of the
314/// machine where the Pod is running.
315#[derive(Debug, Clone, Serialize, Deserialize)]
316#[serde(rename_all = "camelCase")]
317pub struct Machine {
318    /// Minimum number of GPUs required for Pods on this machine.
319    pub min_pod_gpu_count: Option<i32>,
320    /// Identifier for the GPU type available on this machine.
321    pub gpu_type_id: Option<String>,
322    /// Detailed information about the GPU type on this machine.
323    pub gpu_type: Option<GpuInfo>,
324    /// Total number of CPU cores available on this machine.
325    pub cpu_count: Option<i32>,
326    /// Identifier for the CPU type on this machine.
327    pub cpu_type_id: Option<String>,
328    /// Detailed information about the CPU type on this machine.
329    pub cpu_type: Option<CpuType>,
330    /// Geographic location description of this machine.
331    pub location: String,
332    /// Data center identifier where this machine is located.
333    pub data_center_id: String,
334    /// Disk I/O throughput capacity in megabytes per second.
335    pub disk_throughput_m_bps: Option<i32>,
336    /// Maximum network download speed in megabits per second.
337    pub max_download_speed_mbps: Option<i32>,
338    /// Maximum network upload speed in megabits per second.
339    pub max_upload_speed_mbps: Option<i32>,
340    /// Whether this machine supports public IP assignment.
341    pub support_public_ip: bool,
342    /// Whether this machine is in the Secure Cloud environment.
343    pub secure_cloud: bool,
344    /// Scheduled maintenance start time, if any.
345    pub maintenance_start: Option<String>,
346    /// Scheduled maintenance end time, if any.
347    pub maintenance_end: Option<String>,
348    /// Additional information about scheduled maintenance.
349    pub maintenance_note: Option<String>,
350    /// General notes or information about this machine.
351    pub note: Option<String>,
352    /// Current hourly cost in RunPod credits for this machine.
353    pub cost_per_hr: f64,
354    /// Current price per GPU hour in RunPod credits, if applicable.
355    pub current_price_per_gpu: Option<f64>,
356    /// Number of GPUs currently available on this machine.
357    pub gpu_available: Option<i32>,
358    /// Human-readable name of the GPU type on this machine.
359    pub gpu_display_name: Option<String>,
360}
361
362/// A savings plan applied to reduce Pod costs.
363///
364/// Savings plans offer discounted pricing in exchange for longer-term
365/// commitments to specific GPU types. They automatically apply to
366/// eligible Pods to reduce the effective hourly cost.
367#[derive(Debug, Clone, Serialize, Deserialize)]
368#[serde(rename_all = "camelCase")]
369pub struct SavingsPlan {
370    /// Discounted hourly cost per GPU in RunPod credits.
371    pub cost_per_hr: f64,
372    /// UTC timestamp when this savings plan expires.
373    pub end_time: String,
374    /// GPU type identifier that this savings plan applies to.
375    pub gpu_type_id: String,
376    /// Unique identifier for this savings plan.
377    pub id: String,
378    /// Pod identifier that this savings plan is currently applied to.
379    pub pod_id: String,
380    /// UTC timestamp when this savings plan became active.
381    pub start_time: String,
382}
383
384/// A persistent network-attached storage volume.
385///
386/// Network volumes provide persistent storage that can be shared across
387/// multiple Pods and persists beyond individual Pod lifecycles. They are
388/// located in specific data centers and can be mounted to Pods in the same region.
389#[derive(Debug, Clone, Serialize, Deserialize)]
390#[serde(rename_all = "camelCase")]
391pub struct NetworkVolume {
392    /// Unique identifier for this network volume.
393    pub id: String,
394    /// User-defined name for this network volume.
395    pub name: String,
396    /// Storage capacity of this volume in gigabytes.
397    pub size: i32,
398    /// Data center where this network volume is located.
399    pub data_center_id: String,
400}
401
402/// Environment variables for Pod containers.
403///
404/// A key-value mapping of environment variables that will be set
405/// in the Pod's container runtime environment.
406pub type EnvVars = HashMap<String, String>;
407
408/// Port mappings from internal to external ports.
409///
410/// Maps internal container ports (as strings) to external public ports
411/// (as integers) for network access to the Pod.
412pub type PortMappings = HashMap<String, i32>;