If your SaaS customers keep asking to "build a custom app" or "spin up a portal from a prompt", you can build that feature yourself over months, or embed an AI app builder through its API and ship it in weeks. This guide shows how to embed an AI app builder in your SaaS in 2026, step by step, with the real calls of the Totalum App Builder API (read from its documentation on November 10, 2026), what each call costs, how to keep tenants isolated and spend capped, and how the main AI app builder APIs compare.
Updated November 2026. Rewritten around the current Totalum API (launch, agent, publish, domains, credit caps, webhooks), with a dated price table of the APIs you can embed and an FAQ for teams choosing an AI app builder API.

The short answer: to embed an AI app builder in your SaaS, your server calls a builder API that turns a user's prompt into a hosted app, shows the preview in your UI and publishes it on your customer's domain. In 2026 the options are the Totalum API (full apps, credits from $0.07), the v0 API (token-priced, deploys to Vercel), the Lovable API (Business plan, builds via its MCP server), or building your own on E2B sandboxes.
Building this into your product? See the Totalum white-label builder and the API documentation. The API and MCP work on every plan, including Free.
Quick Answer
- What does "embed an AI app builder" mean? Your users describe an app inside your product, and your backend asks a builder API to create, preview and publish it. Your users never leave your product or open an account with the builder.
- Which call starts it? On Totalum,
POST /projects/launchcreates a project and runs the first prompt in one call (2 credits plus the prompt). You poll the agent status, show the preview, send more prompts, then publish (0.5 credits). - How do you keep customers apart? One project per end-user app: each has its own SQL database (development and live), files, secrets, preview, live address and monthly credit caps.
- How do you control cost? Set per-project caps on development and infrastructure spend, listen for the
project.credit_limit.reachedwebhook, and read spend per project from the spending analytics endpoint. - Who owns the app? Every project belongs to your account and is billed to you; pass
ownerEmailso your user becomes the admin of the app they built.
What embedding an AI app builder means in a SaaS
There are two very different things sold under this phrase:
- A chat box that makes throwaway prototypes. Visitors type, get a demo, leave.
- A builder feature your paying customers use to create real apps (portals, booking sites, internal tools, dashboards) that run with their own data, sign-in and payments, under your brand.
This guide is about the second. The reader is a SaaS founder, head of product or agency lead who wants to:
- let customers describe an app in plain language;
- get a working, hosted app per customer, not a code snippet;
- keep the experience under their own brand;
- control what each customer can spend, and bill for it.
That requires an API that does the whole job: generation, hosting, databases, domains, limits and events. A model API alone gives you code; everything around it is yours to build.
AI app builder APIs compared (November 2026)
Prices and plan requirements read on each vendor's pricing or documentation page between November 8 and November 10, 2026.
| Option | What one call gives you | How it is priced | Plan needed | Hosting and data | Who you bill |
|---|---|---|---|---|---|
| Totalum App Builder API | A full app from a prompt: Next.js, its own SQL database, sign-in, file storage, payments, preview and publish | Credits from $0.07 each; launch 2 credits plus the prompt, prompts usually 3 to 50 credits, publish 0.5 | Every plan, including Free | Included, on Cloudflare; custom domain per project on paid plans | Your account; per-project caps |
| v0 API (Vercel) | Chats that generate and iterate on an app, previews in a Vercel Sandbox, deploy to Vercel | Tokens from your v0 credits: v0 Mini $0.20 in / $1.20 out per million tokens, v0 Pro $2 / $10, v0 Max $5 / $25 | v0 plan (Plus $30 per user/month) | Vercel; database and sign-in come from services you connect | Your v0 account |
| Lovable API + MCP | REST API to manage and deploy existing projects and embed a preview; creation and editing go through the Lovable MCP server | Lovable credits | API keys need Business ($50/month) or Enterprise | Lovable Cloud | Your Lovable workspace |
| Build your own (model API + E2B sandboxes) | Whatever you build: you run the agent, the sandbox, the deploy pipeline and the databases | E2B Hobby free with a one-time $100 usage credit; Pro $150/month plus per-second sandbox usage; model tokens on top | n/a | You run it | You |
How to read it: the v0 and Lovable APIs are strong if your customers' apps can live on Vercel or Lovable and you will connect the database and sign-in yourself. Totalum's API is designed for the case where each customer needs a complete app with data, sign-in and payments that you operate under your brand. For deeper dives, see our guides to the v0 API and the Lovable API.
How to embed an AI app builder in your SaaS: 7 steps
The steps below use the Totalum App Builder API. Base URL https://builder-api.totalum.app/api/v1/vcaas, header api-key: tlm_sk_..., JSON responses shaped { errors, data }. Call it from your server only, never from browser or mobile code.
Step 1: Create an API key for your product
In your Totalum account, open API, reveal the key and store it as a server secret. You can create more keys and restrict a key to some projects, which is useful when one product area should only touch its own apps. Keep a credit balance: actions that spend need at least 1 credit.
Step 2: Launch a project when a customer asks for an app
When a customer types "build a booking site for my barbershop" in your product, your backend calls Launch Project. It creates the project and starts the first prompt in one request, with secrets, attachments and credit limits in place before the build starts.
curl -X POST \
-H "api-key: tlm_sk_your_key" \
-H "Content-Type: application/json" \
-d '{"projectId":"barber-bookings","prompt":"Build a booking site for a barbershop with online payments","label":"Barber bookings","ownerEmail":"owner@barbershop.example","creditLimits":{"maxDevelopmentCreditsPerMonth":500}}' \
https://builder-api.totalum.app/api/v1/vcaas/projects/launch
The documented response (trimmed):
{ "errors": null, "data": { "projectId": "barber-bookings", "label": "Barber bookings", "creditLimits": { "maxDevelopmentCreditsPerMonth": 500, "maxInfrastructureCreditsPerMonth": 300 }, "agent": { "started": true, "status": "init", "runId": "run_01k6x8m2c9", "expectedMinutes": 9 }, "engineVersion": "v2" } }
Useful options on the same call: ownerEmail (your customer becomes the app's admin when they sign up with that address), dataResidency: "eu" (data kept in the EU for the project's life), audienceCountry (the database is placed near the app's users), and up to 10 files such as a logo.
Step 3: Show progress, then the preview
Poll Get Agent Status (GET /projects/:projectId/agent/status, free) every 10 to 15 seconds until status is "done", and stream its messages into your UI. The documented example estimates about 9 minutes for a first build. Then read the development preview URL from Get Project and show it in an iframe or a new tab.
Step 4: Let customers keep prompting
Each follow-up ("add a staff calendar", "make the header blue") is a Run AI Agent call (POST /projects/:projectId/agent/start). It is metered by the work the agent does: at least 3 credits, usually 3 to 50, and a run that fails without producing anything is refunded. Every change is saved as a version and deployed to the preview on the development database, so customers can experiment without touching their live app.
Step 5: Publish and connect the customer's domain
When the customer is happy, call Deploy to Production (POST /projects/:projectId/deployments/deploy, 0.5 credits). Publishing takes about 2 to 5 minutes; if a build or migration fails, the agent tries to repair it, and the live site keeps serving the previous version until a publish succeeds. Migrations that would delete live data need explicit confirmation.
Then call Set Custom Domain (PUT /projects/:projectId/domain, 4 credits for the first domain) with the customer's hostname, show them the DNS records returned in dnsRecordsToAdd, and poll until the domain and SSL are active. Custom domains through the API work on any paid plan.
Step 6: Cap and track spend per customer
Every project has two monthly caps: development (the agent and project actions) and infrastructure (what the running app spends on hosting, database, AI, email). Projects created through the API start at 5,000 and 300 credits a month; change them with PATCH /projects/:projectId/credit-limits, or set them at launch.
What happens at the caps is documented precisely: at the infrastructure cap, the app's built-in features (AI, email, uploads) are refused while the site and database keep running; at the cap plus a 10% reserve, only that project is paused. At the development cap, new prompts and paid builder actions are refused. Both lift when you raise the cap or the next month starts.
To bill customers, read GET /api/v1/credits/spending-analytics (daily spend by category and by project, up to 90 days) or the per-project usage endpoint, and charge on your own pricing.
Step 7: React to events with webhooks
Register an account webhook (PUT /webhooks) and your backend receives signed events such as:
| Event | Sent when | What to do with it |
|---|---|---|
agent.prompt.finished |
A prompt finished | Refresh the preview in your UI, notify the customer |
deployment.finished |
A publish ended (success or error) | Show the live URL, or the error and a retry |
project.credit_limit.reached |
A project hit a monthly cap | Prompt the customer to upgrade, or raise the cap |
Payment events from the generated apps need no setup: they reach each app's own /api/webhooks/stripe route automatically, and each app takes Stripe payments into its owner's Stripe account.
Want an architecture review before you build? Read the white-label builder overview, start with the API docs, or book a 30-minute call for an integration review and free credits to test.
Reference architecture
- Your customer types a prompt in your product's builder panel.
- Your frontend sends it to your backend with the customer's session.
- Your backend checks the customer's plan, looks up their
projectId(or launches one), and calls the Totalum API with your server-side key. - Totalum builds the app in an isolated sandbox per project and tests it in a browser before the change reaches the preview.
- Your backend relays progress (polling or the
agent.prompt.finishedwebhook) and stores the preview and live URLs on the customer record. - Your customer sees the app on their own domain and keeps iterating.
If the apps your customers build need to call back into your SaaS, store your API key for them as a project secret (POST /projects/:projectId/secrets). If your own servers need to read an app's data, create a project key (tlm_pk_...) limited to that project and to scopes such as db:read.
A free starting point: the open-source reference builder
You do not have to design the builder UI from scratch. Totalum publishes an open-source reference app builder, totalumlabs/ai-app-builder-open (MIT, Next.js and TypeScript), that runs on this API; the only environment variable it requires is TOTALUM_VCAAS_API_KEY. Fork it, put your brand on it, and replace its screens with your own. Our walkthrough on building your own Lovable-style builder covers it in detail.
Embed an API or build it yourself?
| Dimension | Embed a builder API (Totalum) | Build it yourself (model + sandbox) |
|---|---|---|
| What you build | The panel in your UI, billing, plan checks | The agent loop, sandboxes, deploy pipeline, databases per app, domains, SSL, logs |
| Per-customer isolation | One project per app with its own databases, secrets, caps | Yours to design and test |
| Hosting | Included, on Cloudflare | You run it |
| Cost control | Per-project caps, webhooks, spend analytics | Yours to build |
| Pricing | Credits from $0.07; most reads free | Model tokens plus sandbox time plus hosting |
| When it wins | App building is a feature of your product | App building is your core product and you need full control of the stack |
Our honest reading: build it yourself only if AI app generation is the product you sell and your team can run the infrastructure behind it. If it is a feature inside a larger SaaS, embedding an API is faster and lets your engineers stay on your core product.
Common embed patterns in 2026
- Vertical SaaS with a "build your own tool" feature. An HR, real estate or fitness platform lets customers create portals, forms or booking pages on top of their account.
- Agencies selling client apps under their brand. One account, one project per client, a custom domain per project and a monthly cap per client. See AI app builder for agencies.
- Assistants that build. An in-product assistant answers "build me a dashboard for this" with a published app, not a suggestion.
- Mobile delivery. The same projects can produce Android and iOS builds on paid plans; see how to publish an AI-built app to the App Store and Google Play.
Mistakes to avoid
- Calling the API from the browser. The key is an account key; keep it on your server.
- One project for all customers. Each customer app needs its own project so its data, secrets, domain and caps stay separate.
- No progress UI. A first build takes minutes; stream status so customers do not leave.
- No caps. Set development and infrastructure caps per project from day one.
- Forgetting the owner. Without
ownerEmail, the first person who signs up in an app becomes its admin.
Why embed Totalum
- A complete app per call: Next.js with its own SQL database, sign-in, file storage, email, AI features and Stripe payments, hosted on Cloudflare.
- Built for products that create apps: every project belongs to your account and brand; your users never need a Totalum account.
- Cost controls in the API: per-project monthly caps, a credit-limit webhook, spend analytics per project, operation prices readable from the API, and most reads free.
- Safe changes: a preview and development database separate from live, versions, and live databases restorable to any minute of the last 30 days.
- On every plan: the API and MCP server work on every plan, including Free; credits start at $0.07.
FAQ
What is an AI app builder API?
An API that turns a prompt into a working app and lets you keep changing it by code. With Totalum's App Builder API, one call creates a project and runs the first prompt; others send more prompts, publish, set domains, cap spend and send webhooks.
Which AI app builder has an API?
In 2026, Totalum (full-stack apps from a prompt, every plan), v0 by Vercel (token-priced chats and deploys to Vercel) and Lovable (a REST API on Business and Enterprise plans, with app creation through its MCP server) all offer programmatic access, with different scopes.
How much does it cost to embed an AI app builder?
On Totalum, credits start at $0.07; launching a project costs 2 credits plus the first prompt, prompts usually cost 3 to 50 credits, publishing costs 0.5 credits and the first custom domain 4 credits. Running apps also spend infrastructure credits, which you can cap per project.
Can my customers use it without a Totalum account?
Yes. Every project belongs to your account and runs under your brand. Pass your customer's email as ownerEmail so they become the admin of their app.
How do I stop one customer from running up costs?
Set per-project monthly caps for development and infrastructure (PATCH /projects/:projectId/credit-limits) and listen for the project.credit_limit.reached webhook to offer an upgrade.
Should I use the REST API or the MCP server?
Use the REST API from your backend for everything your product does on behalf of customers. Use the MCP server when an AI agent (Claude, Cursor, Codex) should drive the builder in a conversation.
Can I keep customer data in the EU?
Yes. Create the project with dataResidency: "eu" and its data stays in the EU for the life of the project.
Start embedding
Start with the API docs and a free account: the API works on the Free plan, so you can launch your first project today. When you are ready to put it in front of customers, see the white-label builder, or book a 30-minute call for an integration review.