# 1. import the audio or 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://example.com/interview.mp3"}'
# 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": "en-us"}'
# 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": "en-us",
"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 链接或任意文件直链。在产生任何费用前,您即可获取媒体 ID 和文件元数据。
传入 media_id 和目标语言。如果您知道源语言或说话人人数,也可以一并传入。语音识别将立即开始。
文稿片段一经生成即可读取,此时系统会继续处理译制媒体。项目完成后,您即可下载字幕和媒体文件。
# pip install rask-sdk
from rask_sdk import Rask
rask = Rask() # reads RASK_API_KEY
uploaded = rask.jobs.wait(rask.uploads.upload_file("interview.mp3").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="en-us"
)
# the price you accepted is the ceiling
created = rask.projects.create_project(
media_id=media_id,
target_language="en-us",
expected_cost_minutes=estimate.total_minutes,
)
processed = rask.jobs.wait(created.id)
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://example.com/interview.mp3"}).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": "en-us"}
# 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()
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://example.com/interview.mp3' }),
}).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: 'en-us' };
// 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());
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 file, then wait for the media id
JOB=$(curl -s -X POST $API/media/import -H "$AUTH" -H "$JSON" \
-d '{"url": "https://example.com/interview.mp3"}' | 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\":\"en-us\"}"
# 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 transcript and every other output
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://example.com/interview.mp3']])->getBody(), true);
$media = json_decode($http->get("jobs/{$job['id']}?wait_seconds=20")->getBody(), true);
$order = ['media_id' => $media['result']['media_id'], 'target_language' => 'en-us'];
// 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 speaker labels
72s succeeded the transcript is in the project outputs

es-mx 和 es-es 同样适用。项目会记录 glossary.version,因此后续编辑不会在您不知情的情况下改动已完成的内容。是的。每个 Rask 项目都从语音识别开始。导入音频或视频并创建项目后,您可以调用 GET /v3/projects/{project_id}/transcript,逐段读取带说话人标签和时间戳的文稿。同一项目还会翻译文稿,并返回字幕和配音音频。
API 支持 75 种源语言。将 source_language 留空即可自动检测语言,也可传入 en 或 de 等语言代码。翻译文稿时,可从超过 135 种语言及地区变体中选择目标语言。
可以。您可以上传 MP3、WAV、FLAC 或 M4A 格式的音频文件,例如播客、访谈和通话录音。项目会以与视频相同的方式进行转录。
可以。API 会自动识别不同的说话人,并为每个片段添加 SPEAKER_XX 格式的说话人标签。如果您知道说话人数,可以通过 num_speakers 参数指定。您也可以通过 API 更正任意片段的说话人标签。
不会。时间戳按片段提供,每个片段都有开始和结束时间,格式为 HH:MM:SS,mmm。字幕也使用这些时间来控制显示和消失的时刻。如果您需要每个词的时间戳,请选择专用的语音转文字 API。
不支持。Rask 转录的是预先录制好的完整音频和视频。实时字幕、语音智能体、对话式人工智能和联络中心等场景需要在说话过程中即时获取文字,更适合使用流式语音转文字 API。
准确度取决于音频本身。麦克风、口音、多人同时说话以及背景噪声都会影响识别效果。您可以选取一段自己的录音测试 API,并在发布或翻译文稿前,通过 API 更正任何有误的片段。
语音识别不支持自定义词表。您可以通过 segments 端点更正文稿中的特定词语。翻译文稿时,术语表可确保产品名称、专有名词和专业术语的译法一致。
项目完成后,会提供 SRT 和 VTT 两种格式的目标语言字幕文件。源语言文稿以 JSON 格式分段返回,每段都包含开始和结束时间,只需几行代码即可将其转换为 SRT 文件。
可以。如果您的套餐支持导入文稿,您可以在创建项目时,以 SRT 文件或带时间戳的文本片段形式提交现有的源语言文稿、已审核通过的目标语言译文,或同时提交两者。Rask 可以翻译您的源语言文稿,也可以使用您已审核通过的译文配音。
项目按音频或视频时长计费,时长向上取整到整分钟,与 Rask 应用共用分钟额度。费用包含转录、翻译、旁白和字幕。符合条件的标准套餐按每分钟 $3 收取超额费用。Enterprise 套餐按您的协议定价。如果您只需要文稿,使用专用的语音转文字 API 费用更低。
您可以先在 Rask 应用中免费试用,无需提供银行卡信息,即可用自己的文件测试转录和翻译。Creator Pro、Business 和 Enterprise 套餐均提供 API 访问权限,具体功能取决于您的套餐。
Creator Pro、Business 和 Enterprise 套餐均提供 API 访问权限,具体功能取决于您的套餐。您可以在应用中创建 API 密钥,并立即开始调用。有关 Enterprise 套餐条款、批量定价和定制语言支持,请联系我们的团队。