Cutrix Python SDK

The official Python SDK for the Cutrix AI video platform. Translate, dub, and subtitle videos with a few lines of Python code.

Start translating in minutes

Use the Client class to interact with the Cutrix API. This minimal example shows how to submit a local video for translation.

Minimal example

python
from cutrix import Client

with Client(api_key="sk-...") as client:
    result = client.video.translate(
        file_path="./demo.mp4",
        target_lang="zh",
    )
    print(f"Task ID: {result.task_id}")

System requirements

Ensure your development environment meets the following prerequisites.

  • Python 3.9+
  • A Cutrix API key (obtainable from the user dashboard). Go to get →
  • Only videos up to 45 minutes are currently supported.
  • pip (Python package installer)

Install the SDK

Install the official package from PyPI using pip.

Terminal

bash
pip install cutrix-video-translate-sdk

API Key authentication

Authenticate your requests by passing your API key when initializing the client. Get API Key →

Initialization

python
import os
from cutrix import Client

# Option 1: Direct initialization
client = Client(api_key="sk-...")

# Option 2: Using environment variables (Recommended)
client = Client(api_key=os.environ.get("CUTRIX_API_KEY"))

Submit a translation job

The translate() method handles file uploading and task initialization. You can customize the process with various parameters.

!
Only videos up to 45 minutes are currently supported. Longer files should be split before submission.

Advanced usage

python
from cutrix import Client

with Client(api_key="sk-...") as client:
    result = client.video.translate(
        file_path="./demo.mp4",
        target_lang="zh",
        source_lang="en",
        task_name="Campaign Video V1",
        add_subtitle=True,
        remove_cutrix_logo=True
    )

    print(f"Task created: {result.task_id}")
    print(f"Estimated duration: {result.video_duration_seconds}s")

translate() parameters

ParameterTypeRequiredDescription
file_pathstrYesPath to your local video file.
target_langstrYesTarget language code (BCP-47).
source_langstrNoDefaults to "auto" detection.
task_namestrNoLabel for internal tracking.
add_subtitleboolNoWhether to add subtitles (Default: True).
remove_cutrix_logoboolNoRemove platform branding (Default: True).

Supported languages

Check the lists below for all supported source and target language codes.

Source languages

CodeLanguage
autoAuto-detect
zhChinese (Mandarin)
enEnglish
yueCantonese
arArabic
csCzech
daDanish
deGerman
elGreek
esSpanish
faPersian
fiFinnish
filFilipino
frFrench
hiHindi
huHungarian
idIndonesian
itItalian
jaJapanese
koKorean
mkMacedonian
msMalay
nlDutch
plPolish
ptPortuguese
roRomanian
ruRussian
svSwedish
thThai
trTurkish
viVietnamese

Target languages

CodeLanguage
zhChinese (Mandarin)
enEnglish
arArabic
daDanish
deGerman
elGreek
esSpanish
fiFinnish
frFrench
heHebrew
hiHindi
idIndonesian
itItalian
jaJapanese
koKorean
msMalay
nlDutch
noNorwegian
plPolish
ptPortuguese
ruRussian
svSwedish
swSwahili
thThai
trTurkish
viVietnamese

Monitor task status

Since video processing is asynchronous, you must poll the get_task() method to determine when the processing is complete.

Polling implementation

python
import time
from cutrix import Client

with Client(api_key="sk-...") as client:
    result = client.video.translate(file_path="./demo.mp4", target_lang="zh")
    
    while True:
        task = client.video.get_task(task_id=result.task_id)
        print(f"Current Status: {task.status}")

        if task.status == "succeed":
            print(f"Download URL: {task.output_video_path}")
            break
        elif task.status == "failed":
            print(f"Error: {task.failed_message}")
            break
            
        time.sleep(30) # Poll every 30 seconds

get_task() parameters

ParameterTypeRequiredDescription
task_idint | strYesUnique identifier returned by translate().

Task status codes

statusDescription
pendingTask is queued, waiting to be picked up
startedProcessing is in progress
succeedTranslation finished successfully. output_video_path is available
failedTask failed. Check failed_code for the reason

Failure error codes

CodeReason
2001Automatic language detection failed. Please select the source language manually and try again.
2002No audio was detected. Please make sure the video contains an audio track.
2003No video was detected. Please make sure the file contains video content.
2004Unknown error. Please try again later or contact support.
2005The source and target languages are the same, so translation is not needed.

Exception handling

Handle API and SDK exceptions to ensure your integration is robust.

Error handling

python
from cutrix import Client, AuthenticationError, RateLimitError
from cutrix.exceptions import APIError, SDKError

try:
    with Client(api_key="sk-...") as client:
        # API calls...
        pass
except AuthenticationError:
    print("Invalid API Key.")
except RateLimitError:
    print("Request limit exceeded.")
except APIError as e:
    print(f"API Exception: {e.message} (Status: {e.status_code})")
except SDKError as e:
    print(f"Local SDK Error: {e}")

Need technical assistance?

Our team is available to help with enterprise integrations, custom workflows, or high-volume API usage requirements.

Email Support