First and Last Frame AI Video by API: Control Both Ends
First and last frame AI video by API: which models take both frames, the request body, how to prompt the motion between them, loops and transitions.
Updated 6 min read
First and last frame AI video gives a model two pictures, one to open the clip on and one to land on, and leaves it to invent the motion in between. On Frameport you send the first picture in reference_images and the last one in end_image, on any model that lists both frames, such as Seedance 2.5, Veo 3.1, Hailuo 3 or Frameport Motion 1; the prompt then only has to say what happens on the way.
This guide lists the models that take both frames, shows the request and the rules around it, explains how to prompt the in-between, and ends with loops, transitions and longer sequences built from chained clips.
First and last frame AI video in short
- Two fields.
reference_imagesholds one picture, the first frame.end_imageholds the last. Both take an https URL, a base64 data URI, an upload id (upl_…) or one of your own image outputs (file_…). - The last frame needs a first one.
end_imagealone is not a mode; send it with a first frame. - Only on some models. A model's
options.end_framein GET /v1/models says whether it takes a last frame. A model without one refuses the request with400 invalid_requestbefore anything is held. - Frames, not references. Identity mode, where pictures show who to keep rather than where to start, does not combine with
end_image.
Models that take both frames
Every model below opens on your first picture and lands on your last:
| Model | Lengths | Resolutions | Sound | From |
|---|---|---|---|---|
| Seedance 2.5 | 4 to 30 seconds | 480p and 720p | On or off, same price | $0.12 / s |
| Seedance 2.0 | 4 to 15 seconds | 480p, 720p, 1080p and 4K | On or off, same price | $0.08 / s |
| Seedance 2.0 Fast | 4 to 15 seconds | 480p and 720p | On or off, same price | $0.063 / s |
| Seedance 2.0 Mini | 4 to 15 seconds | 480p and 720p | On or off, same price | $0.041 / s |
| Veo 3.1 | 4, 6 or 8 seconds | 720p, 1080p and 4K | On or off, priced apart | $0.235 / s |
| Veo 3.1 Fast | 4, 6 or 8 seconds | 720p, 1080p and 4K | On or off, priced apart | $0.093 / s |
| Veo 3.1 Lite | 4, 6 or 8 seconds | 720p and 1080p | On or off, priced apart | $0.036 / s |
| Hailuo 3 | 5 to 15 seconds | 2K | On or off, same price | $0.15 / s |
| Hailuo 3 Max | 5 to 15 seconds | 480p and 768p | No soundtrack | $0.06 / s |
| Frameport Motion 1 | 5 to 15 seconds | 480p, 768p, 1080p and 2K | On or off, same price | $0.02 / s |
Wan 3.0, Runway Gen-4.5 and Grok Imagine take a first frame only. On Hailuo 3, each picture adds a fee to the clip and both frames count, so the quote's breakdown ends with + 2 images × …; on the others, the frames change nothing in the price.
Which to pick depends on the shot. Seedance 2.5 has the widest range of lengths, for slow transformations that need time. Veo 3.1 renders up to 4K with sound, Hailuo 3 renders every clip at 2K, and Frameport Motion 1 keeps sound on or off at the same price, which makes it a cheap place to iterate on a transition before a final render.
The request body
The body is an ordinary video request with two pictures in it. This script checks that the model takes a last frame, uploads two local pictures, submits the clip and waits for it:
import os
import time
import requests
API = "https://frameport.ai/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['FRAMEPORT_API_KEY']}"}
MODEL = "seedance-2-5"
# 1. Does this model land on a last frame?
model = requests.get(f"{API}/models/{MODEL}", headers=HEADERS, timeout=30).json()
if not model["options"].get("end_frame"):
raise SystemExit(f"{MODEL} takes no end_image: choose a model whose options list end_frame")
# 2. Upload both pictures (an https URL or one of your file_ ids works too)
def upload(path):
with open(path, "rb") as picture:
res = requests.post(
f"{API}/uploads",
params={"filename": os.path.basename(path)},
headers={**HEADERS, "Content-Type": "image/png"},
data=picture,
timeout=120,
)
res.raise_for_status()
return res.json()["id"]
first, last = upload("sketch.png"), upload("painting.png")
# 3. Submit: the clip opens on the sketch and lands on the painting
gen = requests.post(f"{API}/videos/generations", headers=HEADERS, timeout=60, json={
"model": MODEL,
"prompt": "Brush strokes sweep across the canvas and colour floods in, area by area, "
"until the sketch becomes the finished painting; slow push-in, soft brush sounds",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "4:3",
"reference_images": [first],
"end_image": last,
}).json()
if gen.get("error"):
raise SystemExit(f"{gen['error']['code']}: {gen['error']['message']}")
while gen["status"] in ("queued", "running"):
time.sleep(5)
gen = requests.get(f"{API}/generations/{gen['id']}", headers=HEADERS, timeout=30).json()
if gen["status"] == "failed":
raise SystemExit(f"failed, nothing charged: {gen['error']['message']}")
print(gen["outputs"][0]["url"], gen["cost_usd"])The submit answers at once, with the frames counted in input:
{
"id": "gen_4Wm8QzT1nVb6Xr2Lc9KdPa",
"status": "queued",
"input": {
"duration": 6,
"resolution": "720p",
"aspect_ratio": "4:3",
"audio": true,
"reference_images": 1,
"reference_mode": "frame",
"end_image": true
},
"reserved_usd": 1.62,
"cost_usd": null,
"error": null
}Three refusals are worth knowing, all 400 invalid_request and all free. A last frame on a model without one answers end_image: <model> does not take an end image. Two or more pictures in reference_images without identity mode answer that the model takes one picture, the first frame. And end_image with "reference_mode": "identity" is refused, because identity pictures are references, not frames. The videos reference has the same body in short, and uploads explains the 24-hour upload ids.
Prompt the motion, not the subject
Both ends of the clip are already drawn. Whatever the prompt says about the subject, the outfit or the room competes with the pictures, so spend the words on the journey:
- What changes, and in what order. "Colour floods in, area by area" gives the model a path; "a beautiful painting" gives it nothing it does not already have.
- The camera. One move per clip: a slow push-in, an orbit, a crane down. If the two pictures are framed differently, say how the camera gets from one to the other.
- The pace. Bigger changes need more seconds. A pose change fits in a short clip; a day-to-night time-lapse reads better at the long end of the model's range.
- The sound, on models that render it: brush strokes, wind picking up, a door closing at the end.
The pictures matter as much as the words. Give both the same aspect ratio as the clip, and keep the light, lens and style close: the further apart the two frames are, the more the model has to invent, and the more likely you get a morph instead of a believable move. When the same person appears at both ends, make the two pictures with the same reference photos so the face matches (see consistent character images); identity mode cannot help here, since it does not combine with a last frame.
| First frame | Last frame | What the prompt describes |
|---|---|---|
| A pencil sketch | The finished painting | Colour arriving, stroke by stroke |
| An empty room | The same room furnished | Furniture sliding into place, light warming |
| A closed product box | The product on display | Hands opening the box, the reveal, a slow orbit |
| A street at noon | The same street at night | The sun dropping, lamps flickering on, traffic thickening |
Transitions and loops
- Seamless loops. Send the same picture as the first and the last frame, and prompt a motion that comes back on itself: steam rising and thinning, a flag lifting and settling, a slow orbit that returns to the start. The clip ends where it began, so it can play on repeat without a visible jump.
- Before and after. Two states of one scene, as in the table above, make reveals, renovations, makeovers and product unboxings.
- Longer sequences. A model makes one clip at a time, but you can chain them: take the last frame of clip one, use it as the first frame of clip two, and the motion continues across the cut. Pull that frame with ffmpeg, upload it, and send it as the next
reference_images.
ffmpeg -sseof -1 -i clip-1.mp4 -update 1 last.png
curl "https://frameport.ai/v1/uploads?filename=last.png" \
-H "Authorization: Bearer $FRAMEPORT_API_KEY" \
-H "Content-Type: image/png" \
--data-binary @last.pngGive each link of the chain its own prompt and, where you want the story to land somewhere precise, its own last frame. For more on single-picture starts and reference pictures, see the image to video API guide; for keeping a character through several clips, the consistent character video guide. The simplest case, one photo turned into one clip, is in how to turn a photo into a video, and what a clip costs on each model in image to video API pricing. Turning a whole board of panels into shots is the subject of storyboard to video AI.
FAQ
What is first and last frame AI video?
A way to generate a clip from two pictures: the model opens on the first, ends on the last, and creates the motion between them from your prompt. It gives you control over both ends of a shot, which a prompt or a single picture alone does not.
Which AI video models support a start and end frame?
Here, Seedance 2.5, Seedance 2.0 and its Fast and Mini tiers, Veo 3.1, Veo 3.1 Fast and Veo 3.1 Lite, Hailuo 3 and Hailuo 3 Max, and Frameport Motion 1. The end_frame option of each model in GET /v1/models is the live answer.
Does Wan take an end frame?
Not here. Wan 3.0 takes a first frame only, and a request with end_image is refused with 400 invalid_request before anything is held. For a clip that must land on a picture, pick one of the models in the table above.
Can I use reference pictures and a last frame together?
No. Reference pictures in identity mode tell the model who or what to keep in a new scene, while frames fix the first and last image, and the API refuses the two together. To keep a character between two frames, generate both pictures with the same references first.
Is there a free start and end frame AI video tool?
The account, the API key and price quotes are free, and a clip that fails costs nothing; clips themselves are paid from a prepaid balance. Frameport Motion 1 starts at $0.02 / s, and you can try frames without code in the Studio.