<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raindance Lab</title>
    <description>The latest articles on DEV Community by Raindance Lab (@raindance_lab).</description>
    <link>https://dev.to/raindance_lab</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4218287%2F9bc94bcb-fe22-4f87-bc50-ec4eab6be692.png</url>
      <title>DEV Community: Raindance Lab</title>
      <link>https://dev.to/raindance_lab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raindance_lab"/>
    <language>en</language>
    <item>
      <title>Raindance AI: Clip-Length Pickers, Head-Swap vs Whole-Person, and Seedance via TryAllAPI</title>
      <dc:creator>Raindance Lab</dc:creator>
      <pubDate>Sat, 31 Oct 2026 05:02:49 +0000</pubDate>
      <link>https://dev.to/raindance_lab/raindance-ai-clip-length-pickers-head-swap-vs-whole-person-and-seedance-via-tryallapi-2o0k</link>
      <guid>https://dev.to/raindance_lab/raindance-ai-clip-length-pickers-head-swap-vs-whole-person-and-seedance-via-tryallapi-2o0k</guid>
      <description>&lt;p&gt;&lt;em&gt;How I shipped a timeline-aware Raindance remake product on Cloudflare Workers — where duration knobs drive Seedance costs through TryAllAPI.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://raindanceai.app/?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=builder" rel="noopener noreferrer"&gt;raindanceai.app&lt;/a&gt; is not “upload and hope.” Users pick &lt;strong&gt;solo (1 photo) or duet (2 photos)&lt;/strong&gt;, choose &lt;strong&gt;Head swap&lt;/strong&gt; or &lt;strong&gt;Whole person&lt;/strong&gt;, then select a &lt;strong&gt;3–10s moment&lt;/strong&gt; from the trend clip (including quick Part 1 / 2 / 3 for a full ~30s stitch later in CapCut). Output is an MP4 ready for Shorts/Reels.&lt;/p&gt;

&lt;p&gt;This post focuses on the &lt;strong&gt;API + duration economics&lt;/strong&gt; side: why an aggregator, which Seedance knobs matter, and how pricing from &lt;strong&gt;$5.99&lt;/strong&gt; maps to credits. Prices and model ids change; treat live site / console as source of truth.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp1l096g3n5lkhf1c0rot.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp1l096g3n5lkhf1c0rot.jpg" alt="Raindance AI hero — solo/duet and clip picker" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Product shape that drives the API design
&lt;/h2&gt;

&lt;p&gt;Unlike one-shot 15s party templates, Raindance exposes length:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clip length controls: 3s through 10s.
&lt;/li&gt;
&lt;li&gt;Quick parts: 0:00–0:10, 0:10–0:20, 0:20–0:30.
&lt;/li&gt;
&lt;li&gt;Mode: head swap vs whole person (different reference usage).
&lt;/li&gt;
&lt;li&gt;Solo vs duet changes photo count and composition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That means the Worker must pass &lt;strong&gt;explicit duration&lt;/strong&gt; every time. Omitting duration and letting the model “pick a smart length” is how bills drift — and how a $5.99 entry pack silently loses money.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faqfpy5mlgdhrdrlz026n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faqfpy5mlgdhrdrlz026n.jpg" alt="Desktop screenshot of the Raindance create / timeline UI" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live pricing seen on the homepage while writing: packs from &lt;strong&gt;$5.99&lt;/strong&gt;, with other tiers such as &lt;strong&gt;$9.99&lt;/strong&gt; one-video credit messaging and multi-packs (&lt;strong&gt;$23.99&lt;/strong&gt; / &lt;strong&gt;$14.99&lt;/strong&gt; / &lt;strong&gt;$36.99&lt;/strong&gt; variants appear in copy). No subscription required for the core path. Re-check the create CTA before you quote a friend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack overview
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Choice&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Front / SSR&lt;/td&gt;
&lt;td&gt;TanStack Start (Vite)&lt;/td&gt;
&lt;td&gt;Landing, upload panel, generation status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runtime&lt;/td&gt;
&lt;td&gt;Cloudflare Workers&lt;/td&gt;
&lt;td&gt;Edge deploy, secrets, API routes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DB&lt;/td&gt;
&lt;td&gt;Cloudflare D1&lt;/td&gt;
&lt;td&gt;Credits, orders, task rows (table prefixes if DBs are shared)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payments&lt;/td&gt;
&lt;td&gt;Stripe Checkout&lt;/td&gt;
&lt;td&gt;One-time packs + optional larger packs; guest checkout&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Video upstream&lt;/td&gt;
&lt;td&gt;TryAllAPI → Seedance&lt;/td&gt;
&lt;td&gt;Async create + poll&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analytics&lt;/td&gt;
&lt;td&gt;GA&lt;/td&gt;
&lt;td&gt;Funnel sanity check&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;solo/duet photos + length + mode
→ locked Raindance template prompt
→ check credits (else Stripe)
→ Worker creates Seedance task via TryAllAPI
→ poll until MP4 URL → store / show
→ on failure: refund credits
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyku94muvm1yp5qe26zzv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyku94muvm1yp5qe26zzv.jpg" alt="Raindance scene / sample still used in marketing" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demo clips / scene stills are self-hosted with the product. Do not scrape other CDNs for marketing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why TryAllAPI instead of five vendor SDKs
&lt;/h2&gt;

