Skip to content

ElefantOne/runpod-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RunPod Client

Minimal PSR-compliant PHP 8.3 CLI project for managing RunPod pods through the official REST and GraphQL APIs.

Features

  • List pods with optional filters.
  • Create pods from a JSON payload or CLI options.
  • Delete pods by ID.
  • List available GPU types from the GraphQL API.
  • No framework dependency required to run the CLI.

Requirements

  • PHP 8.3
  • ext-curl
  • ext-json
  • A RunPod API key in RUNPOD_API_KEY

The current docs used for this project are:

Project layout

bin/                    CLI entrypoint
examples/               Example API payloads
src/                    PSR-4 application code
autoload.php            Fallback autoloader for local execution without Composer install
composer.json           Package metadata and PHP 8.3 requirement
phpcs.xml.dist          PSR-12 coding standard config

Setup

cp .env.example .env
export RUNPOD_API_KEY=your-api-key
chmod +x bin/runpod-client

If you are using Composer with PHP 8.3 or newer:

composer install

Usage

Show help:

bin/runpod-client help

List pods:

bin/runpod-client pods:list
bin/runpod-client pods:list --status=RUNNING --compute-type=GPU
bin/runpod-client pods:list --json

Create a pod from the included A5000 example payload:

bin/runpod-client pods:create --payload=examples/create-a5000-pod.json

Create a pod directly from CLI flags:

bin/runpod-client pods:create \
  --name=a5000-pod \
  --gpu-type-id="NVIDIA RTX A5000" \
  --image=runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04 \
  --gpu-count=1 \
  --ports=8888/http,22/tcp \
  --env=JUPYTER_PASSWORD=change-me

Delete a pod:

bin/runpod-client pods:delete --id=<pod-id>

List GPU types:

bin/runpod-client gpus:list
bin/runpod-client gpus:list --id="NVIDIA RTX A5000"
bin/runpod-client gpus:list --id="NVIDIA RTX A5000" --availability --secure-cloud=true --gpu-count=1

Notes

  • examples/create-a5000-pod.json mirrors the documented RunPod REST payload for an A5000 pod.
  • Pod deletion uses DELETE /v1/pods/{podId} and returns success on HTTP 204.
  • GPU types are read from the documented GraphQL gpuTypes query so the CLI stays aligned with RunPod's exposed GPU IDs.
  • The local environment in this repository currently has PHP 8.3.6, which matches the minimum supported runtime.

License

MIT. See LICENSE.

About

A simple PHP client for Runpod service with minimal functionality

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages