[{"data":1,"prerenderedAt":467,"buildId":468},["ShallowReactive",2],{"blog:article:telegram-bot-ai-video":3,"catalog":130},{"article":4,"related":105,"studioPath":129},{"slug":5,"path":6,"title":7,"description":8,"category":9,"categoryLabel":10,"date":11,"updated":11,"readingMinutes":12,"models":13,"featured":16,"primaryKeyword":17,"keywords":18,"words":27,"toc":28,"blocks":51,"faq":99},"telegram-bot-ai-video","\u002Fblog\u002Ftelegram-bot-ai-video","Telegram Bot AI Video: Clips and Images From One API","Telegram bot AI video, step by step: commands, the API calls, waiting for clips by polling or webhook, photo to video, and budgets per user.","guides","Guides","2026-11-28",6,[14,15],"fp-motion-1","nano-banana-2-1",false,"telegram bot ai video",[17,19,20,21,22,23,24,25,26],"ai video generator telegram bot","image to video telegram bot","picture to video ai telegram bot","telegram bot long polling vs webhooks","polling vs webhook telegram","ai image to video telegram bot","unfiltered telegram ai bot","telegram bot python api",1463,[29,33,36,39,42,45,48],{"id":30,"text":31,"level":32},"the-telegram-bot-ai-video-flow-in-brief","The Telegram bot AI video flow in brief",2,{"id":34,"text":35,"level":32},"commands-to-requests","Commands to requests",{"id":37,"text":38,"level":32},"picture-to-video-in-a-telegram-bot","Picture to video in a Telegram bot",{"id":40,"text":41,"level":32},"sending-the-clip-back-to-the-chat","Sending the clip back to the chat",{"id":43,"text":44,"level":32},"waiting-for-video-polling-vs-webhooks-on-telegram","Waiting for video: polling vs webhooks on Telegram",{"id":46,"text":47,"level":32},"budgets-per-user","Budgets per user",{"id":49,"text":50,"level":32},"faq","FAQ",[52,55,59,61,65,67,70,72,75,77],{"type":53,"html":54},"html","\u003Cp>A Telegram bot AI video generator is a small program on your server: it reads commands from Telegram, sends each prompt to a video API, waits for the clip and sends the file back to the chat. With Frameport the bot needs a single key for clips and images: \u003Ca href=\"\u002Fmodels\u002Ffp-motion-1\">Frameport Motion 1\u003C\u002Fa> makes \u003Ccode>\u002Fvideo\u003C\u002Fcode>, $0.10 for 5 seconds at 480p with sound, and Nano Banana 2.1 makes \u003Ccode>\u002Fimage\u003C\u002Fcode> at $0.085 an image.\u003C\u002Fp>\n\u003Cp>This guide builds the bot in Python with \u003Ccode>requests\u003C\u002Fcode> and nothing else: the commands, a photo turned into a clip, the two waits every video bot has (Telegram&#39;s updates and the clip itself), sending files within Telegram&#39;s limits, and a daily budget per user.\u003C\u002Fp>\n\u003Ch2 id=\"the-telegram-bot-ai-video-flow-in-brief\">The Telegram bot AI video flow in brief\u003C\u002Fh2>\n\u003Cdiv class=\"blog-table box blog-table-wide\">\u003Ctable class=\"tbl\">\u003Cthead>\u003Ctr>\u003Cth scope=\"col\">The user sends\u003C\u002Fth>\u003Cth scope=\"col\">The bot calls\u003C\u002Fth>\u003Cth scope=\"col\">Model\u003C\u002Fth>\u003Cth scope=\"col\" class=\"r\">Price\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Ccode>\u002Fimage a lighthouse in fog\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>\u003Ccode>POST \u002Fv1\u002Fimages\u002Fgenerations\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>Nano Banana 2.1\u003C\u002Ftd>\u003Ctd class=\"r\">$0.085\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>\u002Fvideo a paper boat on a rainy street\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>\u003Ccode>POST \u002Fv1\u002Fvideos\u002Fgenerations\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>Frameport Motion 1, 5 s, 480p, 9:16\u003C\u002Ftd>\u003Ctd class=\"r\">$0.10\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>A photo captioned \u003Ccode>\u002Fanimate she turns and waves\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>\u003Ccode>POST \u002Fv1\u002Fuploads\u003C\u002Fcode>, then the video endpoint\u003C\u002Ftd>\u003Ctd>Frameport Motion 1, the photo as first frame\u003C\u002Ftd>\u003Ctd class=\"r\">$0.10\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Before the code, two secrets. Talk to @BotFather in Telegram, create a bot and copy its token. Then \u003Ca href=\"\u002Fsignup\">create a Frameport account\u003C\u002Fa>, add funds and make an API key for this bot alone. Both go in the environment of the server that runs the bot. Telegram users never see your key: they send a command, your server makes the call (\u003Ca href=\"\u002Fdocs\u002Fauthentication#server\">authentication\u003C\u002Fa>).\u003C\u002Fp>",{"type":56,"lang":57,"code":58},"code","curl","export TELEGRAM_BOT_TOKEN=\"...\"\nexport FRAMEPORT_API_KEY=\"fp_live_...\"\npip install requests",{"type":53,"html":60},"\u003Ch2 id=\"commands-to-requests\">Commands to requests\u003C\u002Fh2>\n\u003Cp>The script long-polls Telegram for messages, turns each command into a request, and checks its running jobs after every poll:\u003C\u002Fp>",{"type":56,"lang":62,"code":63,"title":64},"python","import mimetypes\nimport os\nimport time\n\nimport requests\n\nAPI = \"https:\u002F\u002Fframeport.ai\u002Fv1\"\nHEADERS = {\"Authorization\": f\"Bearer {os.environ['FRAMEPORT_API_KEY']}\"}\nBOT_TOKEN = os.environ[\"TELEGRAM_BOT_TOKEN\"]\nTELEGRAM = f\"https:\u002F\u002Fapi.telegram.org\u002Fbot{BOT_TOKEN}\"\nDAILY_BUDGET = float(os.environ.get(\"USER_DAILY_BUDGET\", \"1\"))  # your dollars, per user per day\nRATIOS = {\"16:9\": 16 \u002F 9, \"9:16\": 9 \u002F 16, \"1:1\": 1, \"4:3\": 4 \u002F 3, \"3:4\": 3 \u002F 4}\n\npending = {}  # generation id -> (chat id, budget key); use a database in production\nspent = {}    # (user id, UTC day) -> dollars charged\n\n\ndef telegram(method, **params):\n    return requests.post(f\"{TELEGRAM}\u002F{method}\", timeout=120, **params).json()\n\n\ndef say(chat_id, text):\n    telegram(\"sendMessage\", json={\"chat_id\": chat_id, \"text\": text})\n\n\ndef upload_photo(message):\n    \"\"\"Copy the user's photo to the API: Telegram's file link holds the bot token, so it stays here.\"\"\"\n    photo = message[\"photo\"][-1]  # the largest size Telegram kept\n    path = telegram(\"getFile\", json={\"file_id\": photo[\"file_id\"]})[\"result\"][\"file_path\"]\n    data = requests.get(f\"https:\u002F\u002Fapi.telegram.org\u002Ffile\u002Fbot{BOT_TOKEN}\u002F{path}\", timeout=60).content\n    upload = requests.post(f\"{API}\u002Fuploads\", params={\"filename\": \"photo.jpg\"}, data=data, timeout=60,\n                           headers={**HEADERS, \"Content-Type\": \"image\u002Fjpeg\"}).json()\n    if upload.get(\"error\"):\n        raise RuntimeError(upload[\"error\"][\"message\"])\n    shape = photo[\"width\"] \u002F photo[\"height\"]\n    return upload[\"id\"], min(RATIOS, key=lambda name: abs(RATIOS[name] - shape))\n\n\ndef request_for(message):\n    \"\"\"The endpoint and body for a command, or None.\"\"\"\n    command, _, prompt = (message.get(\"text\") or message.get(\"caption\") or \"\").partition(\" \")\n    command, prompt = command.split(\"@\")[0], prompt.strip()  # \"\u002Fvideo@YourBot\" in groups\n    if not prompt:\n        return None\n    if command == \"\u002Fimage\":\n        return \"\u002Fimages\u002Fgenerations\", {\"model\": \"nano-banana-2-1\", \"prompt\": prompt, \"aspect_ratio\": \"1:1\"}\n    clip = {\"model\": \"fp-motion-1\", \"prompt\": prompt, \"duration\": 5, \"resolution\": \"480p\", \"aspect_ratio\": \"9:16\"}\n    if command == \"\u002Fvideo\":\n        return \"\u002Fvideos\u002Fgenerations\", clip\n    if command == \"\u002Fanimate\" and message.get(\"photo\"):\n        frame, shape = upload_photo(message)\n        return \"\u002Fvideos\u002Fgenerations\", {**clip, \"reference_images\": [frame], \"aspect_ratio\": shape}\n    return None\n\n\ndef start(message, update_id):\n    chat_id = message[\"chat\"][\"id\"]\n    found = request_for(message)\n    if not found:\n        say(chat_id, \"Send \u002Fimage \u003Cprompt>, \u002Fvideo \u003Cprompt>, or a photo captioned \u002Fanimate \u003Cwhat moves>.\")\n        return\n    path, body = found\n    budget = (message[\"from\"][\"id\"], time.strftime(\"%Y-%m-%d\", time.gmtime()))\n    quote = requests.post(f\"{API}\u002Fgenerations\u002Fquote\", headers=HEADERS, json=body, timeout=30).json()\n    if quote.get(\"error\"):\n        raise RuntimeError(quote[\"error\"][\"message\"])\n    if spent.get(budget, 0) + quote[\"price_usd\"] > DAILY_BUDGET:\n        say(chat_id, \"You have used today's budget. It resets at midnight UTC.\")\n        return\n    gen = requests.post(f\"{API}{path}\", json={**body, \"max_cost_usd\": quote[\"price_usd\"]}, timeout=60,\n                        headers={**HEADERS, \"Idempotency-Key\": f\"telegram-{update_id}\"}).json()\n    if gen.get(\"error\"):\n        raise RuntimeError(gen[\"error\"][\"message\"])\n    pending[gen[\"id\"]] = (chat_id, budget)\n    action = \"upload_video\" if gen[\"type\"] == \"video\" else \"upload_photo\"\n    telegram(\"sendChatAction\", json={\"chat_id\": chat_id, \"action\": action})\n    say(chat_id, \"Started. It will arrive in this chat.\")\n\n\ndef send_result(chat_id, gen):\n    output = gen[\"outputs\"][0]\n    data = requests.get(output[\"url\"], timeout=300).content  # a signed link: no key needed\n    name = \"result\" + (mimetypes.guess_extension(output[\"content_type\"]) or \"\")\n    fields = {\"chat_id\": chat_id}\n    if gen[\"type\"] == \"video\" and len(data) > 50_000_000:\n        say(chat_id, f\"Too large for a bot to send. This link opens for about an hour: {output['url']}\")\n        return\n    if gen[\"type\"] == \"video\":\n        method, field = \"sendVideo\", \"video\"\n        fields[\"supports_streaming\"] = \"true\"\n    elif len(data) \u003C= 10_000_000:\n        method, field = \"sendPhoto\", \"photo\"\n    else:\n        method, field = \"sendDocument\", \"document\"  # sendPhoto stops at 10 MB\n    telegram(method, data=fields, files={field: (name, data, output[\"content_type\"])})\n\n\ndef deliver():\n    for gen_id, (chat_id, budget) in list(pending.items()):\n        gen = requests.get(f\"{API}\u002Fgenerations\u002F{gen_id}\", headers=HEADERS, timeout=30).json()\n        if gen[\"status\"] in (\"queued\", \"running\"):\n            continue\n        del pending[gen_id]\n        if gen[\"status\"] == \"failed\":\n            say(chat_id, f\"That one failed, and nothing was charged: {gen['error']['message']}\")\n            continue\n        spent[budget] = spent.get(budget, 0) + gen[\"cost_usd\"]\n        send_result(chat_id, gen)\n\n\ndef handle(update):\n    message = update.get(\"message\")\n    if not message:\n        return\n    try:\n        start(message, update[\"update_id\"])\n    except RuntimeError as err:  # refused before anything was held\n        say(message[\"chat\"][\"id\"], f\"Not started, nothing charged: {err}\")\n\n\nif __name__ == \"__main__\":\n    offset = 0\n    while True:\n        # Long polling: Telegram holds the call open up to 20 seconds when nothing is new\n        updates = telegram(\"getUpdates\", json={\"offset\": offset, \"timeout\": 20, \"allowed_updates\": [\"message\"]})\n        for update in updates.get(\"result\", []):\n            offset = update[\"update_id\"] + 1\n            handle(update)\n        deliver()","bot.py",{"type":53,"html":66},"\u003Cp>What each part does:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>A quote before every job.\u003C\u002Fstrong> \u003Ccode>POST \u002Fv1\u002Fgenerations\u002Fquote\u003C\u002Fcode> prices the body without holding or starting anything, so the bot can refuse a request the user&#39;s budget no longer covers (\u003Ca href=\"\u002Fdocs\u002Fquotes\">quotes\u003C\u002Fa>).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A cap on every job.\u003C\u002Fstrong> \u003Ccode>max_cost_usd\u003C\u002Fcode> set to the quoted price refuses anything that would cost more, before any money is held.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>One job per Telegram update.\u003C\u002Fstrong> The \u003Ccode>Idempotency-Key\u003C\u002Fcode> comes from the update&#39;s id, so a submit retried after a timeout returns the first generation instead of paying for a second (\u003Ca href=\"\u002Fdocs\u002Fidempotency\">idempotency\u003C\u002Fa>).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>No waiting inside a command.\u003C\u002Fstrong> The bot keeps a table of running jobs and checks it after each poll, so a clip in progress never blocks the next message. Reads are not counted against your rate limits.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"picture-to-video-in-a-telegram-bot\">Picture to video in a Telegram bot\u003C\u002Fh2>\n\u003Cp>When a user sends a photo with \u003Ccode>\u002Fanimate\u003C\u002Fcode> as its caption, the bot turns it into the clip&#39;s first frame. Telegram hands a bot its files through a link that contains the bot token, so that link must never reach a third party, us included. The script downloads the photo on your server and streams it to \u003Ccode>POST \u002Fv1\u002Fuploads\u003C\u002Fcode>, which answers with an id that any request can use for 24 hours (\u003Ca href=\"\u002Fdocs\u002Fuploads\">uploads\u003C\u002Fa>).\u003C\u002Fp>\n\u003Cp>The photo then rides in \u003Ccode>reference_images\u003C\u002Fcode> as the first frame, with an aspect ratio picked to match its shape. Because the frame already shows the subject and the scene, the caption only has to say what moves: &quot;she turns to the camera and laughs&quot;, &quot;the waves roll in, slow push-in&quot;. On Frameport Motion 1, a first frame does not change the price. The \u003Ca href=\"\u002Fblog\u002Fimage-to-video-api\">image to video API guide\u003C\u002Fa> lists the models that take a first frame, and \u003Ca href=\"\u002Fblog\u002Ffirst-and-last-frame-video-api\">first and last frame video\u003C\u002Fa> adds a picture to land on.\u003C\u002Fp>\n\u003Ch2 id=\"sending-the-clip-back-to-the-chat\">Sending the clip back to the chat\u003C\u002Fh2>\n\u003Cp>Telegram&#39;s Bot API takes uploaded files of up to 50 MB, photos up to 10 MB, and smaller files when you send a link instead (5 MB for a photo, 20 MB for anything else). So the bot downloads each output from its signed link, which opens without a key for about an hour, and uploads the bytes:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Clips\u003C\u002Fstrong> go out with \u003Ccode>sendVideo\u003C\u002Fcode> and \u003Ccode>supports_streaming\u003C\u002Fcode>, so they play before the download ends. Short clips at 480p keep the file small.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Images\u003C\u002Fstrong> go out with \u003Ccode>sendPhoto\u003C\u002Fcode>, or \u003Ccode>sendDocument\u003C\u002Fcode> when a large picture passes 10 MB.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Anything bigger\u003C\u002Fstrong> gets the signed link in a message. Files are not kept forever on our side: a bot that keeps a history copies them to its own storage (\u003Ca href=\"\u002Fdocs\u002Ffiles\">files\u003C\u002Fa>).\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>\u003Ccode>sendChatAction\u003C\u002Fcode> shows &quot;sending video&quot; in the chat for a few seconds only (Telegram says 5 at most), so the bot also sends a plain &quot;Started&quot; message the user can see while the clip renders.\u003C\u002Fp>\n\u003Ch2 id=\"waiting-for-video-polling-vs-webhooks-on-telegram\">Waiting for video: polling vs webhooks on Telegram\u003C\u002Fh2>\n\u003Cp>A video bot waits twice: for Telegram to deliver messages, and for each clip to finish. Each wait can be polling or a webhook.\u003C\u002Fp>\n\u003Cdiv class=\"blog-table box blog-table-wide\">\u003Ctable class=\"tbl\">\u003Cthead>\u003Ctr>\u003Cth scope=\"col\">\u003C\u002Fth>\u003Cth scope=\"col\">Polling\u003C\u002Fth>\u003Cth scope=\"col\">Webhook\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Telegram updates\u003C\u002Ftd>\u003Ctd>\u003Ccode>getUpdates\u003C\u002Fcode> with a \u003Ccode>timeout\u003C\u002Fcode>: long polling, no public URL needed\u003C\u002Ftd>\u003Ctd>\u003Ccode>setWebhook\u003C\u002Fcode>: Telegram posts each update to your HTTPS address\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>The clip\u003C\u002Ftd>\u003Ctd>\u003Ccode>GET \u002Fv1\u002Fgenerations\u002F{id}\u003C\u002Fcode> until it settles\u003C\u002Ftd>\u003Ctd>Frameport posts \u003Ccode>generation.succeeded\u003C\u002Fcode> or \u003Ccode>generation.failed\u003C\u002Fcode>\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Good for\u003C\u002Ftd>\u003Ctd>One process on any machine, and development\u003C\u002Ftd>\u003Ctd>Many users, serverless hosting, results the moment they land\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Long polling is the script above. To switch both waits to webhooks, register your Telegram address with a \u003Ccode>secret_token\u003C\u002Fcode>, which Telegram sends back in the \u003Ccode>X-Telegram-Bot-Api-Secret-Token\u003C\u002Fcode> header of every update. Telegram takes webhooks on ports 443, 80, 88 and 8443, and \u003Ccode>getUpdates\u003C\u002Fcode> stops working while one is set.\u003C\u002Fp>",{"type":56,"lang":57,"code":68,"title":69},"curl \"https:\u002F\u002Fapi.telegram.org\u002Fbot$TELEGRAM_BOT_TOKEN\u002FsetWebhook\" \\\n  -d url=https:\u002F\u002Fbot.example.com\u002Ftelegram \\\n  -d secret_token=\"$TELEGRAM_WEBHOOK_SECRET\"","Point Telegram at your server",{"type":53,"html":71},"\u003Cp>Then add \u003Ccode>https:\u002F\u002Fbot.example.com\u002Fgenerations\u003C\u002Fcode> under \u003Cstrong>Webhooks\u003C\u002Fstrong> in the dashboard, for both events. One small Flask app receives both, and reuses the functions of \u003Ccode>bot.py\u003C\u002Fcode>:\u003C\u002Fp>",{"type":56,"lang":62,"code":73,"title":74},"import hashlib\nimport hmac\nimport json\nimport os\nimport threading\nimport time\n\nfrom flask import Flask, request\n\nimport bot  # the script above: its polling loop only runs when started directly\n\napp = Flask(__name__)\nTELEGRAM_SECRET = os.environ[\"TELEGRAM_WEBHOOK_SECRET\"]  # the string you gave setWebhook\nSIGNING_SECRET = os.environ[\"WEBHOOK_SECRET\"]  # whsec_..., shown once when you add the endpoint\nseen = set()  # delivery ids already handled: a retried delivery keeps its id\n\n\ndef signed(raw, header, tolerance=300):\n    parts = dict(part.split(\"=\", 1) for part in header.split(\",\") if \"=\" in part)\n    if \"t\" not in parts or \"v1\" not in parts or abs(time.time() - int(parts[\"t\"])) > tolerance:\n        return False\n    expected = hmac.new(SIGNING_SECRET.encode(), parts[\"t\"].encode() + b\".\" + raw, hashlib.sha256).hexdigest()\n    return hmac.compare_digest(expected, parts[\"v1\"])\n\n\n@app.post(\"\u002Ftelegram\")\ndef telegram_update():\n    if request.headers.get(\"X-Telegram-Bot-Api-Secret-Token\") != TELEGRAM_SECRET:\n        return \"\", 403\n    threading.Thread(target=bot.handle, args=(request.get_json(),)).start()\n    return \"\", 200\n\n\n@app.post(\"\u002Fgenerations\")\ndef generation_settled():\n    raw = request.get_data()\n    if not signed(raw, request.headers.get(\"Frameport-Signature\", \"\")):\n        return \"\", 400\n    event = json.loads(raw)\n    gen = event[\"data\"]\n    if event[\"id\"] in seen or gen[\"id\"] not in bot.pending:\n        return \"\", 204  # already handled, or a job this bot did not start\n    seen.add(event[\"id\"])\n    chat_id, budget = bot.pending.pop(gen[\"id\"])\n    if gen[\"status\"] == \"failed\":\n        bot.say(chat_id, f\"That one failed, and nothing was charged: {gen['error']['message']}\")\n    else:\n        bot.spent[budget] = bot.spent.get(budget, 0) + gen[\"cost_usd\"]\n        threading.Thread(target=bot.send_result, args=(chat_id, gen)).start()\n    return \"\", 204","hooks.py",{"type":53,"html":76},"\u003Cp>Both handlers answer at once and do the slow work in a thread: Frameport expects a \u003Ccode>2xx\u003C\u002Fcode> within 10 seconds and retries after 1, 5 and 15 minutes otherwise (\u003Ca href=\"\u002Fdocs\u002Fwebhooks\">webhooks\u003C\u002Fa>). Run \u003Ccode>bot.deliver()\u003C\u002Fcode> every few minutes as a backstop for a delivery your server missed. \u003Ca href=\"\u002Fblog\u002Fpolling-vs-webhooks-ai-jobs\">Polling vs webhooks\u003C\u002Fa> covers that hybrid, and \u003Ca href=\"\u002Fblog\u002Fai-video-generation-api-python\">the video generation API in Python\u003C\u002Fa> the calls one by one.\u003C\u002Fp>\n\u003Ch2 id=\"budgets-per-user\">Budgets per user\u003C\u002Fh2>\n\u003Cdiv class=\"blog-table box blog-table-wide\">\u003Ctable class=\"tbl\">\u003Cthead>\u003Ctr>\u003Cth scope=\"col\">What\u003C\u002Fth>\u003Cth scope=\"col\">Where it is set\u003C\u002Fth>\u003Cth scope=\"col\">What happens past it\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>A daily budget per user\u003C\u002Ftd>\u003Ctd>\u003Ccode>USER_DAILY_BUDGET\u003C\u002Fcode>, checked against each quote\u003C\u002Ftd>\u003Ctd>The bot says so and starts nothing\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>The price of one job\u003C\u002Ftd>\u003Ctd>\u003Ccode>max_cost_usd\u003C\u002Fcode> on the request\u003C\u002Ftd>\u003Ctd>\u003Ccode>400 max_cost_exceeded\u003C\u002Fcode>, nothing held\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Jobs that start, per minute\u003C\u002Ftd>\u003Ctd>60 for the whole workspace\u003C\u002Ftd>\u003Ctd>\u003Ccode>429 rate_limited\u003C\u002Fcode> with \u003Ccode>Retry-After\u003C\u002Fcode>\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>Jobs running at once\u003C\u002Ftd>\u003Ctd>20 for the whole workspace\u003C\u002Ftd>\u003Ctd>\u003Ccode>429 concurrency_limit\u003C\u002Fcode>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>In a group chat, key the budget on the chat as well as the user, so one busy group cannot spend for everyone. Keep the \u003Ccode>spent\u003C\u002Fcode> table in a database, so a restart does not reset it.\u003C\u002Fp>\n\u003Cp>Every workspace starts with its content filter on, and a prompt it blocks is refused with \u003Ccode>400 content_filtered\u003C\u002Fcode> before anything is held. For an unfiltered Telegram AI bot, only an owner or an admin of the workspace, aged 18 or older, can turn the filter off in \u003Cstrong>Settings\u003C\u002Fstrong>; our own models, Frameport Motion 1 included, then render without a content filter. Models from other makers, such as Nano Banana 2.1, keep their makers&#39; policies and may refuse, and the \u003Ca href=\"\u002Facceptable-use\">acceptable use policy\u003C\u002Fa> applies either way: nothing involving minors, no real identifiable people without their consent, nothing illegal. That covers the photos people send to \u003Ccode>\u002Fanimate\u003C\u002Fcode> too, and you answer for what users make through your keys. A refused job costs nothing.\u003C\u002Fp>\n\u003Cp>The photos sent to \u003Ccode>\u002Fanimate\u003C\u002Fcode> reach the API as described in \u003Ca href=\"\u002Fblog\u002Fupload-files-to-ai-generation-api\">upload image to API\u003C\u002Fa>, and the bot&#39;s key belongs on your server (\u003Ca href=\"\u002Fblog\u002Fapi-key-security-ai-generation\">API key security\u003C\u002Fa>).\u003C\u002Fp>",{"type":49,"id":49,"title":50,"items":78},[79,83,87,91,95],{"q":80,"html":81,"text":82},"How do I make a Telegram bot that generates AI videos?","\u003Cp>Create the bot with @BotFather, read its messages with \u003Ccode>getUpdates\u003C\u002Fcode> or a webhook, send each prompt to a video API from your server, and send the clip back with \u003Ccode>sendVideo\u003C\u002Fcode> once the job succeeds. The \u003Ccode>bot.py\u003C\u002Fcode> script above does it with Python and \u003Ccode>requests\u003C\u002Fcode>.\u003C\u002Fp>","Create the bot with @BotFather, read its messages with getUpdates or a webhook, send each prompt to a video API from your server, and send the clip back with sendVideo once the job succeeds. The bot.py script above does it with Python and requests.",{"q":84,"html":85,"text":86},"Should a Telegram bot use long polling or webhooks?","\u003Cp>Long polling for one process or while you develop: it needs no public URL. Webhooks once the bot has many users or runs on serverless hosting: Telegram posts each update to your HTTPS address, and the same server can take the video API&#39;s webhooks too.\u003C\u002Fp>","Long polling for one process or while you develop: it needs no public URL. Webhooks once the bot has many users or runs on serverless hosting: Telegram posts each update to your HTTPS address, and the same server can take the video API's webhooks too.",{"q":88,"html":89,"text":90},"Can a Telegram bot turn a picture into a video?","\u003Cp>Yes. The bot downloads the photo on its own server, uploads it to the video API, and sends it as the first frame of the clip, with a prompt that describes the motion. Never pass Telegram&#39;s file link on, since it contains the bot token.\u003C\u002Fp>","Yes. The bot downloads the photo on its own server, uploads it to the video API, and sends it as the first frame of the clip, with a prompt that describes the motion. Never pass Telegram's file link on, since it contains the bot token.",{"q":92,"html":93,"text":94},"How big a video can a Telegram bot send?","\u003Cp>Telegram&#39;s Bot API says bots can send video files of up to 50 MB by upload, and up to 20 MB when they send a link instead. Short clips at 480p keep files small; for anything larger, send a link.\u003C\u002Fp>","Telegram's Bot API says bots can send video files of up to 50 MB by upload, and up to 20 MB when they send a link instead. Short clips at 480p keep files small; for anything larger, send a link.",{"q":96,"html":97,"text":98},"Is there a free AI video generator Telegram bot?","\u003Cp>Not one that renders for nothing. The account, the API key and quotes are free, and a clip that fails costs nothing, but each clip is paid from a prepaid balance, from $0.02 a second. You can try a prompt in the \u003Ca href=\"\u002Fstudio?model=fp-motion-1\">Studio\u003C\u002Fa> before your bot sends it.\u003C\u002Fp>","Not one that renders for nothing. The account, the API key and quotes are free, and a clip that fails costs nothing, but each clip is paid from a prepaid balance, from $0.02 a second. You can try a prompt in the Studio before your bot sends it.",[100,101,102,103,104],{"q":80,"html":81,"text":82},{"q":84,"html":85,"text":86},{"q":88,"html":89,"text":90},{"q":92,"html":93,"text":94},{"q":96,"html":97,"text":98},[106,114,122],{"slug":107,"path":108,"title":109,"description":110,"category":9,"categoryLabel":10,"date":11,"updated":11,"readingMinutes":111,"models":112,"featured":16},"turn-off-ai-content-filter","\u002Fblog\u002Fturn-off-ai-content-filter","AI Image Generator Without Content Filter: Turn It Off","The content filter is on by default and a refusal costs nothing. An owner or admin turns it off in Settings: what changes, what stays refused, the code.",5,[113,14],"fp-image-1",{"slug":115,"path":116,"title":117,"description":118,"category":9,"categoryLabel":10,"date":11,"updated":11,"readingMinutes":111,"models":119,"featured":16},"ai-video-generation-api-node-js","\u002Fblog\u002Fai-video-generation-api-node-js","AI Video Generation API in Node.js: A Working Script","AI video API Node JS guide: submit a clip with fetch, poll with a backoff, stream the MP4 to disk, verify webhooks and type it all from OpenAPI.",[120,121,14],"seedance-2-5","veo-3-1",{"slug":123,"path":124,"title":125,"description":126,"category":9,"categoryLabel":10,"date":11,"updated":11,"readingMinutes":111,"models":127,"featured":128},"ai-video-generation-api-python","\u002Fblog\u002Fai-video-generation-api-python","AI Video Generation API in Python: prompt to MP4","Use an AI video generation API from Python: quote the price, submit a clip, poll it or take a webhook, then download the MP4. Runnable code, real API.",[120,14],true,"\u002Fstudio",[131,149,158,167,192,209,228,244,259,274,289,303,314,328,341,354,367,378,386,394,404,413,423,431,450],{"id":132,"type":133,"name":134,"description":135,"maker":136,"family":136,"own":128,"image":137,"private":148},"fp-image-2","image","Frameport Image 2","Photoreal renders, up to 4 reference images.","Frameport",{"pricing":138,"options":140},{"per_image":139,"per_extra_reference_image":-1},0.025,{"aspect_ratios":141,"max_images":147},[142,143,144,145,146],"1:1","3:4","4:3","9:16","16:9",4,{},{"id":150,"type":133,"name":151,"description":152,"maker":136,"family":136,"own":128,"image":153,"private":157},"fp-image-3","Frameport Image 3","Clean photoreal renders for characters.",{"pricing":154,"options":155},{"per_image":139,"per_extra_reference_image":-1},{"aspect_ratios":156,"max_images":147},[142,143,144,145,146],{},{"id":113,"type":133,"name":159,"description":160,"maker":136,"family":136,"own":128,"image":161,"private":166},"Frameport Image 1","Generation and reference-driven renders, up to 10 reference images.",{"pricing":162,"options":164},{"per_image":139,"per_extra_reference_image":163},0.0025,{"aspect_ratios":165,"max_images":147},[142,143,144,145,146],{},{"id":14,"type":168,"name":169,"description":170,"maker":136,"family":171,"own":128,"video":172,"private":190},"video","Frameport Motion 1","Our video engine, with native sound.","Frameport Motion",{"pricing":173,"options":180},{"default_resolution":174,"per_second":175,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},"768p",{"480p":176,"768p":177,"1080p":178,"2K":179},0.02,0.06,0.08,0.095,{"resolutions":181,"durations":185,"aspect_ratios":188,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":147,"identity_resolutions":189,"seed":16,"negative_prompt":16},[182,174,183,184],"480p","1080p","2K",{"min":111,"max":186,"step":187},15,1,[146,145,142,144,143],[174,183],{"resolutions":191},[182,174],{"id":120,"type":168,"name":193,"description":194,"maker":195,"family":196,"own":16,"video":197},"Seedance 2.5","The long-take flagship — up to 30 seconds with sound","ByteDance","Seedance",{"pricing":198,"options":203},{"default_resolution":199,"per_second":200,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},"720p",{"480p":201,"720p":202},0.12,0.27,{"resolutions":204,"durations":205,"aspect_ratios":207,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":147,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[182,199],{"min":147,"max":206,"step":187},30,[146,144,142,143,145,208],"21:9",{"id":121,"type":168,"name":210,"description":211,"maker":212,"family":213,"own":16,"video":214},"Veo 3.1","Google’s flagship — up to 4K with native audio","Google","Veo",{"pricing":215,"options":221},{"default_resolution":183,"per_second":216,"per_second_with_audio":219,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"720p":217,"1080p":217,"4K":218},0.235,0.465,{"720p":218,"1080p":218,"4K":220},0.695,{"resolutions":222,"durations":224,"aspect_ratios":226,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":227,"identity_resolutions":-1,"seed":128,"negative_prompt":128},[199,183,223],"4K",{"min":147,"max":225,"step":32},8,[146,145],3,{"id":229,"type":168,"name":230,"description":231,"maker":195,"family":196,"own":16,"video":232},"seedance-2-0","Seedance 2.0","Character consistency, up to 4K",{"pricing":233,"options":240},{"default_resolution":199,"per_second":234,"per_second_with_audio":-1,"aspect_ratio_multiplier":238,"per_reference_image":-1,"per_frame_image":-1},{"480p":178,"720p":235,"1080p":236,"4K":237},0.175,0.435,0.9,{"21:9":239},1.32,{"resolutions":241,"durations":242,"aspect_ratios":243,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":147,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[182,199,183,223],{"min":147,"max":186,"step":187},[146,144,142,143,145,208],{"id":245,"type":168,"name":246,"description":247,"maker":248,"family":249,"own":16,"video":250},"hailuo-3","Hailuo 3","2K cinematic physics, subject references","MiniMax","Hailuo",{"pricing":251,"options":255},{"default_resolution":184,"per_second":252,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":254,"per_frame_image":-1},{"2K":253},0.15,0.047,{"resolutions":256,"durations":257,"aspect_ratios":258,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":227,"identity_resolutions":-1,"seed":16,"negative_prompt":16},[184],{"min":111,"max":186,"step":187},[208,146,144,142,143,145],{"id":260,"type":168,"name":261,"description":262,"maker":263,"family":263,"own":16,"video":264},"runway-gen-4-5","Runway Gen-4.5","Cinematic motion, strong prompt adherence","Runway",{"pricing":265,"options":268},{"default_resolution":199,"per_second":266,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"720p":267},0.14,{"resolutions":269,"durations":270,"aspect_ratios":272,"audio_toggle":16,"start_frame":128,"end_frame":16,"max_reference_images":273,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[199],{"min":32,"max":271,"step":187},10,[146,145],0,{"id":275,"type":168,"name":276,"description":277,"maker":212,"family":213,"own":16,"video":278},"veo-3-1-fast","Veo 3.1 Fast","Veo quality, faster and a quarter of the price",{"pricing":279,"options":285},{"default_resolution":199,"per_second":280,"per_second_with_audio":283,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"720p":281,"1080p":201,"4K":282},0.093,0.29,{"720p":201,"1080p":267,"4K":284},0.35,{"resolutions":286,"durations":287,"aspect_ratios":288,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":227,"identity_resolutions":-1,"seed":128,"negative_prompt":128},[199,183,223],{"min":147,"max":225,"step":32},[146,145],{"id":290,"type":168,"name":291,"description":292,"maker":195,"family":196,"own":16,"video":293},"seedance-2-0-fast","Seedance 2.0 Fast","Seedance references and sound, faster",{"pricing":294,"options":299},{"default_resolution":199,"per_second":295,"per_second_with_audio":-1,"aspect_ratio_multiplier":298,"per_reference_image":-1,"per_frame_image":-1},{"480p":296,"720p":297},0.063,0.145,{"21:9":239},{"resolutions":300,"durations":301,"aspect_ratios":302,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":147,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[182,199],{"min":147,"max":186,"step":187},[146,144,142,143,145,208],{"id":304,"type":168,"name":305,"description":306,"maker":248,"family":249,"own":16,"video":307},"hailuo-3-max","Hailuo 3 Max","Fast Hailuo motion, 768p",{"pricing":308,"options":310},{"default_resolution":174,"per_second":309,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"480p":177,"768p":281},{"resolutions":311,"durations":312,"aspect_ratios":313,"audio_toggle":16,"start_frame":128,"end_frame":128,"max_reference_images":273,"identity_resolutions":-1,"seed":16,"negative_prompt":16},[182,174],{"min":111,"max":186,"step":187},[208,146,144,142,143,145],{"id":315,"type":168,"name":316,"description":317,"maker":318,"family":316,"own":16,"video":319},"grok-imagine","Grok Imagine","Quick clips from a prompt or a start image","xAI",{"pricing":320,"options":324},{"default_resolution":199,"per_second":321,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":323},{"480p":281,"720p":322,"1080p":282},0.165,0.014,{"resolutions":325,"durations":326,"aspect_ratios":327,"audio_toggle":16,"start_frame":128,"end_frame":16,"max_reference_images":273,"identity_resolutions":-1,"seed":16,"negative_prompt":16},[182,199,183],{"min":187,"max":186,"step":187},[146,145,142,144,143],{"id":329,"type":168,"name":330,"description":-1,"maker":195,"family":196,"own":16,"video":331},"seedance-2-0-mini","Seedance 2.0 Mini",{"pricing":332,"options":337},{"default_resolution":182,"per_second":333,"per_second_with_audio":-1,"aspect_ratio_multiplier":336,"per_reference_image":-1,"per_frame_image":-1},{"480p":334,"720p":335},0.041,0.088,{"21:9":239},{"resolutions":338,"durations":339,"aspect_ratios":340,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":147,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[182,199],{"min":147,"max":186,"step":187},[146,144,142,143,145,208],{"id":342,"type":168,"name":343,"description":344,"maker":212,"family":213,"own":16,"video":345},"veo-3-1-lite","Veo 3.1 Lite","Veo with sound, on every account",{"pricing":346,"options":350},{"default_resolution":199,"per_second":347,"per_second_with_audio":349,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"720p":348,"1080p":177},0.036,{"720p":177,"1080p":281},{"resolutions":351,"durations":352,"aspect_ratios":353,"audio_toggle":128,"start_frame":128,"end_frame":128,"max_reference_images":273,"identity_resolutions":-1,"seed":128,"negative_prompt":128},[199,183],{"min":147,"max":225,"step":32},[146,145],{"id":355,"type":168,"name":356,"description":357,"maker":358,"family":359,"own":16,"video":360},"wan-3","Wan 3.0","Up to 30 seconds, references and sound","Alibaba","Wan",{"pricing":361,"options":363},{"default_resolution":199,"per_second":362,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"480p":177,"720p":201,"1080p":217},{"resolutions":364,"durations":365,"aspect_ratios":366,"audio_toggle":128,"start_frame":128,"end_frame":16,"max_reference_images":227,"identity_resolutions":-1,"seed":128,"negative_prompt":16},[182,199,183],{"min":32,"max":206,"step":187},[146,144,142,143,145],{"id":368,"type":133,"name":369,"description":370,"maker":371,"family":372,"own":16,"image":373},"gpt-image-2-5-sunburst","GPT Image 2.5 Sunburst","OpenAI's flagship — precise text, composition and control","OpenAI","GPT Image",{"pricing":374,"options":376},{"per_image":375,"per_extra_reference_image":-1},0.085,{"aspect_ratios":377,"max_images":147},[142,143,144,145,146],{"id":379,"type":133,"name":380,"description":381,"maker":371,"family":372,"own":16,"image":382},"gpt-image-2-5-flare","GPT Image 2.5 Flare","OpenAI's image model tuned for expressive, dramatic frames",{"pricing":383,"options":384},{"per_image":375,"per_extra_reference_image":-1},{"aspect_ratios":385,"max_images":147},[142,143,144,145,146],{"id":15,"type":133,"name":387,"description":388,"maker":212,"family":389,"own":16,"image":390},"Nano Banana 2.1","Google's fast multimodal image model","Nano Banana",{"pricing":391,"options":392},{"per_image":375,"per_extra_reference_image":-1},{"aspect_ratios":393,"max_images":147},[142,143,144,145,146],{"id":395,"type":133,"name":396,"description":397,"maker":195,"family":398,"own":16,"image":399},"seedream-5-0-pro","Seedream 5.0 Pro","ByteDance's flagship — rich detail and texture","Seedream",{"pricing":400,"options":402},{"per_image":401,"per_extra_reference_image":-1},0.099,{"aspect_ratios":403,"max_images":147},[142,143,144,145,146],{"id":405,"type":133,"name":406,"description":407,"maker":212,"family":389,"own":16,"image":408},"nano-banana-pro","Nano Banana Pro","Google's highest-fidelity image model",{"pricing":409,"options":411},{"per_image":410,"per_extra_reference_image":-1},0.16,{"aspect_ratios":412,"max_images":147},[142,143,144,145,146],{"id":414,"type":133,"name":415,"description":416,"maker":417,"family":418,"own":16,"image":419},"flux-3-image","Flux 3 Image","Black Forest Labs' FLUX.3 — photoreal and typography","Black Forest Labs","Flux",{"pricing":420,"options":421},{"per_image":335,"per_extra_reference_image":-1},{"aspect_ratios":422,"max_images":147},[142,143,144,145,146],{"id":424,"type":133,"name":425,"description":426,"maker":318,"family":316,"own":16,"image":427},"grok-imagine-2-0","Grok Imagine 2.0","xAI's fast, characterful image model",{"pricing":428,"options":429},{"per_image":335,"per_extra_reference_image":-1},{"aspect_ratios":430,"max_images":147},[142,143,144,145,146],{"id":432,"type":168,"name":433,"description":434,"maker":136,"family":435,"own":128,"edit":436,"video":444},"fp-replace-1","Frameport Replace 1","Up to four people in your clip replaced by the faces you send: moves, lips, scene and sound kept.","Frameport Replace",{"tool":437,"formats":438,"min_seconds":32,"max_seconds":271,"min_billed_seconds":32,"max_bytes":441,"max_frames":442,"fps":443,"max_faces":147},"replace",[439,440],"mp4","mov",64000000,600,24,{"pricing":445,"options":448},{"default_resolution":174,"per_second":446,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"768p":201,"1080p":447},0.25,{"resolutions":449,"durations":-1,"aspect_ratios":-1,"audio_toggle":-1,"start_frame":-1,"end_frame":-1,"max_reference_images":-1,"identity_resolutions":-1,"seed":-1,"negative_prompt":-1},[174,183],{"id":451,"type":168,"name":452,"description":453,"maker":136,"family":454,"own":128,"edit":455,"video":460},"fp-upscale-1","Frameport Upscale 1","Your clip at 1080p or 2K: the same motion, frame rate and sound, sharper detail.","Frameport Upscale",{"tool":456,"formats":457,"min_seconds":187,"max_seconds":206,"min_billed_seconds":111,"max_bytes":458,"max_frames":459,"fps":-1,"max_faces":-1},"upscale",[439,440],100000000,900,{"pricing":461,"options":465},{"default_resolution":183,"per_second":462,"per_second_with_audio":-1,"aspect_ratio_multiplier":-1,"per_reference_image":-1,"per_frame_image":-1},{"1080p":463,"2K":464},0.03,0.05,{"resolutions":466,"durations":-1,"aspect_ratios":-1,"audio_toggle":-1,"start_frame":-1,"end_frame":-1,"max_reference_images":-1,"identity_resolutions":-1,"seed":-1,"negative_prompt":-1},[183,184],1795901826411,"b270fb84-a112-44f2-9801-f99d6c2e889e"]