# Pricing and billing

URL: https://skywake.dev/docs/pricing

What each Skywake Cloud plan costs and includes, and how billing works when you self-host.

Each Skywake Cloud plan is one flat price a month, with a set amount of storage. Nothing is metered: writes, reads, searches, downloads, forks, merges and disks cost nothing extra.

## Plans [#plans]

| Plan   | Price a month | Storage | Includes                                                |
| ------ | ------------- | ------- | ------------------------------------------------------- |
| Free   | $0, no card   | 10 GB   | Unlimited disks and branches, and search on every disk. |
| Launch | $20           | 500 GB  | Free, plus pinned replicas.                             |
| Scale  | $50           | 3 TB    | Everything in Launch.                                   |

## Storage [#storage]

Storage counts everything you keep: each disk's bytes in the bucket, after compression and dedupe, and the search data of disks that have [search](./filesystem/search.mdx) turned on. If the same data is stored twice on one disk, it counts once. Skywake measures each disk once a day, and again within the hour after it changes. A GB is 2³⁰ bytes.

When an organization reaches its plan's storage, writes fail with `402`, the code `payment_required` and a link to upgrade. Reads, deletes and everything else keep working, and nothing you stored is deleted. The limit lifts as soon as you delete data or upgrade.

On Free, embedding and reranking for search have a fair-use allowance of 10,000 texts and 1,000 results a month.

## Changing plans [#changing-plans]

You can upgrade, downgrade, cancel or update your card from **Settings → Billing** in the console.

- An upgrade takes effect at once. The difference in price for the rest of the month is charged right away.
- A downgrade takes effect at the end of the month. Until then you keep the higher plan, and you can undo the change.
- If you cancel, the plan lasts until the end of the month, and then the account returns to Free. You can resume before the month ends.
- If a payment fails, Stripe retries the card. The plan keeps working for 7 days. After that, the account is treated as Free until the invoice is paid.

## Self-hosting [#self-hosting]

When you run your own servers, billing is off unless you turn it on. A server with no `STRIPE_SECRET_KEY` has no plans, no limits and no paid features, and the console's billing settings show only usage.

If you want to charge your own users through Stripe, set these variables:

| Variable                  | Value                                                                                                                       |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `SKYWAKE_API_BILLING`     | `stripe` to turn billing on, `off` to keep it off. Defaults to `stripe` when a key is set.                                  |
| `STRIPE_SECRET_KEY`       | A secret or restricted key. Live keys are refused unless `SKYWAKE_API_BILLING_LIVE=true`.                                   |
| `STRIPE_WEBHOOK_SECRET`   | The signing secret of the webhook endpoint below.                                                                           |
| `SKYWAKE_API_CHECKOUT`    | `hosted`, the default, sends people to a Stripe Checkout page. `custom` keeps them in the console, with Stripe's card form. |
| `STRIPE_PUBLISHABLE_KEY`  | The matching publishable key. Needed only with `SKYWAKE_API_CHECKOUT=custom`.                                               |
| `SKYWAKE_API_CONSOLE_URL` | The console's address, including its base path. Checkout and the billing portal return here.                                |

You can't set `SKYWAKE_API_PRICES` together with Stripe billing, because Stripe holds the prices.

Next, create the products, prices and portal settings in your Stripe account. Log in with the Stripe CLI first, then run the script below. Running it again changes nothing.

```bash norun
node apps/api/scripts/stripe-catalog.ts
```

Then add a webhook endpoint at `https://<api>/billing/stripe` that sends these events:

- `checkout.session.completed`
- `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.resumed`
- `invoice.finalized`, `invoice.paid`, `invoice.payment_failed`, `invoice.voided`, `invoice.marked_uncollectible`

With the admin token, you can put an organization on Enterprise through `PUT /v1/orgs/{org}/billing/plan`. This turns on every feature, with no limits and no Stripe subscription. The route has no v2 version yet; `/v1` goes away one release after v2.