Requirements
- Runpod account with a verified email address.
- An API key with All access permissions to your Runpod account.
- Python 3.10 to 3.14 installed. Workers run Python 3.12 by default, whatever your local version.
- uv installed.
Step 1: Install Flash
Flash runs natively on macOS and Linux. Windows users can run Flash through WSL2.
Optional: Install coding agent integration
If you’re using an AI coding agent like Claude Code, Cline, or Cursor, you can install the Flash skill package to give your agent detailed context about the Flash SDK:Step 2: Authenticate with Runpod
Log in to your Runpod account:Step 3: Copy this code
Create a file calledgpu_demo.py and paste this code into it:
Step 4: Deploy the endpoint
From the directory that containsgpu_demo.py, deploy the endpoint:
flash-quickstart endpoint. The app is named after the current directory, and the endpoint is deployed to the production environment:
abc123xyz here). You’ll use it in Step 9 to call the endpoint over HTTP. Don’t run the printed curl example as is in 1.21.0. Step 9 explains why.
Every
flash command and script prints a deprecation notice (a FutureWarning in scripts) because runpod-flash is moving into the Runpod SDK. The notice doesn’t affect your deployment.flash deploy installs your endpoint’s dependencies into a local build directory before uploading. Flash leaves torch, torchvision, torchaudio, and triton out of the upload because the worker image already provides them, but a dependency that requires torch (such as accelerate) still downloads it during the local build. On Linux, that can be several GB. If the build runs out of disk space, remove that dependency, or exclude it with --exclude <package>. --no-deps also skips transitive dependencies, but it skips them for every package, so use it only if you list every dependency your code needs yourself. See flash deploy for details.Step 5: Run it
Execute the script from the same directory:Step 6: Update and run again
With your endpoint running, change an input and run the script again:-
Open
gpu_demo.pyand change the matrix size from1000to2000: -
Run the script again:
gpu_matrix_multiply or its @Endpoint configuration, run flash deploy again so the endpoint picks up the new version. Workers that are already warm can keep serving the previous version for a few minutes while new workers replace them. If a result doesn’t reflect your change, or fails with unexpected keyword argument after you added a parameter, wait a minute and run the script again.
Step 7: Understand what you just did
Let’s break down the code you just ran:Imports and setup
asyncio: Enables asynchronous execution (endpoint functions run async).Endpoint: The class that marks functions for remote execution.GpuGroup: Enum for selecting GPU types or groups of GPUs.
flash login or the RUNPOD_API_KEY environment variable.
The @Endpoint decorator
@Endpoint decorator configures everything in one place:
name: Identifies your endpoint in the Runpod console.gpu: Which GPU to use (GpuGroup.ANYaccepts any available GPU for faster provisioning).workers: Maximum parallel workers (allows 3 concurrent executions).idle_timeout: Seconds a worker stays active after completing a request before scaling down. Setting this to 300 (5 minutes) gives you more time to iterate on your code while the worker remains warm.dependencies: Python packages your function needs.torchis already in the worker image, so Flash leaves it out of the upload.- Function body: Runs on the remote worker, not your local machine.
device="cuda"creates the matrices in GPU memory, so the multiplication runs on the GPU. - Return value: The result is returned to your local machine as a Python dictionary.
Calling the function
@Endpoint decorated function:
- Flash looks up the endpoint by its
namein your app (the current directory name) and environment (productionby default).flash deploymust have created it first. - Flash sends the function’s arguments to the endpoint.
- A GPU worker runs the deployed function with those arguments.
- The result is returned to your local machine as a Python dictionary, where it’s printed in your terminal.
@Endpoint function (all the print statements, etc.) runs locally on your machine. Only the decorated function runs remotely.
Step 8: Run multiple operations in parallel
Flash makes it easy to run multiple GPU operations concurrently. Replace yourmain() function with the code below, and keep the if __name__ == "__main__": block at the end of the file. Without it, the script exits without printing anything.
@Endpoint function, so you don’t need to redeploy. Run the script again:
workers=3), or one after another on a single warm worker:
Step 9: Call the endpoint from any language
Your endpoint is a standard Serverless endpoint, so any language that can send HTTP requests can call it. The JSONinput object holds the function’s arguments by name.
flash login stores your API key for Flash, but curl needs it in an environment variable. Export it first, replacing your_key with your API key from the Runpod console:
/run, using the endpoint ID from Step 4:
/status with the job ID until status is COMPLETED:
/run and /status for long jobs and cold starts. /runsync returns the result in one request but waits at most 90 seconds by default, then returns IN_QUEUE or IN_PROGRESS and you poll /status anyway.
Clean up
When you’re done testing, clean up the endpoints:Next steps
You’ve successfully run GPU code on Runpod! Now you’re ready to learn more about Flash:Generate images with Flash
Use Stable Diffusion XL to generate images from text prompts.
Endpoint functions
Learn how to configure and optimize endpoint functions.
Build Flash apps
Deploy production APIs.
Explore Flash examples
Browse example Flash scripts and apps on GitHub.
Troubleshooting
Endpoint not found
@Endpoint function sends the request to an endpoint you’ve already deployed. Run flash deploy from the directory that contains your script, then run the script from that same directory. Flash uses the directory name as the app name, so running from a different directory looks up a different app.
First run fails after 90 seconds
Issue: The first run fails with one of these errors:runpod-flash 1.21.0 waits up to 90 seconds for a result. The first request on a new worker can take longer: the worker may wait for a free GPU, then it starts and runs your function. The endpoint is deployed, and the request keeps running after the error.
Solution: Run the script again. The worker keeps starting after the error, so the next run is faster. Raising FLASH_SENTINEL_TIMEOUT above 90 doesn’t help in 1.21.0: the request returns at 90 seconds with the job still running, and the script fails with the KeyError instead.
To see whether a worker is up, check the endpoint’s health with its ID from flash deploy. curl reads your API key from the RUNPOD_API_KEY environment variable, which flash login doesn’t set, so export it first:
workers.throttled means the worker is waiting for a GPU. A non-zero workers.idle, workers.ready, or workers.running means a worker is up.
Job timed out after 1 retries
- Empty input over HTTP: a request with
{"input": {}}never reaches your function. Send at least one argument, as shown in Step 9. - Redeploying during a request:
flash deployreplaces running workers, so a request that’s in progress fails. Wait for running requests to finish before you redeploy, or run the request again.
Authentication error
flash commands print:
flash login to authenticate with your Runpod account:
RUNPOD_API_KEY environment variable:
Template name conflict
name. If you’ve deployed an endpoint before with the same name, either:
- Use a different name for your new endpoint
- Undeploy the existing endpoint with
flash undeploy <name> --force
Job stuck in queue
Requests wait for minutes, and the endpoint’s health check shows"throttled": 1 with no idle or running workers.
Solution: No GPU of the types you selected is free. GpuGroup.ANY (used in this quickstart) accepts any available GPU. If you narrowed gpu to specific types, list several so Flash can fall back:
Import errors
@Endpoint function: