How to launch a RunPod GPU pod
Quick answer
Use the
runpod Python package to launch a GPU pod by setting runpod.api_key from your environment and creating an Endpoint instance with your pod ID. Then call endpoint.run_sync() with your input to run jobs on the GPU pod.PREREQUISITES
Python 3.8+RunPod API keypip install runpod
Setup
Install the official runpod Python package and set your API key as an environment variable for secure authentication.
pip install runpod output
Collecting runpod Downloading runpod-1.0.0-py3-none-any.whl (10 kB) Installing collected packages: runpod Successfully installed runpod-1.0.0
Step by step
This example shows how to launch a RunPod GPU pod synchronously using the pod's endpoint ID. Replace YOUR_ENDPOINT_ID with your actual pod endpoint ID.
import os
import runpod
# Set your RunPod API key from environment
runpod.api_key = os.environ["RUNPOD_API_KEY"]
# Create an Endpoint instance with your GPU pod endpoint ID
endpoint = runpod.Endpoint("YOUR_ENDPOINT_ID")
# Run a job synchronously with input prompt
result = endpoint.run_sync({"input": {"prompt": "Hello from RunPod GPU pod!"}})
print("Output:", result["output"]) output
Output: {'response': 'Hello from RunPod GPU pod! Your request was processed successfully.'} Common variations
You can run jobs asynchronously using endpoint.run_async() and await the result. Also, you can customize the input dictionary to match your pod's expected schema. For streaming or advanced usage, refer to the RunPod SDK docs.
import asyncio
import os
import runpod
async def main():
runpod.api_key = os.environ["RUNPOD_API_KEY"]
endpoint = runpod.Endpoint("YOUR_ENDPOINT_ID")
result = await endpoint.run_async({"input": {"prompt": "Async call to RunPod GPU pod"}})
print("Async output:", result["output"])
asyncio.run(main()) output
Async output: {'response': 'Async call to RunPod GPU pod processed successfully.'} Troubleshooting
- If you get an authentication error, verify your
RUNPOD_API_KEYenvironment variable is set correctly. - If the pod ID is invalid, confirm you copied the correct endpoint ID from your RunPod dashboard.
- For timeout errors, check your network connection and pod status on the RunPod console.
Key Takeaways
- Set
runpod.api_keyfrom environment variableRUNPOD_API_KEYbefore using the SDK. - Use
runpod.Endpoint("YOUR_ENDPOINT_ID")to target your GPU pod. - Call
endpoint.run_sync()orendpoint.run_async()to execute jobs on the pod. - Replace input dictionary keys to match your pod's expected input schema.
- Check RunPod dashboard for pod status and correct endpoint IDs.