---
name: gpu-setup
description: >
  First-run setup for video-factory: detect provider CLIs, install the ones that
  are missing (after asking permission), authenticate each provider, and write
  the provider registry. Use when the user runs /gpu setup, or when gpu_setup
  reports missing or unauthenticated providers.
---

# GPU Cloud Setup

Goal: end with `gpu_setup` reporting every provider the user wants as `✓ authenticated`.

## Step 1 — Detect

Run `gpu_setup` (or `/gpu setup`). It checks for these CLIs on PATH:

| Provider   | CLI        | Install if missing (ask first)                                                                                            |
| ---------- | ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| RunPod     | runpodctl  | `curl -sSL https://github.com/runpod/runpodctl/releases/latest/download/runpodctl-linux-amd64 -o /usr/local/bin/runpodctl && chmod +x /usr/local/bin/runpodctl` |
| Vast.ai    | vastai     | `pip install -U vastai` (or their install script)                                                                        |
| Modal      | modal      | `pip install modal`                                                                                                      |
| Prime      | prime      | `pip install prime` — verify the current CLI name at docs.primeintellect.ai first                                        |
| Lambda     | (none)     | API-key only — get a key at https://cloud.lambdalabs.com/api-keys, export `LAMBDA_API_KEY`                               |

If the user has no preference, install RunPod + Vast first: together they cover
managed pods and the open marketplace, which is the cheapest 80% of cases.

## Step 2 — Authenticate

- **RunPod:** `runpodctl config --apiKey <RUNPOD_API_KEY>` (key from runpod.io → Settings → API Keys). Verify: `runpodctl get pods --output json`.
- **Vast.ai:** `vastai set api-key <VAST_API_KEY>` (key from vast.ai → Settings → API Keys). Verify: `vastai show instances`.
- **Modal:** `modal token new` (opens browser) or `modal token set --token-id ... --token-secret ...`. Verify: `modal profile current`.
- **Lambda:** export `LAMBDA_API_KEY` in the shell/environment that runs Pi. Verify: `curl -s https://api.lambdalabs.com/v1/instances -H "Authorization: Bearer $LAMBDA_API_KEY"`.
- **Prime:** `prime` CLI has its own login (check `prime --help` / their docs at deploy time).

Never print full API keys into the chat or logs — mask them.

## Step 3 — Record

Re-run `gpu_setup` so the registry (`<project>/.pi/gpu/providers.json`) reflects
reality. Then confirm with the user which providers they actually want to use —
an authenticated provider is also an authorization to spend money on it.
