v3.9.1 | Changelog | Roadmap | Deployment Guide
A text-to-3D model generator powered by a multi-agent AI pipeline. Converts natural language descriptions into printable OpenSCAD code using Google Gemini (Planner) and Anthropic Claude (Coder).
Now available as a SaaS with user authentication, subscription tiers, and usage tracking.
π Live at polygen.ceradonsystems.com β try 2 free generations without signing up!
# 1. Clone and install
git clone https://github.com/nbschultz97/polygen-ai.git
cd polygen-ai && pnpm install
# 2. Configure API keys (minimum: Gemini + Anthropic)
cp .env.example .env.local
# Edit .env.local β set GEMINI_API_KEY and ANTHROPIC_API_KEY
# 3. Start dev server
pnpm dev
# 4. Open http://localhost:5173 β use "Try Demo" for anonymous mode
# (Supabase/Stripe are optional β auth features gracefully degrade)No API keys? The app loads but generation requires at least Gemini + Anthropic keys. See
.env.examplefor details.
- Natural Language Input - Describe what you want to create in plain English
- Image-to-3D - Upload a photo and recreate it as a printable model
- STL Remix - Upload an existing STL and generate parametric modifications around it
- OpenSCAD Code Generation - Outputs parametric, printable-ready pure OpenSCAD code
- Preview/Render Split - Fast preview for iteration, full Manifold render for verified export
- In-App 3D Preview - View your model in the browser with Three.js
- Visual Critic - Auto-triggers AI vision analysis on renders to catch structural issues
- Parametric GST Templates - Pre-built tactical templates for complex assemblies (Picatinny, MOLLE)
- STL Export - Download STL files after verified render
- Closed-Loop Validation - 3-attempt retry system with escalating guidance
- Error Categorization - Parses errors into 7 categories with suggested fixes
- Pitfall Database - 12 common OpenSCAD mistakes with bad/good examples
- Auto-Preprocessing - Injects epsilon and $fn if missing
- Manifold Checking - Detects open edges and non-manifold geometry
- Teaching Mode - Educational comments explain OpenSCAD concepts
- Planner Agent (Gemini 3 Pro) - Generates Geometric Structure Tree (GST) from natural language
- Coder Agent (Claude Sonnet) - Converts GST to pure OpenSCAD code
- Browser Validation - WASM-based OpenSCAD compilation (fully serverless)
- Smart Quick Fixes - Context-aware refinement suggestions based on GST component types
- Symbolic Correction - Edit requests preserve component relationships
- User Authentication - Email/password and Google OAuth via Supabase
- Subscription Tiers - Free, Pro ($19/mo), Enterprise ($99/mo)
- Usage Tracking - Generation limits enforced per tier
- Stripe Payments - Secure checkout and subscription management
- Analytics Dashboard - Track your usage, manage subscription
- Referral System - Earn bonus generations by referring friends
- Design Templates - 9 quick-start templates for common objects
- Clarification Questions - AI asks follow-up questions with clickable suggested answers
- User Preferences - Save your printer settings, tolerances, and material preferences
- Onboarding Tour - Guided introduction for new users
- Export Options - Copy code, download
.scadfiles, or open directly in OpenSCAD
| Plan | Price | Generations | Features |
|---|---|---|---|
| Free | $0 | 5/month | Basic templates, OpenSCAD export |
| Pro | $19/month | 100/month | All templates, STL export, 3D preview, priority support |
| Enterprise | $99/month | Unlimited | + API access, team features |
User Prompt β [Planner/Gemini] β GST JSON β [Coder/Claude] β OpenSCAD β [Validator/WASM] β 3D Model
β β
Clarification Retry with errors
Questions (max 3 attempts)
Geometric Structure Tree (GST): An intermediate JSON representation that captures the semantic structure of the model (components, parameters, anchors, boolean operations) before code generation.
Prerequisites: Node.js 20+
-
Clone the repository:
git clone https://github.com/nbschultz97/polygen-ai.git cd polygen-ai -
Install dependencies:
npm install
-
Copy the environment template:
cp .env.example .env.local
-
Fill in your API keys in
.env.local:# AI APIs (Required) GEMINI_API_KEY=your_gemini_key ANTHROPIC_API_KEY=your_claude_key USE_MULTI_AGENT=true # Supabase (Required for auth) VITE_SUPABASE_URL=https://your-project.supabase.co VITE_SUPABASE_ANON_KEY=your_anon_key # Stripe (Required for payments) STRIPE_SECRET_KEY=sk_live_xxx VITE_STRIPE_PRO_MONTHLY_PRICE_ID=price_xxx
-
Run the app:
npm run dev
-
Open http://localhost:5173 in your browser
See DEPLOYMENT.md for complete deployment instructions including:
- Supabase setup and database schema
- Stripe configuration and webhook setup
- Vercel deployment with environment variables
- Custom domain configuration
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY |
(required) | Google AI API key for Planner agent |
GEMINI_MODEL |
gemini-3-pro-preview |
Gemini model variant |
THINKING_LEVEL |
high |
Reasoning depth: low, medium, high |
ANTHROPIC_API_KEY |
(optional) | Claude API key for Coder agent |
USE_MULTI_AGENT |
false |
Enable PlannerβCoderβValidator pipeline |
| Variable | Description |
|---|---|
VITE_SUPABASE_URL |
Supabase project URL |
VITE_SUPABASE_ANON_KEY |
Supabase anonymous key |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role key (server-side) |
STRIPE_SECRET_KEY |
Stripe secret key |
STRIPE_WEBHOOK_SECRET |
Stripe webhook signing secret |
VITE_STRIPE_*_PRICE_ID |
Stripe price IDs for each plan |
VITE_GA_MEASUREMENT_ID |
Google Analytics 4 ID (optional) |
- Frontend: React 19 + TypeScript + Vite 7 + Tailwind CSS
- 3D Rendering: Three.js + OpenSCAD WASM
- AI: Google Gemini API (Planner) + Anthropic Claude API (Coder)
- Auth: Supabase Auth with Google OAuth
- Payments: Stripe Subscriptions
- Hosting: Vercel (recommended)
- Analytics: Google Analytics 4
polygen-ai/
βββ components/ # React components
β βββ AuthContext.tsx # Authentication state
β βββ LandingPage.tsx # Marketing homepage
β βββ MainApp.tsx # Authenticated app wrapper
β βββ PricingPage.tsx # Subscription plans
β βββ ...
βββ services/ # Business logic
β βββ authService.ts # Supabase auth
β βββ stripeService.ts # Stripe integration
β βββ geminiService.ts # Gemini API
β βββ coderService.ts # Claude API
β βββ errorCategorizer.ts # Error analysis
β βββ ...
βββ api/ # Vercel Edge Functions
β βββ stripe/ # Payment endpoints
βββ supabase/ # Database schemas
βββ marketing/ # Launch materials
βββ seo/ # SEO assets
βββ public/ # Static files
See CONTRIBUTING.md for guidelines.
MIT
Built by Noah Schultz | Powered by Gemini + Claude