Can you set a hard spending limit on Railway?
Yes. On the Workspace Usage page, a workspace admin can set a custom email alert and a hard limit. Once usage hits the hard limit, Railway takes all your workloads offline. It emails you at 75 and 90 percent of the limit and again at 100 percent, when the workloads go down. The minimum hard limit is $10.
To come back, you raise or remove the limit and Railway redeploys the stopped services; any that fail need a manual redeploy. The limit is one number for the whole workspace, picked in advance, so it can't tell a runaway service from normal growth. More in Railway usage limits and Railway pricing.
| Control | What it does | The gap |
|---|---|---|
| Custom email alert | Emails you at an amount you pick | Nothing stops |
| Hard limit | Takes every workload offline at the limit | One number for the workspace, set in advance; $10 minimum |
| Stop a service by hand | Stops one deployment | You have to notice the runaway service first |
| Costbrake | Usage every 5 minutes, spike alerts, freeze at current usage or stop one service | An admin confirms every brake |
What Costbrake reads from Railway
Costbrake reads Railway's usage figure for the current billing period and spreads each increase over the time since the previous reading, which turns it into hourly spend for spike and budget alerts. That figure is the final number: there is no separate daily bill to replace it later. Usage between the last reading of a billing period and its end isn't counted.
Each reading is one API request. On Pro and Team that's about 12 an hour, out of Railway's hourly API allowance of 100 requests on Free, 1,000 on Hobby and 10,000 on Pro.
The Railway sign-in and token
The fastest setup is one click: sign in with Railway and grant Costbrake workspace admin access, which brakes need to set usage limits and stop deployments. Or create a workspace token under Account Settings > Tokens, pick the workspace and paste the token.
Railway has no read-only token. A workspace token has access to all of that workspace's resources, but not to your personal resources or other workspaces. Costbrake only reads with it, except when an admin runs a brake, and brakes use the same access.
How a Railway brake works
Costbrake never brakes on its own. On Pro and Team, an admin turns the killswitch on for the connection, picks the workspace or a service, types the connection name and clicks Brake now.
- Stop service is the narrow brake: the rest of the workspace keeps running.
- Hard limit at current usage is the big one: it freezes spend where it is by taking every workload offline.
- A limit someone changed in Railway after the brake is left alone on Undo.
- Volumes are billed per GB of storage used, so stopped services with volumes keep a storage cost.
What triggers a Railway alert
A spike alert fires when an hour costs more than 3 times your 7-day hourly average and at least $5 more, once Costbrake has 24 hours of history. Budget alerts fire at 50, 80 and 100 percent by default, and Pro adds forecast alerts. Free sends email; Pro adds Slack, Discord and webhooks; Team adds PagerDuty. Compare plans on the pricing page.
Questions and answers
Does Costbrake stop Railway spend automatically?
No. Costbrake alerts you, and an admin on Pro or Team decides whether to brake. A brake needs the killswitch turned on for the connection, the connection name typed in, and a click on Brake now. Every brake has an Undo.
Is Railway's own hard limit enough?
It is a good backstop: at the limit, Railway takes every workload offline. But it is one number for the whole workspace, set in advance, with a $10 minimum. Costbrake checks every 5 minutes on Pro and Team, alerts on spikes, and lets an admin stop just the runaway service.
Why does the Costbrake Railway connection have admin access?
Railway has no read-only tokens: a workspace token has access to all of the workspace's resources, and the one-click sign-in grants workspace admin. Costbrake only reads with that access unless an admin runs a brake.
How many Railway API requests does Costbrake use?
One per reading: about 12 an hour on Pro and Team, which check every 5 minutes, and 1 an hour on Free. Railway allows 100 requests an hour on its Free plan, 1,000 on Hobby and 10,000 on Pro.
What happens to my services when I undo the hard-limit brake?
Costbrake puts the previous hard limit and email alert back, or removes the limit if there was none. Railway then redeploys the services it stopped; any that don't come back need a manual redeploy from the deployment's menu in Railway.
Sources
Updated