open-generative-studio
README.md
# Open Generative Studio
[](https://www.atlascloud.ai/?ref=D3SHKW)
[](LICENSE)
[](https://nextjs.org)
**An open-source, self-hostable AI creation studio.** Generate images, video,
lip-sync, cinematic clips and marketing/UGC ads from one canvas - with a
node-based workflow builder, a per-user credit wallet, and a hosted MCP server
so AI agents (Claude, ChatGPT, Cursor) can generate media through your instance.
Model inference is **powered by [Atlas Cloud](https://www.atlascloud.ai)** -
one API key gives your instance access to frontier image, video, audio and LLM
models (FLUX, Qwen-Image, Kling, Seedream, DeepSeek and more).
---
## Features
- **Image Studio** - text-to-image and image-to-image with reference images,
multi-model picker, and a live per-generation cost pill.
- **Video Studio** - text-to-video, image-to-video and reference-to-video with
multi-image / video / audio reference support.
- **Lip Sync** - portrait + audio (uploaded or recorded in-browser) to talking video.
- **Marketing Studio** - templated UGC / product-ad video generation.
- **Flow** - a node-based workflow builder (React Flow): chain LLM, image,
video and audio nodes, fan out one prompt into N variations, and start from
a library of pre-built community templates with baked example media.
- **MCP server** - a hosted Model Context Protocol endpoint with OAuth 2.1
one-click connect, so agents can call `generate_image`, `generate_video`,
`get_balance` and more against your instance.
- **Credit wallet** - atomic Postgres credit ops (deduct / refund / true-up),
append-only transaction ledger, optional Razorpay top-ups, promo codes, and
a two-tier affiliate program.
- **Production-hardened** - refund-on-failure generation pipeline, async
submit-and-reconcile for long video jobs, result re-hosting into Supabase
Storage, rate limiting, and an admin business-metrics dashboard.
## Architecture (60 seconds)
```
Browser (studio canvas)
| POST /api/generate { model, prompt, ... }
v
Next.js API route - Supabase auth -> atomic credit deduction -> dispatch
|
| model_costs.source drives the dispatcher:
| 'atlascloud' -> lib/atlascloud/client.js (primary provider)
| 'kie.ai' / 'muapi.ai' -> optional secondary adapters
v
Atlas Cloud (async prediction -> polled by the reconciler -> result re-hosted
into Supabase Storage -> row completed / auto-refunded on failure)
```
- **Frontend**: Next.js 15 (App Router) + React + Tailwind.
- **Backend**: Next.js API routes + Supabase (Postgres, Auth, Storage).
- **Inference**: [Atlas Cloud](https://www.atlascloud.ai) - the app talks to
`https://api.atlascloud.ai` server-side only; API keys never reach the browser.
## Quickstart
```bash
git clone https://github.com/nextgentrainingacademy88-max/open-generative-studio.git
cd open-generative-studio
cp .env.local.example .env.local # paste your Supabase + Atlas Cloud keys
npm install
npm run build:packages
npm run dev # http://localhost:3000
```
Full walkthrough (Supabase migrations, storage bucket, model registration):
**[SETUP.md](SETUP.md)**.
## Powered by Atlas Cloud
This project uses [Atlas Cloud](https://www.atlascloud.ai) as its model
inference provider:
- **LLMs** via the OpenAI-compatible `POST /v1/chat/completions` endpoint.
- **Images** via `POST /api/v1/model/generateImage` (FLUX, Qwen-Image, Seedream, ...).
- **Video** via `POST /api/v1/model/generateVideo` (Kling, Vidu, ...).
- Async predictions are polled at `GET /api/v1/model/prediction/{id}` and
finalized by the built-in reconciler.
Set `ATLASCLOUD_API_KEY` in your environment and register the models you want
in the `model_costs` table (`source = 'atlascloud'`) - see
[`supabase/migrations/0052_atlascloud_provider.sql`](supabase/migrations/0052_atlascloud_provider.sql)
for a commented example. Keys are read server-side only and are never committed
to this repository.
## Repository tour
```
app/ Next.js App Router - marketing pages, studio, wallet,
affiliate portal, blog, /api routes (generate, workflow,
razorpay, mcp, cron)
components/ App shell, marketing sections, admin charts, UI primitives
lib/ Server-side core: credit ops, pricing, dispatch
atlascloud/client.js Atlas Cloud adapter (images, video, chat)
generate-core.js Auth -> deduct -> dispatch -> refund-on-failure pipeline
generation-reconcile.js Async poll + re-host + true-up
flow/ Workflow engine (poll-driven, fan-out, CAS-claimed ticks)
mcp/ MCP tools + auth (API keys + OAuth via Supabase)
packages/ Vendored studio UI + workflow-builder (React Flow)
supabase/migrations/ Full schema: wallet, generations, model catalog, promo,
affiliate program, security hardening
scripts/ Template seeders + maintenance scripts
skills/ Agent skill bundle for the MCP server
```
## Credits & lineage
Started from [Anil-matcha/Open-Generative-AI](https://github.com/Anil-matcha/Open-Generative-AI)
(MIT) and substantially rebuilt: credit-wallet SaaS backend, server-side
provider dispatch, Flow workflow engine + builder UX, MCP server with OAuth,
affiliate program, admin analytics, security hardening, and the marketing site.
## License
[MIT](LICENSE) - free to use, self-host, modify and redistribute.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues