API Reference

Endpoint:
POST /v2/MiniMax-H3/fl2va

Schema

Input

The endpoint performs text-to-audio-video generation when both frame fields are omitted, or frame-conditioned generation when either field is supplied.

FieldTypeRequiredDescription
promptstringrequiredText description of the synchronized video and audio to generate.
first_imagestringoptionalFirst-frame image as a base64 image data URI.
last_imagestringoptionalLast-frame image as a base64 image data URI.
aspect_ratiostringoptionalWidth-to-height ratio in positive-integer W:H form. Defaults to "16:9". Any ratio from 1:4 through 4:1 is accepted, including "4:1", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16", and "1:4". The service derives the output canvas from this field.
duration_secondsnumberrequiredPositive target duration in seconds. The service aligns it to MiniMax H3's native 24 fps, 17n+5 frame boundary.
num_inference_stepsintegeroptionalNumber of scheduler points. Must be greater than 1; the native profile uses 50.
flow_shiftnumberoptionalVideo scheduler flow shift. The current service profile requires 12.0.
audio_flow_shiftnumberoptionalAudio scheduler flow shift. The current service profile requires 3.0.
seedintegeroptionalSeed used to reproduce a generation. Defaults to 1101.

Common ratios produce these canvases: 4:1 → 2016×512, 21:9 → 1536×672, 16:9 → 1344×768, 4:3 → 1024×768, 1:1 → 768×768, 3:4 → 768×1024, 9:16 → 768×1344, and 1:4 → 512×2016.

The complete JSON body may be up to 10 MiB. The first supplied frame is stretched onto the requested canvas; when both images are supplied, the last image is cover-cropped onto that canvas.

Output

The API returns the generated audio-video file directly on success and structured JSON when a request fails.

StatusContent typeBody
200video/mp4Binary MP4 data containing H.264 video and AAC audio.
4xx / 5xxapplication/jsonError code and human-readable message.

Setup API key

Export your key in the shell before making a request. The key must be authorized for model MiniMax-H3.

export TENSORSCALE_API_KEY="your-api-key"

Example

Text-to-audio-video generation

curl "https://api.tensorscale.io/v2/MiniMax-H3/fl2va" \
  -H "Authorization: Bearer ${TENSORSCALE_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Accept: video/mp4" \
  -d '{
    "prompt": "At night, while their owner sleeps in a bedroom, three cats march in loudly playing tiny brass instruments, then abruptly file out.",
    "aspect_ratio": "16:9",
    "duration_seconds": 5.0,
    "num_inference_steps": 50,
    "flow_shift": 12.0,
    "audio_flow_shift": 3.0,
    "seed": 1101
  }' \
  --output "brass-band-cats.mp4"

Frame-conditioned example

First- and last-frame-conditioned generation

import base64
import os
from pathlib import Path

import requests

def data_uri(path: Path) -> str:
    encoded = base64.b64encode(path.read_bytes()).decode("ascii")
    return f"data:image/jpeg;base64,{encoded}"

resp = requests.post(
    "https://api.tensorscale.io/v2/MiniMax-H3/fl2va",
    json={
        "prompt": "A cinematic aerial push toward a lighthouse as waves roll against the cliffs.",
        "first_image": data_uri(Path("lighthouse-start.jpg")),
        "last_image": data_uri(Path("lighthouse-end.jpg")),
        "aspect_ratio": "16:9",
        "duration_seconds": 5.0,
        "num_inference_steps": 50,
        "flow_shift": 12.0,
        "audio_flow_shift": 3.0,
        "seed": 1101,
    },
    headers={
        "Authorization": f"Bearer {os.environ['TENSORSCALE_API_KEY']}",
        "Accept": "video/mp4",
    },
    timeout=1800,
)
resp.raise_for_status()
Path("lighthouse-transition.mp4").write_bytes(resp.content)