@gpu-agent/pods (0.1.0)
Installation
@gpu-agent:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/npm install @gpu-agent/pods@0.1.0"@gpu-agent/pods": "0.1.0"About this package
@gpu-agent/pods
The typed client of the pod manager (donny/gpu-agent apps/pod-manager, docs/DESIGN.md §11): zod
schemas of every route of §11.5 and a small fetch client. The ImageLab and Map Maker servers import it
to proxy /pods/* (ImageLab, super-admin) and /api/pods/* (Map Maker, admins) to the one shared
service on .10. Depends on zod only; runs under Bun and Node.
# .npmrc of the consuming repo
@gpu-agent:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/
//gitea.dev.blueoceanswim.com/api/packages/donny/npm/:_authToken=${GITEA_NPM_TOKEN}
bun add @gpu-agent/pods@<version>
Use
import { PodManagerClient, PodManagerError } from "@gpu-agent/pods";
const pods = new PodManagerClient({ baseUrl: process.env.POD_MANAGER_URL!, token: process.env.POD_MANAGER_TOKEN! });
const catalog = await pods.catalog(); // allowed DCs only, 60 s cache; { fresh: "1" } re-reads
try {
const pod = await pods.startPod(
{
candidates: [{ gpuTypeId: "NVIDIA GeForce RTX 4090", dataCenterIds: ["US-CA-2", "US-IL-1"] }],
links: ["lab"],
modelPacks: ["image"],
maxHours: 8,
startedBy: { user: session.user.email },
},
{ idempotencyKey: req.header("Idempotency-Key") }, // pass the browser's key through
);
} catch (e) {
if (e instanceof PodManagerError && e.code === "limit_reached") { /* e.details: { limit, value, current } */ }
if (e instanceof PodManagerError && e.code === "no_capacity") { /* e.details: { tried: [...] } */ }
}
const { pods: mine, others } = await pods.listPods({ all: true });
await pods.stopPod(id); await pods.resumePod(id); await pods.terminatePod(id);
await pods.extendPod(id, { maxHours: 12 });
await pods.totals({ bucket: "day" });
await pods.settings(); await pods.patchSettings({ limits: { dailyUsd: { action: "turnOff" } }, changedBy: { user } });
await pods.settingsAudit(50);
await pods.limits(); // the warning banner: { limits: [...], blocked }
// One SSE stream per app server; relay pod.changed / catalog.changed into the browser realtime.
await pods.events((event) => { if (event.type === "pod.changed") broadcast(event.pod); }, abort.signal);
Every 4xx/5xx is a PodManagerError { status, code, message, details } with the manager's error
code (unauthorized, forbidden, not_found, limit_reached, no_capacity,
data_center_not_allowed, placed_outside_allow_list, runpod_error, app_unreachable, ...).
Release
Bump version here, commit to main, then git tag pods-v<version> && git push origin pods-v<version>
(.gitea/workflows/publish.yml).
Dependencies
Dependencies
| ID | Version |
|---|---|
| zod | ^4.6.7 |