Implementation:Togethercomputer Together python Videos Create
| Knowledge Sources | |
|---|---|
| Domains | Video_Generation, Generative_AI |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
Concrete tool for generating videos from text prompts using AI models provided by the Together Python SDK.
Description
The Videos class provides API methods for creating AI-generated videos and retrieving job results. Video generation is asynchronous: create() submits a job and returns a job ID, while retrieve() polls for completion and returns the video URL. Supports configurable resolution, frame rate, duration, guidance scale, seed, keyframe images, and reference images. Both sync and async variants are provided.
Usage
Import this class when you need to generate videos from text descriptions or with image conditioning. The API uses a v2 endpoint and returns asynchronous job results.
Code Reference
Source Location
- Repository: Together Python
- File: src/together/resources/videos.py
- Lines: 1-303
Signature
class Videos:
def create(
self,
*,
model: str,
prompt: str | None = None,
height: int | None = None,
width: int | None = None,
seconds: str | None = None,
fps: int | None = None,
steps: int | None = None,
seed: int | None = None,
guidance_scale: float | None = None,
output_format: Literal["MP4", "WEBM"] | None = None,
output_quality: int | None = None,
negative_prompt: str | None = None,
frame_images: List[Dict[str, Any]] | None = None,
reference_images: List[str] | None = None,
) -> CreateVideoResponse: ...
def retrieve(self, id: str) -> VideoJob: ...
Import
from together import Together
client = Together()
# Access via client.videos
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| model | str | Yes | Video generation model name |
| prompt | str | No | Text description of the desired video |
| height | int | No | Video height in pixels |
| width | int | No | Video width in pixels |
| seconds | str | No | Video duration (1-10 seconds) |
| fps | int | No | Frames per second (15-60, default 24) |
| steps | int | No | Denoising steps (10-50, default 20) |
| seed | int | No | Random seed for reproducibility |
| guidance_scale | float | No | Prompt adherence (6.0-10.0 recommended, default 8) |
| negative_prompt | str | No | What to avoid in generation |
| frame_images | List[Dict] | No | Keyframe images for guided generation |
| reference_images | List[str] | No | Style/composition reference images |
Outputs
| Name | Type | Description |
|---|---|---|
| create() returns | CreateVideoResponse | Contains job id for polling |
| retrieve() returns | VideoJob | Job status, video URL (when completed), cost |
Usage Examples
import time
from together import Together
client = Together()
# Create a video generation job
response = client.videos.create(
model="together/video-gen-model",
prompt="A serene mountain landscape at sunset with flowing clouds",
height=720,
width=1280,
seconds="5",
fps=24,
steps=30,
guidance_scale=8.0,
output_format="MP4",
)
print(f"Job ID: {response.id}")
# Poll for completion
while True:
job = client.videos.retrieve(response.id)
if job.status == "completed":
print(f"Video URL: {job.outputs.video_url}")
print(f"Cost: ${job.outputs.cost}")
break
elif job.status == "failed":
print(f"Error: {job.error.message}")
break
time.sleep(5)