Music API 400s: duration and negative_prompt, and the fix

Sume's Music Router returns 400 if you send duration, duration_seconds or a non-empty negative_prompt. The fix for each, and a request that passes validation.

3 min readSume
All posts

Three input mistakes make a Sume music request fail at validation, before any generation or charge. Sending duration or duration_seconds is rejected. Sending a non-empty negative_prompt returns HTTP 400 with public_reason=negative_prompt_unsupported. Naming an unknown model returns 400 model_not_found with a catalog_url.

Error and fix

From the Music Router docs
You sentResultFix
duration: 30rejectedWrite the length in the prompt: "a 30-second track".
negative_prompt: "no drums"400, negative_prompt_unsupportedOmit the field or send ""; put the exclusion in the prompt.
model: "lyria-4"400 model_not_foundPick an id from GET /v1/music-router/models.

Moving the exclusion into the prompt

The Lyria engine does not support negative prompts, so the exclusion goes in as a positive instruction. The docs' own examples: "no vocals, no spoken word" and "Instrumental, no vocals." Add "no spoken word" only under narration.

import os, requests

body = {
    "model": "sume/music-auto",
    "prompt": "Dry funk loop, 104 BPM, E minor. Clavinet, tight drums. "
              "A 20-second track. Instrumental, no vocals, no spoken word.",
}
r = requests.post("https://api.sume.com/v1/music-router/generate",
    headers={"Authorization": "Bearer " + os.environ["SUME_API_KEY"],
             "Idempotency-Key": "funk-20s-001"},
    json=body)
print(r.status_code)
print(r.json())

Why rejection beats a silent drop

A field that is ignored without telling you looks like a model that ignored your instruction. Rejecting it makes the cause visible in the first call. The same style applies to the other media endpoints, which refuse ffmpeg-style fields instead of discarding them.

A request rejected at validation does not start a generation; an accepted one is a fixed $0.125. If a policy rejection happens, change the flagged content and keep the musical brief rather than falling back to a generic bed.

Other limits worth checking

The prompt is 1 to 5000 characters. image_url, if you send one, must be a public HTTPS image (or null to clear it). wait_timeout_seconds takes 0 to 30 for sync and subscribe modes. To control length and structure, say so in the prompt, for example "a 2-minute track" or a timed arc such as [0:00-0:30] Intro: ....

Sources

Related posts

More in Developers

All Developers posts

Written by Sume