Host what your models generate
StackMachine is the deploy layer for AI products: sandboxed runtimes, fast cold starts, and a simple SDK your backend calls when ChatGPT or your agent is ready to ship code.
import StackMachine from "stackmachine";
const client = new StackMachine(process.env.STACKMACHINE_API_KEY);
// Called from your OpenAI tool / webhook after the model produces files
const deployment = await client.deployments.create({
appName: "user-site-" + userId,
startCmd: "npm start",
files: generatedFilesFromAgent,
envVars: [
{
name: "OPENAI_API_KEY",
value: process.env.OPENAI_API_KEY ?? "",
sensitive: true,
},
],
});
const version = await deployment.wait({
onProgress: ({ message }) => console.log(message),
});
// Return this URL to the chat thread or tool output
return { url: version.app.url };Who this is for
Teams building on the OpenAI platform and the wider agent ecosystem — not generic “cloud hosting.”
AI-native products
Ship features where users describe an app in chat and get a live URL — without running untrusted code on your API servers.
OpenAI tool backends
Power GPT Actions, custom tools, and Assistants with a deploy endpoint that returns a hosted link in the model response.
Code sandboxes
Replace fragile interpreter VMs with isolated WebAssembly runtimes for Python, Node, and more.
MCP & agent frameworks
Let LangChain, CrewAI, or your own orchestrator call StackMachine when an agent decides to publish a site.
How it fits your stack
OpenAI (or your UI) never talks to StackMachine directly — your trusted backend does, then passes the URL back.
User
Prompts in ChatGPT or your app
Your backend
Calls StackMachine SDK
StackMachine
Builds & hosts in a sandbox
Live URL
Returned to the model / UI
Common OpenAI-era patterns
What teams actually ship when models can write and run code.
Deploy from a prompt
User asks ChatGPT or your copilot to “host this React app.” Your backend calls the SDK and returns stackmachine.app URL in the thread.
Per-user sandboxes
Spin up an isolated environment per conversation or tenant so generated code never shares memory with other customers.
Long-running agents
Keep agent backends warm with ~5 ms restores instead of cold-starting a new container on every tool call.
Secrets for OpenAI
Inject OPENAI_API_KEY and other env vars at deploy time — marked sensitive — so models can call APIs from the hosted runtime.
Why not plain serverless?
Lambda and containers work for your own code. They struggle when every user session might upload new, unreviewed artifacts from a model.
Chat can't wait
Multi-second cold starts feel broken inside GPT threads and in-app copilots. Users expect a link in one turn.
Trust boundaries
Running LLM output on your API host is a security incident waiting to happen. Isolation per deploy is non-negotiable.
Unit economics
One container per sandbox does not scale when 90% of deploys are small static sites or short-lived demos.
Works with your OpenAI & agent stack
Infrastructure for dynamic code
The primitives you need when the artifact changes every session — not just the git repo.
Sandboxed by default
Every deploy runs from an immutable snapshot. Ideal for LLM-generated code you did not review line-by-line.
~5 ms cold starts
Chat UX breaks when deploy takes 30 seconds. StackMachine restores apps fast enough to feel instant in-product.
Dense multi-tenant nodes
Host thousands of small AI-generated apps per machine — better unit economics than one container per user.
Node, Python, PHP, static
Deploy what models actually output: FastAPI services, Next.js exports, WordPress, or static HTML from a single API.
API-first control plane
One API key from your server. No dashboard required for the integration path — though operators get full visibility when they need it.
Public URLs immediately
Return a shareable HTTPS URL to drop into OpenAI messages, Slack, or your product UI.
Ship AI applications on infrastructure designed for dynamic code.
Secure environment with real-world tools for enterprise-grade agents and hosting providers.