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. To move an existing project, see Migrating from Flash.Get started
Quickstart
Install the SDK and run a function on a GPU.
Migrating from Flash
Move an existing Flash project to the Runpod SDK.
CLI reference
Use the
rp CLI to log in, develop, and deploy.Install
The SDK requires Python 3.10 to 3.14, and the features on this page requirerunpod 2.0 or later.
pip install runpod==2.0.0rc1.
Installing the package also installs the 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. Runpod stages the model weights on the host before the worker starts (model=llama), the network volume is mounted at/runpod-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.
gpu= or cpu=, which are mutually exclusive. For GPUs, use a short name such as "4090", "H100", or "B200", a runpod.GpuGroup pool such as runpod.GpuGroup.ANY, or a runpod.GpuType device. Pass a list to allow several options. If you don’t set workers, resources scale between 0 and 3 workers.
For every option, see Resource parameters, GPU types, and CPU types.
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").
.remote() and job.wait() don’t impose an execution timeout by default. For streaming examples and how spawned tasks are cleaned up, see Dev sessions.
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.
To choose between network and global volumes, see Storage overview.
Mount rules
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 GPU compute, for both tasks and endpoints.
volume.path returns the path where the volume is mounted. Read .path inside remote functions, not at the top level of a module. See Storage for volume placement and billing.
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.
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
- 5th-generation CPU instances (
cpu5c) are only available inEU-RO-1. 3rd-generation instances are available in more data centers. See CPU types. - 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.
- Build an app with several resource types.
- Configure resources such as GPUs, workers, and storage.
- Migrate from Flash if you have an existing Flash project.
- Learn about the runtime that runs your code on workers.
- Browse the examples in the runpod-python repository.