How to generate AI video from code: Veo 3.1, Kling and Seedance with one API Alex, who runs the MartLLM API, published a complete Python client pattern for generating AI video from code, covering a price/start/poll/download job flow and demonstrating the same code against Google's Veo 3.1, Kuaishou's Kling and ByteDance's Seedance. The writeup emphasizes a validate step that quotes cost before any charge, idempotency keys to prevent double billing on retries, and polling every 5-10 seconds until a job reaches a final status. Disclosure: I'm Alex, and I run MartLLM, the API used in the examples. The job pattern price, start, poll, download is the same on most video APIs; swap the URLs and field names for your provider's. Text models answer in a second or two. Video models don't. A five-second clip takes a minute or more, so every serious video API treats it as a job : you start it, you check on it, and you download the file when it's done. If you write video code like chat code one blocking request, wait for the bytes , you get timeouts, double charges on retries, and no idea what a clip will cost until the bill arrives. This post builds a small, complete Python client for that flow, then runs the same code against three model families: Google's Veo 3.1, Kuaishou's Kling and ByteDance's Seedance. Prices are what the public catalog listed on 2026-11-28. The endpoints, all under https://api.martllm.com with Authorization: Bearer