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.
| Control | Applies to | What happens | Gap |
|---|---|---|---|
| Zero balance | The whole account | Stops all instances | Storage keeps billing; data can be deleted |
| Autobilling | The whole account | Tops up from a saved card when the balance runs low | Keeps spend going instead of stopping it |
| Low balance email | The whole account | Emails you when the balance runs low | Watches the balance, not the burn rate |
| Costbrake brake | One instance | Stops it, ending its GPU charges | An 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.jsonUser 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
- An admin turns on the killswitch for the connection and adds the brake key.
- Costbrake lists every instance with its name or GPU, its status and its hourly price.
- The admin picks an instance and types the connection's name to confirm.
- Costbrake sets the instance to stopped, which ends its GPU charges and keeps its disk.
- 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