Calling the Sume API from Kotlin: no SDK, so write the poll loop

Sume publishes a TypeScript SDK and no Kotlin package. The documented submit, poll, fetch loop works from OkHttp or Ktor; the deadline lives in your client.

5 min readSume
All posts

There is no official Kotlin client for the Sume API. The only published SDK is @sume-com/sdk for TypeScript, and the Sume docs say a Kotlin integration with OkHttp or Ktor follows the same three steps as any HTTP client. Hand-written is fine because the contract is small: submit with an idempotency key, poll status, fetch the result.

The three steps

The docs mark their Kotlin snippet as an illustrative sketch, not a package. Treat the steps as the contract.

Sume job loop for any HTTP client (read 2026-10-03)
StepCallStop condition
1 SubmitPOST /v1/{product}/generate with mode async and an Idempotency-Key202 with a job id
2 PollGET /v1/jobs/{id}/statusterminal is true
3 FetchGET /v1/jobs/{id}/resultOnly when result_ready or completed

Deadlines belong to the client

wait_timeout_seconds never exceeds 30 and bounds one HTTP request, not the job. Pick your own overall deadline; the docs call 20 minutes reasonable for video. Sleep next_poll_after_seconds when present and use exponential backoff otherwise. When your deadline passes, the job keeps running and billing, so persist the job id and either resume later from status_url or call cancel.

Typed models

Generate your data classes from the live OpenAPI at https://api.sume.com/reference/json rather than copying field tables from the docs; the docs themselves say the schema is the source of truth. Send exactly one credential header, either x-api-key or Authorization: Bearer, because sending both returns 401.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume