YouTube
DIY Build Shorts
A tired room or an old find made new, built on camera in six shots
- From
- 240 crper ad
- Endpoint
POST /api/v1/studio/diy/runs- Workflow id
diy
Real outputs of this workflow.
The request
# 1. Price it. Free, nothing is charged.
PRICE=$(curl -s -X POST https://staglight.ai/api/v1/studio/diy/estimate \
-H "Authorization: Bearer $STAGLIGHT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat'\''s inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"}
}' | jq .credits)
echo "$PRICE"
# 2. Start it. max_credits refuses anything above that price; the Idempotency-Key stops a double charge.
START=$(curl -s -X POST https://staglight.ai/api/v1/studio/diy/runs \
-H "Authorization: Bearer $STAGLIGHT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat'\''s inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"},
"max_credits": '"$PRICE"'
}')
ID=$(echo "$START" | jq -r .id)
# 3. Wait until it finishes.
while :; do
STATUS=$(curl -s "https://staglight.ai/api/v1/studio/diy/runs/$ID" -H "Authorization: Bearer $STAGLIGHT_API_KEY" | jq -r .status)
case "$STATUS" in succeeded|partial|failed) break ;; esac; sleep 10
done
# 4. Download every file in one zip.
curl -s -L -o result.zip "https://staglight.ai/api/v1/studio/diy/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY" import os, time, uuid, requests
BASE = "https://staglight.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['STAGLIGHT_API_KEY']}"}
# 1. Price it. Free, nothing is charged.
estimate = {
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat's inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"}
}
price = requests.post(f"{BASE}/api/v1/studio/diy/estimate", headers=HEADERS, json=estimate, timeout=60).json()["credits"]
print(price)
# 2. Start it. max_credits refuses anything above that price; the Idempotency-Key stops a double charge.
body = {
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat's inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"},
"max_credits": 480
}
body["max_credits"] = price
r = requests.post(f"{BASE}/api/v1/studio/diy/runs", json=body, timeout=60,
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())})
r.raise_for_status()
start = r.json()
# 3. Wait until it finishes.
while True:
run = requests.get(f"{BASE}/api/v1/studio/diy/runs/{start['id']}", headers=HEADERS, timeout=60).json()
if run["status"] in ("succeeded", "partial", "failed"):
break
time.sleep(10)
# 4. Download every file in one zip.
with open("result.zip", "wb") as out:
out.write(requests.get(f"{BASE}/api/v1/studio/diy/runs/{start['id']}/outputs.zip", headers=HEADERS, timeout=300).content) // Node 18 or newer. Save as run.mjs: top-level await needs a module.
const BASE = "https://staglight.ai";
const headers = { Authorization: `Bearer ${process.env.STAGLIGHT_API_KEY}` };
const json = { ...headers, "Content-Type": "application/json" };
// 1. Price it. Free, nothing is charged.
const estimate = {
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat's inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"}
};
const price = await (await fetch(`${BASE}/api/v1/studio/diy/estimate`, { method: "POST", headers: json, body: JSON.stringify(estimate) })).json();
console.log(price.credits);
// 2. Start it. max_credits refuses anything above that price; the Idempotency-Key stops a double charge.
const body = {
"card": "build",
"inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat's inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"},
"max_credits": 480
};
body.max_credits = price.credits;
const res = await fetch(`${BASE}/api/v1/studio/diy/runs`, {
method: "POST", headers: { ...json, "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify(body),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const start = await res.json();
// 3. Wait until it finishes.
let run = start;
while (!["succeeded", "partial", "failed"].includes(run.status)) {
await new Promise((r) => setTimeout(r, 10000));
run = await (await fetch(`${BASE}/api/v1/studio/diy/runs/${start.id}`, { headers })).json();
}
// 4. Download every file in one zip.
console.log(`${BASE}/api/v1/studio/diy/runs/${start.id}/outputs.zip`); Use the Staglight API to run the workflow "DIY Build Shorts" from server code.
Docs: https://staglight.ai/llms.txt
This workflow: https://staglight.ai/en/api/workflows/diy
Key: read it from the STAGLIGHT_API_KEY environment variable. Never put it in browser code.
1. Price it for free first: POST /api/v1/studio/diy/estimate
2. Start it: POST /api/v1/studio/diy/runs, with an Idempotency-Key header and max_credits.
Body: {"card": "build", "inputs": {"plan": "{\"builder\": \"a woman in her early 30s with auburn hair in a messy bun and light freckles, a plain rust-orange flannel shirt with rolled sleeves over a white T-shirt, faded denim overalls, a tan leather tool belt and brown work boots\", \"item\": \"old wooden rowing boat, about 3 metres long\", \"place\": \"a sunny backyard on green grass beside a weathered garden shed\", \"result\": \"boat daybed\", \"shots\": [{\"starts\": \"the old rowing boat sits right side up on the grass behind the shed, grey, cracked and full of dry leaves.\", \"ends\": \"the builder scoops one big armful of dry leaves out into a bucket beside the boat, grinning.\", \"line\": \"Found this old boat rotting behind my shed. Time for a second life.\"}, {\"starts\": \"the boat is empty of leaves now, and its hull is grey and peeling.\", \"ends\": \"the builder runs an orbital sander along it in long passes, dust drifting in the sunlight, and a stripe of bare honey-coloured wood shines through.\", \"line\": \"First, I sanded the hull down to bare wood.\"}, {\"starts\": \"the two old wooden seats are already sawn out and the inside is swept clean.\", \"ends\": \"the builder screws pale pine slats, each cut to the boat's inside width, across the inside one by one with a cordless drill, making a flat base.\", \"line\": \"Next, I cut out the seats and built a slatted base inside.\"}, {\"starts\": \"the slatted base is finished and four smooth wooden posts already stand at the corners of the boat.\", \"ends\": \"the builder pulls a cream canvas canopy tight across the tops of the four posts.\", \"line\": \"Then came four posts and a canvas canopy.\"}, {\"starts\": \"the wood is still raw.\", \"ends\": \"the builder brushes on a warm oak finish that glows on the grain, in long smooth strokes.\", \"line\": \"A warm oak finish, brushed on by hand.\"}, {\"starts\": \"string lights already run along the whole rim; the builder drops a thick mattress, plump cushions and a knitted blanket into the boat.\", \"ends\": \"the string lights glow warm and the builder leans back into the cushions\", \"line\": \"Cushions, blankets, done. Would you nap in this?\"}], \"lang\": \"en\"}"}, "max_credits": 480}
Files are media ids from POST /api/v1/uploads.
3. After a timeout, check the job list before you retry, and retry with the same Idempotency-Key.
4. Poll the run until it finishes, then download its outputs.zip. What it costs
| Template | Final, best text | Draft, fast and cheap |
|---|---|---|
| Build Short | 480 cr | 240 cr |
Prices from the server at the default settings. The estimate call gives the exact price for your inputs, for free.
Inputs
| Name | Type | Allowed |
|---|---|---|
cardThe template | string | build |
inputs.ideaYour idea | string | |
inputs.planThe plan | string | |
inputs.drawSurprise build | string | |
inputs.languageLanguage | enum | auto, en, es |
qualityQuality | enum | final, draft |
aspectShape | enum | 9:16, 16:9 |
Files are media ids from POST /api/v1/uploads. View documentation
Try it by hand
The same workflow runs in the studio, on the same balance. Use it to see the result before you write code.
More workflows
- Real output YouTube
Ranking Shorts
Five crazy levels, ranked #5 to #1, in one vertical Short
per ad, from190 cr
- Real output YouTube
Glow-up Series
An animated series in your language where your audience votes what changes each day
per ad, from216 cr
- Real output YouTube
Motion Math
Any idea becomes a neon maths Short, with the real number worked out and shown happening
per ad, from100 cr