Generate 3D models from natural language descriptions using AI.
- Text to 3D: Describe any object and generate a 3D model using Meshy 6
- Interactive Viewer: Rotate, zoom, and inspect models in the browser
- Export Formats: Download as GLB, STL (for 3D printing), FBX, OBJ
- Model Gallery: Browse and manage your generated models
- Precise CAD Parts: Generate dimensionally accurate engineering components
- Natural Language Input: "90 degree pipe elbow, 25mm diameter, 2mm wall thickness"
- Template-Based: Fast generation for common parts (pipes, brackets, flanges, boxes)
- LLM-Powered: Generate any arbitrary shape using GPT-4/Claude + CadQuery
- Export Formats: STL, STEP (for professional CAD software), GLB
- Auto Thumbnails: Preview images generated for gallery display
- Code Inspection: View generated CadQuery code for LLM-generated models
The app features a modern dark UI with:
- Prompt input for natural language descriptions
- Real-time progress tracking
- Interactive 3D model viewer
- Thumbnail gallery of generated models
-
Clone the repository
git clone https://github.com/yourusername/3d-gpt.git cd 3d-gpt -
Set up the backend
cd backend python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt # Configure environment cp .env.example .env # Edit .env and add your MESHY_API_KEY
-
Set up the frontend
cd frontend npm install
Terminal 1 - Backend:
cd backend
source venv/bin/activate
uvicorn app.main:app --reloadTerminal 2 - Frontend:
cd frontend
npm run devOpen http://localhost:3000 in your browser.
Create backend/.env:
# Provider: "meshy" or "tripo"
PROVIDER=meshy
# Meshy AI (requires Pro plan)
MESHY_API_KEY=your_api_key_here
# Tripo3D (alternative)
TRIPO_API_KEY=your_api_key_here
# LLM for arbitrary CAD shapes (optional - at least one for LLM generation)
OPENAI_API_KEY=your_openai_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here
CAD_LLM_PROVIDER=openai # or "anthropic"
CAD_LLM_MODEL=gpt-4o # or "claude-sonnet-4-20250514"
# Database
DATABASE_URL=sqlite+aiosqlite:///./3dgpt.dbTo use Tripo3D instead of Meshy:
- Get an API key from https://platform.tripo3d.ai/
- Set
PROVIDER=tripoin.env - Add your
TRIPO_API_KEY - Restart the backend
| Endpoint | Method | Description |
|---|---|---|
/api/generate |
POST | Start 3D generation |
/api/task/{id} |
GET | Get task status |
/api/models |
GET | List all models |
/api/models/{id} |
DELETE | Delete a model |
/api/models/{task_id}/file/{type} |
GET | Download model file |
| Endpoint | Method | Description |
|---|---|---|
/api/cad/generate |
POST | Generate engineering part |
/api/cad/parse |
POST | Parse prompt to parameters |
/api/cad/parts |
GET | List supported part types |
/api/cad/download/{filename} |
GET | Download CAD file |
/api/cad/thumbnail/{filename} |
GET | Get thumbnail image |
curl -X POST http://localhost:8000/api/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "a cute cartoon robot"}'curl -X POST http://localhost:8000/api/cad/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "90 degree pipe elbow, 25mm diameter, 2mm wall", "export_format": "stl"}'curl -X POST http://localhost:8000/api/cad/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "hexagonal prism 30mm across, 20mm tall", "export_format": "stl"}'
# Force LLM generation for any prompt
curl -X POST http://localhost:8000/api/cad/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "mounting plate 80x60mm with 4 corner holes", "export_format": "stl", "use_llm": true}'Backend:
- FastAPI - REST API
- SQLAlchemy - Database ORM
- httpx - Async HTTP client
- trimesh - 3D mesh processing
- CadQuery - Parametric CAD generation
- matplotlib - Thumbnail rendering
Frontend:
- React 18 + TypeScript
- Three.js + @react-three/fiber (GLB & STL support)
- Tailwind CSS
- Vite
3d-gpt/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI app
│ │ ├── config.py # Settings
│ │ ├── routers/ # API endpoints
│ │ ├── services/ # Meshy/Tripo clients
│ │ └── models/ # Database & schemas
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API client
│ │ └── types/ # TypeScript types
│ └── package.json
└── README.md
MIT License - see LICENSE file for details.