> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darkbloom.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Add credits and pay for Darkbloom usage

> Load a prepaid balance with Stripe, confirm the deposit, and grant consent for Darkbloom Sandbox CI jobs.

Darkbloom uses a prepaid balance: you add funds before making inference requests or running sandbox jobs, and usage is deducted as it settles. Deposits go through Stripe Checkout.

## Add credits in the console

**1. Sign in to the console**

Go to [console.darkbloom.dev](https://console.darkbloom.dev) and sign in with your email address.

**2. Open billing**

Navigate to **Billing** and choose **Buy Credits**.

**3. Enter an amount**

Enter the amount you want to add. The minimum deposit is **\$0.50**.

**4. Complete Stripe checkout**

You are redirected to a Stripe-hosted checkout page. Enter your card details and confirm the payment.

**5. Wait for the webhook**

The coordinator credits your balance when Stripe delivers `checkout.session.completed`, usually within seconds. The redirect back to the console does not itself apply the credit.

## Add credits with the API

Create a Checkout session with your API key:

```bash theme={null}
curl -X POST https://api.darkbloom.dev/v1/billing/stripe/create-session \
  -H "Authorization: Bearer $DARKBLOOM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": "10.00"}'
```

`amount_usd` is a string and must be at least `0.50`. The response includes the Stripe URL to open and the coordinator's session ID:

```json theme={null}
{
  "session_id": "3f0e...",
  "stripe_session": "cs_live_...",
  "url": "https://checkout.stripe.com/c/pay/cs_live_...",
  "amount_usd": "10.00",
  "amount_micro_usd": 10000000
}
```

Poll the session to confirm the credit:

```bash theme={null}
curl "https://api.darkbloom.dev/v1/billing/stripe/session?id=3f0e..." \
  -H "Authorization: Bearer $DARKBLOOM_API_KEY"
```

`status` moves from `pending` to `completed` after the webhook is processed. A session owned by another account returns `404`.

> [!NOTE]
>
> A deposit is spendable but not withdrawable. Only earnings (provider payouts and referral rewards) count toward the withdrawable balance.

## Check your balance after deposit

```bash theme={null}
curl https://api.darkbloom.dev/v1/payments/balance \
  -H "Authorization: Bearer $DARKBLOOM_API_KEY"
```

## Pay for Darkbloom Sandbox jobs

Darkbloom Sandbox bills the account that consents to pay for a GitHub App installation. Grant consent with the installation ID the sandbox service shows you:

```bash theme={null}
curl -X PUT https://api.darkbloom.dev/v1/sandbox/consents/12345678 \
  -H "Authorization: Bearer <privy-access-token>"
```

Each job holds the price of 60 minutes of its runner class from your balance when it starts, then charges per second with a one-minute minimum and returns the rest. Infrastructure failures are released and cost nothing; jobs on your own provider Mac are free. Read the current rates and platform fee with:

```bash theme={null}
curl https://api.darkbloom.dev/v1/sandbox/rates \
  -H "Authorization: Bearer <privy-access-token>"
```

Before Darkbloom publishes prices this route returns `503 sandbox_billing_unavailable`, and no job can start. List your charges or revoke consent with `GET /v1/sandbox/charges` and `DELETE /v1/sandbox/consents/{installation_id}`.

> [!WARNING]
>
> Do not close the Stripe checkout tab before the payment completes. If you do and the payment goes through, the credit still applies once the webhook arrives, but it may take a few seconds.

See [Pricing](https://docs.darkbloom.dev/billing/pricing.md) for how credits are consumed and how sandbox jobs are metered.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.