# 1. exchange client credentials for a token (valid 1 hour)
curl -X POST https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d "grant_type=client_credentials"# 2. upload by link - YouTube, Drive, S3, Vimeo or direct URL
curl -X POST https://api.rask.ai/api/library/v1/media/link \
-H "Authorization: Bearer $TOKEN" \
-d '{"link": "https://youtu.be/...", "name": "Q3 launch"}'# 3. create the dubbing project - this starts the dub
curl -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" \
-d '{
"video_id": "b8f7835d-e8c9-4ff4-8e34-5c336d818319",
"dst_lang": "es-mx",
"name": "Q3 launch"
}'# Poll the project until status is merging_done.while :; do
curl -s https://api.rask.ai/v2/projects/$ID \
-H "Authorization: Bearer $TOKEN" | jq .status
sleep 10done以多部分表单数据(multipart form data)形式发送文件,或发布链接。支持的链接来源包括YouTube、Google Drive、S3、Vimeo以及任何直接下载URL。在您花费任何费用之前,返回媒体ID和完整的技术元数据。
将媒体ID作为 video_id 传入并选择目标语言。可选择附加您自己的脚本或词汇表。配音将立即开始。
读取状态直到显示merging_done(合并完成),然后下载配音视频、音频轨道和字幕文件。
# pip install git+https://github.com/braskai/rask-sdk
import asyncio
from rask_sdk import RaskSDKClient
async def main():
client = RaskSDKClient(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
media = await client.upload_media_link(link="https://youtu.be/...")
project = await client.create_project(video_id=media.id, dst_lang="es-mx")
while project.status != "merging_done":
await asyncio.sleep(10)
project = await client.get_project(project.id)
print(project.translated_video, project.translation_srt_path)
asyncio.run(main())import os, time, requests
AUTH = "https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token"
API = "https://api.rask.ai"
token = requests.post(AUTH, auth=(CLIENT_ID, CLIENT_SECRET),
data={"grant_type": "client_credentials"}).json()["access_token"]
h = {"Authorization": f"Bearer {token}"}
media = requests.post(f"{API}/api/library/v1/media/link", headers=h,
json={"link": "https://youtu.be/..."}).json()
project = requests.post(f"{API}/v2/projects", headers=h,
json={"video_id": media["id"], "dst_lang": "es-mx"}).json()
while project["status"] != "merging_done":
time.sleep(10)
project = requests.get(f"{API}/v2/projects/{project['id']}", headers=h).json()
print(project["translated_video"])// no dependencies, Node 18+ global fetch
const API = 'https://api.rask.ai';
const auth = await fetch('https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token', {
method: 'POST',
headers: { Authorization: 'Basic ' + btoa(`${CLIENT_ID}:${CLIENT_SECRET}`) },
body: new URLSearchParams({ grant_type: 'client_credentials' }),
}).then(r => r.json());
const h = { Authorization: `Bearer ${auth.access_token}`, 'Content-Type': 'application/json' };
const media = await fetch(`${API}/api/library/v1/media/link`, {
method: 'POST', headers: h,
body: JSON.stringify({ link: 'https://youtu.be/...' }),
}).then(r => r.json());
let project = await fetch(`${API}/v2/projects`, {
method: 'POST', headers: h,
body: JSON.stringify({ video_id: media.id, dst_lang: 'es-mx' }),
}).then(r => r.json());
while (project.status !== 'merging_done') {
await new Promise(r => setTimeout(r, 10000));
project = await fetch(`${API}/v2/projects/${project.id}`, { headers: h }).then(r => r.json());
}
console.log(project.translated_video);# 1. token (valid 1 hour - cache and reuse it)
TOKEN=$(curl -s -X POST https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d "grant_type=client_credentials" | jq -r .access_token)
# 2. upload by link
VIDEO_ID=$(curl -s -X POST https://api.rask.ai/api/library/v1/media/link \
-H "Authorization: Bearer $TOKEN" \
-d '{"link": "https://youtu.be/..."}' | jq -r .id)
# 3. create the dubbing project
ID=$(curl -s -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" \
-d "{\"video_id\": \"$VIDEO_ID\", \"dst_lang\": \"es-mx\"}" | jq -r .id)
# 4. poll, then download
while [ "$(curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" | jq -r .status)" != "merging_done" ]; do
sleep 10
done<?php
use GuzzleHttp\Client;
$http = new Client(['base_uri' => 'https://api.rask.ai']);
$auth = json_decode((new Client)->post(
'https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token',
['auth' => [$clientId, $clientSecret],
'form_params' => ['grant_type' => 'client_credentials']]
)->getBody(), true);
$h = ['Authorization' => 'Bearer ' . $auth['access_token']];
$media = json_decode($http->post('/api/library/v1/media/link',
['headers' => $h, 'json' => ['link' => 'https://youtu.be/...']])->getBody(), true);
$project = json_decode($http->post('/v2/projects',
['headers' => $h, 'json' => ['video_id' => $media['id'], 'dst_lang' => 'es-mx']])->getBody(), true);
while ($project['status'] !== 'merging_done') {
sleep(10);
$project = json_decode($http->get("/v2/projects/{$project['id']}",
['headers' => $h])->getBody(), true);
} 0s created
12s transcription_started
70s translation_started
95s voiceover_started
150s merging_started
170s merging_done

es-mx 和 es-es 类似项目。项目记录 glossary_version,因此后续的修改绝不会悄悄改变已完成的工作。付费套餐已包含API访问权限。您可以在应用中生成客户端ID和密钥,然后立即开始调用。企业条款、大容量优惠和自定义语言支持需要通过我们的团队进行安排。
OAuth 2.0 客户端凭据:使用您的客户端 ID 和密钥来换取短期访问令牌。令牌的有效期为一小时,请进行缓存以便重复使用。
异步处理。创建项目后会立即返回并开始配音。请轮询 GET /v2/projects/{id} 直到状态变为 merging_done。Webhooks 消息推送适用于企业版客户入驻。
每个请求都会按原样接收。吞吐量取决于处理队列的长度,而处理优先级则属于企业版条款的一部分。
支持 135 种以上的目标语言,包括西班牙语、法语、德语、葡萄牙语、印地语、日语和韩语,并且在需要时提供地区变体(例如 dst_lang 可使用 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 格式的字幕文件,并与配音完美同步。
官方在 GitHub 上发布了异步 Python SDK,具有稳定且向后兼容的接口。对于其他语言,你可以通过已发布的 OpenAPI 规范生成客户端。此外,还有一个用于无代码工作流的 n8n 节点。
仅需支付修改部分的内容。编辑和新增片段的时长会相加,并向上取整到最接近的分钟数,因此修正几行台词大约只需花费一分钟的费用。