@@ -30,18 +30,37 @@ Welcome to the official Python library for Runpod API & SDK.
3030
3131## 💻 | Installation
3232
33+ ### Install from PyPI (Stable Release)
34+
3335``` bash
34- # Install the latest release version
36+ # Install with pip
3537pip install runpod
3638
37- # Using uv (faster alternative)
39+ # Install with uv (faster alternative)
3840uv add runpod
41+ ```
42+
43+ ### Install from GitHub (Latest Changes)
3944
40- # Install the latest development version (main branch)
45+ To get the latest changes that haven't been released to PyPI yet:
46+
47+ ``` bash
48+ # Install latest development version from main branch with pip
4149pip install git+https://github.com/runpod/runpod-python.git
4250
43- # Or with uv
51+ # Install with uv
4452uv add git+https://github.com/runpod/runpod-python.git
53+
54+ # Install a specific branch
55+ pip install git+https://github.com/runpod/runpod-python.git@branch-name
56+
57+ # Install a specific tag/release
58+ pip install git+https://github.com/runpod/runpod-python.git@v1.0.0
59+
60+ # Install in editable mode for development
61+ git clone https://github.com/runpod/runpod-python.git
62+ cd runpod-python
63+ pip install -e .
4564```
4665
4766* Python 3.8 or higher is required to use the latest version of this package.*
@@ -101,6 +120,8 @@ runpod.api_key = "your_runpod_api_key_found_under_settings"
101120
102121You can interact with Runpod endpoints via a ` run ` or ` run_sync ` method.
103122
123+ #### Basic Usage
124+
104125``` python
105126endpoint = runpod.Endpoint(" ENDPOINT_ID" )
106127
@@ -126,6 +147,77 @@ run_request = endpoint.run_sync(
126147print (run_request )
127148```
128149
150+ #### API Key Management
151+
152+ The SDK supports multiple ways to set API keys:
153+
154+ ** 1. Global API Key** (Default)
155+ ``` python
156+ import runpod
157+
158+ # Set global API key
159+ runpod.api_key = " your_runpod_api_key"
160+
161+ # All endpoints will use this key by default
162+ endpoint = runpod.Endpoint(" ENDPOINT_ID" )
163+ result = endpoint.run_sync({" input" : " data" })
164+ ```
165+
166+ ** 2. Endpoint-Specific API Key**
167+ ``` python
168+ # Create endpoint with its own API key
169+ endpoint = runpod.Endpoint(" ENDPOINT_ID" , api_key = " specific_api_key" )
170+
171+ # This endpoint will always use the provided API key
172+ result = endpoint.run_sync({" input" : " data" })
173+ ```
174+
175+ #### API Key Precedence
176+
177+ The SDK uses this precedence order (highest to lowest):
178+ 1 . Endpoint instance API key (if provided to ` Endpoint() ` )
179+ 2 . Global API key (set via ` runpod.api_key ` )
180+
181+ ``` python
182+ import runpod
183+
184+ # Example showing precedence
185+ runpod.api_key = " GLOBAL_KEY"
186+
187+ # This endpoint uses GLOBAL_KEY
188+ endpoint1 = runpod.Endpoint(" ENDPOINT_ID" )
189+
190+ # This endpoint uses ENDPOINT_KEY (overrides global)
191+ endpoint2 = runpod.Endpoint(" ENDPOINT_ID" , api_key = " ENDPOINT_KEY" )
192+
193+ # All requests from endpoint2 will use ENDPOINT_KEY
194+ result = endpoint2.run_sync({" input" : " data" })
195+ ```
196+
197+ #### Thread-Safe Operations
198+
199+ Each ` Endpoint ` instance maintains its own API key, making concurrent operations safe:
200+
201+ ``` python
202+ import threading
203+ import runpod
204+
205+ def process_request (api_key , endpoint_id , input_data ):
206+ # Each thread gets its own Endpoint instance
207+ endpoint = runpod.Endpoint(endpoint_id, api_key = api_key)
208+ return endpoint.run_sync(input_data)
209+
210+ # Safe concurrent usage with different API keys
211+ threads = []
212+ for customer in customers:
213+ t = threading.Thread(
214+ target = process_request,
215+ args = (customer[" api_key" ], customer[" endpoint_id" ], customer[" input" ])
216+ )
217+ threads.append(t)
218+ t.start()
219+ ```
220+
129221### GPU Cloud (Pods)
130222
131223``` python
0 commit comments