Skip to content

We're an AI video research company making personalized video possible at scale. Generate videos of yourself, and never record again! Available via web app & developer APIs. Tavus's TypeScript SDK generated by Konfig (https://konfigthis.com/).

Notifications You must be signed in to change notification settings

konfig-sdks/tavus-typescript-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Visit Tavus

We're an AI video research company making personalized video possible at scale. Generate videos of yourself, and never record again! Available via web app & developer APIs.

Table of Contents

Installation

Getting Started

import { Tavus } from "tavus-typescript-sdk";

const tavus = new Tavus({
  // Defining the base path is optional and defaults to https://tavusapi.com
  // basePath: "https://tavusapi.com",
  apiKey: "API_KEY",
});

const createNewReplicaResponse = await tavus.replicas.createNewReplica({
  train_video_url: "train_video_url_example",
});

console.log(createNewReplicaResponse);

Reference

tavus.replicas.createNewReplica

This endpoint creates a new Replica that can be used to generate personalized videos.

The only required body parameter is train_video_url. This url must be a download link such as a presigned S3 url. Please ensure you pass in a video that meets the requirements for training.

Replica training will fail without the following consent statement being present at the beginning of the video:

I, [FULL NAME], am currently speaking and consent Tavus to create an AI clone of me by using the audio and video samples I provide. I understand that this AI clone can be used to create videos that look and sound like me.

Learn more about the consent statement here.

Learn more about training a personal Replica here.

πŸ› οΈ Usage

const createNewReplicaResponse = await tavus.replicas.createNewReplica({
  train_video_url: "train_video_url_example",
});

βš™οΈ Parameters

train_video_url: string

A direct link to a publicly accessible storage location such as an S3 bucket. This video will be used for replica training.

callback_url: string

A url that will receive a callback on completion of replica training or on error.

replica_name: string

A name for the replica.

πŸ”„ Return

ReplicasCreateNewReplicaResponse

🌐 Endpoint

/v2/replicas POST

πŸ”™ Back to Table of Contents


tavus.replicas.deleteByReplicaId

This endpoint deletes a single Replica by its unique identifier. Once deleted, this Replica can not be used to generate videos.

πŸ› οΈ Usage

const deleteByReplicaIdResponse = await tavus.replicas.deleteByReplicaId({});

βš™οΈ Parameters

replicaId: string

🌐 Endpoint

/v2/replicas/{replica_id} DELETE

πŸ”™ Back to Table of Contents


tavus.replicas.getReplicaById

This endpoint returns a single Replica by its unique identifier.

Included in the response body is a training_progress string that represents the progress of the Replica training. If there are any errors during training, the status will be error and the error_message will be populated.

πŸ› οΈ Usage

const getReplicaByIdResponse = await tavus.replicas.getReplicaById({});

βš™οΈ Parameters

replicaId: string

πŸ”„ Return

ReplicasGetReplicaByIdResponse

🌐 Endpoint

/v2/replicas/{replica_id} GET

πŸ”™ Back to Table of Contents


tavus.replicas.list

This endpoint returns a list of all replicas that have been created by the API Key in use. In the response, a root level data key will contain the list of Replicas.

πŸ› οΈ Usage

const listResponse = await tavus.replicas.list();

πŸ”„ Return

ReplicasListResponse

🌐 Endpoint

/v2/replicas GET

πŸ”™ Back to Table of Contents


tavus.replicas.renameReplicaById

This endpoint renames a single Replica by its unique identifier.

πŸ› οΈ Usage

const renameReplicaByIdResponse = await tavus.replicas.renameReplicaById({
  replica_name: "replica_name_example",
});

βš™οΈ Parameters

replica_name: string
replicaId: string

🌐 Endpoint

/v2/replicas/{replica_id}/name PATCH

πŸ”™ Back to Table of Contents


tavus.videos.createVideoFromReplicaAndScript

This endpoint generates a new video using a Replica and a script.

The only required body parameters are replica_id and script. The replica_id is a unique identifier for the Replica that will be used to generate the video. The script is the text that will be spoken by the Replica in the video.

If a background_url is provided, Tavus will record a video of the website and use it as the background for the video. If a background_source_url is provided, where the URL points to a download link such as a presigned S3 URL, Tavus will use the video as the background for the video. If neither are provided, the video will consist of a full screen Replica.

To learn more about generating videos with Replicas, see here.

To learn more about writing an effective script for your video, see Scripting prompting.

πŸ› οΈ Usage

const createVideoFromReplicaAndScriptResponse =
  await tavus.videos.createVideoFromReplicaAndScript({
    replica_id: "r783537ef5",
    script: "Hello from Tavus! Enjoy your new replica",
    video_name: "My First Video",
  });

βš™οΈ Parameters

replica_id: string

A unique identifier for the replica that will be used to generate the video.

script: string

A script to be used for the video.

background_source_url: string

A direct link to a video that is publicly accessible via a storage location such as an S3 bucket. This will be used as the background for the video. The video must be publicly accessible.

background_url: string

A link to a website. This will be used as the background for the video. The website must be publicly accessible and properly formed.

video_name: string

A name for the video.

πŸ”„ Return

VideosCreateVideoFromReplicaAndScriptResponse

🌐 Endpoint

/v2/videos POST

πŸ”™ Back to Table of Contents


tavus.videos.deleteByVideoId

This endpoint deletes a single video by its unique identifier.

πŸ› οΈ Usage

const deleteByVideoIdResponse = await tavus.videos.deleteByVideoId({});

βš™οΈ Parameters

videoId: string

🌐 Endpoint

/v2/videos/{video_id} DELETE

πŸ”™ Back to Table of Contents


tavus.videos.getAll

This endpoint returns a list of all videos that have been generated by the API Key in use.

πŸ› οΈ Usage

const getAllResponse = await tavus.videos.getAll();

πŸ”„ Return

VideosGetAllResponse

🌐 Endpoint

/v2/videos GET

πŸ”™ Back to Table of Contents


tavus.videos.getByVideoId

This endpoint returns a single video by its unique identifier.

The response body will contain a status string that represents the status of the video. If the video is ready, the response body will also contain a download_url, stream_url, and hosted_url that can be used to download, stream, and view the video respectively.

πŸ› οΈ Usage

const getByVideoIdResponse = await tavus.videos.getByVideoId({});

βš™οΈ Parameters

videoId: string

πŸ”„ Return

VideosGetByVideoIdResponse

🌐 Endpoint

/v2/videos/{video_id} GET

πŸ”™ Back to Table of Contents


tavus.videos.updateName

This endpoint renames a single video by its unique identifier.

πŸ› οΈ Usage

const updateNameResponse = await tavus.videos.updateName({
  video_name: "video_name_example",
});

βš™οΈ Parameters

video_name: string
videoId: string

🌐 Endpoint

/v2/videos/{video_id}/name PATCH

πŸ”™ Back to Table of Contents


Author

This TypeScript package is automatically generated by Konfig

About

We're an AI video research company making personalized video possible at scale. Generate videos of yourself, and never record again! Available via web app & developer APIs. Tavus's TypeScript SDK generated by Konfig (https://konfigthis.com/).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published