# 1. import the video - YouTube, Drive, Vimeo or a direct URL
curl -X POST https://api.rask.ai/v3/media/import \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtu.be/..."}'
# 2. the price first - free, and it changes nothing
curl -X POST https://api.rask.ai/v3/projects/estimate \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"media_id": "...", "target_language": "es-mx"}'
# 3. create the dubbing project - the price you accepted is the ceiling
curl -X POST https://api.rask.ai/v3/projects \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"media_id": "...",
"target_language": "es-mx",
"expected_cost_minutes": 12
}'# Wait on the job instead of polling: one request, up to 20 seconds.
curl -s "https://api.rask.ai/v3/jobs/$JOB_ID?wait_seconds=20" \
-H "Authorization: Bearer $RASK_API_KEY" | jq .status以多部分表单数据(multipart form data)形式发送文件,或发布链接。支持的链接来源包括YouTube、Google Drive、S3、Vimeo以及任何直接下载URL。在您花费任何费用之前,返回媒体ID和完整的技术元数据。
将媒体ID作为 media_id 传入,并指定目标语言。还可以选择附带您自己的文稿或词汇表。配音将立即开始。
读取 status 直到其显示为 succeeded,然后下载配音视频、音频轨道和字幕文件。
# pip install rask-sdk
from rask_sdk import Rask
rask = Rask() # reads RASK_API_KEY
uploaded = rask.jobs.wait(rask.uploads.upload_file("q3-launch.mp4").id)
media_id = uploaded.result.media_id
# the price first - free, and it changes nothing
estimate = rask.projects.estimate_project(
media_id=media_id, target_language="es-mx"
)
# the price you accepted is the ceiling
created = rask.projects.create_project(
media_id=media_id,
target_language="es-mx",
expected_cost_minutes=estimate.total_minutes,
)
processed = rask.jobs.wait(created.id)
outputs = rask.exports.list_project_outputs(processed.result.project_id).data
print(next(o.url for o in outputs if o.kind == "dubbed_video"))import os, requests
API = "https://api.rask.ai/v3"
h = {"Authorization": f"Bearer {os.environ['RASK_API_KEY']}"}
job = requests.post(f"{API}/media/import", headers=h,
json={"url": "https://youtu.be/..."}).json()
media_id = requests.get(f"{API}/jobs/{job['id']}?wait_seconds=20",
headers=h).json()["result"]["media_id"]
order = {"media_id": media_id, "target_language": "es-mx"}
# the price first - free, and it changes nothing
estimate = requests.post(f"{API}/projects/estimate", headers=h, json=order).json()
# the price you accepted is the ceiling
project = requests.post(f"{API}/projects", headers=h,
json={**order,
"expected_cost_minutes": estimate["total_minutes"]}).json()
outputs = requests.get(f"{API}/projects/{project['project_id']}/outputs",
headers=h).json()
print(next(o["url"] for o in outputs["data"] if o["kind"] == "dubbed_video"))// no dependencies, Node 18+ global fetch
const API = 'https://api.rask.ai/v3';
const h = {
Authorization: `Bearer ${process.env.RASK_API_KEY}`,
'Content-Type': 'application/json',
};
const imported = await fetch(`${API}/media/import`, {
method: 'POST', headers: h,
body: JSON.stringify({ url: 'https://youtu.be/...' }),
}).then(r => r.json());
const job = await fetch(`${API}/jobs/${imported.id}?wait_seconds=20`, { headers: h })
.then(r => r.json());
const order = { media_id: job.result.media_id, target_language: 'es-mx' };
// the price first - free, and it changes nothing
const estimate = await fetch(`${API}/projects/estimate`, {
method: 'POST', headers: h, body: JSON.stringify(order),
}).then(r => r.json());
// the price you accepted is the ceiling
const project = await fetch(`${API}/projects`, {
method: 'POST', headers: h,
body: JSON.stringify({ ...order, expected_cost_minutes: estimate.total_minutes }),
}).then(r => r.json());
const outputs = await fetch(`${API}/projects/${project.project_id}/outputs`, { headers: h })
.then(r => r.json());
console.log(outputs.data.find(o => o.kind === 'dubbed_video')?.url);API=https://api.rask.ai/v3
AUTH="Authorization: Bearer $RASK_API_KEY"
JSON="Content-Type: application/json"
# 1. import the video, then wait for the media id
JOB=$(curl -s -X POST $API/media/import -H "$AUTH" -H "$JSON" \
-d '{"url": "https://youtu.be/..."}' | jq -r .id)
MEDIA=$(curl -s "$API/jobs/$JOB?wait_seconds=20" -H "$AUTH" | jq -r .result.media_id)
ORDER="{\"media_id\":\"$MEDIA\",\"target_language\":\"es-mx\"}"
# 2. the price first - free, and it changes nothing
CAP=$(curl -s -X POST $API/projects/estimate -H "$AUTH" -H "$JSON" \
-d "$ORDER" | jq -r .total_minutes)
# 3. the price you accepted is the ceiling
ID=$(curl -s -X POST $API/projects -H "$AUTH" -H "$JSON" \
-d "$(jq -c --argjson cap "$CAP" '. + {expected_cost_minutes:$cap}' <<<"$ORDER")" \
| jq -r .project_id)
# 4. collect the dubbed video
curl -s $API/projects/$ID/outputs -H "$AUTH" \
| jq -r '.data[] | select(.kind == "dubbed_video") | .url'<?php
use GuzzleHttp\Client;
$http = new Client([
'base_uri' => 'https://api.rask.ai/v3/',
'headers' => ['Authorization' => 'Bearer ' . getenv('RASK_API_KEY')],
]);
$job = json_decode($http->post('media/import',
['json' => ['url' => 'https://youtu.be/...']])->getBody(), true);
$media = json_decode($http->get("jobs/{$job['id']}?wait_seconds=20")->getBody(), true);
$order = ['media_id' => $media['result']['media_id'], 'target_language' => 'es-mx'];
// the price first - free, and it changes nothing
$estimate = json_decode($http->post('projects/estimate',
['json' => $order])->getBody(), true);
// the price you accepted is the ceiling
$project = json_decode($http->post('projects', ['json' => $order + [
'expected_cost_minutes' => $estimate['total_minutes'],
]])->getBody(), true);
$outputs = json_decode(
$http->get("projects/{$project['project_id']}/outputs")->getBody(), true); 0s queued
3s running transcribing
48s running translating
72s running voicing
128s running merging
150s succeeded

