開發者 API

Lipsync API 平台

使用我們強大的 REST API 以程式化方式生成對口型影片

API 金鑰

管理你的 API 驗證金鑰

為你的 API 金鑰取一個容易記住的名稱(可選)

需要登入

請登入以建立並管理 API 金鑰。

適合你的定價

以彈性且具競爭力的價格開始使用

API 定價

按量計費

注意:API 點數與使用者點數相互獨立,不能互相轉換。

價格
點數
單價

注意:

每次生成至少扣費:5 秒
480p 解析度:每秒 2 點
720p 解析度:每秒 4 點
lipsync-video:若影片長於音訊將被裁切;若音訊長於影片將自動延長。計費在裁切時依音訊長度、延長時依影片長度計算。
lipsync-image-multi:當 order 為「meanwhile」時,按兩段音訊的最大長度計費;否則按「left_audio」與「right_audio」總長度計費。
範例 1:
3 秒音訊,720p = 5 秒 × 4 = 20 點
(適用最少扣費)
範例 2:
10 秒音訊,480p = 10 × 2 = 20 點

驗證

保護你的 API 請求

在所有請求中將 API 金鑰放入 Authorization 標頭:

Authorization: Bearer sk_XXXX_YYYY

可用端點

RESTful API 端點

POST/api/v1/lipsync-video

影片替換音訊並保持對口型同步

POST/api/v1/lipsync-image

圖片 + 音訊 → 單人說話頭像

POST/api/v1/lipsync-image-multi

圖片 + 雙音訊 → 多說話人頭像(對話/談話)

GET/api/v1/jobs/{requestId}

查詢任務狀態並取得結果

詳細參數

完整端點規格

所有端點共用相同結構:可選的 webhook 參數與各模型的 formState 參數。

POST /api/v1/lipsync-video

在維持對口型的同時,以新音訊替換既有影片中的音訊

頂層參數:
webhook選填

你的回呼 URL(HTTPS)。完成後我們會在此 POST 結果。

formState必填

包含所有生成參數的物件(見下)。

formState 參數:
video必填

來源影片的公開 URL(MP4、MOV 等)

audio必填

語音/替換音訊的公開 URL(MP3、WAV 等)

resolution選填

"480p" 或 "720p"(預設:480p)

mask_image選填

遮罩圖片的公開 URL(僅在遮罩區域內進行口型)

prompt選填

風格指引文字

seed選填

用於可重現的整數隨機種子

Async Workflow

Choose how to receive your results

All API calls are asynchronous. You have two options to retrieve results:

Option 1: Webhook (Recommended)

Provide a webhook URL in the JSON body. We will POST the result to your endpoint when the job completes.

Benefits:
  • No need to poll repeatedly
  • Instant notification when job completes
  • More efficient for long-running jobs (30-120 seconds typical)

Option 2: Polling

Omit the webhook parameter and use the returned requestId to poll GET /api/v1/jobs/{requestId} every 5-10 seconds until status is "completed".

Use when:
  • You cannot expose a public webhook endpoint
  • Testing or debugging

Example with Webhook:

POST /api/v1/lipsync-image
Authorization: Bearer sk_XXXX_YYYY
Content-Type: application/json

{
  "webhook": "https://your-app.example.com/webhooks/lipsync",
  "formState": {
    "image": "https://.../face.png",
    "audio": "https://.../voice.mp3",
    "resolution": "720p",
    "seed": 42
  }
}

// Immediate Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "processing"
}

// Later, when job completes, we POST to your webhook:
POST https://your-app.example.com/webhooks/lipsync
Content-Type: application/json

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "model": "lipsync-image",
  "status": "completed",
  "output": "https://.../result.mp4",
  "error": "",
  "executionTime": 12345,
  "timings": null
}

Example without Webhook (Polling):

// Step 1: Submit job (no webhook parameter)
POST /api/v1/lipsync-image
Authorization: Bearer sk_XXXX_YYYY
Content-Type: application/json

{
  "formState": {
    "image": "https://.../face.png",
    "audio": "https://.../voice.mp3",
    "resolution": "720p"
  }
}

// Immediate Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "processing"
}

// Step 2: Poll for status (repeat every 5-10 seconds)
GET /api/v1/jobs/550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer sk_XXXX_YYYY

// Response while processing:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "model": "lipsync",
  "status": "processing",
  "output": null,
  "error": "",
  "executionTime": null,
  "timings": null
}

// Response when completed:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "model": "lipsync-image",
  "status": "completed",
  "output": "https://.../result.mp4",
  "error": "",
  "executionTime": 12345,
  "timings": null
}

// Response if failed:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "model": "lipsync-image",
  "status": "failed",
  "output": null,
  "error": "Invalid audio format",
  "executionTime": null,
  "timings": null
}

Complete Code Examples

Ready-to-use integration examples

Node.js with Webhook (Recommended)

import fetch from 'node-fetch';
import express from 'express';

const API_KEY = 'Bearer sk_XXXX_YYYY';
const BASE_URL = 'https://lipsync.studio/api/v1';

// Set up webhook server to receive results
const app = express();
app.use(express.json());

app.post('/webhooks/lipsync', (req, res) => {
  const { id, status, output, error, model } = req.body;
  
  console.log('✅ Job update received!');
  console.log('Job ID:', id);
  console.log('Model:', model);
  console.log('Status:', status);
  if (status === 'completed') {
    console.log('Video URL:', output);
  } else if (status === 'failed') {
    console.error('Error:', error);
  }
  
  // TODO: Save output URL to your database, send notification, etc.
  
  res.status(200).json({ received: true });
});

app.listen(3000, () => {
  console.log('Webhook server listening on port 3000');
});

// Submit job with webhook
async function submitJobWithWebhook() {
  const webhookUrl = 'https://your-public-domain.com/webhooks/lipsync';
  
  const res = await fetch(`${BASE_URL}/lipsync-image`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': API_KEY
    },
    body: JSON.stringify({
      webhook: webhookUrl,
      formState: {
        image: 'https://example.com/portrait.jpg',
        audio: 'https://example.com/speech.mp3',
        resolution: '720p'
      }
    })
  });
  
  const data = await res.json();
  console.log('Job submitted:', data.id);
  console.log('Waiting for webhook callback...');
  
  // You don't need to poll! The result will be POSTed to your webhook.
}

submitJobWithWebhook();