Skip to content
DashboardGet API Key

Generate lip sync from uploaded media

client.Lipsync.GenerateWithMedia(ctx, body) (*LipsyncGenerate, error)
POST/v1/lipsync/generate-with-media

Starts a lip sync job by uploading one video file and one audio file as multipart form-data.

ParametersExpand Collapse
body LipsyncGenerateWithMediaParams
Audio param.Field[Reader]

Target audio file.

Video param.Field[Reader]

Source video file.

DisableActiveSpeakerDetection param.Field[bool]optional

Disable active speaker detection and use max-face lipsync preprocessing.

Model param.Field[LipsyncGenerateWithMediaParamsModel]optional

Optional model selector.

const LipsyncGenerateWithMediaParamsModelLipsync2 LipsyncGenerateWithMediaParamsModel = "lipsync-2"
ReferenceID param.Field[string]optional

Optional client-provided identifier for later retrieval.

ReturnsExpand Collapse
type LipsyncGenerate struct{…}
RequestID string

Identifier of the created lip sync request.

formatuuid
Status LipsyncGenerateStatus

Current state of the newly created request.

Generate lip sync from uploaded media

package main

import (
  "bytes"
  "context"
  "fmt"
  "io"

  "github.com/chamelaion/chamelaion-go"
  "github.com/chamelaion/chamelaion-go/option"
)

func main() {
  client := chamelaion.NewClient(
    option.WithAPIKey("My API Key"),
  )
  lipsyncGenerate, err := client.Lipsync.GenerateWithMedia(context.TODO(), chamelaion.LipsyncGenerateWithMediaParams{
    Audio: io.Reader(bytes.NewBuffer([]byte("(binary)"))),
    Video: io.Reader(bytes.NewBuffer([]byte("(binary)"))),
    Model: chamelaion.LipsyncGenerateWithMediaParamsModelLipsync2,
    ReferenceID: chamelaion.String("upload-demo-01"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", lipsyncGenerate.RequestID)
}
{
  "status": "success",
  "request_id": "3b7df3e8-f578-44de-b4f5-5f58dd6b89e0"
}
{
  "error": "content-type must be multipart/form-data"
}
{
  "error": "video file is required"
}
{
  "error": "audio file is required"
}
{
  "error": "model must be \"lipsync-2\""
}
{
  "error": "missing authorization header"
}
{
  "error": "invalid authorization format"
}
{
  "error": "missing token"
}
{
  "error": "invalid token"
}
{
  "error": "unauthorized"
}
{
  "error": "token limit reached"
}
{
  "error": "rate limit exceeded"
}
{
  "error": "internal error"
}
Returns Examples
{
  "status": "success",
  "request_id": "3b7df3e8-f578-44de-b4f5-5f58dd6b89e0"
}
{
  "error": "content-type must be multipart/form-data"
}
{
  "error": "video file is required"
}
{
  "error": "audio file is required"
}
{
  "error": "model must be \"lipsync-2\""
}
{
  "error": "missing authorization header"
}
{
  "error": "invalid authorization format"
}
{
  "error": "missing token"
}
{
  "error": "invalid token"
}
{
  "error": "unauthorized"
}
{
  "error": "token limit reached"
}
{
  "error": "rate limit exceeded"
}
{
  "error": "internal error"
}