&lt;p&gt;Direct vendor onboarding for every video model means accounts, KYC, docs drift, and different async status machines. For a small indie product I wanted one API key in Workers Secrets, USD balance billed by usage, and a path to Seedance without rewriting the client each time the console UI changes.&lt;/p&gt;

&lt;p&gt;That is what &lt;a href="https://tryallapi.com/?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=builder" rel="noopener noreferrer"&gt;TryAllAPI&lt;/a&gt; is for on this project.&lt;/p&gt;

&lt;p&gt;Operational checklist after register / top-up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Confirm &lt;strong&gt;available USD balance&lt;/strong&gt; in the console (not only the checkout success page).
&lt;/li&gt;
&lt;li&gt;Create a token in &lt;strong&gt;pay-as-you-go&lt;/strong&gt; style billing.
&lt;/li&gt;
&lt;li&gt;Enable the &lt;strong&gt;video / Seedance-related channel group&lt;/strong&gt; on that token. Wrong group → “no available channel” even when the model id looks right.
&lt;/li&gt;
&lt;li&gt;Prefer separate keys per product (&lt;code&gt;raindance-prod&lt;/code&gt; vs sandbox).
&lt;/li&gt;
&lt;li&gt;Put the key only in Workers Secrets (for example &lt;code&gt;TRYALLAPI_API_KEY&lt;/code&gt;). Never in the frontend bundle or a blog post.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Conceptually the call shape looks like this (field names follow the aggregator’s v3 contents API; always re-check current docs):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /api/v3/contents/generations/tasks
Authorization: Bearer &amp;lt;TRYALLAPI_API_KEY&amp;gt;
Content-Type: application/json
Accept-Encoding: identity

GET /api/v3/contents/generations/tasks/{id}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I send &lt;code&gt;Accept-Encoding: identity&lt;/code&gt; from the Worker because some gateways behave badly with transparent decompression. Model ids used in production look like Seedance 2.x family strings — treat console ids as source of truth, not this paragraph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seedance parameters this product forces you to get right
&lt;/h2&gt;

&lt;p&gt;A few details that bit me across this family of sites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pass &lt;code&gt;duration&lt;/code&gt; as an explicit integer.&lt;/strong&gt; Some models default to “smart length.” Omitting duration can silently lengthen the clip and the bill.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;resolution&lt;/code&gt; and &lt;code&gt;ratio&lt;/code&gt;.&lt;/strong&gt; Cost tracks resolution tier and duration more than portrait vs landscape. Match whatever the create UI offers (often 480p/720p and 9:16 for Shorts).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;generate_audio&lt;/code&gt;.&lt;/strong&gt; When the product ships “finished” downloads, leave audio on; creators who want a trending sound can mute later.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Status machine.&lt;/strong&gt; Expect something like &lt;code&gt;queued&lt;/code&gt; → &lt;code&gt;running&lt;/code&gt; → &lt;code&gt;succeeded&lt;/code&gt; / &lt;code&gt;failed&lt;/code&gt;. Success URLs are often &lt;strong&gt;short-lived signed links&lt;/strong&gt; — download/rehost on your side before handing the file to the user.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decent failure.&lt;/strong&gt; On &lt;code&gt;supply_unavailable&lt;/code&gt; or hard failures: refund credits, show a short human message, log the detailed upstream error server-side, optionally fall back to another Seedance tier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rough mental model for upstream cost (illustrative only — use your own &lt;code&gt;usage&lt;/code&gt; fields and invoices):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tokens ≈ duration_sec × width × height × fps / 1024
cost   ≈ tokens × price_per_million_tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Price the site &lt;strong&gt;after&lt;/strong&gt; you measure a few real runs with retry margin, Stripe fees, and failed-job refunds — not from a spreadsheet fantasy of 0% failure.&lt;/p&gt;

&lt;p&gt;Raindance-specific:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Duration must match the picker (3–10). Longer parts ⇒ higher upstream cost.
&lt;/li&gt;
&lt;li&gt;Reference image count — solo 1 / duet 2; head-swap vs whole-person changes how you describe the edit in the locked template prompt.
&lt;/li&gt;
&lt;li&gt;Source trend framing may lean 16:9 in places; still offer vertical exports where the UI says so.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Credits, Stripe, and short-clip math
&lt;/h2&gt;

