Call Sume video generation from Java 11 with HttpClient
Java 11 HttpClient against Sume /v1/videos: submit a sume/auto job, poll until completed, and see what a default 8-second clip costs. No SDK needed.

Java 11 and later ship java.net.http.HttpClient, which is all you need for Sume's asynchronous video API: POST a job, then GET the polling_url until the status leaves pending and in_progress. No SDK or JSON library is required if you only read two fields.
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.
import java.net.URI;
import java.net.http.*;
import java.util.regex.*;
public class Video {
static final HttpClient C = HttpClient.newHttpClient();
static String send(HttpRequest.Builder b) throws Exception {
var r = b.header("Authorization", "Bearer " + System.getenv("SUME_API_KEY")).build();
return C.send(r, HttpResponse.BodyHandlers.ofString()).body();
}
static String field(String json, String name) {
Matcher m = Pattern.compile("\"" + name + "\":\\s*\\[?\\s*\"([^\"]+)\"").matcher(json);
return m.find() ? m.group(1) : "";
}
public static void main(String[] a) throws Exception {
String body = "{\"model\":\"sume/auto\",\"prompt\":\"Lanterns rising over a harbor\",\"aspect_ratio\":\"16:9\"}";
var post = HttpRequest.newBuilder(URI.create("https://api.sume.com/v1/videos"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body));
String poll = field(send(post), "polling_url");
String s, out;
do {
Thread.sleep(20000);
out = send(HttpRequest.newBuilder(URI.create(poll)).GET());
s = field(out, "status");
} while (s.equals("pending") || s.equals("in_progress"));
System.out.println(s + " " + field(out, "unsigned_urls"));
}
}What to know
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.
The regex reads the first string value of a field, which is enough for status and the first entry of unsigned_urls; switch to Jackson or Gson once you need more. Run the file with java Video.java on Java 11 or newer. This sample was written against the documented response shape and not run end to end.
Sources
Related posts
More in Developers
- callback_url or webhook_url: which field each Sume video route takes
POST /v1/videos takes callback_url; motion control, lip-sync and image routes take mode plus webhook_url. The field names and what they share.
- Cancel a wrong video job after a Sora port: only before it starts
Ported prompts on the wrong model burn money. Sume cancels a video job only before generation starts; later you get 409 job_generation_already_started.
- Cancel a Format run: cancel_effect canceled vs no_op, and the bill
Cancel is idempotent. cancel_effect says canceled or no_op, a canceled run never sends a webhook, and generation that finished is still billed.
- Cap Sume spend from an agent loop: dry_run, max_spend_usd and run caps
Four optional guards cap what an automated Sume caller can spend: dry_run, max_spend_usd, generation_spend_cap_usd on Formats, and a balance check.
Written by Sume