TensorCraft Studio - Building a Cinematic AI Creative Agent
TensorCraft Studio: Building a Cinematic AI Creative Agent
For the last few weeks I’ve basically only been working on this: TensorCraft Studio, live at tensorcraft.studio. You chat with an agent called “Tensor” (or use a more manual, parameter-based UI if you want control) and it generates images, video, and audio for you, with actual credit-based billing behind it. It’s the second thing under the TensorCraft name — the other one’s an AI/ML interview-prep platform, completely different product, just the same brand.
why I built it this way
I didn’t want another tool where you fill out five dropdowns and hit generate. I wanted it to feel like you’re talking to someone who gets what you mean — “give me a 4-shot car chase through a neon city” and the agent figures out what to actually submit. If you want more control, the Studio view is there with real parameter sliders per model. Same billing and generation engine under both, just two different ways to talk to it.
the stack, roughly
Frontend’s React 19 + TypeScript on Vite, Tailwind, Framer Motion for the animation stuff, Supabase for auth, Sentry watching for errors. Backend’s FastAPI with rate limiting (slowapi) and concurrency caps so one user can’t hog everything — 4 generations at a time per media type per user. There’s 80 backend tests, and I mean actually useful ones, not padding — they check credit spend/refund doesn’t double-charge, that sessions belong to the right user, that a draft can be approved/discarded correctly, that the SSE streaming doesn’t choke.
Database’s Supabase Postgres, but I talk to it directly over PostgREST instead of dragging in an ORM. Auth is Google OAuth through Supabase JWTs, checked server-side on every request. Row-level security is on for every user table, though honestly the backend itself always uses the service-role key anyway, because billing logic needs to see across users — that’s a documented tradeoff, not an oversight.
Payments go through Razorpay. Hosted checkout, webhook signature verified, credits added atomically through a Postgres function so a half-failed generation can’t just eat someone’s credits.
the agent part isn’t some custom LLM loop I wrote
Honestly this is the part people assume is hand-rolled and it’s not. “Tensor” runs on Nous Research’s Hermes agent framework — one gateway process per user, talking to my backend over HTTP and SSE. I exposed generation as an MCP server (Model Context Protocol) — basically a typed toolbox (generate_image, generate_video, generate_audio, attach a reference image, pick a Soul identity) and the agent decides when to actually call which tool.
Flow’s roughly: user asks for something → Hermes decides to call a tool → that creates a draft, not a real job yet → shows up as an approval card in the UI → only once you approve does it actually submit and spend credits.
That draft-first thing was deliberate. An agent that can spend your money needs a checkpoint before it does — otherwise you either burn credits on something it misunderstood, or it generates stuff you never wanted in the first place. So nothing fires until you say go.
talking to Higgsfield’s real API
TensorCraft Studio doesn’t use Higgsfield’s official paid API. It talks to the same internal backend their own app and CLI use — through a device-authorization flow, same as if you were logging into their real client. Reason being, their official Go CLI just doesn’t run where I deploy this (broken DNS resolver on a CGO_ENABLED=0 build), so I had to reimplement the whole auth + job submission flow myself in Python, after mapping out the real endpoints and response formats across a few hundred real jobs. That gets me around 80 real models — image, video, audio, 3D — plus their “Soul” feature, which lets you keep a trained face reference and reuse it.
where it actually runs — the part everyone asks about first
Frontend’s just a normal static Vercel deploy, nothing interesting there. The backend is the interesting part: it runs on an actual Android phone. Termux, termux-wake-lock so it doesn’t sleep, Termux:Boot so it comes back after a reboot, and it’s only reachable through an outbound Cloudflare Tunnel — no open ports, ever. Everything that actually needs to survive — database, auth, files, payments — lives in the cloud through Supabase/Razorpay/Higgsfield. The phone just does compute. It’s a scrappy way to run something real without paying for a server, and so far it just… hasn’t gone down.
what’s actually shipped
- Chat generation that remembers you across sessions, not just within one conversation
- Structured Studio UI where the parameter controls are pulled live from Higgsfield’s actual model list, not hardcoded by me
- Draft-then-approve on every single generation, even multiple drafts in one message
- Reference image/video attachment with real validation per model (start frame vs end frame vs merge)
- Multi-shot video planning — since there’s no stitching layer, the agent just chains clips using the last frame as the next one’s start
- Full credit system, Razorpay checkout, atomic spend/refund
- Asset gallery, and you can reuse a past generation as a new reference
- A workaround for Instagram/TikTok/Facebook’s in-app browser blocking Google login (Android intent-escape, manual steps on iOS, magic-link fallback through Supabase)
what’s not done, and I’d rather just say so
- Audio generation exists in the code but you can’t actually use it. The tool’s wired up, the models are there, but there’s no pricing entry for them, so the backend refuses to draft it rather than risk giving something away for free. There’s literally a test for this refusal path. It’s real code, just not a real feature yet.
- About 20 utility models are turned off on purpose — upscaling, background removal, image-to-3D, dubbing. Not bugs, just not ready to expose.
- Two video models are just broken on Higgsfield’s end, not mine — one hangs forever, one fails with zero useful error.
- There’s no visual canvas/workflow builder, and honestly that’s probably the feature that would make this actually sellable. I looked at doing something ComfyUI-style and decided it was too much backend work for where things are right now.
- This whole setup assumes one phone. Rate limiting, concurrency caps, the file lock protecting token refresh — all of it breaks the second I add a second device. That’s the real wall if I ever want to scale this past one phone.
so, basically
TensorCraft Studio is a proof of concept: billed, tested, and security-checked, but still one person’s side project running on a phone. The hardest part wasn’t the AI generation itself — it was making the agent, the billing, and a reverse-engineered API agree on what actually happened, every time, on a device that could lose power at any second.
Tech Stack: React 19, TypeScript, Vite, Tailwind CSS, FastAPI, Supabase (Postgres + Auth), Razorpay, Nous Research Hermes, MCP, Cloudflare Tunnel, Termux
If you’re curious about the phone-as-a-server thing or building something similar, reach out.