Music API image_url null: clear a reused request body, with Python

Send image_url as null on Sume music requests only to clear an image from a reused request object. A short urllib script posts to the Music Router.

4 min readSume
All posts

On Sume's music routes, image_url is a public HTTPS image, or null to clear it. The Music 1.0 page says to send null only when you intentionally clear an image input on a client that reuses request objects. If you build each body from scratch, omit the field. The null is for the case where a shared payload object still carries last scene's image.

Why it exists

A script that generates music for several scenes often keeps one request dict and mutates it. Scene one passes a still as image_url. Scene two has no still, and a stale value would condition the new track on the wrong image. Setting the field to null clears it.

Python sample

This posts to POST /v1/music-router/generate with the standard library. It reads the key from SUME_API_KEY and sets an Idempotency-Key. The prompt controls length, because duration is rejected.

import json, os, urllib.request

body = {
    "model": "sume/music-auto",
    "prompt": "Warm lo-fi hip hop, 84 BPM, C minor. Dusty Rhodes chords, brushed drums. A 30-second track. Instrumental, no vocals.",
    "image_url": None,
}
req = urllib.request.Request(
    "https://api.sume.com/v1/music-router/generate",
    data=json.dumps(body).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["SUME_API_KEY"],
        "Content-Type": "application/json",
        "Idempotency-Key": "music-null-image-001",
    },
    method="POST",
)
with urllib.request.urlopen(req) as resp:
    job = json.load(resp)
print(job.get("id"), job.get("status"))

Rules for the field

The price does not change with image conditioning: the Music 1.0 page lists a fixed $0.125 per accepted generation. The job returns a result you read with GET /v1/jobs/:id/result, and job.request.routed_model names the engine that ran.

image_url values on Sume music requests (read 2026-10-05)
ValueMeaning
OmittedNo image conditioning.
Public HTTPS URLImage-conditioned generation.
nullClear an image carried in a reused request object.
Non-HTTPS or private URLNot valid; image URLs must be public HTTPS.

After the call

The job is async by default. The response gives you a job id, and you read GET /v1/jobs/:id/status and then /result. If you add mode: "sync", set wait_timeout_seconds between 0 and 30, and expect a 202 if the track is not done in time.

The result has the track as a Sume media URL. The docs say to use these URLs, because raw provider URLs are not public outputs.

If you pass a still to condition on, the Music page recommends passing the accepted scene still as image_url when a project wants a score that follows its scenes. For a project that asks for one consistent score, keep continuity in the prompt axes.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume