Runpod SDK
A Rust client library for the Runpod API. This SDK provides a type-safe, ergonomic interface for managing Pods, Serverless endpoints, templates, network volumes, and more.
This crate is a fork of the original runpod.rs developed by Patrick Barker.
Features
- Serverless Endpoints: Full endpoint management with configuration
- Type Safety: Strongly typed models with comprehensive validation
- Async/Await: Built on modern async Rust with
tokioandreqwest
Installation
Add this to your Cargo.toml:
[]
= { = "1.0", = ["macros", "rt-multi-thread"] }
= { = "0.1", = ["serverless"] }
Quick Start
Builder Configuration
use ;
use PodsService;
use Duration;
async
Environment Variables
The SDK can be configured using environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
RUNPOD_API_KEY |
Yes | - | Your RunPod API key from console settings |
RUNPOD_REST_URL |
No | https://rest.runpod.io/v1 |
Custom REST API base URL |
RUNPOD_API_URL |
No | https://api.runpod.io/v2 |
Custom API URL for serverless endpoints (requires serverless feature) |
RUNPOD_GRAPHQL_URL |
No | https://api.runpod.io/graphql |
Custom GraphQL API URL (requires graphql feature) |
RUNPOD_TIMEOUT_SECS |
No | 30 |
Request timeout in seconds (max: 300) |
use ;
async
Optional Features
TLS Backend
Choose between two TLS implementations:
# Default: rustls-tls (recommended)
= { = "0.1", = [] }
# Alternative: native-tls
= { = "0.1", = ["native-tls"], = false }
Tracing Support
Enable comprehensive logging and tracing via the tracing crate.
Tracing targets are defined in lib.rs for fine-grained control over log output:
= { = "0.1", = ["tracing"] }
Examples
The examples/ directory contains comprehensive usage examples:
# Set your API key
# Run the basic usage example
# Run the endpoints management example
# Run the pods management example
# Run the serverless endpoint example (requires serverless feature)
Contributing
Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, and contribute to the project.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.