<!-- https://bobabanana.com/docs/api/credits/ · How BobaBanana API jobs are paid for with workspace credits: prices, the cost of each job, balance, max_credits and what happens at zero credits. -->

# Credits, prices and job costs

**Every BobaBanana API job is paid for with your workspace's credits.** The credits a job will need are reserved when the job is accepted, charged for each step that is delivered, and given back for steps that fail or are canceled. A request that fails completely costs nothing.

## How a job is paid for

1. **Accepted:** the job's estimate is reserved (held) from your balance. If the workspace cannot cover it, the request is refused with `402 insufficient_credits` and nothing is created.
2. **Finished:** each delivered step is charged at the price it was reserved at; anything not delivered is released.
3. **Failed:** every reserved credit is released.
4. **Canceled by you:** steps already delivered are charged, the rest are released.

Every job object carries its cost:

```json
"cost": {"credits_estimate": 30, "credits_charged": 24, "credits_released": 6, "status": "partly_charged"}
```

| `cost.status` | Meaning |
|---|---|
| `held` | The job is unfinished; its estimate is reserved |
| `charged` | Every step was delivered and charged |
| `partly_charged` | Some steps were delivered, the rest released |
| `released` | Nothing was delivered, nothing was charged |
| `exempt` | The workspace is not billed per job |

## Prices

`GET /v1/prices` returns the price table in force now. A job's cost is `base_credits`, plus `per_second_credits` for each started second of video or sound, plus `per_100_chars_credits` for each started 100 characters of speech. A row with `"pricing": "live_quote"` (`video_1080`, `video_2160`, `video_motion`) is priced from premium rendering's live price when the job is accepted: its credits are the most it costs at the regular rate, and the job's `cost.credits_estimate` is the price held. A video whose last frame uses premium rendering can also cost more than its `video_frames` row: the estimate shows it.

```bash
curl https://bobabanana.com/api/v1/prices -H "Authorization: Bearer $BOBABANANA_API_KEY"
```

```json
{"object": "list", "data": [{"key": "image", "base_credits": 4, "per_second_credits": 0, "per_100_chars_credits": 0, "pricing": "fixed"}, {"key": "video", "base_credits": 6, "per_second_credits": 2, "per_100_chars_credits": 0, "pricing": "fixed"}, {"key": "video_2160", "base_credits": 0, "per_second_credits": 95, "per_100_chars_credits": 0, "pricing": "live_quote"}]}
```

| Key | Used for |
|---|---|
| `image` | `POST /v1/images`, and the first frame of a video made from a prompt |
| `video` | A plain video clip without a voice: from `image`, or from a prompt with no references |
| `video_voice` | A video clip with a cloned or saved voice |
| `video_ref`, `video_voice_ref` | A video clip whose first frame uses `reference_images` or `assets` (without / with a voice) |
| `video_frames`, `video_voice_frames` | A video clip with a `last_frame` (without / with a voice) |
| `video_1080`, `video_2160` | A `1080p` or `2160p` video clip (live-quoted) |
| `video_motion` | A [motion transfer](https://bobabanana.com/docs/api/videos/#motion-transfer), priced from the length of your clip (live-quoted; clips of 3 s or less cost more per second; the row is the most a clip costs); each pose-matched picture (three, or one for a clip under 2 s) is an `image` on top. A clip with cuts costs 1.5 times as much (each scene is made on its own and joined), or the normal price with `first_shot_only` |
| `speech` | `POST /v1/speech`, and the speech step of a talking video |
| `sound_effect` | `POST /v1/sound-effects`, and the sound step of a video |
| `transcribe` | Transcribing a voice sample sent without its transcript |
| `upscale_image` | An [image upscale](https://bobabanana.com/docs/api/upscale/) at 2x or 4x |
| `upscale_video`, `upscale_video_4k` | A [video upscale](https://bobabanana.com/docs/api/upscale/): up to 2.2 megapixels a frame (HD), or larger; per second of the clip |

Prices can change; a job always costs what was quoted when it was accepted.

## Balance

```bash
curl https://bobabanana.com/api/v1/balance -H "Authorization: Bearer $BOBABANANA_API_KEY"
```

```json
{"object": "balance", "credits_available": 476, "credits_held": 24, "billing_mode": "credits"}
```

`credits_available` is the balance minus what unfinished jobs hold. It is what new jobs can use.

## Capping a job's cost

Send `max_credits` with any create request to refuse it if it would cost more:

```json
{"prompt": "a lighthouse at dusk", "duration_seconds": 10, "max_credits": 30}
```

If the estimate is higher, the request fails with `400 cost_above_max` and the error carries `credits_estimate`. Nothing is reserved.

## At zero credits

New jobs get `402 insufficient_credits` with `required` and `available`:

```json
{"error": {"code": "insufficient_credits", "message": "Needs 24 credits, you have 10.", "required": 24, "available": 10, "docs": "https://bobabanana.com/docs/api/errors/"}}
```

Jobs already queued or running are not affected. Credits are added by the workspace owner in the studio (**Credits**). There is no automatic top-up.

## Frequently asked questions

### Does a failed job cost anything?
No. Credits for steps that were not delivered are always released.

### Does deleting a job give credits back?
No. Deleting removes the job record and its results; what was charged stays charged, and the job still counts toward the key's daily limit.

### Do retries with an Idempotency-Key cost twice?
No. A retry with the same key returns the original job and reserves nothing new.
