runpod Python package is the single SDK for building on Runpod. It includes the decorator-based app SDK that was previously shipped as Flash, the rp command-line interface, the client for calling existing Serverless endpoints, the Serverless worker SDK, and the API wrapper for managing Pods and other resources.
rp flash dev main.py. The hello function runs on a Runpod GPU, and main runs on your machine.
Flash is now part of the Runpod SDK. If you have existing code that uses the
runpod-flash package, it continues to work. See What changed for how the old Flash commands and imports map to the unified SDK.Get started
Quickstart
Install the SDK and run a function on a GPU.
What changed
Map Flash commands and imports to the unified SDK.
CLI reference
Use the
rp CLI to log in, develop, and deploy.Install
The SDK requires Python 3.10 or higher.rp CLI. The same CLI is available under the longer name runpod.
Authenticate
Log in once to store your credentials:~/.runpod/config.toml and are shared by the SDK and the CLI. See rp login for other options, including named profiles.
What’s in the SDK
Therunpod package covers four areas. Each one is independent, so you can use any of them on its own.
Apps
An app is a collection of Python functions and classes that run on Runpod. Create one withrunpod.App, then attach resources to it with decorators. Each decorator defines a different kind of remote compute.
Resource types
The following example defines one of each:
chatruns on an autoscaling queue endpoint with between 0 and 3 workers. Model weights are cached on the network volume, and theHF_TOKENenvironment variable is read from a Runpod secret.finetuneprovisions a two-GPU Pod for each call and terminates it when the function returns.Counteris served over HTTP. The method marked with@runpod.initruns once when each worker starts, and methods marked with@runpod.getand@runpod.postbecome routes. Workers keep state in memory between requests.
Call remote functions
Decorated functions keep their Python identity. You call them through methods that control where and how they run:
For HTTP services defined with
@app.api, call routes through the class, for example Counter.post("/bump", {"by": 3}) or Counter.get("/value").
Local entrypoints
Mark the function that drives your app with@runpod.local_entrypoint. It runs on your machine and is the entry point for rp flash dev:
Storage
Attach storage with themounts parameter, which maps a path on the worker to a volume:
NetworkVolume(name_or_id, size=50, datacenter=None, create=True)references a network volume in a single datacenter. The app chooses a datacenter that works for every resource sharing the volume.GlobalVolume(name_or_id, create=True)references global storage that isn’t tied to a datacenter.
create=False to require an existing volume.
Mount rules depend on the resource type:
@app.tasksupports one network volume and one global volume, mounted at different paths that don’t overlap.@app.queueand@app.apisupport one volume, mounted at/runpod-volume. Global volumes require a GPU endpoint.
volume.path returns the path where the volume is mounted. Read .path inside remote functions, not at the top level of a module.
Develop and deploy
Use therp flash commands to iterate on an app and ship it:
Endpoint client
To call a Serverless endpoint that already exists, such as one you deployed from the console or withrp flash deploy, use runpod.Endpoint with the endpoint ID. This class works the same way it did before the Flash consolidation.
rp login, RUNPOD_API_KEY, or runpod.api_key. To use a different key for one endpoint, pass it to the constructor: runpod.Endpoint("ENDPOINT_ID", api_key="API_KEY"). A key passed to the constructor takes precedence over the global key.
See Send API requests for more examples.
Serverless worker
If you build your own worker container, userunpod.serverless.start to register the handler that processes jobs:
API wrapper
The SDK includes functions for managing Runpod resources through the REST API:Limitations
- CPU resources are restricted to the
EU-RO-1datacenter. - Apps can scale workers quickly across several endpoints, so you may reach your account’s worker limit. Contact Runpod support to raise it.
Next steps
- Run your first function with the SDK quickstart.
- See what changed if you’re coming from Flash.
- Learn about the runtime that runs your code on workers.
- Browse the examples in the runpod-python repository.