Attempting to upload a 5GB 4K video by reading the entire file into memory will immediately crash the worker node. Utilize the API's chunked upload capability via tokens to stream the file in manageable byte ranges.
import api_video
from api_video.api import VideosApi
client = api_video.Client("YOUR_API_KEY")
videos_api = VideosApi(client)
# Streams data in 50MB chunks, keeping RAM usage flat
videos_api.upload_with_upload_token(
token="to1R5MUX2b8xJ...",
file="huge_4k_master.mp4",
chunk_size=1024 * 1024 * 50
)