Open-source platform for deploying isolated AI agent instances in Docker containers with wallet-based authentication and usage billing.
SpawnClaw lets users spawn isolated AI agent instances (powered by OpenClaw) inside Docker containers. Users authenticate via MetaMask wallet, deposit tokens for USD-based balance, then create instances connected to Telegram or WhatsApp.
- Wallet Authentication - MetaMask/Solana wallet login with JWT tokens
- Docker Isolation - Each AI agent runs in its own isolated container
- Multi-chain Deposits - Accept deposits on Base and Solana networks
- OpenRouter Integration - Access Claude, GPT, Llama, Gemini via single API
- Multi-VPS Scaling - Distribute instances across multiple servers
- Telegram/WhatsApp Support - Connect agents to messaging platforms
- Real-time Dashboard - Monitor instances, deposits, and usage
Frontend (Next.js) → Control Plane API → Spawn Agent → Docker Containers (OpenClaw)
| Component | Port | Description |
|---|---|---|
apps/web |
6700 | Landing page with wallet connect |
apps/admin |
6703 | Admin dashboard |
apps/api |
6702 | Control Plane API (auth, billing, orchestration) |
spawn-agent |
4000 | Docker container lifecycle manager |
docker-runtime |
- | Dockerfile + scripts for OpenClaw containers |
| Gateway Range | 18790-18850 | One port per OpenClaw instance |
- Frontend: Next.js 16, React 19, Tailwind CSS, Dynamic.xyz
- Backend: Express.js, PostgreSQL, Drizzle ORM
- Infrastructure: Docker, PM2
- AI: OpenRouter API
- Blockchain: Base, Solana (viem, @solana/web3.js)
- Node.js 22+
- pnpm 9.0+
- Docker (or Colima on macOS)
- PostgreSQL database
- OpenRouter API key(s)
git clone https://github.com/jsonpreet/spawnclaw.git
cd spawnclaw
pnpm installcd docker-runtime
docker build -t spawnclaw-runtime .Create apps/api/.env:
PORT=6702
DATABASE_URL=postgres://user:password@localhost:5432/spawnclaw
SPAWN_AGENT_URL=http://localhost:4000
SPAWN_AGENT_SECRET=your-shared-secret
OPENROUTER_API_KEY=sk-or-v1-xxx
INSTANCE_COST_USD=15Create spawn-agent/.env:
SPAWNCLAW_SECRET=your-shared-secret
PORT=4000
GATEWAY_PORT_START=18790
GATEWAY_PORT_END=18850cd apps/api
npx drizzle-kit push# Terminal 1: Spawn Agent
cd spawn-agent && node index.js
# Terminal 2: API
cd apps/api && node index.js
# Terminal 3: Web App
pnpm dev:webVisit http://localhost:6700 to get started.
spawnclaw/
├── apps/
│ ├── web/ # Landing page (Next.js)
│ ├── admin/ # Admin dashboard (Next.js)
│ └── api/ # Control Plane API (Express)
├── spawn-agent/ # Docker lifecycle manager
├── docker-runtime/ # OpenClaw container image
├── packages/
│ ├── ui/ # Shared UI components
│ ├── lib/ # Shared utilities
│ ├── types/ # TypeScript types
│ └── config/ # Shared configurations
├── docs/ # Documentation
└── scripts/ # Deployment scripts
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
System health check |
| GET | /api/treasury |
Treasury wallet addresses |
| GET | /api/pricing |
Token price & instance cost |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/balance |
User's USD balance |
| POST | /api/deposits/verify |
Verify token deposit |
| POST | /api/instances/create |
Create new instance |
| GET | /api/instances |
List user's instances |
| POST | /api/instances/:id/stop |
Stop an instance |
| Method | Endpoint | Description |
|---|---|---|
| PATCH | /api/admin/users/:id/block |
Block/unblock user |
| GET | /api/compute/providers |
List compute providers |
| GET | /api/compute/capacity |
Pool capacity info |
SpawnClaw supports distributing instances across multiple VPS servers:
Frontend → Control Plane API (1 server)
↓
ComputePool (scheduler)
↙ ↓ ↘
VPS-1 VPS-2 VPS-3
(spawn-agent) (spawn-agent) (spawn-agent)
Configure in apps/api/.env:
DOCKER_PROVIDERS='[
{
"id": "vps-us-1",
"url": "http://167.71.0.1:4000",
"secret": "shared-secret",
"maxInstances": 8,
"priority": 10
},
{
"id": "vps-eu-1",
"url": "http://138.68.0.1:4000",
"secret": "shared-secret",
"maxInstances": 8,
"priority": 5
}
]'
SCHEDULER_STRATEGY=priority_first- Run setup script on Ubuntu 22.04/24.04
- Clone repo to
/opt/spawnclaw - Build Docker runtime image
- Configure environment variables
- Initialize database
- Start services with PM2
cd /opt/spawnclaw/spawn-agent && pm2 start index.js --name spawn-agent
cd /opt/spawnclaw/apps/api && pm2 start index.js --name spawnclaw-api
pm2 save && pm2 startupDeploy apps/web and apps/admin to Vercel:
cd apps/web && vercel --prod
cd apps/admin && vercel --prodSet environment variables in Vercel dashboard:
NEXT_PUBLIC_API_URL- Your API URLNEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID- Dynamic.xyz ID
| Variable | Required | Default | Description |
|---|---|---|---|
PORT |
No | 6702 | API server port |
DATABASE_URL |
Yes | - | PostgreSQL connection string |
SPAWN_AGENT_URL |
No | http://localhost:4000 | Spawn agent URL |
SPAWN_AGENT_SECRET |
Yes | - | Shared secret |
OPENROUTER_API_KEY |
Yes | - | OpenRouter API key |
INSTANCE_COST_USD |
No | 15 | Cost per instance |
INSTANCE_MEMORY |
No | 1g | RAM per container |
TREASURY_BASE |
No | - | Base treasury address |
TOKEN_ADDRESS_BASE |
No | - | Token contract address |
| Variable | Required | Default | Description |
|---|---|---|---|
SPAWNCLAW_SECRET |
Yes | - | Shared secret |
PORT |
No | 4000 | Agent port |
GATEWAY_PORT_START |
No | 18790 | First gateway port |
GATEWAY_PORT_END |
No | 18850 | Last gateway port |
# Install dependencies
pnpm install
# Start all services in dev mode
pnpm dev
# Start specific app
pnpm dev:web
pnpm dev:api
# Build all apps
pnpm build
# Lint code
pnpm lintFor a VPS with 12GB RAM / 6 CPU cores:
| Metric | Value |
|---|---|
| RAM per instance (peak) | ~800MB |
| RAM per instance (steady) | ~300MB |
| Recommended instances | 6-8 |
| Max instances | ~10 |
Key constraint: RAM, not ports. Each instance needs ~1GB allocated.
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: See
/docsfolder for detailed guides - Issues: https://github.com/jsonpreet/spawnclaw/issues
- Discussions: https://github.com/jsonpreet/spawnclaw/discussions
- OpenClaw - The AI agent framework
- OpenRouter - AI model API gateway
- Dynamic.xyz - Wallet authentication
Built with ❤️ by the SpawnClaw team