&lt;p&gt;Demo UIs are easy. The line between toy and product is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User hits Create → check credit balance.
&lt;/li&gt;
&lt;li&gt;If short → Stripe Checkout Session (guest allowed).
&lt;/li&gt;
&lt;li&gt;Webhook (plus a return-URL sync check) grants credits.
&lt;/li&gt;
&lt;li&gt;Pre-debit / lock credits, create upstream task, persist &lt;code&gt;task_id&lt;/code&gt; in D1.
&lt;/li&gt;
&lt;li&gt;Poll until done; succeed → show MP4; fail → &lt;strong&gt;refund credits&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Two books of account stay separate: &lt;strong&gt;USD balance at TryAllAPI&lt;/strong&gt; (your cost) vs &lt;strong&gt;site credits&lt;/strong&gt; (what you sold). Mixing them in one mental ledger is how you underprice or invent “mysterious” losses.&lt;/p&gt;

&lt;p&gt;When several products share one Stripe account, isolate webhooks by endpoint or by metadata (&lt;code&gt;site&lt;/code&gt; / &lt;code&gt;product&lt;/code&gt;). Callbacks pointed at the wrong apex domain are a classic multi-site footgun.&lt;/p&gt;

&lt;p&gt;Secrets stay in Workers: &lt;code&gt;TRYALLAPI_API_KEY&lt;/code&gt;, &lt;code&gt;STRIPE_SECRET_KEY&lt;/code&gt;, webhook secret, auth secrets. The browser only ever sees publishable Stripe keys if needed.&lt;/p&gt;

&lt;p&gt;Raindance’s lower entry (&lt;strong&gt;from $5.99&lt;/strong&gt;) only works if short clips dominate, duration is explicit, and failure refunds are automatic. Measure COGS on 3s vs 10s before locking pack prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy notes (Workers + D1)
&lt;/h2&gt;

&lt;p&gt;Typical loop on this template family:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="c"&gt;# wire D1 database_id, production env, custom domain in wrangler&lt;/span&gt;
pnpm cf:deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before calling a deploy “done”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;D1 binding is correct; shared DBs use &lt;strong&gt;table prefixes&lt;/strong&gt;, not a new database per micro-idea (free-tier DB counts are limited).
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AUTH_TRUSTED_ORIGINS&lt;/code&gt; and Stripe return / webhook URLs match the production HTTPS origin.
&lt;/li&gt;
&lt;li&gt;GA id is set for a coarse funnel (land → upload → pay → wait → download).
&lt;/li&gt;
&lt;li&gt;One real end-to-end path on production or a staging Worker: upload → pay → render → download.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Production origin: &lt;code&gt;https://raindanceai.app&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Product rules that are not optional
&lt;/h2&gt;

&lt;p&gt;Face-based generation is not “just another SaaS CRUD app”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Require an explicit &lt;strong&gt;18+ / rights-to-use&lt;/strong&gt; confirmation on upload.
&lt;/li&gt;
&lt;li&gt;Block minors and refuse celebrity / stranger misuse in copy and policy.
&lt;/li&gt;
&lt;li&gt;Expect upstream safety refusals; refund and explain.
&lt;/li&gt;
&lt;li&gt;Keep privacy policy honest about retention; do not train on user media by default.
&lt;/li&gt;
&lt;li&gt;Market as an &lt;strong&gt;independent fan-style tool&lt;/strong&gt; for a trend format — not as an official tie-in unless you actually have that deal.
&lt;/li&gt;
&lt;li&gt;Use your own sample renders in marketing.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those constraints belong in the product, not in a footnote you add after the first dispute email.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would reuse on the next timeline-aware trend site
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Expose duration when the trend is a timeline, not a single gag.
&lt;/li&gt;
&lt;li&gt;Force &lt;code&gt;duration&lt;/code&gt; on every Seedance create.
&lt;/li&gt;
&lt;li&gt;Aggregator keeps the Worker boring.
&lt;/li&gt;
&lt;li&gt;Credits with automatic refund on failed generation.
&lt;/li&gt;
&lt;li&gt;Measure the funnel before polishing prompt poetry.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consumer: &lt;a href="https://raindanceai.app/?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=builder" rel="noopener noreferrer"&gt;raindanceai.app&lt;/a&gt;. Builder: &lt;a href="https://tryallapi.com/register?aff=5A6A&amp;amp;utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=builder" rel="noopener noreferrer"&gt;TryAllAPI&lt;/a&gt;, top up, prove create+poll, then wire credits. &lt;strong&gt;Pick the second, bill the second, poll until MP4.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>api</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
