Skip to content
smartloop-labsPublic

About

gpushed: your own GPU shed. Spin up an NVIDIA GPU box on Google Cloud with one command

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

126 Commits

Folders and files

Repository files navigation

gpushed: your NVIDIA GPU, one box away

gpushed

macOS and Linux. Needs curl, jq and ssh. Windows isn't supported (WSL should work but isn't tested).

Your NVIDIA GPU, one box away, from macOS or Linux. Sign in with your email, add credit, and get an NVIDIA GPU box (Ubuntu 22.04 with the driver, CUDA, Python, Node.js and Rust ready) in a few minutes. There's no cloud account, quota request or Terraform to set up. You pay per second from a prepaid balance and delete the box when you're done.

Install. This also runs gpushed init, which checks for the tools gpushed uses and signs you in:

curl -fsSL gpushed.dev/install.sh | bash

Then:

gpushed topup        # add credit with Stripe (minimum $10)
gpushed up           # create your box (default: 1x L4 24 GB)
gpushed ssh          # connect; try nvidia-smi
gpushed cp data/ :   # copy a folder to the box (and :path back)
gpushed down         # delete it

gsh (gpu shed) is a short alias for gpushed: gsh up, gsh ssh, gsh down. The installer links it unless another gsh is installed. (Up to v0.4.0 the alias was gs, which is Ghostscript on most Linux systems; an existing gs link keeps working.)

