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.

4 min readSume
All posts

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.

sendMediaGroup rules (read 2026-10-02)
RuleValue
Items per album2-10
Photo and video togetherallowed
Documentsgrouped only with documents
Audiogrouped only with audio
Per-photo size10 MB
Per-photo width plus height10000 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

All Integrations posts

Written by Sume