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.
- Requirements
- Installation
- Getting Started
- Async
- Raw HTTP Response
- Reference
tavus.replicas.create_new_replica
tavus.replicas.delete_by_replica_id
tavus.replicas.get_replica_by_id
tavus.replicas.list
tavus.replicas.rename_replica_by_id
tavus.videos.create_video_from_replica_and_script
tavus.videos.delete_by_video_id
tavus.videos.get_all
tavus.videos.get_by_video_id
tavus.videos.update_name
Python >=3.7
from pprint import pprint
from tavus_python_sdk import Tavus, ApiException
tavus = Tavus(
api_key="YOUR_API_KEY",
)
try:
# Create Replica
create_new_replica_response = tavus.replicas.create_new_replica(
train_video_url="string_example",
callback_url="string_example",
replica_name="string_example",
)
print(create_new_replica_response)
except ApiException as e:
print("Exception when calling ReplicasApi.create_new_replica: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
async
support is available by prepending a
to any method.
import asyncio
from pprint import pprint
from tavus_python_sdk import Tavus, ApiException
tavus = Tavus(
api_key="YOUR_API_KEY",
)
async def main():
try:
# Create Replica
create_new_replica_response = await tavus.replicas.acreate_new_replica(
train_video_url="string_example",
callback_url="string_example",
replica_name="string_example",
)
print(create_new_replica_response)
except ApiException as e:
print("Exception when calling ReplicasApi.create_new_replica: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())
To access raw HTTP response values, use the .raw
namespace.
from pprint import pprint
from tavus_python_sdk import Tavus, ApiException
tavus = Tavus(
api_key="YOUR_API_KEY",
)
try:
# Create Replica
create_new_replica_response = tavus.replicas.raw.create_new_replica(
train_video_url="string_example",
callback_url="string_example",
replica_name="string_example",
)
pprint(create_new_replica_response.body)
pprint(create_new_replica_response.body["replica_id"])
pprint(create_new_replica_response.body["status"])
pprint(create_new_replica_response.headers)
pprint(create_new_replica_response.status)
pprint(create_new_replica_response.round_trip_time)
except ApiException as e:
print("Exception when calling ReplicasApi.create_new_replica: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
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.
create_new_replica_response = tavus.replicas.create_new_replica(
train_video_url="string_example",
callback_url="string_example",
replica_name="string_example",
)
A direct link to a publicly accessible storage location such as an S3 bucket. This video will be used for replica training.
A url that will receive a callback on completion of replica training or on error.
A name for the replica.
ReplicasCreateNewReplicaRequest
ReplicasCreateNewReplicaResponse
/v2/replicas
post
This endpoint deletes a single Replica by its unique identifier. Once deleted, this Replica can not be used to generate videos.
tavus.replicas.delete_by_replica_id(
replica_id="replica_id_example",
)
/v2/replicas/{replica_id}
delete
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.
get_replica_by_id_response = tavus.replicas.get_replica_by_id(
replica_id="replica_id_example",
)
ReplicasGetReplicaByIdResponse
/v2/replicas/{replica_id}
get
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.
list_response = tavus.replicas.list()
/v2/replicas
get
This endpoint renames a single Replica by its unique identifier.
tavus.replicas.rename_replica_by_id(
replica_name="string_example",
replica_id="replica_id_example",
)
ReplicasRenameReplicaByIdRequest
/v2/replicas/{replica_id}/name
patch
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.
create_video_from_replica_and_script_response = (
tavus.videos.create_video_from_replica_and_script(
replica_id="r783537ef5",
script="Hello from Tavus! Enjoy your new replica",
background_source_url="string_example",
background_url="string_example",
video_name="My First Video",
)
)
A unique identifier for the replica that will be used to generate the video.
A script to be used for the video.
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.
A link to a website. This will be used as the background for the video. The website must be publicly accessible and properly formed.
A name for the video.
VideosCreateVideoFromReplicaAndScriptRequest
VideosCreateVideoFromReplicaAndScriptResponse
/v2/videos
post
This endpoint deletes a single video by its unique identifier.
tavus.videos.delete_by_video_id(
video_id="video_id_example",
)
/v2/videos/{video_id}
delete
This endpoint returns a list of all videos that have been generated by the API Key in use.
get_all_response = tavus.videos.get_all()
/v2/videos
get
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.
get_by_video_id_response = tavus.videos.get_by_video_id(
video_id="video_id_example",
)
/v2/videos/{video_id}
get
This endpoint renames a single video by its unique identifier.
tavus.videos.update_name(
video_name="string_example",
video_id="video_id_example",
)
/v2/videos/{video_id}/name
patch
This Python package is automatically generated by Konfig