Documentation Index
Fetch the complete documentation index at: https://docs.together.ai/llms.txt
Use this file to discover all available pages before exploring further.
Use reference images to steer a video’s visual style, and use keyframes to pin specific frames to a known image.
Reference images
Guide your video’s visual style with reference images:
import time
from together import Together
client = Together()
job = client.videos.create(
prompt="A cat dancing energetically",
model="minimax/hailuo-02",
width=1366,
height=768,
seconds="6",
reference_images=[
"https://cdn.pixabay.com/photo/2020/05/20/08/27/cat-5195431_1280.jpg",
],
)
print(f"Job ID: {job.id}")
# Poll until completion
while True:
status = client.videos.retrieve(job.id)
print(f"Status: {status.status}")
if status.status == "completed":
print(f"Video URL: {status.outputs.video_url}")
break
elif status.status == "failed":
print("Video generation failed")
break
# Wait before checking again
time.sleep(60)
Keyframe control
Control specific frames in your video for precise transitions.
Single keyframe: Set a single frame (the first frame, in the example below) to a specific image.
Depending on the model, you can also set multiple keyframes. See the supported models table for details.
import base64
import requests
import time
from together import Together
client = Together()
# Download image and encode to base64
image_url = (
"https://cdn.pixabay.com/photo/2020/05/20/08/27/cat-5195431_1280.jpg"
)
response = requests.get(image_url)
base64_image = base64.b64encode(response.content).decode("utf-8")
# Single keyframe at start
job = client.videos.create(
prompt="Smooth transition from day to night",
model="minimax/hailuo-02",
width=1366,
height=768,
fps=24,
frame_images=[{"input_image": base64_image, "frame": 0}], # Starting frame
)
print(f"Job ID: {job.id}")
# Poll until completion
while True:
status = client.videos.retrieve(job.id)
print(f"Status: {status.status}")
if status.status == "completed":
print(f"Video URL: {status.outputs.video_url}")
break
elif status.status == "failed":
print("Video generation failed")
break
# Wait before checking again
time.sleep(60)
Frame number = seconds × fps.