# Lipsync ## Generate lip sync from URLs `client.Lipsync.Generate(ctx, body) (*LipsyncGenerate, 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. ### Parameters - `body LipsyncGenerateParams` - `Inputs param.Field[[]LipsyncGenerateParamsInput]` Exactly one video input and one audio input (order does not matter). - `Type string` Type of input media. - `const LipsyncGenerateParamsInputTypeVideo LipsyncGenerateParamsInputType = "video"` - `const LipsyncGenerateParamsInputTypeAudio LipsyncGenerateParamsInputType = "audio"` - `URL string` URL of the media resource. - `DisableActiveSpeakerDetection param.Field[bool]` Disable active speaker detection and use max-face lipsync preprocessing. - `ReferenceID param.Field[string]` Optional client-provided identifier for later retrieval. ### Returns - `type LipsyncGenerate struct{…}` - `RequestID string` Identifier of the created lip sync request. - `Status LipsyncGenerateStatus` Current state of the newly created request. - `const LipsyncGenerateStatusSuccess LipsyncGenerateStatus = "success"` ### Example ```go package main import ( "context" "fmt" "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.Generate(context.TODO(), chamelaion.LipsyncGenerateParams{ Inputs: []chamelaion.LipsyncGenerateParamsInput{chamelaion.LipsyncGenerateParamsInput{ Type: "video", URL: "https://cdn.example.com/episodes/42.mp4", }, chamelaion.LipsyncGenerateParamsInput{ Type: "audio", URL: "https://cdn.example.com/dubs/42-japanese.wav", }}, ReferenceID: chamelaion.String("dub-episode-42"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lipsyncGenerate.RequestID) } ``` #### Response ```json { "status": "success", "request_id": "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8" } ``` ## 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. ### Parameters - `body LipsyncGenerateWithMediaParams` - `Audio param.Field[Reader]` Target audio file. - `Video param.Field[Reader]` Source video file. - `DisableActiveSpeakerDetection param.Field[bool]` Disable active speaker detection and use max-face lipsync preprocessing. - `Model param.Field[LipsyncGenerateWithMediaParamsModel]` Optional model selector. - `const LipsyncGenerateWithMediaParamsModelLipsync2 LipsyncGenerateWithMediaParamsModel = "lipsync-2"` - `ReferenceID param.Field[string]` Optional client-provided identifier for later retrieval. ### Returns - `type LipsyncGenerate struct{…}` - `RequestID string` Identifier of the created lip sync request. - `Status LipsyncGenerateStatus` Current state of the newly created request. - `const LipsyncGenerateStatusSuccess LipsyncGenerateStatus = "success"` ### Example ```go 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) } ``` #### Response ```json { "status": "success", "request_id": "3b7df3e8-f578-44de-b4f5-5f58dd6b89e0" } ``` ## Domain Types ### Lipsync Generate - `type LipsyncGenerate struct{…}` - `RequestID string` Identifier of the created lip sync request. - `Status LipsyncGenerateStatus` Current state of the newly created request. - `const LipsyncGenerateStatusSuccess LipsyncGenerateStatus = "success"` # Requests ## Get lip sync request `client.Lipsync.Requests.Get(ctx, id) (*LipsyncRequest, error)` **get** `/v1/lipsync/requests/{id}` Returns a single lip sync request by request UUID or `reference_id`. ### Parameters - `id string` ### Returns - `type LipsyncRequest struct{…}` - `ID string` Lip sync request ID. - `CreatedAt Time` Request creation time in UTC. - `Status string` Current request status. - `ErrorMessage string` Failure message when status is `failed`. - `FinishedAt Time` Request processing completion time in UTC. - `OutputURL string` URL to the generated output media, when available. - `ReferenceID string` Client-provided identifier for this request. - `StartedAt Time` Request processing start time in UTC. ### Example ```go package main import ( "context" "fmt" "github.com/chamelaion/chamelaion-go" "github.com/chamelaion/chamelaion-go/option" ) func main() { client := chamelaion.NewClient( option.WithAPIKey("My API Key"), ) lipsyncRequest, err := client.Lipsync.Requests.Get(context.TODO(), "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", lipsyncRequest.ID) } ``` #### Response ```json { "id": "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8", "reference_id": "dub-episode-42", "status": "completed", "created_at": "2026-04-07T10:00:00Z", "started_at": "2026-04-07T10:00:05Z", "finished_at": "2026-04-07T10:01:30Z", "output_url": "https://storage.chamelaion.com/output/6f82a2d8.mp4" } ``` ## List lip sync requests `client.Lipsync.Requests.List(ctx, query) (*LipsyncRequestListResponse, error)` **get** `/v1/lipsync/requests` Returns a paginated list of lip sync requests for the authenticated account. ### Parameters - `query LipsyncRequestListParams` - `Limit param.Field[int64]` Maximum number of items to return. - `Offset param.Field[int64]` Number of items to skip before returning results. - `ReferenceID param.Field[string]` Filter requests by exact `reference_id`. ### Returns - `type LipsyncRequestListResponse struct{…}` - `Data []LipsyncRequest` - `ID string` Lip sync request ID. - `CreatedAt Time` Request creation time in UTC. - `Status string` Current request status. - `ErrorMessage string` Failure message when status is `failed`. - `FinishedAt Time` Request processing completion time in UTC. - `OutputURL string` URL to the generated output media, when available. - `ReferenceID string` Client-provided identifier for this request. - `StartedAt Time` Request processing start time in UTC. - `Pagination LipsyncRequestListResponsePagination` - `Limit int64` Applied page size. - `Offset int64` Applied result offset. - `Total int64` Total number of matching records. ### Example ```go package main import ( "context" "fmt" "github.com/chamelaion/chamelaion-go" "github.com/chamelaion/chamelaion-go/option" ) func main() { client := chamelaion.NewClient( option.WithAPIKey("My API Key"), ) requests, err := client.Lipsync.Requests.List(context.TODO(), chamelaion.LipsyncRequestListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", requests.Data) } ``` #### Response ```json { "data": [ { "id": "6f82a2d8-a6d4-4e8a-a0fa-e8b09823a2d8", "reference_id": "batch-2026-04", "status": "completed", "created_at": "2026-03-30T11:00:00Z", "started_at": "2026-03-30T11:00:04Z", "finished_at": "2026-03-30T11:01:09Z", "output_url": "https://storage.chamelaion.com/output/6f82a2d8.mp4" }, { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "reference_id": "batch-2026-04", "status": "queued", "created_at": "2026-03-30T11:02:00Z" } ], "pagination": { "limit": 20, "offset": 0, "total": 2 } } ``` ## Domain Types ### Lipsync Request - `type LipsyncRequest struct{…}` - `ID string` Lip sync request ID. - `CreatedAt Time` Request creation time in UTC. - `Status string` Current request status. - `ErrorMessage string` Failure message when status is `failed`. - `FinishedAt Time` Request processing completion time in UTC. - `OutputURL string` URL to the generated output media, when available. - `ReferenceID string` Client-provided identifier for this request. - `StartedAt Time` Request processing start time in UTC.