Telegram sendMediaGroup: 2-10 items, building an AI image album
sendMediaGroup sends 2 to 10 photos or videos as one album. Batch-generate a matching set with the Sume images API and keep each file inside the photo limits.

Telegram's sendMediaGroup sends an album of 2 to 10 items. Photos and videos can share an album; documents and audio files can only be grouped with their own type. To build an AI image album, generate every picture with the same model, prompt frame and aspect_ratio, check each file against the sendPhoto limits, and pass them to the method in order.
What are the album rules?
The Bot API page describes the method as sending a group of photos, videos, documents or audios as an album, with an array that must hold 2-10 items. Documents and audio files can be only grouped in an album with messages of the same type. The same page gives each photo the sendPhoto limits.
| Rule | Value |
|---|---|
| Items per album | 2-10 |
| Photo and video together | allowed |
| Documents | grouped only with documents |
| Audio | grouped only with audio |
| Per-photo size | 10 MB |
| Per-photo width plus height | 10000 px at most |
How do I generate a consistent set?
Keep one model, one aspect_ratio and one output_format across every call so the album tiles evenly. A shared ratio matters because Telegram shows an album as a grid, and mixed shapes look uneven. Vary only the subject line in the prompt. Each Sume call returns URLs to Sume-hosted images, so collect the URLs and download the files for the multipart upload, or pass URLs where the method allows them.
import json, os, urllib.request
body = {
"model": "bytedance-seed/seedream-4.5",
"prompt": "flat lay of a linen tote bag on a pale background, product photo, front view",
"aspect_ratio": "1:1",
"output_format": "jpeg"
}
req = urllib.request.Request(
"https://api.sume.com/v1/images",
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["SUME_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
print(urllib.request.urlopen(req).read().decode())What breaks an album?
- Fewer than 2 items or more than 10: the method refuses the array.
- Mixing a document into a photo album: documents group only with documents.
- One photo over 10 MB or past the pixel sum: the whole send fails, so check every file first.
- Caption text: the Bot API gives photo and video captions a 0-1024 character range, so keep any caption inside it.
Where does Sume fit in the rest of the flow?
Sume produces the files; the bot sends them. For a larger batch, loop over prompts and respect your plan's rate limits from the API reference. The images guide lists the models and parameters you can pin.
Sources
Related posts
More in Integrations
- Telegram sendVideo cover and start_timestamp: pick a poster frame
sendVideo takes a cover image and a start_timestamp in seconds. Use Sume video-frames to pull candidate stills from a generated clip and choose the poster.
- Telegram sendVoice formats: OGG/Opus, MP3 or M4A up to 50 MB
Telegram sendVoice accepts OGG/Opus, MP3 or M4A up to 50 MB. Pull an MP3 track from a generated video with Sume audio-detach and send it as a voice note.
- TikTok max_video_post_duration_sec: trim before Direct Post
TikTok's creator_info endpoint returns max_video_post_duration_sec, a per-creator limit. Read it first, then cut the clip to fit with Sume video trim.
- TikTok privacy_level_options: public vs private account values
TikTok creator_info returns different privacy_level_options for public and private accounts, and Direct Post privacy_level must match one. Values for each.
Written by Sume