# Pricing and billing

> How calls are charged, what happens when the balance runs out, and how to read your usage.

Calls are paid for from your workspace’s balance, by the second. There is nothing to pay per request: only time on a call with a caller costs anything.

## What a call costs

Every agent has a per-minute rate, its `costPerMinute`. A call is charged for exactly as long as it lasted, counted from the moment the caller joined:

The sum:

```
cost = durationSeconds ÷ 60 × costPerMinute
```

The current rate and the plans are on the [pricing page](https://www.cracklehq.com/pricing), and served by [Get the price list](https://www.cracklehq.com/docs/reference/plans), which needs no key. A call keeps the rate it started at, even if the price changes while it runs.

- The time before the caller joins is not charged.
- A call nobody joined, and a call that failed to start, cost nothing.
- Test calls made in the studio are charged like any other call.

The charge is on the call as `callCost` once it has ended, and arrives with the `call.ended` [webhook](https://www.cracklehq.com/docs/webhooks).

## Balance

Your balance is credit in US dollars. It goes up when a plan is paid for or you add credit in the studio under **Billing**, and down as calls end. Read it at any time:

Request:

cURL:

```bash
curl "https://goblins-call-api.onrender.com/v1/me" \
  -H "Authorization: Bearer $CRACKLE_API_KEY"
```

Node.js:

```js
const response = await fetch('https://goblins-call-api.onrender.com/v1/me', {
  headers: {
    Authorization: `Bearer ${process.env.CRACKLE_API_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

Python:

```python
import os
import requests

response = requests.get(
    "https://goblins-call-api.onrender.com/v1/me",
    headers={"Authorization": f"Bearer {os.environ['CRACKLE_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

[List balance history](https://www.cracklehq.com/docs/reference/workspace/usage) is the ledger behind that number: one entry per charged call, with its duration and rate, and one per credit.

## When the balance runs out

- `Before a call` (402): With a balance of zero or less, Start a call answers `402 INSUFFICIENT_BALANCE`, and the response carries the `balance`.
- `During a call` (max-duration): A call is given only as long as the balance can pay for. When that time is up it ends with the reason `max-duration`, so a workspace never goes into debt.

If calls matter to your product, watch the balance from your own monitoring and top up before it gets low.

## Plans

A plan adds call credit to the balance each time it is paid for, and sets how many calls the workspace can run at once: see [Rate limits and concurrency](https://www.cracklehq.com/docs/limits). [Get plan and payments](https://www.cracklehq.com/docs/reference/workspace/billing) returns the plan a workspace is on.

Source: https://www.cracklehq.com/docs/billing
