From 318059a71da67e7b466c08a312eecc56a6fa5571 Mon Sep 17 00:00:00 2001 From: mehfuz Date: Mon, 16 Nov 2026 11:52:11 -0800 Subject: [PATCH] Drop the $100 minimum balance for premium plans Every plan, H100 included, now needs one hour of its price in the balance to create or start a box. gpushed plans drops the MIN BALANCE column and the premium tag; /plans no longer sends premium or min_balance_usd (v0.3.3 clients fall back to the hourly price). --- README.md | 3 +-- api/src/index.ts | 24 ++++++++---------------- api/src/pricing.ts | 15 --------------- api/test/pricing.test.ts | 12 +----------- client/gpushed-cli | 14 ++++++-------- 5 files changed, 16 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 21f25dd..f0971c5 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,7 @@ for your region, `gpushed plans --region asia-southeast1` for another, and **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. Premium plans, -those at $10/hour or more (`h100`), need $100. +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 diff --git a/api/src/index.ts b/api/src/index.ts index 0f6f639..da3a093 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -1,7 +1,7 @@ import { type Box, type User, credit, getBox, meterBox, runMetering, updateBox, welcomeOnFirstTopup } from "./billing"; import { type Env, numVar } from "./env"; import { type ProvisionAction, dispatchProvision } from "./external"; -import { DEFAULT_PLAN, PLANS, isPremium, planPrice, requiredBalanceMicros } from "./pricing"; +import { DEFAULT_PLAN, PLANS, planPrice } from "./pricing"; import { REGIONS, byDistance, enabledRegions, regionOfZone, requestLocation } from "./regions"; import { PLAN_ZONES } from "./zones.generated"; import { type CheckoutSession, createCheckoutSession, topupCents, verifyStripeSignature } from "./stripe"; @@ -290,8 +290,6 @@ route("GET", "/plans", async (req, env) => { machine_type: p.machineType, hourly_usd: usd(price.hourlyMicros), stopped_hourly_usd: usd(price.stoppedHourlyMicros), - premium: isPremium(price.hourlyMicros), - min_balance_usd: usd(requiredBalanceMicros(price.hourlyMicros)), // available: can be created now; unavailable: not offered yet (no GCP // quota); elsewhere: offered, but not in this region. status: !p.available || where.length === 0 ? "unavailable" : offered ? "available" : "elsewhere", @@ -402,11 +400,8 @@ route("POST", "/stripe/webhook", async (req, env) => { // ---------------------------------------------------------------- boxes -function balanceShortMessage(balanceMicros: number, planId: string, hourlyMicros: number, neededMicros: number): string { - const why = isPremium(hourlyMicros) - ? `the $${usd(neededMicros)} minimum for ${planId}, a premium plan ($${usd(hourlyMicros)}/h)` - : `one hour of ${planId} ($${usd(neededMicros)})`; - return `balance $${usd(balanceMicros)} is less than ${why}; run gpushed topup`; +function balanceShortMessage(balanceMicros: number, planId: string, hourlyMicros: number): string { + return `balance $${usd(balanceMicros)} is less than one hour of ${planId} ($${usd(hourlyMicros)}); run gpushed topup`; } route("POST", "/box", async (req, env) => { @@ -434,12 +429,10 @@ route("POST", "/box", async (req, env) => { } if (candidates.length === 0) throw new HttpError(503, `${plan.id} isn't available right now`); const premium = numVar(env.PREMIUM_PCT, 20); - // At least an hour at the price shown for the first region (what plans - // shows), or $100 for a premium plan. + // At least an hour at the price shown for the first region (what plans shows). const price = planPrice(plan, candidates[0].id, premium)!; - const needed = requiredBalanceMicros(price.hourlyMicros); - if (user.balance_micros < needed) { - throw new HttpError(402, balanceShortMessage(user.balance_micros, plan.id, price.hourlyMicros, needed)); + if (user.balance_micros < price.hourlyMicros) { + throw new HttpError(402, balanceShortMessage(user.balance_micros, plan.id, price.hourlyMicros)); } const now = nowSec(); const box: Box = { @@ -494,9 +487,8 @@ route("POST", "/box/start", async (req, env) => { const box = await activeBox(env, user.id); if (!box) throw new HttpError(404, "you have no box"); if (box.status !== "stopped") throw new HttpError(409, `box is ${box.status}; only a stopped box can be started`); - const needed = requiredBalanceMicros(box.hourly_micros); - if (user.balance_micros < needed) { - throw new HttpError(402, balanceShortMessage(user.balance_micros, box.plan, box.hourly_micros, needed)); + if (user.balance_micros < box.hourly_micros) { + throw new HttpError(402, balanceShortMessage(user.balance_micros, box.plan, box.hourly_micros)); } const now = nowSec(); const updated = await updateBox(env, box, { status: "starting" }, now); diff --git a/api/src/pricing.ts b/api/src/pricing.ts index 8fd23c1..2fd2516 100644 --- a/api/src/pricing.ts +++ b/api/src/pricing.ts @@ -102,21 +102,6 @@ export function planPrice(plan: Plan, region: string, premiumPct: number) { }; } -// Premium plans (H100 today) cost $10/hour or more, and need $100 in the -// balance to create or start a box, so a box isn't stopped for lack of credit -// a few minutes in. Every other plan needs an hour of use. -export const PREMIUM_HOURLY_USD = 10; -export const PREMIUM_MIN_BALANCE_USD = 100; - -export function isPremium(hourlyMicros: number): boolean { - return hourlyMicros >= PREMIUM_HOURLY_USD * 1e6; -} - -// Balance, in micro-dollars, needed to create or start a box at this rate. -export function requiredBalanceMicros(hourlyMicros: number): number { - return isPremium(hourlyMicros) ? Math.max(hourlyMicros, PREMIUM_MIN_BALANCE_USD * 1e6) : hourlyMicros; -} - // Charge for `seconds` at an hourly rate, rounded down to the micro-dollar. export function chargeMicros(hourlyMicros: number, seconds: number): number { if (seconds <= 0 || hourlyMicros <= 0) return 0; diff --git a/api/test/pricing.test.ts b/api/test/pricing.test.ts index 9118674..5e7cabe 100644 --- a/api/test/pricing.test.ts +++ b/api/test/pricing.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import { meterRate } from "../src/billing"; -import { IP_HOURLY_USD, PLANS, chargeMicros, diskHourlyUsd, gcpHourlyUsd, isPremium, planPrice, requiredBalanceMicros, withPremium } from "../src/pricing"; +import { IP_HOURLY_USD, PLANS, chargeMicros, diskHourlyUsd, gcpHourlyUsd, planPrice, withPremium } from "../src/pricing"; import { REGIONS, byDistance, enabledRegions, regionOfZone } from "../src/regions"; describe("pricing", () => { @@ -36,16 +36,6 @@ describe("pricing", () => { expect(chargeMicros(1_000_000, -5)).toBe(0); }); - it("makes plans of $10/h or more premium, needing $100 to create", () => { - const h100 = planPrice(PLANS.h100, "us-central1", 20)!.hourlyMicros; - const a100 = planPrice(PLANS.a100, "us-central1", 20)!.hourlyMicros; - expect(isPremium(h100)).toBe(true); - expect(isPremium(a100)).toBe(false); - expect(requiredBalanceMicros(h100)).toBe(100_000_000); - expect(requiredBalanceMicros(a100)).toBe(a100); // just an hour of use - expect(requiredBalanceMicros(150_000_000)).toBe(150_000_000); // never less than an hour - }); - it("lists H100 but doesn't offer it until GCP grants quota", () => { expect(PLANS.h100.available).toBe(false); expect(Object.values(PLANS).filter((p) => p.id !== "h100").every((p) => p.available)).toBe(true); diff --git a/client/gpushed-cli b/client/gpushed-cli index 5f6e1ad..2c69913 100755 --- a/client/gpushed-cli +++ b/client/gpushed-cli @@ -344,25 +344,23 @@ case "$cmd" in if [ "${1:-}" = --region ]; then region="${2:-}"; [ -n "$region" ] || die "Usage: gpushed plans [--region REGION]"; fi NO_AUTH=1 api GET "/plans${region:+?region=$region}" jq -r '"Prices in \(.region_name) (\(.region))\(if .nearest then ", the region nearest you" else "" end). Default plan: \(.default)\n"' <<<"$API_BODY" - # One row per plan: id, GPU and machine, price, stopped price, minimum - # balance, status. Older APIs send no status: treat the plan as available. + # One row per plan: id, GPU, price, stopped price, status. Older APIs send + # no status: treat the plan as available. jq -r '.plans[] | [ .id, (.label | split(", ")[0] | sub("^1x NVIDIA "; "")), "$\(.hourly_usd)", "$\(.stopped_hourly_usd)", - "$\(.min_balance_usd // .hourly_usd)", ((.status // "available") as $s | if $s == "unavailable" then "coming soon (no GPU quota yet)" elif $s == "elsewhere" then "not here; in \(.regions | join(", "))" - else "available" end - + (if .premium then ", premium" else "" end)) + else "available" end) ] | @tsv' <<<"$API_BODY" | - awk -F'\t' 'BEGIN { printf " %-8s %-18s %9s %9s %11s %s\n", "PLAN", "GPU", "PER HOUR", "STOPPED", "MIN BALANCE", "STATUS" } - { printf " %-8s %-18s %9s %9s %11s %s\n", $1, $2, $3, $4, $5, $6 }' + awk -F'\t' 'BEGIN { printf " %-8s %-18s %9s %9s %s\n", "PLAN", "GPU", "PER HOUR", "STOPPED", "STATUS" } + { printf " %-8s %-18s %9s %9s %s\n", $1, $2, $3, $4, $5 }' jq -r '"\nRegions: \([.regions[] | .id] | join(", "))"' <<<"$API_BODY" say "Prices include disk and IP, and differ a little by region. A stopped box costs only its disk." - say "Min balance is what you need to create or start a box: an hour of use, or \$100 for premium plans (\$10/h or more)." + say "To create or start a box you need an hour of its price in your balance." say "Your box goes to the nearest region with free GPUs; pick one with: gpushed up [plan] --region REGION" ;;