Skip to content
DashboardGet API Key

Generate lip sync from URLs

client.Lipsync.Generate(ctx, body) (*LipsyncGenerateResponse, error)
POST/v1/lipsync/generate

Starts a lip sync job from exactly one remote video URL and one remote audio URL. The response includes a request identifier to poll later.

ParametersExpand Collapse
body LipsyncGenerateParams
Inputs param.Field[[]LipsyncGenerateParamsInput]

Exactly one video input and one audio input (order does not matter).

Type LipsyncGenerateParamsInputsType

Type of input media.

One of the following:
const LipsyncGenerateParamsInputsTypeVideo LipsyncGenerateParamsInputsType = "video"
const LipsyncGenerateParamsInputsTypeAudio LipsyncGenerateParamsInputsType = "audio"
URL string

URL of the media resource.

formaturi
DisableActiveSpeakerDetection param.Field[bool]Optional

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

ReferenceID param.Field[string]Optional

Optional client-provided identifier for later retrieval.

ReturnsExpand Collapse
type LipsyncGenerateResponse struct{…}
RequestID string

Identifier of the created lip sync request.

formatuuid
Status LipsyncGenerateResponseStatus

Current state of the newly created request.

Generate lip sync from URLs

package main

import (
  "context"
  "fmt"

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

func main() {
  client := githubcomchamelaionchamelaiongo.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  response, err := client.Lipsync.Generate(context.TODO(), githubcomchamelaionchamelaiongo.LipsyncGenerateParams{
    Inputs: githubcomchamelaionchamelaiongo.F([]githubcomchamelaionchamelaiongo.LipsyncGenerateParamsInput{githubcomchamelaionchamelaiongo.LipsyncGenerateParamsInput{
      Type: githubcomchamelaionchamelaiongo.F(githubcomchamelaionchamelaiongo.LipsyncGenerateParamsInputsTypeVideo),
      URL: githubcomchamelaionchamelaiongo.F("https://storage.googleapis.com/chamelaion-test-media/video.mp4"),
    }, githubcomchamelaionchamelaiongo.LipsyncGenerateParamsInput{
      Type: githubcomchamelaionchamelaiongo.F(githubcomchamelaionchamelaiongo.LipsyncGenerateParamsInputsTypeAudio),
      URL: githubcomchamelaionchamelaiongo.F("https://storage.googleapis.com/chamelaion-test-media/audio.wav"),
    }}),
    ReferenceID: githubcomchamelaionchamelaiongo.F("normal-lipsync-demo"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.RequestID)
}
{
  "status": "success",
  "request_id": "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8"
}
{
  "error": "invalid request body"
}
{
  "error": "content-type must be application/json"
}
{
  "error": "expected exactly one video input"
}
{
  "error": "expected exactly one audio input"
}
{
  "error": "input type must be \"video\" or \"audio\""
}
{
  "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": "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8"
}
{
  "error": "invalid request body"
}
{
  "error": "content-type must be application/json"
}
{
  "error": "expected exactly one video input"
}
{
  "error": "expected exactly one audio input"
}
{
  "error": "input type must be \"video\" or \"audio\""
}
{
  "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"
}