Submit and poll a Sume video job from Rust with reqwest
Rust reqwest blocking client for Sume /v1/videos: submit a sume/auto job, poll until completed, print the download URL and usage.cost. Cargo features listed.

Rust teams can call Sume's /v1/videos with reqwest in blocking mode and read the job as serde_json::Value, which avoids writing structs for a response with only four fields you care about.
The code
Set SUME_API_KEY. The program submits one job, polls polling_url every 20 seconds until completed, and prints the first download URL.
use serde_json::{json, Value};
use std::{env, thread, time::Duration};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let key = env::var("SUME_API_KEY")?;
let c = reqwest::blocking::Client::new();
let body = json!({"model": "sume/auto", "prompt": "Fog rolling over a ridge", "aspect_ratio": "9:16"});
let job: Value = c.post("https://api.sume.com/v1/videos").bearer_auth(&key).json(&body).send()?.json()?;
let poll = job["polling_url"].as_str().ok_or("no polling_url")?.to_string();
loop {
thread::sleep(Duration::from_secs(20));
let s: Value = c.get(&poll).bearer_auth(&key).send()?.json()?;
match s["status"].as_str() {
Some("completed") => {
println!("{} {}", s["unsigned_urls"][0], s["usage"]["cost"]);
return Ok(());
}
Some("failed") | Some("cancelled") => return Err(s.to_string().into()),
_ => {}
}
}
}What to know
Cargo.toml needs reqwest = { version = "0.12", features = ["blocking", "json"] } and serde_json = "1". This sample was written against the documented response shape and was not compiled in this session, so run cargo check first.
sume/auto currently resolves to Gemini Omni Flash 1.1 and takes 3 to 10 seconds in 16:9 or 9:16. The defaults are 720p and 8 seconds, so this call bills $1.00 (list $0.10 per second x 1.25 x 8 s). A failed or cancelled job ends the loop with a non-success status; check error in the poll body.
Sources
Related posts
More in Developers
- Retry or fix? A status-code policy for Sume API clients in Python
Retry 429 and 503 with the same idempotency key; never retry 400, 401, 402 or 404. A small Python policy function, tested, with the Sume docs rules behind it.
- sume/auto is missing from GET /v1/images/models: hardcode it
Sume Image Router Auto never appears in the model list. Discovery code that only reads GET /v1/images/models will never offer sume/auto. How to handle it.
- SUME_API_AUTH_MODE: make the Sume CLI send Bearer instead of x-api-key
The Sume CLI sends x-api-key by default. Set SUME_API_AUTH_MODE=bearer when your client or network layer expects Authorization: Bearer. Never send both.
- No progress percent in Sume job events: what to log and show instead
Sume's job events are a public timeline of eight named events, not a progress feed. What each means, what to log, and what to show a user while a video renders.
Written by Sume