Extract 16 kHz mono audio from a video for transcription
A Python script that detaches speech-ready 16 kHz mono wav from a Sume-hosted video, then polls the job. Costs $0.01 per detach before the STT minute.

To prepare a video for transcription, detach its audio as 16 kHz mono wav: format: "wav", sample_rate: 16000, channels: "mono". That is the shape the Audio detach page names as the STT shape, and it costs $0.01 per job. Speech to text then costs $0.01 per audio minute.
The script
The source must be a media.sume.com video in your workspace. The script submits with mode: "sync", which waits up to 30 seconds and returns 200, or 202 with a job to poll.
import os, time, requests
BASE = "https://api.sume.com"
H = {"Authorization": "Bearer " + os.environ["SUME_API_KEY"],
"Idempotency-Key": "detach-16k-001"}
r = requests.post(BASE + "/v1/audio-detach", headers=H, json={
"video_url": "https://media.sume.com/artifacts/artf_demo/talk.mp4",
"format": "wav", "sample_rate": 16000, "channels": "mono",
"mode": "sync",
})
r.raise_for_status()
job = r.json()
jid = job.get("data", job)["request_id"]
while True:
s = requests.get(BASE + f"/v1/jobs/{jid}/status", headers=H).json()
s = s.get("data", s)
if s["terminal"]:
break
time.sleep(s.get("next_poll_after_seconds") or 2)
if not s["result_ready"]:
raise SystemExit("detach did not complete: " + str(s))
res = requests.get(BASE + f"/v1/jobs/{jid}/result", headers=H).json()
print(res.get("data", res))
What comes back
A finished result has kind: audio_detach with an audio_url (a new artf_ artifact), duration_seconds, format, channels, sample_rate, and source_duration_seconds. Pass audio_url to the next step.
Budget for an hour of audio
Output is capped at 900 seconds per job and STT at 10 minutes per request, so the cheapest plan for an hour is to detach in 15-minute ranges and transcribe in 10-minute slices.
| Step | Jobs for 60 min | Cost |
|---|---|---|
| Detach, 900 s ranges | 4 | $0.04 |
| STT, 60 audio minutes | 6 (10 min each) | $0.60 |
| Total | $0.64 |
Sources
Related posts
More in Developers
- Face swap request in Python: validate the video URL before you send
A Python snippet that rejects non-HTTPS, localhost and private-IP video URLs locally, then submits a Sume face-swap beta run with a quality and idempotency key.
- Failed Sume video job: resubmit or stop? Read retryable, next_action
Sora said failed and little else. A failed Sume job carries an error with category, retryable, retry_after_seconds and next_action. A small decision function.
- FastAPI 0.142 native OpenTelemetry: tag spans with a Sume job id
FastAPI 0.142.0 added native OpenTelemetry. Put the Sume job_id on the current span in a webhook route so a failed render shows up next to the HTTP trace.
- FastAPI background poll of a Sume job: use next_poll_after_seconds
Poll a Sume job from an asyncio task in a FastAPI 0.142 app, wait for the server-provided interval, stop at terminal, and never resubmit after a timeout.
Written by Sume