Log the Sume request_id in Python JSON logs, no keys or URLs
A small logging helper for failed /v1/videos calls: keep error.code, request_id and job id, and leave out the API key and signed media URLs.

When a Sume call fails, log error.code, error.request_id, the HTTP status and your own job id, as one JSON line. Sume says the request id is safe to share with support. It also says not to include API keys, signed URLs, raw media URLs, or private workspace and user ids in a report, so the logger should drop those fields by design.
What the error body gives you
Public errors share one envelope: {"error": {"code", "message", "request_id", "details"}}. The request id also appears in response headers. For video jobs that failed after acceptance, the poll shows a single error string, which is the public reason; there is no request id in it, so log your own job id next to it.
| Field | Log it? | Reason |
|---|---|---|
| error.code | yes | branch and alert on it |
| error.request_id | yes | the id support asks for |
| HTTP status | yes | separates 4xx from 5xx |
| error.details | yes, trimmed | for example details.supported on a 400 |
| Authorization header | never | it is your API key |
| unsigned_urls and Location values | never | signed or private media URLs |
The helper
The function below takes a requests.Response, builds the log record and writes it with the standard logging module. It truncates details to 500 characters and falls back to a plain-text record when the body is not JSON, which is what a proxy error page looks like.
import json
import logging
log = logging.getLogger("sume")
def log_sume_failure(resp, job_id: str | None = None) -> None:
try:
err = resp.json().get("error", {})
except ValueError:
err = {}
log.error(json.dumps({
"event": "sume_request_failed",
"status": resp.status_code,
"code": err.get("code"),
"request_id": err.get("request_id"),
"job_id": job_id,
"details": json.dumps(err.get("details"))[:500],
"retry_after": resp.headers.get("retry-after"),
}))What to alert on
Count by code, not by message text. unauthorized means a bad or missing key and should page a human once, not retry. rate_limited and queue_full are expected under load and should only alert when they persist. unsupported_capability and unsupported_parameter are bugs in your own request builder, so alert on any non-zero count after a deploy.
Because the request id is also in the response headers, a proxy that strips bodies can still log it. Log both when you have both.
When you open a ticket, send the request id, the time, the route and the HTTP status. That is enough for support to find the call, and none of it is secret.
Using it
Call it right before you raise. A 429 with retry-after becomes a record you can chart, and a 400 with unsupported_capability keeps details.supported, so the next engineer sees the allowed values without reproducing the call. For the typed version of the same envelope, see the dataclass post, and for Node the pino version.
- Redact at the logger, not at each call site.
- Keep the job id from
idon the 202 so a poll failure can be tied to the submit. - Send the
request_idto support; do not paste the key or a download URL.
Sources
Related posts
More in Developers
- Longest AI video clip in one API call: max seconds per Sume model
In one Sume call, Seedance 2.5 and Wan 3.0 reach 30 seconds, Seedance 2.0, Kling v3 Pro and MiniMax reach 15, Gemini Omni Flash 1.1 stops at 10. Full table.
- MAI-Voice-2.1 SSML style="happiness" is not in the voice style list
Microsoft's MAI-Voice-2.1 SSML example uses style="happiness", but the Learn page's own style lists say happy or joyful. Check styles before you ship.
- mask_url edit on GPT Image 2.5: the mask is a guide, not a hard edge
OpenAI says GPT Image masking is prompt-based and may not follow the mask shape exactly. How that affects mask_url edits on Sume and a cheap way to test it.
- MCP C# SDK 2.0 for a .NET client: check the protocol header with Sume
The C# MCP SDK 2.0 targets the 2026-07-28 spec and keeps 1.x APIs compiling. What to test before pointing a .NET client at Sume, which lists 2025 versions.
Written by Sume