Sonilo Video to Music API

Sonilo Video to Music composes an original soundtrack for a video. It follows the footage's pacing and mood on its own, and optional prompts, timed segments and speech preservation let you steer the result.

Music GenerationVideo to Music

Provider

Sonilo

Billing

Per second

ScalingTensor price

$0.009 per second of source video

Playground

Try Sonilo Video to Music

Edit the params, add your API key and run the model here. The result plays on this page when the job completes.

Input

Used for this request only and never stored. Get a key

Running a request charges your wallet: $0.009 per second of source video.

Output

preview

Request summary

Endpoint
POST /api/media/generate
Model ID
sonilo/video-to-music
prompt
cinematic
segments
[{"start":0,"prompt":"quiet"}]
video_url
https://example.com/your-video.mp4
preserve_speech
true

Need chat models, job lookups or the raw response? Open the full playground.

Pricing

Sonilo Video to Music API pricing

Prices come from the live catalog. There is no subscription; each request is charged to your prepaid wallet.

ScalingTensor price

Per second

Live catalog price

$0.009

per second of source video

A 60-second video costs $0.54.

Compare all model prices

Shared balance

Add credits

Top up

One wallet and one API key for every model in the catalog. Top-ups start at $10 and are paid through Stripe.

Parameters

Input parameters

These parameters belong inside the request body's params object.

Input parameters
nametyperequireddescription
video_urlstringconditionalURL to a video file. Provide either video or video_url, not both. Must be a public http:// or https:// URL; private/internal addresses are rejected. Max file size: default 300MB. Max duration: 6 minutes.
output_formatstringoptionalOptional. m4a (default) returns AAC‑encoded audio. wav returns 16‑bit PCM WAV instead, transcoded server‑side after generation — applies to both audio and, when preserve_speech is used, the mux track (the isolated vocals stem is unaffected). mp3 returns 320 kbps MP3.
promptstringoptionalOptional text prompt to guide music generation, up to 2000 characters. For best results, omit this and let the model generate based on video content.
segmentsstringoptionalOptional JSON array of timed segment prompts; the music changes style at each boundary. Each item has start (seconds; the first must be 0, starts strictly increasing and at least 5 seconds apart, the last at least 5 seconds before the end of the video), prompt (1‑200 characters), and an optional label that must be exactly one of these values — any other value is rejected with a 422 error, and it defaults to none when omitted: intro, verse, pre‑chorus, chorus, bridge, break, silence, outro, none. 1‑30 items.
preserve_speechbooleanoptionalOptional boolean, default false. When true, the original speech (dialogue, narration, or voice‑over) is preserved while generating a new soundtrack. The model automatically isolates the speech from the source audio and composes music around it, preventing the original background music from influencing generation. No additional charge — billed the same as preserve_speech=false.
duckingbooleanoptionalOptional boolean, default false. Pass ducking=true to duck the generated music under the video's speech so dialogue stays intelligible, returned as an extra ducked audio track alongside the clean audio — free of charge. When preserve_speech is used the ducking rides on the isolated vocals stem; otherwise it uses the video's original audio.
duckingbooleanoptionalOptional boolean, default false. Pass ducking=true to duck the generated music under the video's speech so dialogue stays intelligible, returned as an extra ducked audio track alongside the clean audio — free of charge. When preserve_speech is used the ducking rides on the isolated vocals stem; otherwise it uses the video's original audio.
variants_numintegeroptionalOptional. How many distinct music variants to generate in one request, 1‑10 (default 1). Each variant is a separate creative direction with its own title, returned as its own entry in audio. Cost scales linearly — variants_num=3 costs three times a single‑variant request. Values above 1 are never covered by the free trial and are always billed.
prompt_influencenumberoptionalOptional number, 0 to 1 (default 0.5). How strongly the generated music follows your prompt: lower values let the video lead, higher values follow the prompt more literally. Free of charge.
stemsbooleanoptionalOptional boolean, default false. Pass stems=true to also split each generated track into four separated instrument tracks — drums, bass, vocals and other — returned as a stems array alongside the clean audio. It splits the generated music, never the video's own audio. The stems normally follow output_format; each stem's content_type reports what was actually delivered. Free of charge, but separation runs after generation and typically adds 2‑6 min to the wait, and gives up after 30 min — a ceiling reached by a retry or a busy queue rather than by track length, so do not size a client timeout off the duration. It never fails the task: if separation fails, audio is unaffected and the response carries stems_error — on its own, or alongside the streams that did separate.

When the job completes, GET /api/media/result returns the provider’s result, including the output URL, in data.resultData.

API

Call Sonilo Video to Music from your code

Create a key in the console and call the API from your server using the apiKey header. Save data.jobId and poll GET /api/media/result?jobId=... with the same key; a code of 0 means success.

POST /api/media/generate
curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
  --header 'apiKey: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "model": "sonilo/video-to-music",
  "params": {
    "prompt": "cinematic",
    "segments": [
      {
        "start": 0,
        "prompt": "quiet"
      }
    ],
    "video_url": "https://example.com/your-video.mp4",
    "preserve_speech": true
  }
}'
const response = await fetch("https://restapi.scalingtensor.com/api/media/generate", {
  method: "POST",
  headers: {
    apiKey: process.env.SCALINGTENSOR_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "sonilo/video-to-music",
    "params": {
      "prompt": "cinematic",
      "segments": [
        {
          "start": 0,
          "prompt": "quiet"
        }
      ],
      "video_url": "https://example.com/your-video.mp4",
      "preserve_speech": true
    }
  }),
});

const result = await response.json();
if (!response.ok || result.code !== 0) {
  throw new Error(result.msg || `Request failed: ${response.status}`);
}
console.log(result.data); // Save data.jobId to query /api/media/result
import os
import requests

payload = {
    "model": "sonilo/video-to-music",
    "params": {
        "prompt": "cinematic",
        "segments": [
            {
                "start": 0,
                "prompt": "quiet",
            },
        ],
        "video_url": "https://example.com/your-video.mp4",
        "preserve_speech": True,
    },
}

response = requests.post(
    "https://restapi.scalingtensor.com/api/media/generate",
    headers={"apiKey": os.environ["SCALINGTENSOR_API_KEY"]},
    json=payload,
    timeout=60,
)
result = response.json()
if result["code"] != 0:
    raise RuntimeError(result["msg"])
print(result["data"])  # Save data["jobId"] to query /api/media/result

API documentation · This page as Markdown · Markdown API reference

Related models

Sonilo Video to Music API FAQ

How much does the Sonilo Video to Music API cost?

Sonilo Video to Music costs $0.009 per second of source video on ScalingTensor. A 60-second video costs $0.54. There is no subscription; usage is charged to your prepaid wallet.

How do I call the Sonilo Video to Music API?

Send POST /api/media/generate with "model": "sonilo/video-to-music" and the parameters in a params object, using your apiKey header. The call returns a jobId. Poll GET /api/media/result?jobId=... until the status is completed, then read the output URL from the result.

Which parameters does Sonilo Video to Music accept?

No parameter is strictly required. Optional: video_url, output_format, prompt, segments, preserve_speech, ducking, variants_num, prompt_influence and stems. The parameter table on this page describes each one.

Do I need a Sonilo account to use Sonilo Video to Music?

No. You call Sonilo Video to Music with your ScalingTensor API key and pay from your ScalingTensor wallet. The same key works for every other model in the catalog.