es-mx 和 es-es 类似项目。项目记录 glossary.version,因此后续的修改绝不会悄悄改变已完成的工作。API 访问权限适用于创作者专业版、商业版和企业版套餐,具体功能由您的套餐决定。您可以在应用中创建 API 密钥并立即开始调用。企业条款、大宗定价和自定义语言覆盖范围请联系我们的团队咨询。
只需在Authorization: Bearer标头中使用一个API密钥。无需令牌交换,也无需刷新。可为每个集成设置具有所需权限的专属密钥,并为其设置每月消费限额。
采用异步处理并内置等待机制。创建项目会立即返回一个任务。调用 GET /v3/jobs/{job_id}?wait_seconds=20,请求会在配音完成时立即返回,因此不再需要编写循环等待和轮询的代码。
每项付费操作都提供一项免费估算,其定价机制与实际收费相同。将该数值作为 expected_cost_minutes 返回,它即成为上限:若实际费用等于或低于该数值,则按原价收费;若高于该数值,则请求失败且不收取任何费用。每个 API 密钥还可以设置各自的月度支出限额。
支持135种以上目标语言,包括西班牙语、法语、德语、葡萄牙语、印地语、日语和韩语,并在需要时提供地区变体(例如 target_language 使用 es-mx 而非 es)。源语言会自动检测,您也可以手动设置。源语言和目标语言代码的完整列表请参见API文档。对于目录以外的语言,请联系我们的团队咨询可行性及可用方案。
即时声音克隆在支持的目标语言中直接使用源视频中说话者的声音。若要使用可重复使用的自定义声音克隆,请在 Rask 应用中经说话者授权后创建,然后通过 API 进行分配。效果取决于源音频、所选语言以及声音。
这取决于视频长度、说话人数、目标语言以及队列长度。每个项目都会报告从转写到合并等各个阶段的状态,以便您向用户展示实时的处理进度。
支持七种视频格式(MP4、MOV、MKV、AVI、WebM、M4V、3GP)和四种音频格式(MP3、WAV、FLAC、M4A)。您还可以直接通过 YouTube、Google Drive、S3、Vimeo 或直接链接导入,而无需手动上传。
系统会自动检测并分离源音频中的不同说话者,并为每个人在目标语言中分配相应声音。您可以为每个说话者覆盖分配,或者在创建项目时直接传入说话人数(num_speakers,如果您已知晓具体人数)。
可以。上传 .srt 文件即可生成字幕,并在创建项目时传入其 ID。你还可以让 API 先进行转写,然后按片段编辑脚本。
每个完成的项目除了视频和音频轨道外,还提供 .srt 和 .vtt 格式的字幕文件,并与配音完美同步。
提供五个语言版本:TypeScript、Python、Go、Java和PHP,它们由同一个OpenAPI规范生成并与之一并发布。每个版本都提供全部82个操作,包括价格预估和任务等待功能。此外还提供用于无代码工作流的n8n节点。
仅需支付修改部分的内容。编辑和新增片段的时长会相加,并向上取整到最接近的分钟数,因此修正几行台词大约只需花费一分钟的费用。