# Pricing and billing

Scribase has **no project limit**. You pay for the projects that exist:

| Option | Price | What it covers |
|---|---|---|
| **Per project** (default) | **$9 per project per month** | Postgres, Auth, Storage, Realtime, Functions and previews for each project |
| **Unlimited** | **$299 per month** | Any number of projects, under pooled fair-use quotas |

Idle projects scale to zero and wake on the next request; they are not paused
while your balance covers them. Self-hosting Scribase is free (Apache-2.0).

## How the balance works

1. **Sign up and a $1 card check.** A one-time $1 payment through Creem (our
   merchant of record) verifies your card and is credited 1:1 to your
   organization's balance.
2. **Trial credit.** After the card check your first project gets a **7-day
   trial credit**, so it is live immediately.
3. **Daily charges.** Once a day, every project that exists (running or
   scaled to zero) is charged **price / 30** from the balance: $0.30 a day at
   $9/month. Each project is charged at most once per day, so a retry never
   double-charges. On Unlimited the organization is charged $299 / 30 per day
   instead, whatever the project count. Delete a project and its charges stop
   from the next day.
4. **Top-ups.** **Top up** in Billing opens a one-click checkout for the amount
   you choose; the amount is credited as soon as the payment completes.
5. **Auto top-up.** Turn it on in Billing with a threshold and an amount. When
   the balance drops below the threshold, the console shows a one-click
   checkout for that amount. Creem cannot charge a saved card off-session for
   one-time payments, so **auto top-up is a prompted one-click checkout, not an
   automatic charge**: nothing is charged until you click it.
6. **Grace period, then pause.** If the balance reaches zero, projects keep
   running for **72 hours**. After that they **pause**: compute scales to zero
   and all data is kept. New projects cannot be created while paused.
7. **Resume.** A top-up that brings the balance above zero resumes paused
   projects right away.

The console **Billing** page shows the balance, "N projects × $9/mo = $X", a
per-project ledger of daily charges, the **Top up** button and the
**auto top-up** toggle. When the per-project total would be more than $299, it
suggests switching to Unlimited and shows how much you would save.

## Temporary agent projects

An agent can create a temporary project with `POST /v1/temporary-projects`
(see [Temporary databases](https://docs.scribase.com/docs/agents/temporary-databases.md)). Temporary
projects are **free for 72 hours**. Claim one to keep it; billing starts from
the claim. An unclaimed temporary project is removed when it expires.

## Unlimited fair use

Unlimited quotas are pooled across the organization, per calendar month:

| Resource | Fair use |
|---|---|
| Database | 500 GB |
| File storage | 2 TB |
| Egress | 5 TB |
| Compute hours | 50,000 |

Each environment still has its own hard caps (from `config/plans.json`), and
capacity packs add room to one environment.

## API

All routes are under `/v1/organizations/{org}/` and use the same bearer as the
rest of the API.

| Route | Who | What |
|---|---|---|
| `GET billing/balance` | Any member | Balance, price, billable projects, monthly estimate, status (active, grace, paused), auto top-up settings, pending top-up prompt, Unlimited savings |
| `GET billing/ledger` | Any member | Credits and daily charges, per project |
| `POST billing/top-up` | Owner, admin | `{"amount_cents":2000,"success_url":"https://..."}` returns a `checkout_url` |
| `POST billing/top-up-confirm` | Any member | `{"query":"..."}` from the signed success redirect; idempotent |
| `PUT billing/settings` | Owner, admin | Auto top-up (`auto_top_up_enabled`, `auto_top_up_threshold_cents`, `auto_top_up_amount_cents`) and `billing_model` (`per_project` or `unlimited`) |

## Operator configuration

Hosted billing is configured with environment variables on the control API.

| Variable | Default | Meaning |
|---|---|---|
| `SCRIBASE_PRICE_PER_PROJECT_CENTS` | `900` | Monthly price of one project; charged daily at price / 30 |
| `SCRIBASE_UNLIMITED_PLAN_CENTS` | `29900` | Monthly price of the Unlimited plan; charged daily at price / 30 |
| `SCRIBASE_TRIAL_DAYS` | `7` | Days of trial credit for the first project after the card check |
| `SCRIBASE_BILLING_GRACE_HOURS` | `72` | Hours projects keep running after the balance reaches zero |
| `SCRIBASE_TOP_UP_MIN_CENTS` | `500` | Smallest top-up |
| `SCRIBASE_TOP_UP_MAX_CENTS` | `100000` | Largest top-up |
| `CREEM_PRODUCT_ID_TOP_UP` | the card-check product | A $1 one-time Creem product; a top-up buys it in units. Falls back to `CREEM_PRODUCT_ID_CARD_CHECK` |
| `SCRIBASE_PROJECT_BILLING` | on when `CREEM_API_KEY` is set | `1`/`0` forces per-project billing on or off |
| `SCRIBASE_BILLING_SWEEP_SECONDS` | `300` | How often the daily-charge, pause and resume sweep runs |

The card check itself keeps its existing variables (`CREEM_API_KEY`,
`CREEM_PRODUCT_ID_CARD_CHECK`, `SCRIBASE_CARD_CHECK_CENTS`,
`SCRIBASE_REQUIRE_CARD`), and top-up payments arrive through the same signed
webhook (`CREEM_WEBHOOK_SECRET`). There is no project cap to configure; a
self-hosted deployment without billing never charges or pauses anything.
