Open source · Apache-2.0

Put a price on any endpoint.

Humans and AI agents pay your API per request, in stablecoins. Speaks x402 and MPP. Your coding agent integrates it from one prompt.

Fastest path — paste into your coding agent
Read goldrail.dev/integrate.md and follow it to integrate Goldrail into this repo. Ask me its questions first, work on a branch, keep every route in shadow mode, and stop after opening the PR.
prefer hands-on? $ npx goldrail dev

Built by 🟠 Goldsky

any coding agent · one paste
you Read goldrail.dev/integrate.md and integrate Goldrail into this repo. agent Read your repo: Express, 14 routes, Postgres, k8s. Three questions — routes & prices? pay-to wallet? admin panel where? you /api/** at $0.000005 · 0x9f…4c2 · mount /ops agent Opened PR #142 — shadow mode on, fail-open, payment checks on mock money. Nobody is charged until you flip the switch.
How it works

One router in front of your API

Payments verify locally and debit a prepaid balance. Facilitators only see real money moving.

Apps fetch · curl AI agents MCP · x402 GOLDRAIL :4402 Challenge x402 + MPP in one 402 Verify · debit local — no round trip Route · settle budgets · failover prepaid balance every unit ledgered Your API unchanged FACILITATORS Circle CDP · Stripe
request served from credit settle — refills the balance
served 0 facilitator calls 0 ratio

demo runs ~8 requests per settle so you can see it — production is ~1,000

Funding rails

Per-request by default. Credit when you need it.

Same wire protocol either way — payers never change anything.

Default

Per-request

Plain x402: every request settles through your facilitator. Works with any x402 client, nothing to configure.

rails = ["per-request"]
Opt-in · one line

Prepaid credit

One settle funds a balance; the next ~1,000 requests verify locally and debit it. No facilitator in your hot path.

rails = ["credit", "per-request"]

List both and Goldrail prefers credit, falling back to per-request whenever a balance can't cover the call.

~1M/daypaid requests in production
~1,000×fewer calls, with credit
1 lineto integrate
2 protocolsx402 + MPP
Deployment

Run it however you already run things

One engine, four shapes. Same behaviour, same config, same panel.

Standalone proxy

Zero code. Put it in front of anything that speaks HTTP.

goldrail serve

Sidecar

Same pod, localhost hop. Nothing leaves the box unpriced.

goldrail serve --port 4402

Embedded library

In-process middleware. No extra hop, no extra service.

app.use(goldrail())

Gateway hook

Keep your gateway. It asks Goldrail per request.

ext_authz · auth_request
Features

Everything a paid API needs

Credit rail · opt-in

One settle, ~1,000 requests

Verify locally, debit a balance. Per-request settle stays the default.

Router

Protocols are routes, not bets

x402 and MPP in one 402. New chains and facilitators plug in.

Failsafe

Failover, budgets, breakers

Throttled facilitator reroutes. A lying one gets benched.

Live pricing

No deploy to change a price

Versioned config in your DB. Apply from CI, roll back instantly.

Fail dials

Experiments can't cause outages

Shadow mode prices traffic before charging. Fail-open per route.

Ledger

Revenue you can audit

Atomic units, reconciled against the facilitator. Per-payer statements.

Agent-native

Agents find and pay you

Discovery endpoints, built-in MCP, spend-capped payer tools.

Observability

Metrics and dashboards, wired

Prometheus, OTel traces, Grafana packs included.

Enterprise

SOC 2 evidence built in

SSO, RBAC, tamper-evident audit chain, one-command audit pack.

Admin panel

Every knob, live

Ships in the binary. Change a price, flip a rail, roll back — no deploy.

localhost:4402/admin v42 · live
Revenue today$1,284.20▲ 12%
Paid requests2.41M▲ 8%
Requests / settle1,014credit rail

Funding mix · 24h

bounded labels
● credit 96% ● settled 3% ● exempt 1%

Routes

click a price to edit
/rpc/**$0.000005credit
/cache/**$0.000002credit
/data/**$0.00001per-request

Backends

auto-tuned budgets
Circle · 8.2 rps · p50 240ms CDP · standby Stripe · cordoned
🎛 Prices are live state. Edit here or config apply from CI. Every change is a version. Diff it, blame it, roll it back. 🔎 See it before you build it: goldrail dev --seed demo
Quickstart

Paste a prompt. Review a PR.

Your coding agent integrates Goldrail — shadow mode on, you flip the switch. Or do it by hand.

Read https://goldrail.dev/integrate.md and follow it to integrate Goldrail into this repo. Ask me its Phase-2 questions first, work on a branch, keep every route in shadow mode, and stop after opening the PR.
1 reads your repo 2 asks the right questions 3 opens a PR — shadow mode, zero payer impact 4 you flip the switch
brew install goldsky-io/tap/goldrail # or cargo, or docker goldrail init # scaffold a priced route goldrail dev # mock money, admin panel, chaos API goldrail serve # production, same binary
npm install goldrail import { goldrail } from "goldrail"; app.use(goldrail()); // that's it app.use("/ops", goldrail.admin()); // optional panel
cargo add goldrail-tower let app = Router::new() .merge(api) .layer(GoldrailLayer::from_env()?); // prices live in config
go get github.com/goldsky-io/goldrail/sdk/go handler = goldrail.Middleware(handler)
No wallet. No signup. No real money. goldrail dev ships a mock facilitator + funded wallets, and goldrail check --against localhost:3000 tests your app like a paying customer — 402, pay, top-up, replay, refund — and refuses to run against mainnet.
Compare

Who owns your payment path?

Coinbase middlewareCloudflare gatewayGoldrail
modelembed the protocolrent the gatewayown the layer
protocolsx402 onlyx402 onlyx402 + MPP
fundingsettle every requestsettle every requestprepaid credit
price changesredeploytheir dashboardlive, versioned
ledgernonetheir analyticsbuilt in
runs wherein your apptheir edgeanywhere
lock-infacilitatorplatformnone

Full comparison in docs/comparison.md.

Born in production

Every rule was paid for with real money

Goldrail runs Goldsky's edge — ~1M paid requests a day. The scars are the spec.

A hidden rate limit refused 96% of settles.→ credit rail + auto-tuned budgets.
A price change clients couldn't converge on.→ every 402 says exactly what to sign.
A revenue dashboard wrong by 1000×.→ revenue counted in units settled.
A timeout is not a failure.→ ambiguous settles resolve, never blind-retry.