This SDK provides an official Python client for the Rask API. For full API reference and authentication setup, see Rask API Docs.
Rask SDK can be installed by the direct link to the repository using any Python package manager.
Below you can find an example of how to do this using pip:
pip install git+ssh://git@github.com/braskai/rask-sdk.git@mainOr using poetry and pyproject.toml:
[tool.poetry.dependencies]
rask-sdk = { branch = "main", git = "git@github.com:braskai/rask-sdk.git" }Below you can find a list of all available methods with their input and output data formats.
class RaskSDKClient:
"""."""
async def authenticate(self) -> None:
"""Fetch new token for the instantiated client."""
async def get_credits(self) -> schemas.CreditsGet:
"""Get credits of the current user."""class RaskSDKClient:
"""."""
async def create_media_file(
self, file: BinaryIO, kind: Optional[enums.MediaKind] = None, timeout: int = 1800
) -> schemas.MediaGet:
"""Create media by binary file provided."""
async def create_media_link(self, data: schemas.MediaCreateLink) -> schemas.MediaGet:
"""Create media by link provided."""
async def get_media(self, media_id: uuid.UUID) -> schemas.MediaGet:
"""Get media by id."""class RaskSDKClient:
"""."""
async def create_project(self, data: schemas.ProjectCreate) -> schemas.ProjectGet:
"""Create project."""
async def get_project(self, project_id: uuid.UUID) -> schemas.ProjectGet:
"""Get project by id."""
async def get_projects(
self, offset: int = 0, limit: int = 10, name: Optional[str] = None
) -> schemas.ProjectsGet:
"""Get project list."""
async def generate_project(self, project_id: uuid.UUID) -> schemas.ProjectGet:
"""Generate project."""
async def patch_project(
self, project_id: uuid.UUID, data: schemas.ProjectPatch
) -> schemas.ProjectGet:
"""Patch project."""
async def get_project_voices(self, project_id: uuid.UUID) -> List[schemas.Voice]:
"""Get project voices.""" async def run_check_face_task(
self, project_id: uuid.UUID
) -> schemas.CheckFaceTaskResponse:
"""Run check face task for project id provided."""
async def run_lipsync_task(
self,
project_id: uuid.UUID,
data: schemas.LipsyncTaskData,
) -> schemas.LipsyncTaskResponse:
"""Run lipsync task for project id provided."""
async def get_lipsync_info(self, project_id: uuid.UUID) -> schemas.LipsyncInfo:
"""Get lipsync info.""" async def create_transcription(
self, data: schemas.TranscriptionCreate
) -> schemas.TranscriptionId:
"""Create transcription."""
async def create_transcription_srt(
self,
src: Optional[BinaryIO] = None,
dst: Optional[BinaryIO] = None,
src_lang: Optional[str] = None,
dst_lang: Optional[str] = None,
timeout: int = 1800,
) -> schemas.TranscriptionId:
"""Create transcription via .srt uploading."""
async def get_project_transcription(
self,
project_id: uuid.UUID,
segment_ids: Optional[List[uuid.UUID]] = None,
) -> schemas.TranscriptionGet:
"""Get transcription associated with the project."""
async def add_project_transcription_segments(
self, project_id: uuid.UUID, data: schemas.TranscriptionSegmentsCreate
) -> schemas.TranscriptionGet:
"""Create segments in the transcription associated with the project."""
async def patch_project_transcription_segments(
self, project_id: uuid.UUID, data: schemas.TranscriptionSegmentsPatch
) -> schemas.TranscriptionGet:
"""Patch segments in the transcription associated with the project."""
async def delete_project_transcription_segment(
self, project_id: uuid.UUID, segment_id: uuid.UUID
) -> schemas.SegmentId:
"""Delete the segment in the transcription associated with the project.""" async def create_glossary(self, data: schemas.GlossaryCreate) -> schemas.GlossaryGet:
"""Create new glossary."""
async def get_glossary(self, glossary_id: uuid.UUID) -> schemas.GlossaryGet:
"""Get glossary by id."""
async def update_glossary(
self, glossary_id: uuid.UUID, data: schemas.GlossaryUpdate
) -> schemas.GlossaryGet:
"""Update existing glossary."""
async def delete_glossary(self, glossary_id: uuid.UUID) -> schemas.GlossaryIdGet:
"""Delete glossary by id."""Our SDK contains refresh token logic inside the RaskSDKClient, so you do not really have to implement this logic on your side.
You can do it if you want using authenticate method, but in general you can just initialize the client and use it as is.
To obtain your API credentials from your Rask account settings, follow instructions here.
In this example, let's look at our basic flow, which includes the following steps:
- Upload a media
- Create a glossary
- Create and dub a project with both items
- Update project transcription
- Redub the project
- Run lipsync for the project
To learn more about workflows you can set up, check out the pages under Workflow section in our API docs.
import asyncio
from rask_sdk import enums
from rask_sdk import schemas
from rask_sdk import clients
async def main():
# Initialize client
client = clients.RaskSDKClient(
client_id="MY_CLIENT_ID",
client_secret="MY_CLIENT_SECRET",
)
# Upload a media
with open("video.mp4", "rb") as video:
media = await client.create_media_file(kind=enums.MediaKind.VIDEO, file=video)
# Create a glossary
glossary = await client.create_glossary(
data=schemas.GlossaryCreate(
name="SDK Glossary",
src_lang="pt",
dst_lang="en",
entries={"Olá": "Hello"}
)
)
# Create a project with both items provided
project = await client.create_project(
data=schemas.ProjectCreate(
video_id=media.id,
name="SDK Project",
dst_lang="en-us",
glossary_id=glossary.id
)
)
# Fetch project status waiting for dubbing to be completed
while project.status is not enums.ProjectStatus.MERGING_DONE:
project = await client.get_project(project_id=project.id)
await asyncio.sleep(10)
# Get project transcription
transcription = await client.get_project_transcription(project_id=project.id)
# Update certain project transcription segments
segments_ = await client.patch_project_transcription_segments(
project_id=project.id,
data=schemas.TranscriptionSegmentsPatch(
segments=[
schemas.SegmentPatch(id=..., speaker="SPEAKER_01")
]
)
)
# Redub the project to apply the changes
project = await client.generate_project(project_id=project.id)
# Fetch project status waiting for redubbing to be completed
while project.status is not enums.ProjectStatus.MERGING_DONE:
project = await client.get_project(project_id=project.id)
await asyncio.sleep(10)
# Get lipsync info
lipsync_info = await client.get_lipsync_info(project_id=project.id)
# If the face has not been detected automatically, do it manually
if lipsync_info.check_face_task_status is not enums.LipsyncStatus.DONE:
await client.run_check_face_task(project_id=project.id)
# Run lipsync task
lipsync_response_ = await client.run_lipsync_task(project_id=project.id, data=schemas.LipsyncTaskData())
# Fetch lipsync info waiting for lipsync to be completed
while lipsync_info.lipsync_task_status is not enums.LipsyncStatus.DONE:
lipsync_info = await client.get_lipsync_info(project_id=project.id)
await asyncio.sleep(10)
if __name__ == "__main__":
asyncio.run(main())Tip: some operations (generating voiceover, lipsync or re-dubbing the project) take time to complete - please make sure to adjust your polling intervals accordingly.
We support over 130 target languages and dialects.
When working with the SDK, make sure to specify the langauge - whether source or destination or both - using the appropriate language codes.
You can find the full list of supported language codes in our API documentation - be sure to double-check the correct format for your specific context.
Many SDK methods accept or return structured data using Pydantic models defined in rask_sdk.schemas.
These models provide:
- Structured request bodies (e.g.
ProjectCreate,TranscriptionCreate) - Typed, autocompletable responses (e.g.
TranscriptionGet,ProjectGet) - Built-in validation and serialization
from rask_sdk import schemas
# Access schema types
project = schemas.ProjectCreate(...)
# Convert to JSON-compatible dict (Pydantic v2+)
json_data = project.model_dump()| SDK Method | API Docs |
|---|---|
authenticate() |
Authentication |
get_credits() |
Get credits |
create_media_file(...) |
Upload media by file |
create_media_link(...) |
Upload media by link |
get_media(...) |
Get media |
create_project(...) |
Create project |
get_project(...) |
Get project |
get_projects(...) |
Get project list |
generate_project(...) |
Generate project |
patch_project(...) |
Patch project |
get_project_voices(...) |
Get project voices |
run_check_face_task(...) |
Run check face |
run_lipsync_task(...) |
Run Lip-sync |
get_lipsync_info(...) |
Get Lip-sync info |
create_transcription(...) |
Create transcription |
create_transcription_srt(...) |
Create transcription srt |
get_project_transcription(...) |
Get transcription |
add_project_transcription_segments(...) |
Add segments |
patch_project_transcription_segments(...) |
Patch segments |
delete_project_transcription_segment(...) |
Delete segment |
create_glossary(...) |
Create glossary |
get_glossary(...) |
Get glossary |
update_glossary(...) |
Update glossary |
delete_glossary(...) |
Delete glossary |