Docs menu

Money

Apps that pay their own hosting

Let what an app earns cover its hosting first, keep a reserve, and pay out only the rest to your wallet, automatically.

Explain it

If your app earns money on CLI (selling API calls, subscriptions, paid tools, being hired), those earnings land in the same balance its hosting is paid from. So an app that earns more than it costs already pays for itself.

Pays its own hosting, on the project's settings, makes that a plan:

  • It shows what the app earned and what its hosting cost over the last 30 days, and says plainly whether it pays for itself ("It earned 140% of its hosting").
  • You choose how many days of hosting to keep from earnings, say two weeks. That much always stays in the project.
  • Anything beyond that can go to your wallet automatically, every day or every Monday.

An app can run indefinitely without anyone topping it up, and you still collect the profit.

How to do it: open the project, go to Settings, find Pays its own hosting and press Set it up. Choose the days to keep, then Pay out daily or Pay out weekly, and enter your wallet address. Only the project's owner can set this, with a second sign-in step if you have one.

Payouts are earnings paid in USDC only. Credit you added yourself stays for hosting. The first payout to a new address waits 48 hours, like any withdrawal.

Read it

API
GET /v1/projects/:id/self-funding
JSON
{
  "setting": { "enabled": true, "reserveDays": 14, "sweep": "weekly", "address": "0x…", "network": "eip155:8453", "lastSweepAt": null, "nextSweepAt": 1763042400000 },
  "report": {
    "days": 30,
    "earned": 120000000,
    "hosting": 30000000,
    "net": 90000000,
    "coverage": 4,
    "paysForItself": true,
    "burnPerHour": 40000,
    "balance": 140000000,
    "reserveDays": 14,
    "reserve": 13440000,
    "withdrawable": 120000000,
    "sweepableNow": 120000000,
    "summary": "It pays for itself: it earned 400% of its hosting in the last 30 days."
  },
  "networks": ["eip155:8453"]
}

Money is in micro-USDC. earned is the earnings log over 30 days (after CLI's fee and any revenue splits); hosting is usage charged in that time. coverage is earned ÷ hosting (null when it earned but cost nothing). reserve is burnPerHour × 24 × reserveDays, using the same burn rate as the credit panel. sweepableNow is min(withdrawable, balance − reserve): only cash-backed earnings, and never below the reserve. Environments share the project's balance, so this always reads the parent project.

Set it

API
PUT /v1/projects/:id/self-funding
{"enabled": true, "reserveDays": 14, "sweep": "weekly", "address": "0x…", "network": "eip155:8453", "minPayout": 10000000}
FieldMeaning
reserveDays1 to 180, default 14
sweepoff (keep it all), daily or weekly (Mondays). Payouts run at 14:00 UTC
address, networkrequired unless sweep is off; checked like a withdrawal address
minPayoutskip a payout smaller than this; the server's minimum withdrawal applies anyway

Owners only, people only (not API keys or connected apps), and a recent second sign-in (it's a step-up route, like withdrawals).

How payouts run

Hourly, the leader finds projects that are due, moves their next date forward first (so a failure doesn't retry every hour), and calls the normal withdrawal on behalf of the owner who set it up. Everything that applies to a withdrawal applies here: identity checks, the 48-hour hold on a new address, review for large amounts or new accounts, and the per-project daily and platform hourly limits. Each payout adds a self_funding_payout event, and shows in Credit and billing with the other withdrawals.