madeAPI
Log in
Explore/HeyGen Lipsync Precision
Video1 credit / second of audio

HeyGen Lipsync Precision

Re-voices a clip with HeyGen’s avatar model on the face, for the closest mouth match.

View docs
// Node.js. Running this creates one paid generation.
import { randomUUID } from 'node:crypto';
const base = "https://www.made.app/api";
const headers = {
  Authorization: `Bearer ${process.env.MADE_API_KEY}`,
  'Content-Type': 'application/json',
};
const input = {
  "model": "heygen_lipsync_v3_precision",
  "medias": [
    {
      "value": "https://example.com/reference.mp4",
      "role": "video"
    },
    {
      "value": "https://example.com/reference.mp3",
      "role": "audio"
    }
  ]
};

async function api(path, body) {
  const response = await fetch(base + path, {
    method: body ? 'POST' : 'GET', headers,
    ...(body && { body: JSON.stringify(body) }),
  });
  if (!response.ok) throw new Error(await response.text());
  return response.json();
}

const { cost } = await api('/v1/cost', input);
console.log('Quoted cents:', cost.customerCostCents);
// Preserve this request ID when retrying a submission.
const requestId = randomUUID();
let job = await api('/v1/generations', {
  ...input, request_id: requestId,
  max_cost_cents: cost.customerCostCents,
});
console.log('Request:', job.id);
while (!['succeeded', 'failed', 'canceled'].includes(job.status)) {
  await new Promise(resolve => setTimeout(resolve, 3000));
  job = await api('/v1/generations/' + job.id);
}
if (job.status !== 'succeeded') throw new Error(JSON.stringify(job.error || job.status));
console.log(job.result.assets);

Input

Generate · 5 credits

Uses your credits. See the exact price before generating.

Result

Your result will appear here.

Price

1 credit / second of audio. Billed on the length of your audio · Each job total rounds up to a whole credit Check the exact cost for your settings before generating. Failed generations are refunded. Full price sheet.