Railway integration

Railway cost alerts with reversible brakes

Costbrake watches Railway through a one-click sign-in or a workspace token: it reads Railway's usage for the current billing period every 5 minutes on Pro and Team and turns each increase into hourly spend, so a runaway service shows up as a spike within minutes.

Free checks hourly and sends email. Pro at $12 a month and Team at $39 a month add 2 brakes an admin confirms by hand: set the workspace hard limit to its current usage, which Railway enforces by taking every workload offline, or stop one service. Every brake has an Undo.

Railway at a glance

Reads
Railway's usage for the current billing period, spread over the time between readings
Key
One-click Railway sign-in or a workspace token; Railway has no read-only tokens, so both have full access to the workspace
Setup
Sign in with Railway, or create a workspace token under Account Settings > Tokens and paste it
Free plan
Hourly checks, email alerts
Pro and Team
Every 5 minutes, about 12 Railway API requests an hour
Spike checks
No speed-up; stays at every 5 minutes
Brakes
2: hard limit at current usage, stop a service

Brakes

2 brakes for Railway

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

  • Admin confirms

    Hard limit at current usage

    Sets the workspace's compute hard limit to its current usage, rounded down to whole dollars, so Railway takes every workload in every project offline until the limit is raised or the next billing period starts.

    UndoPuts the previous hard limit and email alert back, or removes the limit if there was none, and Railway redeploys the services it stopped.

    Railway's minimum hard limit is $10, so below $10 of usage this only caps spend at $10, and a service that doesn't come back needs a redeploy from the Railway dashboard.

  • Admin confirms

    Stop service

    Stops one service's running deployment in one environment; nothing is deleted.

    UndoRestarts the stopped deployment with the same image, unless a newer deployment has replaced it.

    A new deploy, for example from a git push, or a Railway host migration can start it again, and attached volumes keep billing for storage.

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.

ControlWhat it doesThe gap
Custom email alertEmails you at an amount you pickNothing stops
Hard limitTakes every workload offline at the limitOne number for the workspace, set in advance; $10 minimum
Stop a service by handStops one deploymentYou have to notice the runaway service first
CostbrakeUsage every 5 minutes, spike alerts, freeze at current usage or stop one serviceAn 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

Start with 14 days of Pro, free

Catch the next Railway spike before the invoice.

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