# 1. exchange your client id and secret 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 the video - file, or a YouTube, Drive, S3, Vimeo or direct link
curl -X POST https://api.rask.ai/api/library/v1/media/link \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"link": "https://youtu.be/...", "name": "Q3 launch"}'
# 3. create the project - transcription, translation and dubbing start
curl -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"video_id\": \"$VIDEO_ID\", \"dst_lang\": \"es-mx\"}"# Poll until merging_done, then collect the files
curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" \
| jq '{status, translated_video, voiceover, translation_srt_path}'以多部分表单数据(multipart form data)形式发送视频或音频文件,或者发布来自 YouTube、Google Drive、S3、Vimeo 或任何直接 URL 的链接。在您产生任何消费之前,即可获取媒体 ID 和文件元数据。
将媒体ID作为 video_id 传入并指定目标语言。也可以选择附带您自己的文稿或术语表。处理过程将立即开始。
持续读取状态,直到显示 merging_done,然后下载配音视频、音轨、字幕文件和文稿。
# pip install git+ssh://[email protected]/braskai/rask-sdk.git@main
import asyncio
from rask_sdk import clients, enums, schemas
async def main():
# the client exchanges your credentials for tokens and refreshes them
client = clients.RaskSDKClient(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
media = await client.create_media_link(data=schemas.MediaCreateLink(link="https://youtu.be/..."))
while media.status is enums.MediaStatus.PROCESSING:
await asyncio.sleep(5)
media = await client.get_media(media_id=media.id)
job = await client.create_project(data=schemas.ProjectCreate(video_id=media.id, dst_lang="es-mx"))
while job.status is not enums.ProjectStatus.MERGING_DONE:
await asyncio.sleep(10)
job = await client.get_project(project_id=job.id)
print(job.translated_video, job.translation_srt_path, job.translation_vtt_path)
asyncio.run(main())import 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}"}
with open("launch.mp4", "rb") as f:
media = requests.post(f"{API}/api/library/v1/media", headers=h,
params={"kind": "video"}, files={"data": f}).json()
while media["status"] == "processing":
time.sleep(5)
media = requests.get(f"{API}/api/library/v1/media/{media['id']}", headers=h).json()
pid = requests.post(f"{API}/v2/projects", headers=h,
json={"video_id": media["id"], "dst_lang": "de-de"}).json()["id"]
while (p := requests.get(f"{API}/v2/projects/{pid}", headers=h).json())["status"] != "merging_done":
time.sleep(10)
for field in ("translated_video", "translated_audio", "translation_srt_path"):
print(field, p[field]) # presigned links, valid for one hour// no dependencies, Node 18+ global fetch
const API = 'https://api.rask.ai';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
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 call = (method, path, body) => fetch(API + path, { method, headers: h, body: body && JSON.stringify(body) }).then((r) => r.json());
let media = await call('POST', '/api/library/v1/media/link', { link: 'https://youtu.be/...' });
while (media.status === 'processing') { await sleep(5000); media = await call('GET', `/api/library/v1/media/${media.id}`); }
let p = await call('POST', '/v2/projects', { video_id: media.id, dst_lang: 'ja-jp' });
while (p.status !== 'merging_done') { await sleep(10000); p = await call('GET', `/v2/projects/${p.id}`); }
const { translated_video, voiceover, translation_vtt_path } = p;
console.log({ translated_video, voiceover, translation_vtt_path });# 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" -H "Content-Type: application/json" \
-d '{"link": "https://youtu.be/..."}' | jq -r .id)
# 3. create the project once the media status is ready
ID=$(curl -s -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"video_id\": \"$VIDEO_ID\", \"dst_lang\": \"pt-br\"}" | jq -r .id)
# 4. wait for merging_done, then read the links
until [ "$(curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" | jq -r .status)" = merging_done ]; do
sleep 10
done
curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" \
| jq '{translated_video, translated_audio, translation_srt_path}'<?php
use GuzzleHttp\Client;
$http = new Client(['base_uri' => 'https://api.rask.ai']);
$json = fn($r) => json_decode($r->getBody(), true);
$auth = $json((new Client)->post('https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token',
['auth' => [$clientId, $clientSecret], 'form_params' => ['grant_type' => 'client_credentials']]));
$h = ['Authorization' => 'Bearer ' . $auth['access_token']];
$media = $json($http->post('/api/library/v1/media/link', ['headers' => $h, 'json' => [
'link' => 'https://youtu.be/...']]));
while ($media['status'] === 'processing') {
sleep(5);
$media = $json($http->get("/api/library/v1/media/{$media['id']}", ['headers' => $h]));
}
$p = $json($http->post('/v2/projects', ['headers' => $h, 'json' => [
'video_id' => $media['id'], 'dst_lang' => 'fr-fr']]));
while ($p['status'] !== 'merging_done') {
sleep(10);
$p = $json($http->get("/v2/projects/{$p['id']}", ['headers' => $h]));
}
echo $p['translated_video'], PHP_EOL, $p['translation_srt_path'], PHP_EOL; 0s created
11s transcription_started
87s translation_started
99s voiceover_started
154s merging_started
165s merging_done

