Deploy BabyChain
Every output becomes the next input.
babychain
Just deployed
Deploy and Host BabyChain on Railway
BabyChain is a self-hosted API starter for chaining image and video generation steps into one durable run. Its built-in chain template supports text-to-image into image-to-video, image-to-image into image-to-video, and optional image refinement 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 runs on Next.js with Supabase-backed run state, BabySea SDK execution, direct BYOK execution for Alibaba Cloud, Black Forest Labs, and BytePlus, or mock mode for deterministic local runs without inference provider keys.
About Hosting
A caller starts in the API surface by listing available templates, inspecting model schemas, or posting to POST /api/v1/chains/runs with Authorization: Bearer BABYCHAIN_API_KEY. BabyChain uses one chain template and caller-selected models to decide whether the run starts from text, an uploaded image, or an optional refinement step.
The create-run route validates the input against the template schema, rejects credential-like request fields, checks safe HTTPS input files, estimates the selected steps, stores the run and step records in Supabase, and returns the public run resource immediately. The returned resource includes steps plus a compact timeline array for ordered status display.
The processor resumes queued work through the server runner. For each ready step, it resolves the selected model, chooses BabySea, BYOK, or mock provider execution, starts or polls the generation, stores provider metadata needed for recovery, and injects each successful output URL into the dependent input for the next step.
After every step reaches a terminal state, the run presenter returns one caller-facing resource with step details, final output references, and timeline events. The callback worker sends the same signed JSON payload to the configured webhook URL, while API consumers can still retrieve or cancel runs without coordinating individual provider jobs themselves.
Common Use Cases
- Public API endpoints for listing chain templates, creating runs, polling runs, and canceling runs.
text-to-imagethenimage-to-videochains.image-to-imagethenimage-to-videochains that accept safe HTTPS image inputs.- Three-step
text-to-image,image-to-image, andimage-to-videoworkflows with one final callback. - BYOK, BabySea, or mock execution with cost estimates, provider polling, deterministic local outputs, and terminal status delivery.
- Provider-native model schema discovery through
GET /api/v1/modelsandGET /api/v1/models/{modelId}. - Public run responses with ordered
timelineevents for step status, timing, provider, output count, and error display.
Dependencies for BabyChain Hosting
- 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, andBABYCHAIN_CALLBACK_SECRET. - BabySea for hosted image and video execution when
BABYCHAIN_PROVIDER_MODE=babysea. - Alibaba Cloud for BYOK Qwen, Wan, and HappyHorse model execution.
- 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, Netlify, Railway, Render, or Vercel.
Why Deploy BabyChain on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying babychain on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
babychain
babysea-community/babychainSUPABASE_SECRET_KEY
NEXT_PUBLIC_SITE_URL
BABYCHAIN_CRON_SECRET
UPSTASH_REDIS_REST_URL
BABYCHAIN_PROVIDER_MODE
NEXT_PUBLIC_SUPABASE_URL
UPSTASH_REDIS_REST_TOKEN
BABYCHAIN_CALLBACK_SECRET