Requirements

  • macOS (Intel or Apple silicon) or Linux
  • bash (macOS's built-in 3.2 is fine), curl, ssh and jq. macOS and most Linux distributions ship all but sometimes jq; if it's missing, gpushed init tells you how to install it (brew install jq, sudo apt-get install jq, ...)

The client is a bash script that talks to the gpushed API; there's nothing else to install and no cloud credentials on your machine.

Upgrading from v0.3.x, which ran the client in Apple's container runtime: gpushed init deletes the old client image. The runtime itself stays installed; remove it with Apple's uninstall-container.sh if nothing else uses it.

Plans and pricing

gpushed plans
Plan GPU Machine Price / hour (US)
t4 1x Tesla T4 16 GB, Spot n1-standard-8 $0.53
l4 (default) 1x L4 24 GB, Spot g2-standard-4 $0.54
a100 1x A100 40 GB, Spot a2-highgpu-1g $2.68
h100 (Spot only) 1x H100 80 GB, Spot a3-highgpu-1g $7.88
v6e (Spot only) 1x Google TPU v6e 32 GB, Spot ct6e-standard-1t $0.80
v6e-4 (Spot only) 4x Google TPU v6e 128 GB, Spot ct6e-standard-4t $3.09
v6e-8 (Spot only) 8x Google TPU v6e 256 GB, Spot ct6e-standard-8t $6.14
t4-ondemand 1x Tesla T4 16 GB n1-standard-8 $0.91
l4-ondemand 1x L4 24 GB g2-standard-4 $0.88
a100-ondemand 1x A100 40 GB a2-highgpu-1g $4.44
rtx6000 (coming soon) 1x RTX PRO 6000 96 GB, Spot g4-standard-48 $2.12
rtx6000-ondemand (coming soon) 1x RTX PRO 6000 96 GB g4-standard-48 $5.43

Spot by default. t4, l4, a100, and h100 and the v6e plans (which GCP sells us only as Spot) run as GCP Spot VMs: 40-45% cheaper, but Google may reclaim one at any time, with 30 seconds' notice. The box is then stopped with its disk kept (whatever was running ends), you get an email, and gpushed start (or gpushed ssh) resumes it once a GPU is free in its zone, which can take a while when GPUs are scarce. Save your work and checkpoints often. For work that mustn't be interrupted, use the on-demand plan of the same GPU: gpushed up l4-ondemand. (l4-spot and the like, the Spot plans' names in v0.3.14, still work.)

TPU plans. v6e, v6e-4 and v6e-8 are Google TPU v6e (Trillium) boxes, not NVIDIA GPUs: there's no CUDA. They boot Canonical's Ubuntu 22.04 TPU image with Python 3.11, Node.js and Rust; the TPU runtime comes with your framework: pip install "jax[tpu]", PyTorch/XLA (torch_xla[tpu]) or vLLM's TPU build. One v6e chip (32 GB HBM, 918 bf16 TFLOPS) is priced well under a Spot A100. A new TPU box takes longer to get ready than a GPU box (it installs the dev tools on first boot). The idle watcher sees a TPU as busy while a program holds it open.

If a reclaimed box can't tell gpushed in time, the provisioner's check of all box VMs (every 15 minutes while Spot boxes run) finds it, and from then on only its disk is billed.

Prices are GCP's cost (on-demand or Spot, as the plan is) of the machine, its 100 GB SSD and IP, plus 20%. A box is billed per second from when it's created until it's deleted. A stopped box costs only its disk (about $0.03/hour), and is deleted after 6 hours stopped (STOPPED_MAX_HOURS), so copy off anything you want to keep.

Regions. Boxes run in us-central1 (Iowa), us-east1 (South Carolina), us-west1 (Oregon), europe-west4 (Netherlands), asia-southeast1 (Singapore) and asia-east1 (Taiwan); each GPU is offered where we have quota for it (H100: Iowa, Netherlands, Singapore and Taiwan; TPU v6e: everywhere but Taiwan, cheapest in Singapore and the US; RTX PRO 6000: not yet, pending GPU quota and a newer driver in the box image). A new box goes to a region with GPUs to spare, nearest you first (from Cloudflare's estimate of where your request comes from), and only then to one that looks full. It's billed at the price of the region it lands in. Europe is about 3-5% above the US and Singapore 9-23%; gpushed plans shows the prices for your region, gpushed plans --region asia-southeast1 for another, and gpushed up l4 --region europe-west4 picks the region yourself.

Balance. Credit is prepaid: the minimum top-up is $10, and you can top up any amount above that at any time with gpushed topup 25. To create or start a box you need at least one hour of its price in your balance.

Running out. When your balance falls below $2 you get an email. When it's nearly used up, your box is stopped (its disk is kept) and you get another email. Top up and run gpushed start to carry on. A box that stays stopped for 6 hours is deleted, credit or not.

Commands

Command What it does
gpushed init Check for curl, jq and ssh, then sign in
gpushed login Sign in with your smartloop account in the browser (--email [address]: with an emailed code instead)
gpushed logout Sign out on this computer
gpushed balance Show your balance
gpushed topup [usd] Add credit (opens Stripe Checkout; minimum $10). Without an amount, pick $10, $25, $50 or $100
gpushed history Recent charges and top-ups
gpushed plans GPUs available and their prices
gpushed up [plan] Create your box and watch it install the driver + CUDA
gpushed status Show your box
gpushed ssh [cmd] SSH into the box, or run a command on it. Starts a stopped box first, or creates one (default plan) if you have none. Forwards your SSH agent, so git clone/git pull over SSH on the box use the keys on your computer (load one with ssh-add); GitHub's host key is already trusted there
gpushed cp SRC... DEST Copy files between this computer and the box with rsync, straight over SSH. Box paths start with : (a bare : is your home dir there): gpushed cp data.csv :, gpushed cp :work/out ./. Starts a stopped box first. Resumes partial transfers, skips unchanged files, and passes rsync options through (--exclude=..., --delete). As with rsync, dir copies the folder and dir/ its contents
gpushed stop / start Pause and resume (disk kept)
gpushed down Delete the box and its disk
gpushed update Upgrade to the latest release
gpushed uninstall Remove gpushed from this computer

Your API token and the box's SSH key are in ~/.gpushed/state. To SSH from outside gpushed: ssh -i ~/.gpushed/state/box_ssh_key boxuser@<ip> (the IP is in gpushed status; it changes after a stop/start).

What you get

  • An Ubuntu 22.04 VM with the NVIDIA server driver and CUDA Toolkit 12.6
  • The everyday toolchain, preinstalled: Python 3.11 (python, pip, uv; the system python3 stays 3.10), Node.js 24 LTS with npm, Rust stable (rustup, cargo), and build-essential, git, cmake, tmux, htop and jq. You have root to add anything else
  • A Starship prompt in its default style, in Omarchy's Osaka Jade colors, with the box's GPU (~/project on  main [?] on ☁️ L4, then ❯), and a GPU Shed login banner. The branch symbol needs a Powerline or Nerd Font in your terminal; the rest is plain text. Use your own ~/.config/starship.toml, or set GPUSHED_NO_STARSHIP=1 for the plain bash prompt. Hack Nerd Font is installed on the box too
  • A 100 GB SSD and a public IP; only SSH (port 22) is open
  • Boxes boot from a prebuilt image with all of that baked in, so a new box is ready a minute or two after Google Cloud starts it. (If the image is ever unavailable, the box installs everything on first boot instead, which takes 10–15 minutes; gpushed up streams the progress.) If nvidia-smi can't talk to the driver, sudo reboot once.

Boxes run in smartloop's GCP project. They have no Google credentials and can't reach each other.


How it works

 Mac/Linux ─ gpushed ─► gpushed-cli (bash + curl + jq + ssh; no cloud keys)
                        │ API token (per user)
                        ▼
              gpushed API  (Cloudflare Worker + D1)
              at api.gpushed.dev     · smartloop accounts · balances
              Stripe · metering cron (every 5 min)
                        │ queues the run in D1, starts an execution
                        │ (run.invoker only, no arguments)
                        ▼
              Cloud Run job: gpushed-provisioner
              provisioner image (Terraform + gcloud) from Artifact Registry;
              claims the queued run from the API, runs as the provisioner
              service account, R2 keys + API secret from Secret Manager
                        │ terraform (state in R2)
                        ▼
              GCE GPU VM in smartloop's GCP project
Path What it is
gpushed, install.sh The gpushed command (checks dependencies, runs the CLI) and installer
client/ The CLI (gpushed-cli): bash, compatible with macOS's bash 3.2
api/ Cloudflare Worker: smartloop sign-in, billing, Stripe webhook, metering, dispatch
provisioner/ Provisioner image, entrypoint and the box's Terraform
infra/bootstrap/ One-time GCP setup: network, service accounts, the provisioner Cloud Run job, Workload Identity
.github/workflows/ release.yml, ci.yml (tests + API deploy), provision.yml (the old provisioner, until the switch to Cloud Run)

Why the keys aren't in the client. The client runs on users' machines, so anything inside it can be read by them. A cloud key there would let anyone create VMs in our project without paying. Instead, the client holds only a per-user API token; the API checks the balance before it asks the provisioner (which has the cloud access) to provision anything, and metering runs on the server.

Why the API can only start the provisioner. The API's GCP key (GCP_DISPATCH_KEY) may run the gpushed-provisioner job and nothing else, and not with arguments or environment overrides. What to do is queued in D1 (provision_jobs); the execution claims it from POST /internal/jobs/claim with the provisioner secret, taking the oldest run whose box has none going, so runs of one box happen in order. A leaked key starts executions that find nothing to do.

Accounts. gpushed users are smartloop accounts. gpushed login signs in in the browser: the CLI starts a sign-in (POST /auth/cli/start) and opens app.smartloop.ai/gpushed/cli-login?code=XXXX-XXXX; you sign in there if needed and approve the code shown in the terminal (POST /auth/cli/approve, with your smartloop session), and the CLI, polling POST /auth/cli/poll with its secret device code, gets a long-lived gpushed token. Sign-ins expire after 10 minutes. gpushed login --email instead asks smartloop's API (/v1/auth/otp/request and /verify) for an emailed code and trades the smartloop access token for a gpushed token (POST /auth/smartloop, checked with smartloop's /v1/users/me). The gpushed user id is the smartloop user id.

Web app. The smartloop web app can call the same API from the browser with the user's smartloop access token (Authorization: Bearer <token>), from the origins in APP_ORIGINS. Useful routes for a usage page: GET /me (balance and box), GET /usage?days=30 (spend and top-ups per day), GET /ledger?kind=topup (recent top-ups), GET /plans, and POST /topup (returns a Stripe checkout URL; pass return_url on the web app to come back to it with ?topup=done or ?topup=cancelled).

Billing. Money is stored in micro-dollars in D1. Every change is a ledger row with a unique ref, so Stripe webhooks and metering runs are idempotent. A box is billed from the moment Terraform reports it created, at the plan's price while running and the disk price while stopped.

Operating it

One-time setup

  1. Cloudflare R2: create two buckets:

    npx wrangler r2 bucket create gpushed-releases   # public, served at dl.gpushed.dev
    npx wrangler r2 bucket create gpushed-state      # private, Terraform state
    npx wrangler r2 bucket domain add gpushed-releases --domain dl.gpushed.dev --zone-id <zone>

    Create two R2 API tokens: one with write access to gpushed-releases (release workflow), one with read/write on gpushed-state (the provisioner and the bootstrap). Optional: a lifecycle rule to expire old releases' images after 30 days.

  2. API (Cloudflare Worker + D1):

    cd api && npm ci
    npx wrangler d1 create gpushed          # put the id in wrangler.toml
    npx wrangler d1 migrations apply gpushed --remote
    npx wrangler secret put STRIPE_SECRET_KEY
    npx wrangler secret put STRIPE_WEBHOOK_SECRET   # endpoint: https://api.gpushed.dev/stripe/webhook,
                                                    # events: checkout.session.completed, checkout.session.async_payment_succeeded
    npx wrangler secret put RESEND_API_KEY          # low-balance emails
    npx wrangler secret put PROVISIONER_SECRET      # random; same value as the GitHub secret below
    # GCP_DISPATCH_KEY comes after step 4
    npx wrangler deploy

    The Worker is served at api.gpushed.dev and, for CLIs installed before the move, gpushed-api.smartloop.ai: Worker custom domains (Cloudflare creates their DNS records and certificates on deploy), so the gpushed.dev and smartloop.ai zones must be in the same Cloudflare account. Downloads are likewise on both dl.gpushed.dev and dl.gpushed.smartloop.ai. Pricing knobs (PREMIUM_PCT, MIN_TOPUP_USD, LOW_BALANCE_USD, STOPPED_MAX_HOURS, and REGIONS to limit regions) are in api/wrangler.toml. Regions are listed in api/src/regions.ts (and their subnets in infra/bootstrap); GCP list prices per plan and region are generated into api/src/regions.generated.ts by node api/scripts/gcp-prices.mjs <project>, and the zones offering each plan into api/src/zones.generated.ts by node api/scripts/gcp-zones.mjs <project> (rerun both when adding a region or plan).

  3. GitHub (the repository is private): add these as repository Actions secrets and variables (Settings > Secrets and variables > Actions). The workflows that use them run only from main or a v* tag.

    Kind Name Value
    variable GCP_PROJECT, GCP_SERVICE_ACCOUNT, GCP_IMAGE_SERVICE_ACCOUNT, GCP_RELEASE_SERVICE_ACCOUNT, GCP_WORKLOAD_IDENTITY_PROVIDER, GCP_PROVISIONER_IMAGE, CLOUD_RUN_JOB set by step 4
    variable GPUSHED_API https://api.gpushed.dev
    variable GPUSHED_DL https://dl.gpushed.dev
    variable R2_ENDPOINT https://<account-id>.r2.cloudflarestorage.com
    variable R2_STATE_BUCKET / R2_RELEASE_BUCKET gpushed-state / gpushed-releases
    variable CLOUDFLARE_ACCOUNT_ID your account ID
    secret PROVISIONER_SECRET same as the Worker's (step 4 copies it into Secret Manager)
    secret R2_STATE_ACCESS_KEY_ID, R2_STATE_SECRET_ACCESS_KEY state bucket token
    secret R2_RELEASE_ACCESS_KEY_ID, R2_RELEASE_SECRET_ACCESS_KEY release bucket token
    secret CLOUDFLARE_API_TOKEN Workers + D1 edit, for API deploys
    secret GCP_BOOTSTRAP_KEY for step 4 only; delete afterwards
    secret GH_ADMIN_TOKEN optional, for step 4: fine-grained PAT that can write this repo's Actions variables

    Boxes are provisioned on Cloud Run, so their logs are in Cloud Logging. The website is served by a Cloudflare Worker (infra/site) at gpushed.dev; nothing users need comes from GitHub.

  4. GCP (in our project; needs GPU quota in each region): run Actions > Bootstrap GCP with plan, check it, then run it with apply. It runs infra/bootstrap with Terraform state in gpushed-state/bootstrap/terraform.tfstate, and stores its outputs as repository variables (with GH_ADMIN_TOKEN; otherwise copy them from the run summary). It also creates the gpushed-provisioner Cloud Run job (in us-central1), its Artifact Registry repo, and Secret Manager copies of PROVISIONER_SECRET and the R2 state keys; re-run it after changing any of those.

  5. Provisioner on Cloud Run:

    # The job runs a placeholder image until a release pushes the real one:
    git tag v0.x.y && git push origin v0.x.y      # see Releasing
    # The API's key, which may only start the job:
    gcloud iam service-accounts keys create key.json \
      --iam-account gpushed-dispatcher@<project>.iam.gserviceaccount.com
    (cd api && npx wrangler secret put GCP_DISPATCH_KEY < ../key.json) && rm key.json

    Then in api/wrangler.toml set CLOUD_RUN_JOB to the bootstrap's CLOUD_RUN_JOB output and PROVISIONER = "cloudrun", and deploy. To check it by hand, run gcloud run jobs execute gpushed-provisioner --region us-central1: with nothing queued it logs "nothing to do" and exits. Until the switch, PROVISIONER = "github" keeps using provision.yml (with the Worker secret GITHUB_TOKEN); set it back to roll back. If your organization blocks service account keys, the API can't start the job this way; keep PROVISIONER = "github".

    GCP_BOOTSTRAP_KEY is a JSON key for a service account with roles/owner on the project:

    gcloud iam service-accounts create gpushed-bootstrap --project <project>
    gcloud projects add-iam-policy-binding <project> \
      --member serviceAccount:gpushed-bootstrap@<project>.iam.gserviceaccount.com --role roles/owner
    gcloud iam service-accounts keys create key.json \
      --iam-account gpushed-bootstrap@<project>.iam.gserviceaccount.com
    gh secret set GCP_BOOTSTRAP_KEY --env production < key.json && rm key.json

    Afterwards delete the key (or the whole account); boxes are provisioned through Workload Identity and never use it. Re-run the workflow (with a new key) only to change the bootstrap, e.g. after renaming the repo. If your organization blocks service account keys (iam.disableServiceAccountKeyCreation), run infra/bootstrap by hand instead; the commands are at the top of its main.tf.

Releasing

git tag v0.2.0 && git push origin v0.2.0

The release workflow builds the CLI package and the provisioner image (linux/amd64), uploads them to R2 under v0.2.0/, then moves latest. It also pushes the provisioner image to Artifact Registry and points the gpushed-provisioner Cloud Run job at it, so new box runs use it at once.

Local development

cd api && npm ci
npx wrangler d1 migrations apply gpushed --local --env dev
npx wrangler dev --env dev --test-scheduled --ip 0.0.0.0   # emails and dispatches are logged, not sent
# Sign-in goes to SMARTLOOP_API in wrangler.toml [env.dev] (a local smartloop
# API on :8788, or set it to https://api.smartloop.ai to use real accounts).
npm test

# In another terminal, from a checkout:
GPUSHED_API=http://localhost:8787 GPUSHED_SMARTLOOP_API=http://localhost:8788 \
  ./gpushed login --email you@example.com

curl localhost:8787/__scheduled runs the metering cron once.

License

gpushed is source-available under the Business Source License 1.1 (BUSL-1.1).

  • You may read, modify, self-host and use it in production, including inside your company.
  • You may not offer it to third parties as a hosted or embedded commercial product that competes with Smartloop's paid offerings.
  • Each version converts to the Apache License 2.0 four years after it is published.

For a commercial license or questions, contact hello@smartloop.ai.

Versions released before November 27, 2026 remain available under the Apache License 2.0 to anyone who received them under it.

About

gpushed: your own GPU shed. Spin up an NVIDIA GPU box on Google Cloud with one command

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages