Exhaustive documentation for all Flash CLI commands. This guide covers every option, parameter, and use case.
- flash login - Authenticate with Runpod
- flash init - Create new Flash project
- flash run - Run development server
- flash build - Build deployment package
- flash deploy - Build and deploy application
- flash undeploy - Delete deployed endpoints
- flash env - Manage deployment environments
- flash app - Manage Flash applications
Authenticate with Runpod by opening a browser for OAuth authentication.
flash loginAuthenticates with Runpod by opening your default browser to the Runpod authentication page. After successful authentication, credentials are saved locally and persist across terminal sessions.
This is the recommended authentication method for interactive use. For CI/CD or automated environments, use the RUNPOD_API_KEY environment variable instead.
Authenticate with Runpod:
flash loginAlternative: Manual API key configuration:
# Set environment variable
export RUNPOD_API_KEY=your-key-here
# Or add to .env file
echo "RUNPOD_API_KEY=your-key-here" > .env- Requires a browser for OAuth flow
- Credentials are stored securely on your local machine
- For headless environments, use
RUNPOD_API_KEYenvironment variable
Create a new Flash project with the correct structure, boilerplate code, and configuration files.
flash init [PROJECT_NAME] [OPTIONS]Creates a new Flash project directory with all necessary files for development and deployment. The command generates a complete project structure including FastAPI application, worker templates, configuration files, and documentation.
If PROJECT_NAME is omitted or set to ., the project is initialized in the current directory.
PROJECT_NAME (optional)
- Type: String
- Default: Current directory if
.specified - Description: Name for the project directory. Creates a new subdirectory with this name.
--force, -f
- Type: Boolean flag
- Default:
false - Description: Overwrite existing files without prompting for confirmation. Use with caution as this can replace modified files.
project-name/
├── main.py # FastAPI application entry point
├── mothership.py # Mothership endpoint configuration
├── gpu_worker.py # GPU worker template with @Endpoint decorator
├── pyproject.toml # Project dependencies and metadata
├── requirements.txt # Pinned dependencies (generated)
├── .env.example # Environment variable template
├── .gitignore # Git ignore patterns (includes flash auto-generated files)
├── .flashignore # Files to exclude from build
├── .python-version # Python version specification
└── README.md # Project documentation
main.py
- FastAPI application that loads routers from worker files
- Configured for local development and testing
- Automatically discovers
@Endpointdecorated functions
mothership.py
- Configures the mothership endpoint (load-balanced FastAPI application endpoint)
- Can be customized for different scaling requirements
- Delete this file if you don't want to deploy the mothership endpoint
gpu_worker.py
- Template worker with
@Endpointdecorator - Configured for GPU resources via
gpu=parameter - Contains example endpoint with proper structure
pyproject.toml
- Project metadata and dependencies
- Used by
flash buildto install packages - Update this file to add dependencies
.flashignore
- Specifies files to exclude from deployment package
- Similar to
.gitignorebut for builds - Reduces package size by excluding unnecessary files
flash init my-api
cd my-api
ls -laOutput:
drwxr-xr-x 12 user staff 384 Jan 01 12:00 .
drwxr-xr-x 8 user staff 256 Jan 01 12:00 ..
-rw-r--r-- 1 user staff 271 Jan 01 12:00 .env.example
-rw-r--r-- 1 user staff 350 Jan 01 12:00 .flashignore
-rw-r--r-- 1 user staff 580 Jan 01 12:00 .gitignore
-rw-r--r-- 1 user staff 10 Jan 01 12:00 .python-version
-rw-r--r-- 1 user staff 2154 Jan 01 12:00 README.md
-rw-r--r-- 1 user staff 1256 Jan 01 12:00 gpu_worker.py
-rw-r--r-- 1 user staff 845 Jan 01 12:00 main.py
-rw-r--r-- 1 user staff 456 Jan 01 12:00 mothership.py
-rw-r--r-- 1 user staff 512 Jan 01 12:00 pyproject.toml
mkdir my-api && cd my-api
flash init .Creates all files in the current my-api/ directory.
# Project already exists with modifications
flash init my-api --forceOverwrites all template files without prompting. Useful for resetting a project to template defaults.
flash init api-v1
flash init api-v2
flash init testing-envCreates three separate project directories.
flash init my-api
cd my-api
git init
git add .
git commit -m "Initial commit"The generated .gitignore already includes necessary patterns.
- Directory Creation: Creates project directory if it doesn't exist
- Template Rendering: Generates files from internal templates
- Dependency Setup: Creates
pyproject.tomlwith base dependencies - Configuration Files: Generates
.flashignore,.gitignore,.env.example - Documentation: Creates README with project-specific instructions
- Validation: Ensures all files are created successfully
-
Configure Environment
cp .env.example .env # Edit .env with your RUNPOD_API_KEY -
Install Dependencies
uv sync && uv pip install -e .
-
Run Locally
uv run flash run
-
View Documentation
http://localhost:8888/docs
Directory Already Exists
Problem:
Error: Directory 'my-api' already exists. Use --force to overwrite.
Solution:
flash init my-api --force
# Or use a different name
flash init my-api-v2Permission Denied
Problem:
Error: Permission denied: '/path/to/directory'
Solution:
# Ensure you have write permissions
chmod u+w /path/to/directory
# Or create in a directory you own
cd ~
flash init my-apiflash run- Run the initialized projectflash build- Build the projectflash deploy- Deploy the project
Run the Flash development server locally with hot reloading for rapid development and testing.
flash run [OPTIONS]Starts a local uvicorn development server that runs your Flash application. The server automatically discovers all @Endpoint decorated functions and makes them available as HTTP endpoints. Supports hot reloading, custom host/port configuration, and optional resource auto-provisioning.
With flash run, your system operates in a hybrid architecture:
- Your FastAPI app runs locally on your machine (localhost:8888)
@Endpointfunctions run on Runpod as serverless endpoints- Hot reload works because your app code is local—changes are picked up instantly
- Endpoints are prefixed with
live-to distinguish from production (e.g.,gpu-workerbecomeslive-gpu-worker)
This hybrid approach enables rapid development: iterate on your orchestration logic locally with hot-reload while testing real GPU/CPU workloads in the cloud.
--host
- Type: String
- Default:
localhost - Environment Variable:
FLASH_HOST - Description: Host address to bind the server to. Use
0.0.0.0to make the server accessible from your network.
--port, -p
- Type: Integer
- Default:
8888 - Environment Variable:
FLASH_PORT - Description: Port number to bind the server to. Must be available (not in use).
--reload / --no-reload
- Type: Boolean flag
- Default:
--reload(enabled) - Description: Enable or disable automatic reloading when source files change. Disable for production-like testing.
--auto-provision
- Type: Boolean flag
- Default:
false - Description: Automatically provision Runpod serverless endpoints on startup. Useful for testing deployed resources locally.
Variables can be set in .env file or exported in shell. The .env file populates os.environ for local CLI use and development -- it is not carried to deployed endpoints.
# .env file (local CLI and development only)
FLASH_HOST=0.0.0.0
FLASH_PORT=9000
RUNPOD_API_KEY=your-key-hereTo pass env vars to deployed endpoints, declare them on the resource config:
env={"HF_TOKEN": os.environ["HF_TOKEN"]}.
Precedence (highest to lowest):
- Command-line options (
--host,--port) - Environment variables (
FLASH_HOST,FLASH_PORT) - Default values (
localhost,8888)
flash runOutput:
INFO: Started server process [12345]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:8888 (Press CTRL+C to quit)
INFO: Started reloader process [12346] using StatReload
Visit http://localhost:8888/docs for interactive API documentation.
flash run --host 0.0.0.0 --port 3000Makes server accessible from network at http://<your-ip>:3000. Useful for:
- Testing on mobile devices
- Accessing from other machines on your network
- Development in containers or VMs
flash run --no-reloadUseful for:
- Debugging issues related to hot reload
- Testing production-like behavior
- Profiling performance without reload overhead
export FLASH_HOST=0.0.0.0
export FLASH_PORT=9000
flash runOr with .env file:
# .env
FLASH_HOST=0.0.0.0
FLASH_PORT=9000flash run
# Automatically loads .envflash run --auto-provisionThis will:
- Start local development server
- Provision Runpod endpoints for all
@Endpointfunctions - Allow testing with real Runpod infrastructure
- Incur Runpod costs (workers will spin up)
Use case: Testing autoscaling behavior and cold start times.
flash run --host 0.0.0.0 --port 9000 --no-reloadRuns on all network interfaces, port 9000, without auto-reload.
flash run --host 0.0.0.0
# Server accessible at http://192.168.1.100:8888 (your local IP)Share the URL with team members for testing.
- Application Loading: Imports
main.pyand discovers FastAPI app - Router Discovery: Scans for APIRouter exports in worker files
- Remote Function Discovery: Finds all
@Endpointdecorated functions - Uvicorn Startup: Starts ASGI server with specified configuration
- Hot Reload Setup: Watches Python files for changes (if enabled)
- Documentation Generation: Creates OpenAPI schema at
/docs
After starting the server, test your endpoints using:
Swagger UI (Recommended)
Visit http://localhost:8888/docs
- Interactive API explorer
- Try requests directly in browser
- See request/response schemas
- View example payloads
curl
curl -X POST http://localhost:8888/your-endpoint \
-H "Content-Type: application/json" \
-d '{"input": "test data"}'Python requests
import requests
response = requests.post(
"http://localhost:8888/your-endpoint",
json={"input": "test data"}
)
print(response.json())HTTPie
http POST localhost:8888/your-endpoint input="test data"When --reload is enabled (default):
- File Watching: Monitors
.pyfiles in project directory - Change Detection: Detects file modifications
- Process Restart: Restarts server with new code
- State Loss: In-memory state is reset
Files watched:
*.pyin project rootworkers/**/*.py- Excludes:
.venv/,.build/,__pycache__/
Example workflow:
# Terminal 1: Run server
flash run
# Terminal 2: Edit code
echo 'print("Updated!")' >> gpu_worker.py
# Terminal 1: Automatic reload
# INFO: Detected file change, reloading...
# INFO: Application startup complete.Development Mode:
- Hot reload adds overhead
- Debug logging enabled
- Not optimized for high load
For production-like testing:
flash run --no-reload
# More representative of deployed performancePort Already in Use
Problem:
ERROR: [Errno 48] Address already in use
Solutions:
# Option 1: Use different port
flash run --port 9000
# Option 2: Kill process using port
lsof -ti:8888 | xargs kill -9
# Option 3: Find and manually kill
lsof -i:8888 # Shows process ID
kill <pid>Import Errors
Problem:
ModuleNotFoundError: No module named 'your_module'
Solutions:
# Ensure dependencies installed
pip install -e .
# Or install specific package
pip install your-module
# Check virtual environment active
which python # Should point to .venv/bin/pythonSlow Hot Reload
Problem: Server takes long time to reload after changes.
Solutions:
# Reduce watched files
# Add to .gitignore (uvicorn respects it):
echo "large_files/" >> .gitignore
# Or disable reload temporarily
flash run --no-reloadCannot Access from Network
Problem: Cannot reach server from other devices.
Solutions:
# Use 0.0.0.0 instead of localhost
flash run --host 0.0.0.0
# Check firewall settings
# macOS: System Preferences → Security & Privacy → Firewall
# Linux: sudo ufw allow 8888API Key Not Found (with --auto-provision)
Problem:
Error: RUNPOD_API_KEY environment variable not set
Solution:
export RUNPOD_API_KEY=your-key-here
flash run --auto-provisionflash init- Create project to runflash build- Build for deploymentflash deploy- Deploy to production
Build the Flash application into a deployable package for Runpod serverless infrastructure.
flash build [OPTIONS]Packages your Flash application and its dependencies into a tar.gz archive suitable for deployment to Runpod. The build process installs dependencies cross-platform (Linux x86_64), generates handler files for each @Endpoint function, creates a manifest with resource configurations, and produces a final artifact ready for upload.
The .build/ directory is preserved after building for inspection and debugging.
Build does not deploy. Use flash deploy to build and deploy in one step.
--no-deps
- Type: Boolean flag
- Default:
false - Description: Skip transitive dependencies during pip install. Only installs packages directly listed in
pyproject.toml, not their dependencies. Use when dependencies are pre-installed in base image.
--output, -o
- Type: String
- Default:
artifact.tar.gz - Description: Custom name for the output archive. Useful for versioning or multiple builds.
--exclude
- Type: String (comma-separated)
- Default: None
- Description: Packages to exclude from the build. Used to avoid bundling packages already present in Runpod base images. Significantly reduces archive size.
--use-local-flash
- Type: Boolean flag
- Default:
false - Description: Bundle local
runpod_flashsource code instead of installing from PyPI. For Flash SDK development and testing.
The build command executes these steps:
-
Create Build Directory
- Creates/cleans
.build/directory - Preserves directory after completion for inspection
- Creates/cleans
-
Install Dependencies
- Runs
pip install --target .build/lib --platform manylinux2014_x86_64 - Installs packages for Linux x86_64 (Runpod platform)
- Respects
--no-depsand--excludeoptions
- Runs
-
Generate Manifest
- Scans code for
@Endpointdecorated functions - Extracts resource configurations (Endpoint params)
- Creates
flash_manifest.jsonwith deployment metadata
- Scans code for
-
Generate Handlers
- Creates handler file for each
@Endpointfunction - Handlers interface between Runpod and your functions
- Includes error handling and serialization logic
- Creates handler file for each
-
Copy Application Code
- Copies project files to
.build/ - Respects
.flashignorepatterns - Includes all necessary source files
- Copies project files to
-
Create Archive
- Packages
.build/contents into tar.gz - Compresses for upload efficiency
- Reports final size
- Packages
flash buildOutput:
Building Flash application...
Creating build directory...
Installing dependencies...
✓ Installed 25 packages
Generating manifest...
✓ Found 3 remote functions
✓ Generated flash_manifest.json
Generating handlers...
✓ Created handler_gpu_worker_process_request.py
✓ Created handler_mothership.py
Copying application code...
Creating archive...
✓ Build complete: artifact.tar.gz (45.2 MB)
Archive size: 45.2 MB (500 MB limit)
Build directory preserved at: .build/
flash build -o my-app-v1.2.3.tar.gzUseful for versioning:
VERSION=1.2.3
flash build -o my-app-v${VERSION}.tar.gzflash build --exclude torch,torchvision,torchaudioReduces build size by excluding packages in Runpod base image.
Common packages to exclude:
torch,torchvision,torchaudio- PyTorch stacktransformers- Hugging Face transformerstensorflow,tf-keras- TensorFlow stackjax,jaxlib- JAX ML frameworkopencv-python- OpenCV
Check Runpod base image documentation for full list.
flash build --exclude torch,torchvision,torchaudio,transformers,opencv-pythonflash build --no-depsOnly installs packages in pyproject.toml dependencies list, not their subdependencies. Use when:
- Base image has most dependencies
- You want minimal package size
- Dependencies conflict with base image versions
flash build --use-local-flashBundles your local runpod_flash modifications for testing. Path detected automatically from your environment.
flash build \
-o my-app-prod-v2.tar.gz \
--exclude torch,torchvision,torchaudio \
--no-depsCreates optimized production build with custom name.
If your build exceeds the 500MB deployment limit:
1. Identify Large Packages
du -sh .build/lib/* | sort -h | tail -20Example output:
156M .build/lib/torch
89M .build/lib/torchvision
45M .build/lib/transformers
23M .build/lib/opencv_python
...
2. Exclude Packages in Base Image
# Exclude PyTorch (already in Runpod GPU images)
flash build --exclude torch,torchvision,torchaudio3. Use --no-deps for Common Packages
# Base image has most ML packages
flash build --no-deps --exclude torch,torchvision4. Check .flashignore
# Exclude large files not needed at runtime
echo "tests/" >> .flashignore
echo "docs/" >> .flashignore
echo "*.md" >> .flashignore
echo "data/" >> .flashignore5. Remove Unnecessary Dependencies
Edit pyproject.toml:
[project]
dependencies = [
# Remove unused packages
# "pandas", # Not needed for inference
"torch>=2.0.0",
]The .build/ directory is preserved for inspection:
# View build contents
ls -lah .build/
# Check installed packages
ls -1 .build/lib/
# Inspect manifest
cat .build/flash_manifest.json
# View generated handler
cat .build/handler_gpu_worker_process_request.py
# Check package sizes
du -sh .build/lib/* | sort -hThe flash_manifest.json contains deployment metadata:
{
"resources": [
{
"name": "gpu_worker_process_request",
"type": "Endpoint",
"config": {
"name": "my_api_gpu",
"gpus": ["ANY"],
"workersMin": 0,
"workersMax": 3,
"idleTimeout": 300
},
"handler": "handler_gpu_worker_process_request.py"
}
],
"mothership": {
"enabled": true,
"config": {
"name": "my_api_mothership",
"workersMin": 1,
"workersMax": 3
}
}
}Flash builds for Linux x86_64 regardless of your development platform:
macOS (ARM64) → Linux x86_64:
flash build
# Packages installed for manylinux2014_x86_64Windows → Linux x86_64:
flash build
# Packages installed for manylinux2014_x86_64Linux (x86_64) → Linux x86_64:
flash build
# Native platform buildThis ensures your application works on Runpod's Linux infrastructure.
Archive Too Large
Problem:
ERROR: Archive size (523MB) exceeds 500MB limit
Solution:
# Identify large packages
du -sh .build/lib/* | sort -h | tail -10
# Exclude packages in base image
flash build --exclude torch,torchvision,torchaudio,transformers
# Check size again
ls -lh artifact.tar.gzDependency Installation Failed
Problem:
ERROR: Could not find a version that satisfies the requirement
Solutions:
# Check pyproject.toml for typos
cat pyproject.toml
# Update dependency versions
# Edit pyproject.toml, then:
flash build
# Install locally first to verify
pip install <package-name>Import Error During Build
Problem:
ModuleNotFoundError: No module named 'your_module'
Solution:
# Ensure dependencies in pyproject.toml
# Add missing dependency:
# [project]
# dependencies = ["your-module>=1.0.0"]
flash buildPermission Denied
Problem:
Permission denied: '.build/...'
Solution:
# Remove .build directory
rm -rf .build
# Retry
flash buildManylinux Compatibility Error
Problem:
ERROR: Package has no compatible wheels for manylinux2014_x86_64
Solution:
# Package may not support Linux
# Options:
# 1. Use alternative package
# 2. Build from source (add build dependencies)
# 3. Contact package maintainer
# Temporarily skip package
flash build --exclude problematic-packageflash deploy- Build and deploy in one stepflash run- Test before building
Build and deploy the Flash application to Runpod in a single command.
flash deploy [OPTIONS]Combines building and deploying into one streamlined command. Packages your application (same as flash build), then uploads to Runpod and creates serverless endpoints for each resource defined in your code.
If only one environment exists, it's used automatically. With multiple environments, specify with --env or select interactively.
With flash deploy, your entire application runs on Runpod Serverless:
- Your FastAPI app runs on Runpod as the "mothership" endpoint
@Endpointfunctions run on Runpod as separate worker endpoints- Users call the mothership URL directly (e.g.,
https://xyz123.api.runpod.ai/api/hello) - No
live-prefix on endpoint names—these are production endpoints - No hot reload—code changes require a new deployment
This is different from flash run, where your FastAPI app runs locally on your machine. With flash deploy, everything is in the cloud for production use.
Deployment Options
--env, -e
- Type: String
- Default: Auto-select if only one exists
- Description: Target environment name for deployment. Environments isolate deployments (staging, production, etc.).
--app, -a
- Type: String
- Default: Current app context
- Description: Flash app name to deploy to. Apps provide namespace isolation.
--preview
- Type: Boolean flag
- Default:
false - Description: Build and launch local Docker preview environment instead of deploying to Runpod. Useful for testing the deployment package locally.
Build Options (same as flash build)
--no-deps
- Skip transitive dependencies during pip install
--exclude
- Comma-separated packages to exclude from build
--use-local-flash
- Bundle local runpod_flash source instead of PyPI version
--output, -o
- Custom archive name (default:
artifact.tar.gz)
RUNPOD_API_KEY (required)
- Runpod API authentication key
- Get from https://runpod.io/console/user/settings
- Can be set in
.envfile
flash deployOutput:
Building Flash application...
✓ Build complete: artifact.tar.gz (45.2 MB)
Deploying to environment: dev (auto-selected)
Uploading artifact... ████████████████████ 100% (45.2 MB)
Creating endpoints...
✓ gpu_worker: https://abcd1234-my-api-gpu.runpod.io
✓ mothership: https://efgh5678-my-api-mothership.runpod.io
Deployment successful!
Test your endpoints:
curl -X POST https://abcd1234-my-api-gpu.runpod.io/run \
-H "Authorization: Bearer $RUNPOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": {"your": "data"}}'
Next steps:
1. Test endpoints with curl or Postman
2. Monitor at https://runpod.io/console/serverless
3. Update deployment: flash deploy --env dev
4. View logs: Visit Runpod console
flash deploy --env productionExplicitly targets "production" environment.
flash deploy --env prod --exclude torch,torchvision,torchaudioReduces deployment package size by excluding packages in Runpod base image.
flash deploy --app my-other-app --env stagingDeploys to "staging" environment in "my-other-app" namespace.
flash deploy --previewBuilds and launches in local Docker container for testing:
Building Flash application...
✓ Build complete: artifact.tar.gz (45.2 MB)
Launching local preview...
✓ Docker container started
✓ Preview running at http://localhost:8000
Test your preview:
curl -X POST http://localhost:8000/run \
-H "Content-Type: application/json" \
-d '{"input": {"your": "data"}}'
Press Ctrl+C to stop preview
flash deploy --env dev --use-local-flashDeploys with local Flash SDK modifications for testing SDK changes.
flash deploy \
--env production \
--exclude torch,torchvision,torchaudio,transformers \
--no-depsOptimized deployment to production environment.
-
Build Phase (same as
flash build)- Create
.build/directory - Install dependencies
- Generate manifest and handlers
- Create archive
- Create
-
Validation
- Check
RUNPOD_API_KEYis set - Verify archive size ≤ 500MB
- Validate environment exists
- Check
-
Upload
- Authenticate with Runpod API
- Upload artifact with progress bar
- Verify upload integrity
-
Endpoint Creation
- Create/update serverless endpoints for each resource
- Configure autoscaling (workers min/max)
- Set idle timeout
- Assign GPU types
-
Verification
- Check endpoint status
- Wait for endpoints to become active
- Report endpoint URLs
One Environment:
flash deploy
# Automatically uses the only environmentMultiple Environments:
flash deploy
# Prompts:
# Available environments:
# 1. dev
# 2. staging
# 3. production
# Select environment (1-3): _Or specify explicitly:
flash deploy --env stagingNo Environments:
flash deploy
# Error: No environments found
# Create one with: flash env create <name>After successful deployment, test your endpoints:
Test GPU Worker Endpoint:
curl -X POST https://abcd1234-my-api-gpu.runpod.io/run \
-H "Authorization: Bearer $RUNPOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"payload": {"message": "test"}
}
}'Test Mothership Endpoint:
curl -X POST https://efgh5678-my-api-mothership.runpod.io/your-route \
-H "Content-Type: application/json" \
-d '{"your": "data"}'View in Runpod Console: https://runpod.io/console/serverless
Check deployment status:
flash env get productionView logs:
- Go to Runpod console
- Select your endpoint
- View "Logs" tab
To update an existing deployment:
# Make code changes
# ...
# Redeploy to same environment
flash deploy --env productionThis:
- Rebuilds with new code
- Uploads new artifact
- Updates existing endpoints (zero downtime)
Missing API Key
Problem:
Error: RUNPOD_API_KEY environment variable not set
Solution:
export RUNPOD_API_KEY=your-key-here
# Or add to .env file
echo "RUNPOD_API_KEY=your-key-here" >> .envArchive Too Large
Problem:
ERROR: Archive size (523MB) exceeds 500MB limit
Solution:
flash deploy --env prod --exclude torch,torchvision,torchaudioSee Build Size Optimization for details.
Environment Not Found
Problem:
Error: Environment 'production' not found
Solution:
# List available environments
flash env list
# Create missing environment
flash env create production
# Deploy
flash deploy --env productionUpload Failed
Problem:
Error: Upload failed: Connection timeout
Solutions:
# Check internet connection
ping runpod.io
# Retry deployment
flash deploy --env production
# Check firewall settingsEndpoint Creation Failed
Problem:
Error: Failed to create endpoint: Insufficient GPU availability
Solutions:
# Wait and retry (GPUs may become available)
flash deploy --env production
# Change GPU type in resource config
# Edit gpu_worker.py:
# gpus=[GpuGroup.RTX_3090] # More common GPU
# Redeploy
flash deploy --env productionAuthentication Failed
Problem:
Error: Invalid API key
Solutions:
# Verify API key
echo $RUNPOD_API_KEY
# Get new key from https://runpod.io/console/user/settings
export RUNPOD_API_KEY=new-key-here
# Retry
flash deploy --env productionflash build- Build without deployingflash env- Manage environmentsflash undeploy- Delete deploymentsflash run- Test locally before deploying
Delete deployed Runpod serverless endpoints and clean up resources.
flash undeploy [NAME] [OPTIONS]Removes deployed endpoints from Runpod infrastructure. Supports deleting individual endpoints, bulk deletion, interactive selection, and cleaning up stale tracking data.
Undeployment is permanent and cannot be undone. Endpoints are deleted from Runpod and removed from local tracking.
NAME (optional)
- Type: String
- Special value:
list- Show all endpoints without deleting - Description: Name of the endpoint to undeploy. If omitted, other options determine behavior.
--all
- Type: Boolean flag
- Default:
false - Description: Undeploy all tracked endpoints. Prompts for confirmation unless
--forceis used.
--interactive, -i
- Type: Boolean flag
- Default:
false - Description: Show interactive checkbox UI to select which endpoints to delete. Useful for selective cleanup.
--cleanup-stale
- Type: Boolean flag
- Default:
false - Description: Remove endpoints from local tracking that were already deleted externally (e.g., via Runpod console). Does not delete active endpoints.
--force, -f
- Type: Boolean flag
- Default:
false - Description: Skip all confirmation prompts. Use with caution as deletions are permanent.
The command operates in different modes based on options:
- List Mode -
flash undeploy list - Single Endpoint -
flash undeploy <name> - All Endpoints -
flash undeploy --all - Interactive Selection -
flash undeploy --interactive - Cleanup Stale -
flash undeploy --cleanup-stale
flash undeploy listOutput:
Deployed Endpoints:
┌──────────────────────────┬─────────────────────┬──────────────────────┬────────────┐
│ Name │ Type │ Environment │ Status │
├──────────────────────────┼─────────────────────┼──────────────────────┼────────────┤
│ my-api-gpu │ Endpoint │ production │ Active │
│ my-api-mothership │ Endpoint (LB) │ production │ Active │
│ test-worker │ Endpoint │ dev │ Active │
│ old-api-gpu │ Endpoint │ staging │ Inactive │
└──────────────────────────┴─────────────────────┴──────────────────────┴────────────┘
Total: 4 endpoints
flash undeploy my-api-gpuOutput:
Endpoint: my-api-gpu
Type: Endpoint (GPU)
Environment: production
Status: Active
This will permanently delete the endpoint.
Continue? [y/N]: y
Deleting endpoint... ✓
Removed from tracking ✓
Endpoint 'my-api-gpu' undeployed successfully.
flash undeploy test-worker --forceOutput:
Deleting endpoint 'test-worker'... ✓
Endpoint undeployed successfully.
flash undeploy --allOutput:
Found 4 endpoints to undeploy:
- my-api-gpu (production)
- my-api-mothership (production)
- test-worker (dev)
- old-api-gpu (staging)
This will permanently delete ALL endpoints.
Continue? [y/N]: y
Deleting endpoints...
my-api-gpu ✓
my-api-mothership ✓
test-worker ✓
old-api-gpu ✓
All endpoints undeployed successfully.
flash undeploy --all --forceImmediately deletes all endpoints without prompting.
flash undeploy --interactiveOutput:
Select endpoints to undeploy:
[✓] my-api-gpu (production)
[✓] my-api-mothership (production)
[ ] test-worker (dev)
[✓] old-api-gpu (staging)
Press SPACE to toggle, ENTER to confirm, ESC to cancel
Selected 3 endpoints.
Continue? [y/N]: y
Deleting endpoints...
my-api-gpu ✓
my-api-mothership ✓
old-api-gpu ✓
Selected endpoints undeployed successfully.
flash undeploy --cleanup-staleOutput:
Checking endpoint status...
Found 2 stale endpoints (deleted externally):
- old-worker-v1
- test-endpoint-abc
Remove from tracking? [y/N]: y
Cleaning up...
old-worker-v1 ✓
test-endpoint-abc ✓
Stale tracking cleaned up successfully.
On Runpod:
- Serverless endpoint and its configuration
- Auto-scaling settings
- Worker instances (if running)
- Endpoint metrics and logs (after retention period)
Locally:
.runpod/<endpoint-name>.jsontracking file- Endpoint reference in environment configuration
Not Deleted:
- Source code
- Build artifacts (
.build/,artifact.tar.gz) - Environment configuration
- Other endpoints in the same environment
Development Cleanup:
# After testing feature
flash undeploy feature-test-gpu --forceRemove Old Deployments:
# Interactive selection
flash undeploy --interactive
# Select old endpoints, keep active onesEnvironment Teardown:
# Remove all staging endpoints
flash env get staging # Note endpoint names
flash undeploy staging-* --force
# Or delete entire environment
flash env delete stagingFix Tracking Issues:
# Deleted endpoints manually via console
flash undeploy --cleanup-staleBulk Cleanup:
# Remove everything for fresh start
flash undeploy --all --forceConfirmation Prompts:
- Single endpoint: Shows endpoint details, asks confirmation
- Multiple endpoints: Shows count and list, asks confirmation
- Can be bypassed with
--forceflag
Stale Detection:
- Checks endpoint status on Runpod before deletion
- Identifies endpoints deleted externally
- Prevents errors from trying to delete non-existent endpoints
Rollback Not Possible:
- Undeployment is permanent
- Must redeploy with
flash deployto restore - Ensure you have source code and can rebuild
Endpoint Not Found Locally
Problem:
Error: Endpoint 'my-api' not found in tracking
Solutions:
# List endpoints
flash undeploy list
# Check spelling
flash undeploy my-api-gpu # Note: exact name required
# If deleted externally, cleanup
flash undeploy --cleanup-staleEndpoint Already Deleted
Problem:
Warning: Endpoint 'my-api' not found on Runpod (may be deleted)
Remove from tracking anyway? [y/N]:
Solution:
# Confirm to remove from tracking
y
# Or cleanup all stale at once
flash undeploy --cleanup-staleDeletion Failed
Problem:
Error: Failed to delete endpoint: Insufficient permissions
Solutions:
# Check API key permissions
# Generate new key at https://runpod.io/console/user/settings
# Verify API key
echo $RUNPOD_API_KEY
# Try again
flash undeploy my-apiCannot Delete While Processing Requests
Problem:
Error: Endpoint has active requests. Wait or force deletion.
Solutions:
# Wait for requests to complete
# Check Runpod console for request status
# Or force deletion (requests will be terminated)
flash undeploy my-api --forceVerify Deletion:
# List remaining endpoints
flash undeploy list
# Check specific environment
flash env get production
# Verify on Runpod console
# https://runpod.io/console/serverlessRedeploy if Needed:
# Undeploy was a mistake? Redeploy:
flash deploy --env productionflash deploy- Deploy endpointsflash env- Manage environmentsflash env delete- Delete environment and all its endpoints
Manage deployment environments. Environments represent isolated deployment targets (dev, staging, production) with their own endpoints and configurations.
flash env list- Show all environmentsflash env create- Create new environmentflash env get- Show environment detailsflash env delete- Delete environment and all its endpoints
See individual subcommand sections for detailed documentation.
Show all available deployment environments across all Flash apps.
flash env list [OPTIONS]--app, -a
- Type: String
- Default: Show all apps
- Description: Filter environments by Flash app name.
List All Environments:
flash env listOutput:
Environments:
┌────────────────┬─────────────────┬───────────────┬────────────────┐
│ Name │ App │ Endpoints │ Status │
├────────────────┼─────────────────┼───────────────┼────────────────┤
│ dev │ my-app │ 3 │ Active │
│ staging │ my-app │ 2 │ Active │
│ production │ my-app │ 4 │ Active │
│ dev │ other-app │ 1 │ Idle │
└────────────────┴─────────────────┴───────────────┴────────────────┘
Total: 4 environments across 2 apps
Filter by App:
flash env list --app my-appOutput:
Environments in 'my-app':
┌────────────────┬───────────────┬────────────────┐
│ Name │ Endpoints │ Status │
├────────────────┼───────────────┼────────────────┤
│ dev │ 3 │ Active │
│ staging │ 2 │ Active │
│ production │ 4 │ Active │
└────────────────┴───────────────┴────────────────┘
Total: 3 environments
flash env create- Create new environmentflash env get- View environment detailsflash deploy- Deploy to environment
Create a new deployment environment in a Flash app.
flash env create NAME [OPTIONS]NAME (required)
- Type: String
- Description: Name for the new environment (e.g.,
dev,staging,production)
--app, -a
- Type: String
- Default: Current app context
- Description: Flash app name to create environment in
Create Environment:
flash env create devOutput:
Creating environment 'dev'...
✓ Environment created successfully
Deploy to this environment:
flash deploy --env dev
Create in Specific App:
flash env create production --app my-appCreate Multiple Environments:
flash env create dev
flash env create staging
flash env create production- Environment entry in Flash configuration
- Namespace for deploying endpoints
- Isolated resource group
Common environment names:
dev,development- Local or shared developmentstaging,stage- Pre-production testingprod,production- Live productiontest,testing- Automated testingpreview- Temporary preview deployments
Best practices:
- Use lowercase names
- Avoid spaces (use hyphens or underscores)
- Keep names short and descriptive
- Match your CI/CD pipeline stages
Environment Already Exists:
Problem:
Error: Environment 'dev' already exists
Solution:
# List environments
flash env list
# Use different name or delete existing
flash env delete dev
flash env create devflash deploy- Deploy to environmentflash env list- List environmentsflash env delete- Delete environment
Show detailed information about a specific deployment environment.
flash env get ENV_NAME [OPTIONS]ENV_NAME (required)
- Type: String
- Description: Name of environment to inspect
--app, -a
- Type: String
- Default: Current app context
- Description: Flash app name
Get Environment Details:
flash env get productionOutput:
Environment: production
App: my-app
Status: Active
Created: 2024-01-15 10:30:00
Endpoints (4):
┌──────────────────────────┬─────────────────────┬────────────┬──────────────┐
│ Name │ Type │ Status │ Workers │
├──────────────────────────┼─────────────────────┼────────────┼──────────────┤
│ my-api-gpu │ Endpoint │ Active │ 0/3 │
│ my-api-mothership │ Endpoint (LB) │ Active │ 1/3 │
│ batch-processor │ Endpoint │ Idle │ 0/5 │
│ image-worker │ Endpoint │ Active │ 2/3 │
└──────────────────────────┴─────────────────────┴────────────┴──────────────┘
Resource Configuration:
GPU Types: A100, RTX_4090
CPU Workers: 2 endpoints
Total Workers: 3 active, 0-14 range
Recent Deployments:
2024-01-20 14:15 - Updated my-api-gpu
2024-01-19 10:00 - Created batch-processor
2024-01-15 10:30 - Initial deployment
Endpoint URLs:
my-api-gpu: https://abcd1234-my-api-gpu.runpod.io
my-api-mothership: https://efgh5678-my-api-mothership.runpod.io
batch-processor: https://ijkl9012-batch-processor.runpod.io
image-worker: https://mnop3456-image-worker.runpod.io
Get in Specific App:
flash env get staging --app my-appCheck deployment status:
flash env get production
# See which endpoints are activeGet endpoint URLs:
flash env get production | grep "https://"Monitor worker scaling:
flash env get production
# Check "Workers" column for current/max valuesflash env list- List all environmentsflash deploy- Deploy to environmentflash undeploy- Remove endpoints
Delete a deployment environment and all its endpoints permanently.
flash env delete ENV_NAME [OPTIONS]ENV_NAME (required)
- Type: String
- Description: Name of environment to delete
--app, -a
- Type: String
- Default: Current app context
- Description: Flash app name
Delete Environment:
flash env delete stagingOutput:
Environment: staging
App: my-app
Endpoints: 3
This will permanently delete:
- staging environment configuration
- All 3 endpoints in this environment
- All endpoint data and metrics
This action cannot be undone.
Continue? [y/N]: y
Deleting endpoints...
my-api-gpu ✓
my-api-worker ✓
batch-processor ✓
Removing environment configuration... ✓
Environment 'staging' deleted successfully.
Delete in Specific App:
flash env delete production --app old-appOn Runpod:
- All serverless endpoints in environment
- Endpoint configurations and autoscaling settings
- Running worker instances
- Endpoint metrics (after retention period)
Locally:
- Environment configuration
- All endpoint tracking files for this environment
Not Deleted:
- Source code
- Build artifacts
- Other environments
- Flash app (unless this was the last environment)
Confirmation Required: Shows endpoint count and asks for explicit confirmation before deletion.
Production Protection: Deleting production is risky. Consider:
# Safer: Undeploy endpoints individually first
flash undeploy --interactive
# Then delete empty environment
flash env delete productionNo Rollback: Deletion is permanent. Must redeploy to restore:
# After accidental deletion
flash env create production
flash deploy --env productionEnvironment Not Found:
Problem:
Error: Environment 'staging' not found
Solution:
# List available environments
flash env list
# Check spelling and app context
flash env list --app my-appEndpoints Still Active:
Problem:
Warning: Environment has 3 active endpoints with running requests
Continue anyway? [y/N]:
Solutions:
# Wait for requests to complete
# Check Runpod console
# Or confirm to force deletion (terminates requests)
yflash env create- Create environmentflash undeploy- Delete individual endpointsflash deploy- Redeploy after deletion
Manage Flash applications. Apps provide namespace isolation for organizing multiple projects, teams, or deployment groups.
flash app list- Show all appsflash app create- Create new appflash app get- Show app detailsflash app delete- Delete app and all resources
See individual subcommand sections for detailed documentation.
List all Flash applications under your Runpod account.
flash app listflash app listOutput:
Flash Apps:
┌────────────────────┬─────────────────┬───────────────┬────────────────┐
│ Name │ Environments │ Endpoints │ Status │
├────────────────────┼─────────────────┼───────────────┼────────────────┤
│ my-api │ 3 │ 9 │ Active │
│ batch-processing │ 2 │ 4 │ Active │
│ ml-inference │ 1 │ 2 │ Idle │
│ legacy-app │ 0 │ 0 │ Empty │
└────────────────────┴─────────────────┴───────────────┴────────────────┘
Total: 4 apps, 6 environments, 15 endpoints
flash app create- Create new appflash app get- View app details
Create a new Flash application namespace.
flash app create APP_NAMEAPP_NAME (required)
- Type: String
- Description: Name for the new Flash app
Create App:
flash app create my-new-appOutput:
Creating Flash app 'my-new-app'...
✓ App created successfully
Next steps:
1. Create an environment:
flash env create dev --app my-new-app
2. Deploy your application:
flash deploy --app my-new-app --env dev
Organize by Project:
flash app create api-v1
flash app create api-v2
flash app create mobile-backendTeam Isolation:
flash app create team-alpha
flash app create team-betaClient Separation:
flash app create client-acme
flash app create client-globexflash env create- Create environment in appflash deploy- Deploy to appflash app list- List apps
Get detailed information about a Flash application.
flash app get APP_NAMEAPP_NAME (required)
- Type: String
- Description: Name of app to inspect
flash app get my-appOutput:
Flash App: my-app
Status: Active
Created: 2024-01-10 09:00:00
Environments (3):
┌────────────────┬───────────────┬────────────────┐
│ Name │ Endpoints │ Status │
├────────────────┼───────────────┼────────────────┤
│ dev │ 3 │ Active │
│ staging │ 2 │ Active │
│ production │ 4 │ Active │
└────────────────┴───────────────┴────────────────┘
Total Endpoints: 9
Active Workers: 12
Resource Usage:
GPU: 8 workers (A100, RTX_4090)
CPU: 4 workers
Recent Activity:
2024-01-20 14:15 - Deployed to production
2024-01-19 10:00 - Created staging environment
2024-01-15 16:30 - Updated dev deployment
flash env get- Environment detailsflash app list- List all apps
Delete a Flash app and all associated environments and endpoints.
flash app delete [OPTIONS]--app, -a (required)
- Type: String
- Description: Flash app name to delete
Delete App:
flash app delete --app my-old-appOutput:
Flash App: my-old-app
Environments: 2
Total Endpoints: 5
This will permanently delete:
- Flash app 'my-old-app'
- 2 environments (dev, staging)
- All 5 endpoints
- All configurations and data
This action cannot be undone.
Type app name to confirm: my-old-app
Deleting endpoints...
dev (3 endpoints) ✓
staging (2 endpoints) ✓
Deleting environments...
dev ✓
staging ✓
Deleting app configuration... ✓
Flash app 'my-old-app' deleted successfully.
Confirmation Required: Must type exact app name to confirm deletion.
Complete Deletion: Removes everything:
- All environments
- All endpoints
- All tracking data
- App configuration
No Rollback: Cannot undo. Must recreate and redeploy:
flash app create my-app
flash env create production --app my-app
flash deploy --app my-app --env productionflash env delete- Delete individual environmentflash undeploy- Delete individual endpoints
- Getting Started Guide - First Flash project tutorial
- Workflows Guide - Common development workflows
- Troubleshooting Guide - Solutions to common problems
- CLI Reference - Quick reference for all commands