Create Lip Sync Video
August 8, 2024 (October 18, 2024)
Table of contents
Runway AI Tools » Audio tools » Lip Sync Video.
Please be aware that Runway’s moderation system analyzes your voice text (parameter voice_text
) and may fail task with moderation message if the prompt is determined to be offensive. Runway monitors the rate and the number of moderated tasks, which may result in your account being suspended when the internal threshold is exceeded.
https://api.useapi.net/v1/runwayml/lipsync/create
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"image_assetId": "Optional assetId of image asset",
"video_assetId": "Optional assetId of video asset",
"audio_assetId": "Optional assetId of audio asset",
"voiceId": "Optional voiceId from lipsync/voices endpoint",
"voice_text": "Optional lipsync text",
"model_id": "Optional voice model",
"exploreMode": true,
"replyUrl": "Place your call back URL here",
"replyRef": "Place your reference id here",
"maxJobs": 5,
}
-
image_assetId
is optional. Specify the image assetId you want to be present in the first frame. Use GET /assets/?mediaType=image to see the list of image assets. To upload a new image asset use POST /assets. -
video_assetId
is optional. Specify the video assetId you want to be present in the first frame. Use GET /assets/?mediaType=video to see the list of video assets. To upload a new video asset use POST /assets. -
audio_assetId
is optional. Specify an audio assetId you want to lip sync with provided above image or video. Use GET /assets/?mediaType=audio to see the list of audio assets. To upload a new audio asset use POST /assets. -
voiceId
is optional. Specify AI voiceId used readvoice_text
to lip sync with provided above image or video. Use GET lipsync/voices to see the list of voices. -
voice_text
is optional. Specify text to lip sync with provided above image or video. -
model_id
is optional. Specify AI voice model.
Supported values:eleven_multilingual_v1
(default) andeleven_multilingual_v2
(28+ languages). -
exploreMode
is optional. Set totrue
if you have a Runway Unlimited plan and wish to execute relaxed generation. You are not charged credits for Explore mode generations. -
replyUrl
is optional, if not provided value from account will be used.
Place here your callback URL. API will call the providedreplyUrl
once Runway task completed or failed.
Maximum length 1024 characters.
We recommend using sites like webhook.site to test callback URL functionality. -
replyRef
is optional, place here your reference id which will be stored and returned along with this Runway task response / result.
Maximum length 1024 characters. -
maxJobs
is optional, if not provided value for referenced by image/video assetId account will be used.
Valid range: 1…10.
Responses
-
Use returned
taskId
to retrieve task status and results using GET /tasks/taskId
. The generated videourl
can be found in theartifacts
array of the task with the statusSUCCEEDED
.If you specify the optional parameter
replyUrl
the API will call the providedreplyUrl
with task progress updates until the task is complete or fails.{ "taskId": "user:user_id-runwayml:account_email-task:task_uuid", "id": "<uuid>", "name": "<name>", "image": null, "createdAt": "2024-08-01T01:02:03.456Z", "updatedAt": "2024-08-01T01:02:03.456Z", "taskType": "lipsync", "options": { "name": "<name>", "exploreMode": true, "paid_user_watermark_override": false, "video": "<video url>", "video_asset_id": "<video asset uuid>", "audio": "<audio ulr>" }, "status": "PENDING", "error": null, "progressText": null, "progressRatio": null, "estimatedTimeToStartSeconds": 0, "artifacts": [], "sharedAsset": null, "features": { "storageGB": 500, "numPlanCredits_permitted": 2250, "numPlanCredits_used": 1315 }, "code": 200, "replyUrl": "https://webhook.site/abc", "replyRef": "<your optional reference id>" }
-
{ "error": "<Error message>", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Unable to retrieve assetId <uuid> (Not found.)", "code": 404 }
-
You do not have enough credits to run this task.
{ "error": "You do not have enough credits to run this task." }
-
Wait in a loop for at least 10..30 seconds and retry again.
There are two possible cases for API response 429:
- API query is full and can not accept new lipsync/create requests. Size of query defined by
maxJobs
optional parameter.
{ "error": "Account <Runway account email> is busy executing <Account maxJobs> tasks", "runningTasks": { "<Runway account email>": [ { "email": "<Runway account email>", "taskId": "user:user_id-runwayml:account_email-task:task_#1_uuid", "id": "<uuid>", "replyUrl": "<replyUrl if provided>", "replyRef": "<replyRef if provided>" }, { "email": "<Runway account email>", "taskId": "user:user_id-runwayml:account_email-task:task_#N_uuid", "id": "<uuid>", "replyUrl": "<replyUrl if provided>", "replyRef": "<replyRef if provided>" } ] }, "code": 429 }
- The API received an HTTP response status 429 from Runway. Runway has dynamic query management and may limit the number of simultaneously executed tasks based on internal service load and policies.
{ "error": "You have too many tasks running or pending. Please wait for some of them to finish before starting more." }
- API query is full and can not accept new lipsync/create requests. Size of query defined by
Model
{ // TypeScript, all fields are optional
taskId: string,
id: string,
name: string,
image: string,
createdAt: string,
updatedAt: string,
taskType: string,
options: {
name: string,
exploreMode: boolean,
paid_user_watermark_override: boolean,
image: string,
image_asset_id: string,
video: string,
video_asset_id: string,
audio: string,
audio_asset_id: string,
gen_audio_options: {
name: string,
text: string,
voice_id: string,
model_id: string
}
},
status: string,
progressText: string,
progressRatio: number,
estimatedTimeToStartSeconds: number,
artifacts: any[],
sharedAsset: any,
features: {
storageGB: number,
numPlanCredits_permitted: number,
numPlanCredits_used: number
},
error: {
errorMessage: string,
reason: string,
message: string,
moderation_category: string,
tally_asimov: boolean
},
code: number,
replyUrl: string,
replyRef: string
}
Examples
-
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -X POST "https://api.useapi.net/v1/runwayml/lipsync/create" \ -d '{"image_assetId": "…", "audio_assetId": "…"}'
-
const image_assetId = "assetId of image asset"; const audio_assetId = "assetId of audio asset"; const apiUrl = `https://api.useapi.net/v1/runwayml/lipsync/create`; const token = "API token"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ image_assetId, audio_assetId }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests image_assetId = "assetId of image asset" audio_assetId = "assetId of audio asset" apiUrl = f"https://api.useapi.net/v1/runwayml/lipsync/create" token = "API token" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } body = { "image_assetId": f"{image_assetId}", "audio_assetId": f"{audio_assetId}" } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())