# 1. the lip-sync state of a dubbed project
curl https://api.rask.ai/v3/projects/$ID/lipsync \
-H "Authorization: Bearer $RASK_API_KEY"
# "video_has_face": true, "free_trial_run_available": true
# 2. the price first - free, and it changes nothing
curl -X POST https://api.rask.ai/v3/projects/$ID/lipsync/estimate \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "enhanced"}'
# 3. lip-sync the full video - the price you accepted is the ceiling
curl -X POST https://api.rask.ai/v3/projects/$ID/lipsync \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "enhanced", "expected_cost_minutes": 12}'# Starting lip-sync returns a job. Wait on it instead of polling:
# one request, up to 20 seconds, and it returns the moment the task is done.
curl -s "https://api.rask.ai/v3/jobs/$JOB_ID?wait_seconds=20" \
-H "Authorization: Bearer $RASK_API_KEY" | jq .status导入输入视频或发送公开URL,创建包含目标语言的项目并等待任务成功。口型同步需要该项目生成的配音视频。
人脸检查任务用于确认视频中至少有一个人脸,通常会自动开始。如果未开始,请手动运行一次该项目。
启动口型同步任务,在任务中跟踪从0到100的进度,然后从项目输出中下载视频。
import os, requests
API = "https://api.rask.ai/v3"
h = {"Authorization": f"Bearer {os.environ['RASK_API_KEY']}"}
# lip-sync runs on a project that has already been dubbed
state = requests.get(f"{API}/projects/{project_id}/lipsync", headers=h).json()
assert state["video_has_face"]
# the price first - free, and it changes nothing
estimate = requests.post(f"{API}/projects/{project_id}/lipsync/estimate", headers=h,
json={"model": "enhanced"}).json()
# the price you accepted is the ceiling
job = requests.post(f"{API}/projects/{project_id}/lipsync", headers=h,
json={"model": "enhanced",
"expected_cost_minutes": estimate["total_minutes"]}).json()
requests.get(f"{API}/jobs/{job['id']}?wait_seconds=20", headers=h).json()
for o in requests.get(f"{API}/projects/{project_id}/outputs", headers=h).json()["data"]:
print(o["kind"], o["url"])# pip install rask-sdk
from rask_sdk import Rask
rask = Rask() # reads RASK_API_KEY
# the price first - free, and it changes nothing
estimate = rask.projects.estimate_project(
media_id=media_id, target_language="es-mx"
)
# dub, then lip-sync what it produced
created = rask.projects.create_project(
media_id=media_id,
target_language="es-mx",
expected_cost_minutes=estimate.total_minutes,
)
dubbed = rask.jobs.wait(created.id)
for o in rask.exports.list_project_outputs(dubbed.result.project_id).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',
};
// lip-sync runs on a project that has already been dubbed
const state = await fetch(`${API}/projects/${projectId}/lipsync`, { headers: h })
.then(r => r.json());
// the price first - free, and it changes nothing
const estimate = await fetch(`${API}/projects/${projectId}/lipsync/estimate`, {
method: 'POST', headers: h, body: JSON.stringify({ model: 'enhanced' }),
}).then(r => r.json());
// the price you accepted is the ceiling
const job = await fetch(`${API}/projects/${projectId}/lipsync`, {
method: 'POST', headers: h,
body: JSON.stringify({ model: 'enhanced', expected_cost_minutes: estimate.total_minutes }),
}).then(r => r.json());
await fetch(`${API}/jobs/${job.id}?wait_seconds=20`, { headers: h }).then(r => r.json());
const outputs = await fetch(`${API}/projects/${projectId}/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. the dubbed video must have a usable face
curl -s $API/projects/$ID/lipsync -H "$AUTH" | jq .video_has_face
# 2. the price first - free, and it changes nothing
CAP=$(curl -s -X POST $API/projects/$ID/lipsync/estimate -H "$AUTH" -H "$JSON" \
-d '{"model": "enhanced"}' | jq -r .total_minutes)
# 3. start lip-sync - the price you accepted is the ceiling
JOB=$(curl -s -X POST $API/projects/$ID/lipsync -H "$AUTH" -H "$JSON" \
-d "{\"model\":\"enhanced\",\"expected_cost_minutes\":$CAP}" | jq -r .id)
# 4. wait on the job, then collect the lip-synced video
curl -s "$API/jobs/$JOB?wait_seconds=20" -H "$AUTH" | jq .status
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')],
]);
// lip-sync runs on a project that has already been dubbed
$state = json_decode($http->get("projects/{$projectId}/lipsync")->getBody(), true);
// the price first - free, and it changes nothing
$estimate = json_decode($http->post("projects/{$projectId}/lipsync/estimate",
['json' => ['model' => 'enhanced']])->getBody(), true);
// the price you accepted is the ceiling
$job = json_decode($http->post("projects/{$projectId}/lipsync", ['json' => [
'model' => 'enhanced',
'expected_cost_minutes' => $estimate['total_minutes'],
]])->getBody(), true);
$http->get("jobs/{$job['id']}?wait_seconds=20");
$outputs = json_decode(
$http->get("projects/{$projectId}/outputs")->getBody(), true); 0s queued lip-sync task accepted
8s running face check
40s running generating
180s running merging
210s succeeded the lip-synced video is in the project outputs

es-mx 和 es-es 类似项目。项目记录 glossary.version,因此后续的修改绝不会悄悄改变已完成的工作。可以。Rask口型同步API适用于您的项目配音的任何视频。请检查视频中是否有人脸,使用 POST /v3/projects/{project_id}/lipsync/estimate 预估任务,启动任务并在完成后下载同步好口型的视频。验证仅需一个API密钥,因此集成方式与Rask API的其他部分保持一致。
口型同步适用于翻译后的视频。请先创建并配音您的项目,在该任务成功且项目的输出中列出配音视频后,再启动口型同步。
口型同步使用项目的配音音频。若要使用您自己的措辞,请编辑翻译后的文本或通过您自己的 .srt 创建脚本,重新为项目配音,然后在导出的新版本上运行口型同步。
Rask 的口型同步功能针对的是您输入视频中真人说话的真实影像。由图片或文本提示词生成的会说话的虚拟形象、数字人以及人工智能视频生成属于不同的产品类别,使用人工智能视频生成工具会更合适。
请使用说话者的面部清晰可见、光线良好且嘴部无遮挡的视频素材。避免使用明显的侧面镜头以及任何遮挡嘴唇的东西,例如麦克风、手或字幕。人脸检查用于确认是否存在人脸;您可以使用预览功能来评估视频素材的处理效果。
口型同步与配音分开计费,按每个完整视频的生成次数收费。在进行编辑后生成新的口型同步版本将产生另一次口型同步费用。
是的。每个账号都在免费额度中包含了一分钟的免费口型同步时长。将 free_trial_run 设置为 true 运行任务,即可同步一分钟的视频并进行检查。此额度会在 credits 端点中显示为 lipsync_free_minutes。
是的。当镜头前有多人说话时,请在项目中设置 num_speakers,以便将每个声音匹配给对应的说话人。如果不设置,Rask 将自动检测说话人。
GET /v3/projects/{project_id}/lipsync returns the state: video_has_face, whether a free trial run is available, and the latest job. Starting lip-sync returns a job that reports its stage, progress and queue position, and GET /v3/jobs/{job_id}?wait_seconds=20 returns the moment it is done.
处理时间取决于视频的长度和口型同步队列。通过队列位置和进度值,你可以向用户准确展示任务当前的进展。
每个配音版本会生成一次口型同步。更改文本、时间戳、说话人或声音后,请重新配音项目,等待任务成功并再次运行口型同步。新的口型同步生成将单独预估和计费。已完成的人脸检查无需再次运行。
如果任务状态显示失败,请查看任务中的错误信息;如需团队协助排查,请将您的 project_id 发送至 [email protected]。
API 访问权限适用于创作者专业版、商业版和企业版套餐,具体功能由您的套餐决定。您可以在应用中创建 API 密钥并立即开始调用。企业条款、大宗定价和自定义语言覆盖范围请联系我们的团队咨询。