Python: find the Sume Format that takes your input and returns video
Page through GET /v1/formats and filter on the io profile (input_kind, output_kind) to pick a Sume Format by shape. Includes the null-io case.

GET /v1/formats returns each Format with an io profile that names its input_kind and output_kind, so you can pick a Format by shape before you spend anything. The script below walks the keyset pages with next_cursor and yields the handle/slug of every Format that matches. Formats saved before registration existed return io: null, which means not declared, so the script skips them.
import json, os, urllib.request
def get(url):
req = urllib.request.Request(
url, headers={"Authorization": "Bearer " + os.environ["SUME_API_KEY"]})
with urllib.request.urlopen(req) as res:
return json.load(res)
def formats_by_io(kind_in, kind_out):
cursor = None
while True:
url = "https://api.sume.com/v1/formats?limit=50"
if cursor:
url += "&cursor=" + cursor
page = get(url)
for f in page["data"]:
io = f.get("io")
if io and io["input_kind"] == kind_in and io["output_kind"] == kind_out:
yield f"{f['handle']}/{f['slug']}"
if not page["has_more"]:
return
cursor = page["next_cursor"]
if __name__ == "__main__":
print(list(formats_by_io("text", "video")))What the profile holds
Run it once in CI and diff the output over time. A change in the list of matching Formats is a signal that the catalog or your team's own Formats changed, which is cheaper to find out from a script than from a failed run.
| Field | Values |
|---|---|
input_kind | url, text, image or product |
output_kind | video, image or text |
profile | A name such as url_to_video |
null | The Format was saved before the profile existed; read its description instead |
How the paging works
The list returns the Formats your key's workspace owns plus the first-party catalog, in keyset pages. While has_more is true, send next_cursor back as cursor.
The key needs formats:read. A key made before the Format API call trigger shipped does not carry it, and you cannot add scopes to an existing key, so mint a new one.
Why not hard-code a slug
The catalog answers at the reserved sume handle, and any slug not in the published list answers 404 format_not_found. A filter on io keeps working when your own team adds Formats, and it tells you the shape of input to send: io is the only declared contract between a Format author and its callers, because the run body's input is free-form.
From the list to a call
Once you have a handle/slug, read GET /v1/formats/{handle}/{slug} for the description and cap. Then call POST /v1/formats/{handle}/{slug}/runs with an Idempotency-Key. Each list entry also carries generation_spend_cap_usd_micros, so you can filter out a Format whose cap is above what you want before you call it.
Sources
Related posts
More in Formats
- Smallest vertical video size that passes Google Ads and TikTok
Google lists 720x1280 as the vertical minimum, TikTok in-feed 540x960 and its app bundle 720x1280. One Timeline output size clears them all, with the table.
- Previously on: add a recap to a YouTube Shorts series episode
Open a Shorts episode with a Previously on recap: build it with Timeline 1.0 audio.parts and see what it costs per minute.
- Put your 16 strongest hooks first: Sume bulk queues start in order
A bulk queue returns 202 with the first `concurrency` items already running, up to 16. Order your 100 weekly ads so the best hooks are the first ones you see.
- Recreate a winning ad's structure for your product with Sume
sume-recreate keeps a reference video's scene order, beat timing and caption rhythm, casts a new presenter and generates every shot fresh. How to call it.
Written by Sume