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

# Prices and refunds

> How the Rask API v3 prices dubs, segment generation, lip-sync and on-screen work, how the price cap works, and which failures are refunded.

Paid work is priced in **minutes**, from the payer's balance. These pages give the rules, never amounts. To get a price, call the estimate: **it runs the same price function as the charge.**

## Estimate, then cap

Every spending operation has an estimate, named in `x-rask-operation.estimate_operation`. It is free, needs no `credits:spend`, and changes nothing.

| Spending operation | Estimate |
| - | - |
| [createProject](https://docs.api.rask.ai/operations/createProject.md) | [estimateProject](https://docs.api.rask.ai/operations/estimateProject.md) |
| [createProjectCopies](https://docs.api.rask.ai/operations/createProjectCopies.md) | [estimateProjectCopies](https://docs.api.rask.ai/operations/estimateProjectCopies.md) |
| [createDub](https://docs.api.rask.ai/operations/createDub.md) | [estimateDub](https://docs.api.rask.ai/operations/estimateDub.md) |
| [generateSegments](https://docs.api.rask.ai/operations/generateSegments.md) | [estimateSegmentGeneration](https://docs.api.rask.ai/operations/estimateSegmentGeneration.md) |
| [createLipsync](https://docs.api.rask.ai/operations/createLipsync.md) | [estimateLipsync](https://docs.api.rask.ai/operations/estimateLipsync.md) |
| [createOnscreen](https://docs.api.rask.ai/operations/createOnscreen.md) | [estimateOnscreen](https://docs.api.rask.ai/operations/estimateOnscreen.md) |
| [createLocalization](https://docs.api.rask.ai/operations/createLocalization.md), [resumeJob](https://docs.api.rask.ai/operations/resumeJob.md) | [estimateLocalization](https://docs.api.rask.ai/operations/estimateLocalization.md) |

Send its `total_minutes` as `expected_cost_minutes`. **That value is a price cap, not a price:**

* A higher current price answers 409 [`cost_changed`](https://docs.api.rask.ai/errors/cost_changed), with `current_cost_minutes`, and spends nothing.
* An equal or lower price is charged as it is.
* Too few minutes answer 402 [`insufficient_balance`](https://docs.api.rask.ai/errors/insufficient_balance).

Some spends come later: the auto-dub after translation, an on-screen auto-start after the first dub, and each stage of a run. They are stored with the cap. If the price at that moment is above it, or the balance is short, the spend is skipped, uncharged, and the project or the job says why (for the auto-dub, `auto_dub.skipped_reason`).

Behind every request sit the key's [monthly caps](https://docs.api.rask.ai/authentication.md#spend-caps).

## The price rules

`round` is rounding half to even: 90 seconds is 1.5 minutes and rounds to 2, while 150 seconds is 2.5 minutes and also rounds to 2. `ceil` rounds up.

| Work | Minutes | Based on |
| - | - | - |
| Dub, redub ([createDub](https://docs.api.rask.ai/operations/createDub.md)) | `max(1, round(s/60))` | `s`: speech seconds of the voiced segments (every segment for `full`) |
| Auto-dub | `max(1, round(s/60))` | `s`: the processed media duration |
| Segment generation | `max(1, round(s/60))` | `s`: speech seconds of the chosen segments |
| Free dubbing variant | 0 | |
| Lip-sync, paid run | `max(1, ceil(minutes x m))`, with minutes = `max(1, round(duration/60))` | `duration`: the media's seconds, the whole of them also when the plan trims the run. `m` is 1 for `legacy`, and the plan's `lipsync_enhanced_cost_multiplier` for `enhanced` |
| Lip-sync, free run | 1 free lip-sync minute | The first 60 seconds |
| On-screen translation | `max(1, ceil(minutes x m))`, with minutes = `ceil(s/60)` | `s`: the media's seconds. `m` is the plan's `onscreen_cost_multiplier` |
| A localization run | The sum of its stages | Each stage at its own rule; a reused stage costs 0 |
| A project, a copy | 1 project credit each, 0 when the payer's credits are unlimited | Charged at the request |

**A dub has no cap at the full price.** A `changed_segments` dub costs the speech of the segments it voices. There is no point where a redub is cut off at what a full dub would cost, so the estimate is the number to trust.

Dub and segment-generation estimates state the rule in `details.pricing_rule`, and a localization estimate in `details.dub.pricing_rule`: `full`, `changed_speech`, `selected_speech` or `free_language`. Each minutes cost line has `credit_type`, `feature`, `minutes`, `charged_when` and `basis` (`billable_seconds`, `multiplier`). A project-credit line has `projects` instead of `minutes`, and no `basis`.

The text a dub voices is held to the speech it is priced on. [createDub](https://docs.api.rask.ai/operations/createDub.md), [generateSegments](https://docs.api.rask.ai/operations/generateSegments.md) and the dub of a run answer 422 [`validation_failed`](https://docs.api.rask.ai/errors/validation_failed) when a translation holds more than 60 characters per second of its segment, though any segment may hold 100 (`errors[].code`: `text_too_long_for_interval`). When every line passes, all the text one request voices may hold at most 3,600 characters for each minute its speech is priced at, also on a free dubbing variant (`text_too_long_for_price`). The estimate lists the same refusal in `reasons`.

## The anchor segment

A dub can reuse clips from [generateSegments](https://docs.api.rask.ai/operations/generateSegments.md) without voicing or charging them again, but a track can be rebuilt only when at least one segment is voiced. So when **every** changed segment already has a current clip, the shortest is voiced again, at its own speech price with **a minimum of 1 minute**, and its clip in the track is a new take.

The estimate discloses this before you pay: `details.assembly_anchor_segment_id` names the segment, and the notice `assembly_anchor_voiced` explains it. Details are in [Voice chosen segments](https://docs.api.rask.ai/v3/recipes/segment-generation.md#5-assemble-with-a-dub).

## Refunds

| What failed | What comes back |
| - | - |
| A job that charged minutes | Its minutes, whole. `onscreen_charge_failed` never charged |
| A dub that failed while voicing (`dub_voiceover_failed`) or merging (`dub_merge_failed`), or timed out (`dub_timeout`) | Its minutes, and also the project's credit, unless credits are unlimited. A project's credit comes back once at most |
| [generateSegments](https://docs.api.rask.ai/operations/generateSegments.md), when one segment failed | The whole job, also for segments already voiced |
| [createLipsync](https://docs.api.rask.ai/operations/createLipsync.md): no face, a failure, a timeout | Its minutes |
| A [localization run](https://docs.api.rask.ai/v3/recipes/localization-run.md) | Only the failed stage, by its type's rule. Stages that succeeded stay charged. Skipped and unreached stages were never charged |
| `project_processing` | Its project credit when transcription, audio separation, speaker detection or translation failed (`transcription_failed`, `no_speech_detected`, `audio_separation_failed`, `speaker_detection_failed`, `translation_failed`), when it timed out (`project_processing_timeout`), and when a copy failed. **Not** for `media_processing_failed`, `source_unavailable` or `no_audio_track`. `cost.refunded` on the job says which |
| An on-screen job canceled while queued | Its minutes |
| A project deleted while its jobs run | The work is discarded and **not** refunded. Only on-screen runs are refunded |

Refunds show on the job, in `cost.refunded` and `cost.refunded_at`, and in [the usage events](https://docs.api.rask.ai/operations/listUsageEvents.md), in `refunded_minutes`. A failed dub's refund also [closes the text again](https://docs.api.rask.ai/v3/concepts/paid-text.md) if it was the only dub charge.

## Which pool pays

| `credit_type` | Pool |
| - | - |
| `minutes` | The main pool |
| `lipsync_free_minutes` | Free lip-sync minutes, used by the free run |
| `projects` | Project credits, which count projects. Not in `total_minutes`; see `total_projects` |

All the pools belong to the workspace owner, and all workspaces of one owner share them. The balance is in [Spend, balance and errors](https://docs.api.rask.ai/v3/recipes/spend-balance-errors.md).


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