# 1. import the video
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": "de-de"}'
# 3. create the 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": "de-de",
"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以文件形式发送视频,或发布来自 YouTube、Google Drive、S3、Vimeo 或任何直接链接的视频。只需上传一次即可支持所有字幕语言。
传递 media_id 以及每个项目一种目标语言。不同语言的项目可同时运行。
等待任务成功完成,然后通过 GET /v3/projects/{project_id}/subtitles 以 .srt 或 .vtt 格式渲染字幕并将其保存在您的本地。
# pip install rask-sdk
from rask_sdk import Rask
rask = Rask() # reads RASK_API_KEY
uploaded = rask.jobs.wait(rask.uploads.upload_file("webinar.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="de-de"
)
# the price you accepted is the ceiling
created = rask.projects.create_project(
media_id=media_id,
target_language="de-de",
expected_cost_minutes=estimate.total_minutes,
)
processed = rask.jobs.wait(created.id)
# the .srt and .vtt files are among the project outputs
for o in rask.exports.list_project_outputs(processed.result.project_id).data:
print(o.kind, o.url)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": "de-de"}
# 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()
# the .srt and .vtt files are among the project outputs
outputs = requests.get(f"{API}/projects/{project['project_id']}/outputs",
headers=h).json()
for o in outputs["data"]:
print(o["kind"], o["url"])// 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: 'de-de' };
// 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());
// the .srt and .vtt files are among the project outputs
const outputs = await fetch(`${API}/projects/${project.project_id}/outputs`, { headers: h })
.then(r => r.json());
outputs.data.forEach(o => console.log(o.kind, o.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\":\"de-de\"}"
# 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 .srt and .vtt files
curl -s $API/projects/$ID/outputs -H "$AUTH" \
| jq -r '.data[] | "\(.kind)\t\(.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' => 'de-de'];
// 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);
// the .srt and .vtt files are among the project outputs
$outputs = json_decode(
$http->get("projects/{$project['project_id']}/outputs")->getBody(), true); 0s queued
3s running transcribing
48s running translating
70s succeeded the .srt and .vtt files are in the project outputs

es-mx 和 es-es 类似项目。项目记录 glossary.version,因此后续的修改绝不会悄悄改变已完成的工作。提供。每个 Rask 项目都会返回目标语言的 SRT 和 WebVTT 格式字幕文件。只需上传视频,为每种字幕语言创建一个项目,并在项目完成后下载文件。
每个项目提供两种格式:目标语言的 SRT 文件和 WebVTT (VTT) 文件。如果您的平台需要其他字幕格式,也可以获取包含时间戳的 JSON 片段格式文稿。
字幕文件为目标语言。若需获取原语言字幕,请阅读文稿片段:每个片段都包含带有起止时间的原文,只需几行代码即可将其转换为 SRT 或 VTT 文件。
支持 135 种以上的语言和地区选项(如 es-mx、pt-br 和 fr-ca),源语言多达 75 种。每个项目对应一种目标语言;您可以从同一个上传文件开始,为每种语言分别创建一个项目。
暂不支持。API 会返回供您的播放器或视频剪辑软件使用的字幕文件。如需获取已烧录字幕的视频,请使用 Rask 网页端应用。
文件包含文本和时间轴。字体、大小、颜色和位置均在您的视频播放器、应用或剪辑软件中设置,这使得同一个字幕文件可以通用。
文件包含的是口语对话。系统不会自动为听障观众生成音乐和音效描述;您可以在自己的字幕编辑环节中添加这些内容。
每个文稿片段都带有 SPEAKER_XX 格式的说话人标签,因此在为访谈和对话制作字幕时,您可以添加说话人姓名。
通过 API 修改片段的文本或时间,然后重新生成项目。字幕文件将与配音版本同时更新。重新生成按修改的片段计费,单次运行最低一分钟。
下载链接经过预签名,有效期为一小时。请将文件保存到您自己的存储中,或者重新获取项目以获得新链接。
可以。在包含字幕导入功能的套餐中,您可以在创建项目时上传源语言字幕、经过审核的目标语言 SRT 字幕,或两者都上传。您可以使用现有字幕作为源,也可以保留已审核的目标语言字幕和配音翻译。
项目按视频分钟数计费,向上取整至下一个完整分钟,费用从 Rask 应用的同一分钟数额度中扣除。价格包含转写、翻译、字幕和配音版本。在符合条件的标准套餐中,额外分钟数的费用为每分钟 3 美元。企业版定价则根据您的具体协议定制。
API 访问权限适用于创作者专业版、商业版和企业版套餐,具体功能由您的套餐决定。您可以在应用中创建 API 密钥并立即开始调用。企业条款、大宗定价和自定义语言覆盖范围请联系我们的团队咨询。