Highlight Reel Generation

The Vision API provides powerful highlight generation capabilities for your longer videos, which can be used to generate shorter highlight reels from the video.

Usage

We offer two ways to generate reels from your videos:

  • Option 1: 2‑step workflow
    • Submit a job with POST /generations
    • Poll job status with GET /v1/creator/reels/{id} until completed
  • Option 2: Single streaming request
    • Submit a job to POST /v1/creator/reels with stream=true to receive real‑time progress updates (SSE)

Option 1: Submit and poll

Endpoint

  • POST /v1/creator/reels

Headers

  • Content-Type: application/json
  • X-Api-Key: YOUR_API_KEY

Request body

  • video_urls (array[string], required): URLs of input videos
  • prompt (string, required): Description of the reel to generate
  • generation_config (object, optional):
    • template (“moments” | “compilation”, default: “moments”)
    • num_generations (integer, default: 1)
    • min_duration_seconds (integer, optional)
    • max_duration_seconds (integer, optional)
  • rendering_config (object, optional):
    • subtitles (boolean, default: true)
    • aspect_ratio (string, default: “9:16”)

Bash

$curl -X POST "https://vision-agent.api.reka.ai/v1/creator/reels" \
> -H "X-Api-Key: $REKA_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "video_urls": ["https://www.youtube.com/watch?v=U0Cd8jbj5zg"],
> "prompt": "Create an engaging short video highlighting the best moments",
> "generation_config": {
> "template": "moments",
> "num_generations": 3,
> "min_duration_seconds": 0,
> "max_duration_seconds": 60
> },
> "rendering_config": {
> "subtitles": true,
> "aspect_ratio": "9:16"
> }
> }'

Python

1import requests, json
2
3BASE_URL = "https://vision-agent.api.reka.ai"
4API_KEY = "YOUR_API_KEY" # or use an environment variable
5
6endpoint_url = f"{BASE_URL}/v1/creator/reels"
7payload = {
8 "video_urls": ["https://www.youtube.com/watch?v=U0Cd8jbj5zg"],
9 "prompt": "Create an engaging short video highlighting the best moments",
10 "generation_config": {
11 "template": "moments",
12 "num_generations": 3,
13 "min_duration_seconds": 0,
14 "max_duration_seconds": 60,
15 },
16 "rendering_config": {
17 "subtitles": True,
18 "aspect_ratio": "9:16",
19 },
20}
21headers = {
22 "Content-Type": "application/json",
23 "X-Api-Key": API_KEY,
24}
25
26response = requests.post(endpoint_url, headers=headers, json=payload)
27response.raise_for_status()
28result = response.json()
29print(json.dumps(result, indent=2))
30
31generation_id = result["id"]

Check generation status

  • GET /v1/creator/reels/{id}

Returns job metadata and, when status is completed, an output array with generated reels.

Bash

$GEN_ID="YOUR_GENERATION_ID"
>curl -X GET "https://vision-agent.api.reka.ai/v1/creator/reels/${GEN_ID}" \
> -H "X-Api-Key: $REKA_API_KEY" \
> -H "Content-Type: application/json" | jq .

Python

1url = f"{BASE_URL}/v1/creator/reels/{generation_id}"
2headers = {"X-Api-Key": API_KEY}
3
4resp = requests.get(url, headers=headers)
5resp.raise_for_status()
6status = resp.json()
7print(json.dumps(status, indent=2))

Option 2: Streaming in one request

Set stream: true to receive Server-Sent Events (SSE) with progress updates until completion.

Bash

$curl -N -X POST "https://vision-agent.api.reka.ai/v1/creator/reels" \
> -H "X-Api-Key: $REKA_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "video_urls": ["https://demo-videos-bucket-reka.s3.eu-west-2.amazonaws.com/evYsMdBrFXc.mp4"],
> "prompt": "Create an engaging short video highlighting the best moments",
> "generation_config": {"template": "moments", "num_generations": 1},
> "rendering_config": {"subtitles": true, "aspect_ratio": "9:16"},
> "stream": true
> }'

Python

1import requests, json
2from typing import Generator, Dict, Any
3
4endpoint_url = f"{BASE_URL}/v1/creator/reels"
5payload = {
6 "video_urls": ["https://demo-videos-bucket-reka.s3.eu-west-2.amazonaws.com/evYsMdBrFXc.mp4"],
7 "prompt": "Create an engaging short video highlighting the best moments",
8 "generation_config": {
9 "template": "moments",
10 "num_generations": 1,
11 "min_duration_seconds": 0,
12 "max_duration_seconds": 90,
13 },
14 "rendering_config": {
15 "subtitles": True,
16 "aspect_ratio": "9:16",
17 },
18 "stream": True,
19}
20headers = {
21 "Content-Type": "application/json",
22 "X-Api-Key": API_KEY,
23}
24
25def stream_events(response) -> Generator[Dict[str, Any], None, None]:
26 last_data = None
27 for line in response.iter_lines():
28 if not line:
29 continue
30 decoded = line.decode("utf-8")
31 if decoded.startswith("data: "):
32 try:
33 data = json.loads(decoded[6:])
34 if data != last_data:
35 yield data
36 last_data = data
37 except json.JSONDecodeError:
38 pass
39
40with requests.post(endpoint_url, headers=headers, json=payload, stream=True) as r:
41 r.raise_for_status()
42 for event in stream_events(r):
43 print(json.dumps(event, indent=2))