Vast.ai integration

Vast.ai spend alerts and GPU brakes

Costbrake reads your Vast.ai balance every 5 minutes on Pro and Team, and every minute for 2 hours after a spike alert; spend is the drop between checks. An admin can stop a runaway GPU instance, and Undo starts it again.

Vast.ai's own guard is the prepaid balance: at zero it stops your instances, and autobilling can refill it from a saved card. The Free plan checks hourly with email alerts; brakes come with Pro at $12 a month and Team at $39 a month (see pricing).

Vast.ai at a glance

Reads
Account balance, including credit; spend is the drop between checks
Key
A key with only User Read; brakes need a second key with User Read, Instance Read and Instance Write
Setup
Paste the key, or let a coding agent create it with your Vast.ai key
Free plan
Checks every hour, email alerts, no brakes
Pro and Team
Checks every 5 minutes, Slack, Discord and webhook alerts, brakes
Spike checks
Every minute for 2 hours after a spike alert
Brakes
Stop instance

Brakes

1 brake for Vast.ai

An admin picks a brake, confirms it, and can undo it later. Brakes come with Pro and Team.

  • Admin confirms

    Stop instance

    Stops the instance, which ends its GPU charges, and keeps its disk.

    UndoStarts the instance again; if its GPU was rented out meanwhile, it waits until the GPU is free.

    Storage keeps billing while the instance is stopped, and someone else can rent its GPU in the meantime.

Can you set a hard spending limit on Vast.ai?

Not as a dollar cap. Vast.ai is prepaid: when your credit balance hits zero or below, it stops your instances but doesn't destroy them, and storage keeps billing. Without a saved card, a negative balance gets your instances and data scheduled for deletion. With autobilling on, Vast.ai tops up from your card when the balance runs low, so the balance stops being a cap.

ControlApplies toWhat happensGap
Zero balanceThe whole accountStops all instancesStorage keeps billing; data can be deleted
AutobillingThe whole accountTops up from a saved card when the balance runs lowKeeps spend going instead of stopping it
Low balance emailThe whole accountEmails you when the balance runs lowWatches the balance, not the burn rate
Costbrake brakeOne instanceStops it, ending its GPU chargesAn admin starts it

Costbrake alerts when an hour costs over 3 times its 7-day usual and at least $5 more. How Vast.ai billing works and what stopped instances cost covers prices and storage fees.

What Costbrake reads from Vast.ai

Costbrake reads your balance, including credit, at every check. Spend is the drop in the balance between two checks, spread evenly over the hours between them. A top-up between two checks hides the spend in that window.

Costbrake doesn't read Vast.ai invoices, so the balance drop is the spend figure for this provider.

Which Vast.ai keys does Costbrake need?

A key with only User Read. Vast.ai keys have full access by default, so scope it when you create it, for example with the vastai CLI:

echo '{"api":{"user_read":{}}}' > read.json
vastai create api-key --name costbrake --permission_file read.json

User Read also lets a key see the account's environment variables and SSH keys. With agent setup, a coding agent that has your Vast.ai key creates the scoped key through Vast.ai's API and sends it without printing it.

The brake needs a second key with User Read, Instance Read and Instance Write. Instance Write also allows creating and destroying instances; Costbrake only stops and starts them.

How the Vast.ai brake works

  1. An admin turns on the killswitch for the connection and adds the brake key.
  2. Costbrake lists every instance with its name or GPU, its status and its hourly price.
  3. The admin picks an instance and types the connection's name to confirm.
  4. Costbrake sets the instance to stopped, which ends its GPU charges and keeps its disk.
  5. Undo sets it back to running. If its GPU was rented out meanwhile, it waits until the GPU is free.

Costbrake never destroys instances or volumes. When you're done with an instance for good, destroy it on Vast.ai to stop storage billing.

What Costbrake can't do on Vast.ai

  • Stop spend on its own. Alerts are automatic; a brake always waits for an admin.
  • Stop storage billing on a stopped instance.
  • Promise the same GPU after Undo, since someone else may rent it while the instance is stopped.
  • See spend that a top-up hides between two checks.

If a Vast.ai key leaks, see What to do in the first hour after an API key leaks.

Questions and answers

Does Vast.ai have a spending limit?

Not as a dollar cap. Vast.ai is prepaid: when your credit balance hits zero, it stops your instances, and autobilling can refill the balance from a saved card. Costbrake adds spike alerts and a brake that stops one instance.

Does a stopped Vast.ai instance still cost money?

Yes. Stopping ends GPU charges, but Vast.ai keeps charging storage for stopped instances until you destroy them.

Which permissions do the Vast.ai keys for Costbrake need?

The read key needs only User Read. The brake key needs User Read, Instance Read and Instance Write. Vast.ai keys have full access by default, so scope both when you create them.

How often does Costbrake check Vast.ai spend?

Every 5 minutes on Pro and Team, every minute for 2 hours after a spike alert, and every hour on Free. Spend is the drop in your balance between checks.

Does Costbrake stop Vast.ai instances on its own?

No. Alerts go out automatically, but a brake only runs when an admin of your Costbrake workspace picks an instance and types the connection name to confirm.

Sources

Updated

Start with 14 days of Pro, free

Catch the next Vast.ai spike before the invoice.

14 days of Pro, then Free for 2 accounts. No card needed.