# Lambda Adapter

**Interface:** REST API only (no public CLI). **Kind:** premium on-demand instances. **No egress fees.**

## Auth

API key from https://cloud.lambdalabs.com/api-keys → export `LAMBDA_API_KEY`.

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

## Provision

```bash
# 1. list instance types (exact ids + specs + region availability)
curl -s https://api.lambdalabs.com/v1/instance-types -H "Authorization: Bearer $LAMBDA_API_KEY" \
  | jq -r '.data | to_entries[] | .key as $t | .value.regions_with_capacity_available[] | "\($t) \(.name)"'

# 2. create (ssh key must exist in the account first)
curl -s -X POST https://api.lambdalabs.com/v1/instances \
  -H "Authorization: Bearer $LAMBDA_API_KEY" -H "Content-Type: application/json" \
  -d '{"instance_type_name":"gpu_1x_h100_sxm","region_name":"us-east-1","ssh_key_names":["my-key"]}'

# 3. poll until active
curl -s https://api.lambdalabs.com/v1/instances -H "Authorization: Bearer $LAMBDA_API_KEY" \
  | jq '.data[] | {id, instance_type: .instance_type.name, status, ip, ssh_port}'
```

Instance type ids: `gpu_1x_a6000`, `gpu_1x_a10`, `gpu_1x_a100_sxm4`,
`gpu_1x_h100_pcie`, `gpu_1x_h100_sxm`, `gpu_1x_h200`, `gpu_1x_b200`,
`gpu_1x_gh200` etc. (`gpu_<count>x_<type>`).

## Destroy

```bash
curl -s -X DELETE https://api.lambdalabs.com/v1/instances/<id> -H "Authorization: Bearer $LAMBDA_API_KEY"
```

## Gotchas

- **Multi-GPU HGX is commitment-only** (2 weeks+; see pricing doc). Single-GPU
  on-demand is the agent lane.
- No spot. No reclaim. If it's up, it's yours — and you pay until you destroy.
- SSH key must be registered in the Lambda account (console or `POST /v1/ssh-keys`) before instance creation.
- Billing is hourly per instance, prorated; no egress fees — the cheapest lane
  for moving big video assets around.

## Reference

- API docs: https://docs.lambdalabs.com/api (instances, instance-types, ssh-keys)
- Pricing snapshot: docs/pricing/lambda.md