es-mx 和 es-es 类似内容。项目记录 glossary_version,因此后续的修改绝不会悄悄改变已完成的工作。Rask AI API 是一个用于视频本土化的 REST API。它可以转写视频中的语音、进行翻译、使用 AI 声音或声音克隆进行配音、添加可选的唇形同步,并返回字幕、音轨和文本转写,所有操作都在一个项目中完成。
AI 配音、视频翻译、视频本土化、声音克隆、唇形同步、视频文本转语音、语音转文本、视频转写和字幕。它们共用一个身份验证、一个项目对象和一个分钟资源池,并且每个功能都有包含详细信息和代码的专属页面。
创建者专业版(Creator Pro)、商业版和企业版套餐均提供API访问权限,具体功能取决于您的套餐。您可以在应用中生成客户端ID和密钥并立即开始调用。企业版条款、批量定价和定制语言范围需通过我们的团队沟通。
该 API 使用 OAuth 2.0 客户端凭证。请在令牌端点用你的客户端 ID 和密钥交换访问令牌,然后在每个请求中将其作为 Bearer 令牌发送。令牌的有效期为一个 hour(一小时);请将其缓存,并在过期时请求新令牌。
是的。官方 Python SDK 可以在 GitHub 的 braskai/rask-sdk 上找到,它会为您处理令牌。REST API 适用于任何编程语言;此页面提供 Python、Node、cURL 和 PHP 的完整示例。
源音频支持 75 种语言,具备自动语言检测功能,并提供 135 种以上的语言和地区选项作为目标语言(例如 es-mx 或 pt-br)。语音克隆功能可在支持的语音克隆语言中使用;其余语言则由 AI 语音预设覆盖。
使用量按视频分钟数计费,向上取整至整分钟,费用从 Rask 应用的相同分钟数池中扣除。在符合条件的标准套餐中,额外分钟数的费用为 3 美元/分钟,企业版定价则根据您的协议量身定制。重新生成按修改后的片段计费,每次运行最少计费一分钟,而口型同步则按每个完整视频的生成单独计费。
没有。没有速率限制、没有并发配额,也没有每个密钥的流量限制,因此您可以同时处理整个视频目录和所有目标语言。
Poll GET /v2/projects/{id} for the status of each project; the statuses are documented, so you can show real progress. Webhook delivery is part of enterprise onboarding.
视频格式支持 MP4、MOV、MKV、AVI、WebM、M4V 和 3GP,音频格式支持 MP3、WAV、FLAC 和 M4A,或者也可以使用来自 YouTube、Google Drive、S3、Vimeo 的链接或直接网址。
可以。您可以上传源字幕和翻译后的 SRT 文件,或者发送文本片段,并在创建项目时传入 transcript_id。然后,Rask 会为您的审核通过的文本进行配音。
不是。API 处理的是录制的视频和音频文件,并以文件的形式交付结果。对于实时语音代理或实时字幕,流式语音 API 是更好的选择。
Brask Inc 拥有 SOC 2 Type II 认证并遵循 GDPR,其信任中心提供实时控制状态。自定义语音克隆必须在说话者同意的前提下创建。