Templates
BabyChain icon

BabyChain

Model chain API engine for image and video workloads with one durable pipeline and one final callback.

View demo
Loading preview
BabyChain preview

Best for

API-first chains
Image model chains
Video model chains
Output-to-input steps
Final callbacks
BYOK execution
Server-side keys
Scheduler recovery
Product media pipelines

Overview

BabyChain is an API-first starter for chaining image and video generation steps into one durable run. It exposes chain templates for text-to-image into image-to-video, image-to-image into image-to-video, and three-step image transformation flows before final video output.

Use it when you want callers to submit one request, let each model output become the next model input, and receive one signed final callback. The starter supports BabySea mode or BYOK mode with server-side Black Forest Labs and BytePlus credentials, while Supabase stores runs, steps, callbacks, and API-key state.

What you can build

  • Public API endpoints for listing chain templates, creating runs, polling runs, and canceling runs.
  • text-to-image then image-to-video chains using FLUX or Seedream image models and Seedance video models.
  • image-to-image then image-to-video chains that accept safe HTTPS image inputs.
  • Three-step text-to-image, image-to-image, and image-to-video workflows with one final callback.
  • BYOK or BabySea-backed execution with cost estimates, provider polling, and terminal status delivery.

What you need

  • Next.js for API routes, route handlers, and the server runner.
  • Supabase for run records, step records, API callers, callback state, and migrations.
  • BabyChain secrets for BABYCHAIN_API_KEY, BABYCHAIN_CRON_SECRET, and BABYCHAIN_CALLBACK_SECRET.
  • BabySea for hosted image and video execution when BABYCHAIN_PROVIDER_MODE=babysea.
  • Black Forest Labs for BYOK FLUX image model execution.
  • BytePlus for BYOK Seedream and Seedance model execution.
  • Upstash for Redis-backed caller API rate limiting.
  • Sentry for optional production observability.
  • For hosting, you can deploy using Cloudflare, DigitalOcean, Heroku, Netlify, Railway, Render, or Vercel.

Description flow

A caller starts in the API surface by listing available templates or posting to a specific chain route with Authorization: Bearer BABYCHAIN_API_KEY. BabyChain validates the chain input against the template schema, rejects credential-like request fields, checks safe HTTPS input files, estimates the run, stores the run and step records in Supabase, and returns the public run resource immediately.

The processor resumes queued work through the server runner. For each ready step, it resolves the selected model, chooses BabySea or BYOK provider execution, starts the generation, and records provider metadata needed to poll without exposing provider secrets to the caller.

When a step succeeds, BabyChain reads the output file URL and injects it into the dependent input for the next step. That is how a text-to-image result becomes an image-to-video source, or how a generated image is restyled before final video creation in the three-step chain.

After every step reaches a terminal state, the run presenter returns a single caller-facing resource and the callback worker sends one signed JSON payload to the configured webhook URL. API consumers can still retrieve or cancel runs, but they do not need to coordinate individual provider jobs themselves.