Your first rendered video
On this page
By the end of this page you will have turned two photos into a finished 7-second vertical video with OneUpRender, the render engine, and saved the MP4 on your computer. It takes five steps and about five minutes, and costs 15 credits, about $0.15.
Before you start #
You need:
- An API key from an API plan, Concierge or Concierge Plus. The quickstart shows how to get one and put it in
ONEUP_API_KEY. - Two JPEG photos named
photo-1.jpgandphoto-2.jpgin the folder you work in. Any size works: the video crops them to fill a vertical frame. - One of:
curlin a terminal, Node.js 20 or newer, or Python 3.8 or newer.
Each step shows the code in curl, TypeScript and Python, then the exact response body. Run the steps in order:
- curl: paste each block into the same terminal window.
- TypeScript: put the blocks in one file named
first-video.mtsand runnpx tsx first-video.mts. - Python: put the blocks in one file named
first_video.pyand runpython3 first_video.py.
What it costs #
You will make two renders of the same video. The Preview is free: a quick, smaller copy with a PREVIEW mark, to check your work. The final is the full-quality video, at 15 credits for each started 10 seconds. This video is 7.4 seconds long, so the final is one 10-second block: 15 credits, about $0.15. A 25-second video would be three blocks, 45 credits.
Step 1: Upload two photos #
An upload takes two requests. First you send the file's type and size, and the answer has an upload_id and an upload_url. Then you send the bytes to upload_url with a PUT. The upload_id is how your video names the photo.
API=${ONEUP_BASE_URL:-https://api.oneupai.com}
AUTH="Authorization: Bearer $ONEUP_API_KEY"
JSON="Content-Type: application/json"
field() { echo "$2" | grep -o "\"$1\":\"[^\"]*\"" | head -1 | cut -d'"' -f4; }
upload() {
SIZE=$(wc -c < "$1" | tr -d ' ')
ANSWER=$(curl -s "$API/v1/uploads/initiate" -H "$AUTH" -H "$JSON" \
-d "{\"content_type\": \"image/jpeg\", \"file_name\": \"$1\", \"size_bytes\": $SIZE}")
echo "$ANSWER"
curl -s -X PUT "$(field upload_url "$ANSWER")" \
-H "Content-Type: image/jpeg" --data-binary @"$1"
echo
UPLOAD_ID=$(field upload_id "$ANSWER")
}
upload photo-1.jpg
FIRST=$UPLOAD_ID
upload photo-2.jpg
SECOND=$UPLOAD_IDimport { readFile, writeFile } from "node:fs/promises";
const API = process.env.ONEUP_BASE_URL ?? "https://api.oneupai.com";
const KEY = process.env.ONEUP_API_KEY;
async function call(
method: string,
path: string,
body?: object,
headers?: Record<string, string>
) {
const res = await fetch(API + path, {
signal: AbortSignal.timeout(60_000),
method,
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
...headers,
},
body: body && JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${res.status} ${json.error}: ${json.message}`);
return json;
}
async function upload(file: string): Promise<string> {
const bytes = await readFile(file);
const answer = await call("POST", "/v1/uploads/initiate", {
content_type: "image/jpeg",
file_name: file,
size_bytes: bytes.length,
});
console.log(JSON.stringify(answer, null, 2));
const put = await fetch(answer.upload_url, {
signal: AbortSignal.timeout(300_000),
method: "PUT",
headers: { "Content-Type": "image/jpeg" },
body: bytes,
});
console.log(await put.text());
return answer.upload_id;
}
const first = await upload("photo-1.jpg");
const second = await upload("photo-2.jpg");import json, os, time, urllib.error, urllib.request, uuid
API = os.environ.get("ONEUP_BASE_URL", "https://api.oneupai.com")
KEY = os.environ["ONEUP_API_KEY"]
AGENT = "my-app/1.0"
def call(method, path, body=None, headers=None):
request = urllib.request.Request(
API + path,
method=method,
data=None if body is None else json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
"User-Agent": AGENT,
**(headers or {}),
},
)
try:
with urllib.request.urlopen(request, timeout=60) as response:
return json.load(response)
except urllib.error.HTTPError as error:
problem = json.load(error)
raise SystemExit(f"{error.code} {problem['error']}: {problem['message']}")
def upload(name):
with open(name, "rb") as f:
data = f.read()
answer = call("POST", "/v1/uploads/initiate", {
"content_type": "image/jpeg",
"file_name": name,
"size_bytes": len(data),
})
print(json.dumps(answer, indent=2))
put = urllib.request.Request(
answer["upload_url"],
method="PUT",
data=data,
headers={"Content-Type": "image/jpeg", "User-Agent": AGENT},
)
with urllib.request.urlopen(put, timeout=300) as response:
print(response.read().decode())
return answer["upload_id"]
first = upload("photo-1.jpg")
second = upload("photo-2.jpg")The Python code sets a User-Agent header on every request, because the one Python sends by default is refused before the request reaches the API. Any name for your app works.
The first answer, for photo-1.jpg:
{
"upload_id": "oneup_upload_67V064dxyYYZezF7sEmz67V064",
"upload_url": "https://media.oneupai.com/o/oneup_upload_67V064dxyYYZezF7sEmz67V064/1791441004/109879/uXa7jRLUP8-owjdaVyjle7",
"file_url": "https://media.oneupai.com/u/oneup_upload_67V064dxyYYZezF7sEmz67V064/1791523804/q-DZpkZDYl4lZNcw0zVj2k"
}upload_url takes the bytes for one hour, and only a file of the size you sent. file_url is a link to the stored photo that works for a day. The PUT answers {"ok": true, "size_bytes": 109879}: the size it received.
The second photo gets the same two answers, with its own upload_id.
Step 2: Create a Project #
A Project keeps one video: every version of its Timeline, and its renders.
ANSWER=$(curl -s "$API/v1/projects" -H "$AUTH" -H "$JSON" \
-d '{"agent_slug": "oneup/render-timeline"}')
echo "$ANSWER"
PROJECT=$(field project_id "$ANSWER")const project = await call("POST", "/v1/projects", {
agent_slug: "oneup/render-timeline",
});
console.log(JSON.stringify(project, null, 2));project = call("POST", "/v1/projects", {"agent_slug": "oneup/render-timeline"})
print(json.dumps(project, indent=2))The response:
{
"project_id": "c9af6833-b0d9-4a83-9f13-dcf3e19b9887"
}Step 3: Save the Timeline #
A Timeline is the whole video, written as JSON. This one has two segments, one for each photo, and shows each photo for 4 seconds. The first photo slowly zooms in, then blends into the second over 0.6 seconds. The second stays slightly zoomed. A title sits at the top for the first 3 seconds.
{
"v": "1.18",
"output": { "aspect": "9:16", "resolution": 1080, "fps": 30, "container": "mp4" },
"segments": [
{
"id": "first",
"source": { "$asset": "<first upload_id>" },
"duration": 4000,
"effects": [{ "op": "kenburns", "from": { "zoom": 1 }, "to": { "zoom": 1.15 } }],
"transition_out": { "op": "crossfade", "duration": 600 }
},
{
"id": "second",
"source": { "$asset": "<second upload_id>" },
"duration": 4000,
"effects": [{ "op": "zoom", "level": 1.05 }]
}
],
"overlays": [
{ "id": "title", "kind": "text", "content": "My first video", "style": "headline",
"position": "top", "range": { "from": 0, "to": 3000 } }
]
}vis the version of the Timeline language.1.18lets you use every operation in the catalog.outputis the frame: vertical (9:16), 1080 pixels wide, 30 frames a second, an MP4 file.- Times are whole milliseconds. The two segments overlap while they blend, so the video is 4000 + 4000 − 600 = 7400 ms long.
kenburns,crossfade,zoomand theheadlinetext are operations. The catalog lists every one, with its settings and an example.
Saving checks the Timeline. If anything is wrong, the answer is 400 invalid_request with a detail that names the field, and nothing is saved or charged.
ANSWER=$(curl -s -X PUT "$API/v1/projects/$PROJECT/timeline" -H "$AUTH" -H "$JSON" -d '{
"timeline": {
"v": "1.18",
"output": { "aspect": "9:16", "resolution": 1080, "fps": 30, "container": "mp4" },
"segments": [
{ "id": "first", "source": { "$asset": "'"$FIRST"'" }, "duration": 4000,
"effects": [{ "op": "kenburns", "from": { "zoom": 1 }, "to": { "zoom": 1.15 } }],
"transition_out": { "op": "crossfade", "duration": 600 } },
{ "id": "second", "source": { "$asset": "'"$SECOND"'" }, "duration": 4000,
"effects": [{ "op": "zoom", "level": 1.05 }] }
],
"overlays": [
{ "id": "title", "kind": "text", "content": "My first video", "style": "headline",
"position": "top", "range": { "from": 0, "to": 3000 } }
]
}
}')
echo "$ANSWER"
VERSION=$(field version_id "$ANSWER")const timeline = {
v: "1.18",
output: { aspect: "9:16", resolution: 1080, fps: 30, container: "mp4" },
segments: [
{
id: "first",
source: { $asset: first },
duration: 4000,
effects: [{ op: "kenburns", from: { zoom: 1 }, to: { zoom: 1.15 } }],
transition_out: { op: "crossfade", duration: 600 },
},
{
id: "second",
source: { $asset: second },
duration: 4000,
effects: [{ op: "zoom", level: 1.05 }],
},
],
overlays: [
{
id: "title",
kind: "text",
content: "My first video",
style: "headline",
position: "top",
range: { from: 0, to: 3000 },
},
],
};
const version = await call(
"PUT",
`/v1/projects/${project.project_id}/timeline`,
{ timeline }
);
console.log(JSON.stringify(version, null, 2));timeline = {
"v": "1.18",
"output": {"aspect": "9:16", "resolution": 1080, "fps": 30, "container": "mp4"},
"segments": [
{
"id": "first",
"source": {"$asset": first},
"duration": 4000,
"effects": [{"op": "kenburns", "from": {"zoom": 1}, "to": {"zoom": 1.15}}],
"transition_out": {"op": "crossfade", "duration": 600},
},
{
"id": "second",
"source": {"$asset": second},
"duration": 4000,
"effects": [{"op": "zoom", "level": 1.05}],
},
],
"overlays": [
{
"id": "title",
"kind": "text",
"content": "My first video",
"style": "headline",
"position": "top",
"range": {"from": 0, "to": 3000},
}
],
}
version = call("PUT", f"/v1/projects/{project['project_id']}/timeline", {"timeline": timeline})
print(json.dumps(version, indent=2))The response:
{
"version_id": "e0d4e4ed-3ac0-4a94-8411-8660eb257d14",
"parent_version_id": null,
"timeline_hash": "7a8b7c26066ef9cc0e81a3beb67245ac0ac453103c88f429821bb6fb60b52dee"
}version_id names this exact Timeline, and it never changes. To change the video, save a new version with parent_version_id set to this one. A render always uses the version you name.
Step 4: Render a Preview, then the final #
Start a render with POST /v1/renders. Name the render Alias oneup/render-timeline, the Project, the version and the kind, and send a new retry key with each render. The answer comes at once with "status": "QUEUED". Then ask GET /v1/renders/{render_id} every 5 seconds until it says COMPLETED or FAILED. This video's Preview takes about 15 seconds and its final under a minute.
render() {
ANSWER=$(curl -s "$API/v1/renders" -H "$AUTH" -H "$JSON" -H "Idempotency-Key: $(uuidgen)" \
-d "{\"alias\": \"oneup/render-timeline\", \"project_id\": \"$PROJECT\", \"version_id\": \"$VERSION\", \"kind\": \"$1\"}")
echo "$ANSWER"
RENDER=$(field render_id "$ANSWER")
until echo "$ANSWER" | grep -qE '"status":"(COMPLETED|FAILED)"|"error"'; do
sleep 5
ANSWER=$(curl -s "$API/v1/renders/$RENDER" -H "$AUTH")
done
echo "$ANSWER"
}
render preview
render final
ASSET=$(field asset_id "$ANSWER")async function render(kind: "preview" | "final") {
let answer = await call(
"POST",
"/v1/renders",
{
alias: "oneup/render-timeline",
project_id: project.project_id,
version_id: version.version_id,
kind,
},
{ "Idempotency-Key": crypto.randomUUID() }
);
console.log(JSON.stringify(answer, null, 2));
while (answer.status !== "COMPLETED" && answer.status !== "FAILED") {
await new Promise((resolve) => setTimeout(resolve, 5000));
answer = await call("GET", `/v1/renders/${answer.render_id}`);
}
console.log(JSON.stringify(answer, null, 2));
return answer;
}
const preview = await render("preview");
const final = await render("final");def render(kind):
answer = call(
"POST",
"/v1/renders",
{
"alias": "oneup/render-timeline",
"project_id": project["project_id"],
"version_id": version["version_id"],
"kind": kind,
},
{"Idempotency-Key": str(uuid.uuid4())},
)
print(json.dumps(answer, indent=2))
while answer["status"] not in ("COMPLETED", "FAILED"):
time.sleep(5)
answer = call("GET", f"/v1/renders/{answer['render_id']}")
print(json.dumps(answer, indent=2))
return answer
preview = render("preview")
final = render("final")The first answer, for the Preview:
{
"render_id": "4033f514-b2c5-43d5-9e32-0d6774bdb4ab",
"ticket": "oneup_req_aWYGiLxcmkuohU3ho0alaWYGiL",
"kind": "preview",
"status": "QUEUED"
}The Preview when it is done:
{
"render_id": "4033f514-b2c5-43d5-9e32-0d6774bdb4ab",
"ticket": "oneup_req_aWYGiLxcmkuohU3ho0alaWYGiL",
"kind": "preview",
"status": "COMPLETED",
"progress": {},
"preview_url": "https://media.oneupai.com/a/4033f514-b2c5-43d5-9e32-0d6774bdb4ab/1791441027/kpwoNLoyjuqYkIcuPeoj0E",
"poster_url": "https://media.oneupai.com/a/oneup_asset_Ni106DyiWeS5hOR0JGQR3S75p5/1791441027/jxNuwz9JAafntGNvUKYI9F",
"preview_expires_at": "2026-10-11T05:30:11.112Z",
"created_at": "2026-10-08T05:30:11.133Z",
"completed_at": "2026-10-08T05:30:25.008Z"
}Open preview_url in a browser to watch the Preview. It is kept until preview_expires_at, 72 hours later. poster_url is a still from it. Both links work for one hour: ask for the render again to get fresh ones.
Then the final. Its first answer has "kind": "final", and the 15 credits were taken when it was accepted. When it is done:
{
"render_id": "c5791f16-8005-4481-9250-be866267b9a3",
"ticket": "oneup_req_STloE9IrapuyeeJaSmWbSTloE9",
"kind": "final",
"status": "COMPLETED",
"progress": {},
"poster_url": "https://media.oneupai.com/a/oneup_asset_ZkVpwBU4xPwaadDwyxHRM0Y5EI/1791441071/Z1L_4ApjsHB44Xs_pvI69D",
"asset_id": "oneup_asset_L9TEdpOwQTTRlyXNmfLnlnFcVI",
"created_at": "2026-10-08T05:30:28.510Z",
"completed_at": "2026-10-08T05:31:10.196Z"
}The final is now an asset in your account, and asset_id names it. If a final ends FAILED instead, its credits are already back in your balance: that is a refund.
Step 5: Download the video #
Ask for links to the asset, then save the file.
ANSWER=$(curl -s "$API/v1/assets/$ASSET/url" -H "$AUTH")
echo "$ANSWER"
curl -s -o my-first-video.mp4 "$(field download_url "$ANSWER")"
ls -l my-first-video.mp4const links = await call("GET", `/v1/assets/${final.asset_id}/url`);
console.log(JSON.stringify(links, null, 2));
const file = await fetch(links.download_url, {
signal: AbortSignal.timeout(300_000),
});
await writeFile("my-first-video.mp4", Buffer.from(await file.arrayBuffer()));
console.log("Saved my-first-video.mp4");links = call("GET", f"/v1/assets/{final['asset_id']}/url")
print(json.dumps(links, indent=2))
download = urllib.request.Request(links["download_url"], headers={"User-Agent": AGENT})
with urllib.request.urlopen(download, timeout=300) as response, open("my-first-video.mp4", "wb") as out:
out.write(response.read())
print("Saved my-first-video.mp4")The response:
{
"asset_id": "oneup_asset_L9TEdpOwQTTRlyXNmfLnlnFcVI",
"url": "https://media.oneupai.com/a/oneup_asset_L9TEdpOwQTTRlyXNmfLnlnFcVI/1791441071/V7g27-1y0H9sM6MwgBn4Mo",
"content_type": "video/mp4",
"download_url": "https://media.oneupai.com/a/oneup_asset_L9TEdpOwQTTRlyXNmfLnlnFcVI/1791441071/V7g27-1y0H9sM6MwgBn4Mo?download=oneup_asset_L9TEdpOwQTTRlyXNmfLnlnFcVI.mp4",
"duration_ms": null,
"poster_url": "https://media.oneupai.com/a/oneup_asset_ZkVpwBU4xPwaadDwyxHRM0Y5EI/1791441071/Z1L_4ApjsHB44Xs_pvI69D"
}url plays the video in a browser and download_url saves it as a file. Both are expiring links that work for one hour, and GET /v1/assets/{asset_id}/url gives you new ones whenever you need them. duration_ms is the video's measured length; right after a render it can still be null, before we have measured it. Your video is now in my-first-video.mp4.
What just happened #
You uploaded two photos, described a video as a Timeline, and rendered it twice: a free Preview to check it, then the charged final. OneUpRender used only your photos and your Timeline, so the same Timeline gives the same video every time. Only the final cost credits, and the video stays in your account until you delete it.
Next steps #
- Change one thing. Swap
crossfadeforseamless_spin, a spin from one photo into the next, save a new version and render again. The before and after recipe uses it. - Find more. The catalog lists every operation (motion, transitions, text, split screens, sound), each with its settings and a small example.
- Learn the rules. The concepts explain Projects, versions and renders, and the errors page says what each error code means.