Skip to main content
Generate videos from text prompts, animate still images into motion, or edit existing videos with natural language instructions. Supports cinematic scenes with dialogue, timelapse animations, style transfers, and high-fidelity video editing.

Quick Start

import requests

response = requests.post(
    "https://api.zarkai.xyz/v1/chat",
    headers={
        "x-api-key": "your_api_key",
        "Content-Type": "application/json",
    },
    json={
        "messages": [
            {"role": "user", "content": "Generate a 10-second video of ocean waves crashing on a rocky shore at sunset"}
        ],
        "workspace_id": "wks-xxxxx",
        "tools": ["video_gen"],
        "tool_choice": "auto",
    },
)

data = response.json()
print(data["response"])
Video generation is asynchronous — it typically takes a few minutes depending on complexity. When streaming, you receive progress updates in real time.

Image-to-Video

Animate a still image from your Space into motion video:
{
  "messages": [
    {"role": "user", "content": "Animate this photo with a slow zoom and gentle wind movement"}
  ],
  "workspace_id": "wks-xxxxx",
  "tools": ["video_gen"],
  "file_ids": ["file-abc123"],
  "tool_choice": "auto"
}
The model uses the image as the starting frame and generates motion based on your instructions.

Video Editing

Edit an existing video by referencing it and describing the changes:
{
  "messages": [
    {"role": "user", "content": "Edit this video to make it look like it's snowing"}
  ],
  "workspace_id": "wks-xxxxx",
  "tools": ["video_gen"],
  "file_ids": ["file-vid456"],
  "tool_choice": "auto"
}
The model applies high-fidelity edits while preserving the rest of the scene — modifying only what you ask for.

Request Modes

The video generation tool supports multiple modes, determined by what’s included in the request:
ModeHow to triggerDescription
Text-to-videomessages onlyGenerate video from text prompt
Image-to-videomessages + file_ids (image)Animate a still image
Video editingmessages + file_ids (video)Edit an existing video

Streaming

Python
import requests
import json

response = requests.post(
    "https://api.zarkai.xyz/v1/chat",
    headers={"x-api-key": "your_api_key", "Content-Type": "application/json"},
    json={
        "messages": [{"role": "user", "content": "Create a cinematic drone shot flying through mountain peaks"}],
        "workspace_id": "wks-xxxxx",
        "tools": ["video_gen"],
        "stream": True,
    },
    stream=True,
)

for line in response.iter_lines():
    if line:
        event = json.loads(line.decode("utf-8").removeprefix("data: "))
        if event["type"] == "media_item":
            print(f"Video ready: {event['file_id']}")
        elif event["type"] == "ai_chunk":
            print(event["content"], end="", flush=True)
        elif event["type"] == "ai_complete":
            print(f"\n\nDone.")

Streaming Events

EventDescription
media_itemGenerated video file reference with file_id and metadata
ai_chunkIncremental text describing what was generated
ai_completeFinal response with video reference

What Video Generator Is Not

  • Not for transcription — to transcribe or index video content, use Media Processor
  • Not for still images — to create static images, use Image Generator
  • Not for browsing — to search or list your existing videos, use File Manager

Examples

Generate a cinematic drone shot flying through mountain peaks
Create a 15-second timelapse of a flower blooming
Animate this product photo with a slow rotating motion
Make a video of a sunset over a city skyline with ambient music
Edit this clip to add a lens flare effect
Create a video with two people having a conversation in a café