# SaladCloud Adapter

**Interface:** REST API only. **Kind:** container groups on a distributed consumer-GPU fleet. **The aggressive economics lane.**

## Auth

API key from https://portal.salad.com → export `SALAD_API_KEY`, plus
`SALAD_ORG` (organization name) and `SALAD_PROJECT` (project name) — the API
is namespaced by org/project.

```bash
test -n "$SALAD_API_KEY"   # auth check
```

## Deploy (container group — there are no pods)

Salad runs Docker containers, not VMs. The pattern for H3 work:

```bash
# 1. check GPU class availability
curl -s https://api.salad.com/api/public/gpu-classes -H "Salad-Api-Key: $SALAD_API_KEY"

# 2. create a container group (single container, 1 GPU, public endpoint)
curl -s -X POST https://api.salad.com/api/public/organizations/$SALAD_ORG/projects/$SALAD_PROJECT/containers \
  -H "Salad-Api-Key: $SALAD_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "vf-h3-worker",
    "container_groups": [{
      "name": "vf-h3-worker",
      "container": {
        "image": "yourorg/h3-comfyui-worker:latest",
        "command": [],
        "environment": { "HF_TOKEN": "..." }
      },
      "resources": { "gpu_classes": ["rtx_5090"], "gpus": 1 }
    }],
    "restart_policy": "on_failure",
    "networking": { "auth": false }
  }'

# 3. poll the group's status/endpoint
curl -s https://api.salad.com/api/public/organizations/$SALAD_ORG/projects/$SALAD_PROJECT/containers/$NAME \
  -H "Salad-Api-Key: $SALAD_API_KEY"
```

GPU class ids are Salad-specific strings — list them via the gpu-classes
endpoint (or the docs) rather than assuming `rtx_5090`.

## Destroy

```bash
curl -s -X DELETE https://api.salad.com/api/public/organizations/$SALAD_ORG/projects/$SALAD_PROJECT/containers/$NAME \
  -H "Salad-Api-Key: $SALAD_API_KEY"
```

## Gotchas

- **Bring your own container**: you must Dockerize the worker (ComfyUI +
  weights in the image, or an onstart pull). Salad won't provision your runtime
  for you — the comfyui skill's image guidance applies, but the image must be
  pushed to a registry Salad can pull.
- **Availability varies** — the group can wait for hosts; batch pricing means
  retryable workloads only. One-shot "must finish tonight" jobs belong on Vast.
- Endpoints are public by default in the quickstart — set `"auth": true` for
  any production workload.
- The 2x price gap vs Vast is real but conditional on container startup being
  fast enough — if startup eats the savings, fall back to Vast (the gpu-ops
  keep-alive math decides).

## Reference

- Docs: https://docs.salad.com (container engine quickstart: docs.salad.com/container-engine/tutorials/quickstart-api)
- Pricing snapshot: docs/pricing/salad.md
