Translate subtitles and make a dub script
translate_subtitlesUse this when the user wants captions or a spoken script in another language, for example "translate these subtitles to Spanish", "make a French dub script for my talk". Pass the transcript_id from transcribe_media, or the text of an SRT or VTT file the user owns as subtitles with source_lang and confirm_rights true (only after the user says they own the recording or may use it). Always pass target_lang. Limits: about 18,000 characters per call (roughly 20 minutes of speech) and a daily allowance of characters per user and in total. Returns translated SRT and VTT with the original times, and a dub script with one spoken line per segment, its start and end, max_chars for the time it has and a fit of ok, tight or long (trim with include). Translated with Cloudflare Workers AI (m2m100), about $0.0002 per 1,000 characters; over-long dub lines are shortened with a small Llama model. Nothing is stored. Pass library_id only if transcribe_media returned one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include | No | What to return (default all three): translated SRT captions, translated VTT captions, a dub script with one spoken line per segment. | |
| subtitles | No | The text of an SRT or WebVTT file the user owns or may use. Give this or transcript_id. | |
| library_id | No | The library_id that transcribe_media returned. Only needed when transcribe_media returned one; leave it out otherwise. | |
| source_lang | No | Language of the text. Needed for subtitles; for a transcript the language it was detected in is used. | |
| target_lang | Yes | Language to translate into, as a two-letter code such as es, fr, de, ja, ar or hi. | |
| transcript_id | No | The transcript_id from transcribe_media. Give this or subtitles. | |
| confirm_rights | No | Set true only after the user has said they own this recording or have the rights to translate it. Required with subtitles. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| srt | No | ||
| vtt | No | ||
| as_of | Yes | ||
| model | Yes | ||
| notes | Yes | ||
| usage | Yes | ||
| source | Yes | ||
| status | Yes | ||
| target | Yes | ||
| cue_count | Yes | ||
| dub_model | No | Present when some dub lines were shortened by this model. | |
| dub_script | No |