X media upload total_bytes ceiling of 16 GiB: trim long AI video first

X's media upload init accepts total_bytes up to 17179869184 (16 GiB). Why the cap rarely binds for AI clips, and how Sume video-trim keeps uploads short.

4 min readSume
All posts

The X API media upload initialization takes a total_bytes value with a maximum of 17,179,869,184, which is 16 GiB. An AI-generated clip is nowhere near that, so the number is not your constraint; X's own per-type media rules are. Trim the clip to the length you want to post first, since a shorter file uploads faster and fails less.

What does the spec say about total_bytes?

The OpenAPI document gives the upload init body a total_bytes integer with maximum: 17179869184. That figure is a property of the request schema. The same document does not, in the part read here, list per-type duration or resolution limits, so those need X's media documentation and should not be assumed.

X upload init (read 2026-10-02)
FieldDetail
total_bytesInteger, maximum 17179869184 (16 GiB)
media in a post1-4 media_ids
Per-type duration limitsNot stated in the schema read; check X's media docs

Why trim before uploading?

A short file is the cheapest fix for most upload problems: fewer chunks, less to retry, and a better fit for a feed where people scroll quickly. Sume's video-trim cuts a Sume-hosted video to a start and an end or duration (0.2-900 seconds), and a source up to 1800 seconds is accepted.

import json, os, urllib.request

body = {
    "video_url": "https://media.sume.com/artifacts/artf_demo/talk.mp4",
    "start": 5,
    "end": 35,
    "precision": "exact",
    "output": {
        "width": 1280,
        "height": 720,
        "fps": 30
    }
}
req = urllib.request.Request(
    "https://api.sume.com/v1/video-trim",
    data=json.dumps(body).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["SUME_API_KEY"],
        "Content-Type": "application/json",
        "Idempotency-Key": "x-trim-001",
    },
    method="POST",
)
print(urllib.request.urlopen(req).read().decode())

What does a trim job return?

When the job is ready, GET /v1/jobs/:id/result returns a kind: video_trim result with a new video_url, duration_seconds, actual_start_seconds, precision, audio and output. Download that MP4 for the chunked upload.

What should I verify?

Read X's media upload documentation for the supported types and durations before you automate. The video trim guide lists Sume's caps and error codes.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume