# RunPod Adapter

**Interface:** `runpodctl` CLI + REST API. **Kind:** managed instances (pods).

## Install & auth

```bash
curl -sSL https://github.com/runpod/runpodctl/releases/latest/download/runpodctl-linux-amd64 -o /usr/local/bin/runpodctl && chmod +x /usr/local/bin/runpodctl
runpodctl config --apiKey $RUNPOD_API_KEY    # key: runpod.io → Settings → API Keys
runpodctl get pods --output json             # verify
```

## Provision (API flow — richer than the CLI)

```bash
# 1. find a template (comfyui is usually preloaded)
curl -s https://api.runpod.io/v2/templates -H "Authorization: Bearer $RUNPOD_API_KEY" | jq '.[] | {id, name}'

# 2. create the pod
curl -s -X POST https://api.runpod.io/v2/pods \
  -H "Authorization: Bearer $RUNPOD_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "vf-h3",
    "gpuTypeId": "NVIDIA GeForce RTX 5090",
    "templateId": "<template_id>",
    "cloudType": "COMMUNITY",          # or SECURE
    "containerDiskInGb": 20,
    "volumeInGb": 50,
    "startSsh": true
  }'

# 3. poll until RUNNING (minutes; image pull + boot)
curl -s https://api.runpod.io/v2/pods -H "Authorization: Bearer $RUNPOD_API_KEY" \
  | jq '.[] | select(.name=="vf-h3") | {id, desiredStatus, runtime}'
```

`runtime` in the pod JSON carries the SSH host/port and (if the template
exposes it) the HTTP endpoint. Record both.

## GPU type ids (exact strings)

`NVIDIA GeForce RTX 5090`, `NVIDIA GeForce RTX 4090`, `NVIDIA GeForce RTX 3090`,
`NVIDIA L40S`, `NVIDIA H100 80GB SXM`, `NVIDIA H100 80GB PCIe`,
`NVIDIA A100 80GB SXM`, `NVIDIA A100 40GB SXM`, `NVIDIA H200 141GB SXM`,
`NVIDIA RTX A6000`, `NVIDIA L4 24GB`.

## Destroy

```bash
runpodctl remove pod <pod_id>
# or: curl -s -X DELETE https://api.runpod.io/v2/pods/<pod_id> -H "Authorization: Bearer $RUNPOD_API_KEY"
```

## Gotchas

- **Community vs Secure:** community is ~1.5–2x cheaper, but instances can be
  preempted and there's no SLA. Secure guarantees the pod.
- **Templates save the install:** a comfyui template arrives with ComfyUI +
  common custom nodes preinstalled. Always prefer a template over a bare image
  for video work.
- Pod billing starts at container creation, not RUNNING — a pod stuck pulling
  the image still costs. Watch for image-pull hangs.
- Volumes persist across pod restarts (good for weights); container disk does
  not (weights on container disk die with the pod).

## Reference

- API docs: https://docs.runpod.io/reference (pods, templates, gpu-types endpoints)
- GPU types list: `GET /v2/gpuhub` (or the pricing page snapshot in docs/pricing/runpod.md)
