Files
Obsidian-Vault/Personal/Projects/Molt-TrueNAS-Setup.md
2026-01-30 14:48:53 +01:00

200 lines
4.5 KiB
Markdown

# Molt on TrueNAS SCALE Setup Guide
Molt is an open-source personal AI assistant that runs on your own infrastructure with messaging integrations (Telegram, WhatsApp, Discord), browser automation, and system access.
- **Website:** https://www.molt.bot/
- **GitHub:** https://github.com/moltbot/moltbot
- **Docs:** https://docs.molt.bot/
## Prerequisites
- TrueNAS SCALE (has native Docker support)
- API key from a supported AI provider
- Telegram bot token (from @BotFather)
## AI Provider Options
### Price Comparison (per 1M tokens)
| Provider | Model | Input | Output | Notes |
|----------|-------|-------|--------|-------|
| **Z.AI** | GLM-4.7-FlashX | $0.07 | $0.40 | Cheapest capable model |
| **Z.AI** | GLM-4.7 | $0.60 | $2.20 | Full flagship model |
| **Z.AI** | GLM-4.5-Air | $0.20 | $1.10 | Good balance |
| **NanoGPT** | Various | varies | varies | 200+ models, pay-as-you-go |
| **Anthropic** | Claude Sonnet 4 | $3.00 | $15.00 | Best quality, most expensive |
### Recommended: Z.AI
Z.AI (formerly Zhipu) is directly supported by Molt and 10-40x cheaper than Anthropic.
- Get API key at: https://open.bigmodel.cn/ or https://z.ai
- GLM-4.7 has 200K context window
- Designed for coding/agent workflows
### Alternative: Anthropic
If you need highest quality:
- Get API key at: https://console.anthropic.com
- Note: Claude Code subscription does NOT provide API access - you need separate API billing
### Alternative: NanoGPT
Pay-as-you-go aggregator with 200+ models:
- Website: https://nano-gpt.com
- Requires custom OpenAI-compatible endpoint configuration
## Step 1: Create Telegram Bot
1. Open Telegram and search for **@BotFather**
2. Send `/newbot`
3. Choose a display name (e.g., "My Molt Assistant")
4. Choose a username (must end in `bot`, e.g., `my_molt_bot`)
5. Save the token BotFather provides
## Step 2: Deploy on TrueNAS SCALE
### SSH into TrueNAS
```bash
ssh admin@your-truenas-ip
```
### Create Dataset and Clone Repository
```bash
# Create a dataset via TrueNAS UI first, then:
mkdir -p /mnt/your-pool/apps/moltbot
cd /mnt/your-pool/apps/moltbot
# Clone the repository
git clone https://github.com/moltbot/moltbot.git .
```
### Configure Environment
```bash
# Create .env file with your credentials
cat > .env << 'EOF'
# Choose ONE of these AI providers:
Z_AI_API_KEY=your-z-ai-key-here
# ANTHROPIC_API_KEY=your-anthropic-key-here
# Telegram
TELEGRAM_BOT_TOKEN=your-telegram-bot-token-here
EOF
```
### Run Setup
```bash
# Optional: Mount additional directories
export CLAWDBOT_HOME_VOLUME="moltbot_home"
export CLAWDBOT_EXTRA_MOUNTS="/mnt/your-pool/documents:/home/node/documents:rw"
# Run the setup script
./docker-setup.sh
```
### Configure Molt
Create or edit `~/.clawdbot/moltbot.json`:
```json
{
"agent": {
"model": "z-ai/glm-4.7-flashx"
},
"channels": {
"telegram": {
"enabled": true,
"dmPolicy": "pairing"
}
}
}
```
For Anthropic instead:
```json
{
"agent": {
"model": "anthropic/claude-sonnet-4-20250514"
}
}
```
### Start the Gateway
```bash
docker compose up -d moltbot-gateway
```
## Step 3: Pair Telegram
1. Open Telegram and message your bot
2. You'll receive a pairing code
3. Approve it via CLI:
```bash
docker compose run --rm moltbot-cli pairing approve telegram <CODE>
```
## Step 4: Verify
Access the Control UI at: `http://your-truenas-ip:18789/`
Check gateway health:
```bash
docker compose exec moltbot-gateway node dist/index.js health --token "$CLAWDBOT_GATEWAY_TOKEN"
```
## Management Commands
```bash
# View logs
docker compose logs -f moltbot-gateway
# Restart
docker compose restart moltbot-gateway
# Stop
docker compose down
# Update
git pull
docker compose build
docker compose up -d
```
## Features
Once running, Molt can:
- Respond via Telegram DMs and group chats
- Execute shell commands on your TrueNAS
- Browse the web and fill forms
- Manage files on mounted volumes
- Set reminders and run scheduled tasks
- Learn your preferences over time
## Troubleshooting
### Bot not responding
- Check logs: `docker compose logs moltbot-gateway`
- Verify Telegram token is correct
- Ensure pairing was approved
### API errors
- Verify API key is set in `.env`
- Check provider account has credits/billing enabled
### Permission issues
- Ensure Docker has access to mounted paths
- Check file ownership in mounted volumes
## Resources
- [Molt Docker Docs](https://docs.molt.bot/install/docker)
- [Telegram Channel Setup](https://docs.molt.bot/channels/telegram)
- [Z.AI Pricing](https://docs.z.ai/guides/overview/pricing)
- [NanoGPT](https://nano-gpt.com)