AI Video Ads by API: From One Brief to Many Variants
Make AI video ads by API: one brief turned into hooks, formats, presenters and products, each variant quoted, logged and charged only when it comes out.
Updated 6 min read
To make AI video ads by API, you write the brief once and let code turn it into variants: every hook, format, presenter and product becomes one request to a video model, priced before it runs. On Frameport that request is POST /v1/videos/generations on Seedance 2.5, Veo 3.1 or Frameport Motion 1; Frameport Replace 1 puts an approved presenter's face into a clip you already have, and a variant that fails costs nothing.
This guide turns a brief into a grid, picks the shape for each placement, puts a presenter and a product in the same shot, and ends with a script that prices the grid, runs it and logs what each variant cost. For presenter-led clips on their own, see the AI UGC video API guide.
How to make AI video ads from one brief
A brief names what you sell, to whom, and the one thing a viewer should remember. Variants come from the parts you are willing to change. Write each part as a short list, and the grid is every combination of them:
| Part | Example values | Where it goes in the request |
|---|---|---|
| Hook | A question to camera, a quick demo, an unboxing | The first sentence of prompt |
| Format | 9:16, 1:1, 16:9 | aspect_ratio |
| Presenter | Two approved presenters | A picture in reference_images, identity mode |
| Product | The bottle, the mug | Another picture in reference_images |
| Finish | Draft or final | resolution, or another model |
Three hooks in three formats make nine clips; a second presenter makes eighteen. Change one part per round so each result teaches you something: when the hook, the presenter and the format all move at once, nobody can say what made a variant work. Draft the whole grid at a low resolution, watch it, then render only the keepers at a higher one.
Video ad formats for each platform
Each placement wants its own shape, and each shape is its own request. A clip composed for a phone screen keeps the presenter and the product inside the frame, where a crop of a wide shot can cut them off.
- Vertical for stories, reels and short-video feeds: 9:16.
- Square for feed posts: 1:1.
- Wide for in-stream video and a site header: 16:9.
| Model | Aspect ratios | Lengths | Sound |
|---|---|---|---|
| Seedance 2.5 | 16:9, 4:3, 1:1, 3:4, 9:16 and 21:9 | 4 to 30 seconds | On or off, same price |
| Veo 3.1 | 16:9 and 9:16 | 4, 6 or 8 seconds | On or off, priced apart |
| Frameport Motion 1 | 16:9, 9:16, 1:1, 4:3 and 3:4 | 5 to 15 seconds | On or off, same price |
Veo 3.1 takes 16:9 and 9:16 only, so the square cut of a campaign made on it has to come from another model. Ask a model for a shape it lacks and the request is refused up front, with nothing held, and the error lists the shapes that model offers.
Adding a presenter and a product to an ad
Make the presenter once and reuse them in every variant. Generate a face that belongs to no one on Frameport Image 3, or photograph a real person who has agreed in writing to appear in your ads. Then send the presenter's picture and the product's picture together with reference_mode: "identity", and say in the prompt which is which: "the woman from the first picture holds the bottle from the second". Seedance 2.5 reads up to 4 pictures, Veo 3.1 up to 3, and Frameport Motion 1 up to 4 at 768p and 1080p (references).
Third-party models follow their makers' rules and may turn down a photo of a realistic person as a reference. A refused request costs nothing, and Frameport Motion 1, our own engine, takes identity references too.
When a clip already works, keep it and change the face. Frameport Replace 1 takes the clip and one picture per person replaced, keeps the clothes unless keep_outfit is false, and bills by the second of clip (edits). It suits a market-by-market version of one ad, each with a local presenter. Everyone whose face goes into a clip must have agreed to it, as the acceptable use policy requires; the face swap video API guide covers the edit in detail.
curl https://frameport.ai/v1/videos/edits \
-H "Authorization: Bearer $FRAMEPORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "fp-replace-1",
"video": "upl_3Tn8Lc1BdZeR7Rk2PqV9wX",
"faces": ["file_3Vb8KqW2nTx7Lc5Rm1YdPs"],
"keep_outfit": true,
"resolution": "768p"
}'Tracking the cost of each ad variant
Spend stays readable when every variant leaves a line behind:
- A quote before the grid.
POST /v1/generations/quotegives the price and the hold of one variant for free, and variants with the same model, length and resolution share it (quotes). - A cap on each request.
max_cost_usdrefuses a variant that would cost more than planned (spending caps). - An
Idempotency-Keyper variant, named after its parts, so a retry replays the first answer instead of paying twice (idempotency). - A key per campaign. The Usage page of the dashboard splits spend by key, as well as by day or model, and exports the rows as CSV.
import csv
import itertools
import os
import time
import requests
API = "https://frameport.ai/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['FRAMEPORT_API_KEY']}"} # a key made for this campaign
PRESENTER = "https://example.com/spring/presenter.png" # an approved presenter
PRODUCT = "https://example.com/spring/bottle.png"
HOOKS = {
"question": "She looks into the camera and asks: 'Why is my coffee cold by nine?' then lifts the bottle from the second picture.",
"demo": "She pours hot tea into the bottle from the second picture, closes it and turns it upside down. Not a drop falls.",
"unbox": "She opens a parcel on the counter and takes out the bottle from the second picture, turning the label to the camera.",
}
FORMATS = ["9:16", "1:1", "16:9"]
def body(hook, aspect):
return {
"model": "seedance-2-5",
"prompt": "The woman from the first picture, filmed handheld on a phone in a bright kitchen. "
f"{HOOKS[hook]} Natural voice, quiet room sound.",
"reference_images": [PRESENTER, PRODUCT],
"reference_mode": "identity",
"duration": 8,
"resolution": "480p",
"aspect_ratio": aspect,
"max_cost_usd": 0.96,
}
grid = list(itertools.product(HOOKS, FORMATS))
# Every variant has the same model, length and resolution: one quote prices the grid
quote = requests.post(f"{API}/generations/quote", headers=HEADERS, json=body("question", "9:16")).json()
need = quote["price_usd"] * len(grid)
if need > quote["available_usd"]:
raise SystemExit(f"The grid needs {need:.2f} USD and the balance holds {quote['available_usd']:.2f}")
ledger = {}
for hook, aspect in grid:
variant = f"spring-{hook}-{aspect.replace(':', 'x')}"
while True:
res = requests.post(f"{API}/videos/generations", json=body(hook, aspect),
headers={**HEADERS, "Idempotency-Key": variant})
if res.status_code != 429:
break
time.sleep(int(res.headers.get("Retry-After", "15")))
gen = res.json()
if gen.get("error"):
print(variant, "not charged:", gen["error"]["message"])
continue
ledger[variant] = gen
while any(gen["status"] in ("queued", "running") for gen in ledger.values()):
time.sleep(10)
for variant, gen in ledger.items():
if gen["status"] in ("queued", "running"):
ledger[variant] = requests.get(f"{API}/generations/{gen['id']}", headers=HEADERS).json()
os.makedirs("ads", exist_ok=True)
with open("ledger.csv", "w", newline="", encoding="utf-8") as sheet:
rows = csv.writer(sheet)
rows.writerow(["variant", "generation", "status", "reserved_usd", "cost_usd"])
for variant, gen in ledger.items():
rows.writerow([variant, gen["id"], gen["status"], gen["reserved_usd"], gen["cost_usd"]])
if gen["status"] == "succeeded":
clip = requests.get(f"{API}/generations/{gen['id']}/content", headers=HEADERS)
with open(f"ads/{variant}.mp4", "wb") as out:
out.write(clip.content)Each line of ledger.csv holds what the variant held when it started and what it was finally charged, and a failed variant shows a cost of zero. Weeks later, GET /v1/generations lists the same jobs again, filtered by model, status, type, source (api for a key, playground for the Studio) and a window of created_after and created_before (list).
How much an AI video ad costs
| Use | Model | Setting | Price |
|---|---|---|---|
| Rough cut of a variant | Seedance 2.5 | 8 s, 480p, sound on | $0.96 |
| Keeper | Seedance 2.5 | 8 s, 720p, sound on | $2.16 |
| Vertical or wide master | Veo 3.1 | 8 s, 1080p, sound on | $3.72 |
| Silent cut for your own music | Veo 3.1 | 8 s, 720p, no sound | $1.88 |
| Product insert | Frameport Motion 1 | 8 s, 768p | $0.48 |
| New face in a finished clip | Frameport Replace 1 | 8 s of clip, 768p | $0.96 |
The draft round of a grid costs the first row times the number of variants, and each keeper then costs the second row. Every clip is paid from a prepaid balance, and only when it comes out (pricing). The guide to pricing a video before you run it covers quotes and holds in more depth. Ads for TikTok, Reels and Shorts start vertical: the vertical video API guide lists the models that render 9:16. For one spot adapted to several markets, see video ad localization with face swap; before an ad runs, check commercial use against each maker's terms.
FAQ
Can I make AI video ads for free?
Setting up costs nothing: signing up, creating a key and pricing a variant are free, and a variant that fails is never charged. Each clip that arrives is paid from a balance you fund in advance, from $0.02 per second of video, with nothing billed monthly.
Which model should I use for AI video ads?
Seedance 2.5 for takes with a presenter and sound in most shapes, Veo 3.1 for 1080p or 4K in vertical or wide, Frameport Motion 1 for product inserts and inexpensive drafts, and Frameport Replace 1 to reuse a finished clip with another consenting presenter. Quote the same variant on two models and compare.
Can an AI video ad feature a real person?
Only with that person's consent. Use a presenter who has agreed to appear in your ads, or generate a face that belongs to no one, and never use a public figure or anyone who has not agreed. Third-party models may also refuse a realistic face as a reference.
How do I track what each ad variant cost?
Every generation reports what it held when it started and what it was charged in the end, so a script can log both for each variant, as the ledger above does. A separate key per campaign lets the dashboard's Usage page split spend by campaign, with a CSV export.
Do I need to code to make AI video ads?
No. The Studio runs the same models from a form and spends from the same balance, and the guide to AI UGC ads without code walks through a presenter ad step by step.