The Runpod SDK lets you interact with Serverless endpoints programmatically from your own applications.
Python
Install
Create a virtual environment and install the SDK:
python3 -m venv venv
source venv/bin/activate
pip install runpod
python -m venv venv
venv\Scripts\activate
pip install runpod
To verify the installation:
python -c "import runpod; print(runpod.__version__)"
Set your API key as an environment variable and reference it in your code:
import runpod
import os
runpod.api_key = os.getenv("RUNPOD_API_KEY")
Never hardcode your API key directly in your code. Always use environment variables or a secrets manager.
For more information, see the Python SDK on GitHub.
JavaScript
The JavaScript SDK supports Node.js and modern JavaScript environments using ES modules.
Install
npm install --save runpod-sdk
# or
yarn add runpod-sdk
const { RUNPOD_API_KEY, ENDPOINT_ID } = process.env;
import runpodSdk from "runpod-sdk";
const runpod = runpodSdk(RUNPOD_API_KEY);
const endpoint = runpod.endpoint(ENDPOINT_ID);
For more information, see the JavaScript SDK on GitHub and the npm package.
Install
go get github.com/runpod/go-sdk
go mod tidy
package main
import (
"os"
"github.com/runpod/go-sdk/pkg/sdk/config"
rpEndpoint "github.com/runpod/go-sdk/pkg/sdk/endpoint"
)
func main() {
apiKey := os.Getenv("RUNPOD_API_KEY")
endpointId := os.Getenv("ENDPOINT_ID")
endpoint, err := rpEndpoint.New(
&config.Config{ApiKey: &apiKey},
&rpEndpoint.Option{EndpointId: &endpointId},
)
if err != nil {
panic(err)
}
// Use the endpoint...
}
For more information, see the Go SDK on GitHub and the Go package documentation.
Use the SDKs
For detailed examples of how to use the SDKs to interact with Serverless endpoints, see Send API requests.
Next steps
Once you’ve installed and configured the SDK, you’re ready to send requests to your Serverless endpoints: