# 🚀 Setup API Keys for AI Moderation

## 📋 Quick Setup Instructions

### 1. Update Directus Configuration

The ecosystem config file has been transferred to the server at `/tmp/directus_ecosystem_final.js`.

**Option A: Edit on Server**
```bash
ssh patrick@194.238.28.122
nano /tmp/directus_ecosystem_final.js
# Replace the placeholder keys with your actual keys
```

**Option B: Edit Locally & Transfer**
1. Open `c:\Webs\Sojorn\directus_ecosystem_final.js`
2. Replace these lines:
   ```javascript
   OPENAI_API_KEY: 'sk-YOUR_OPENAI_API_KEY_HERE',      // ← Replace with your key
   GOOGLE_VISION_API_KEY: 'YOUR_GOOGLE_VISION_API_KEY_HERE', // ← Replace with your key
   ```
3. Save and transfer:
   ```bash
   scp "c:\Webs\Sojorn\directus_ecosystem_final.js" patrick@194.238.28.122:/tmp/
   ```

### 2. Apply Configuration

```bash
ssh patrick@194.238.28.122
cp /tmp/directus_ecosystem_final.js /home/patrick/directus/ecosystem.config.js
pm2 restart directus --update-env
```

### 3. Verify Setup

```bash
# Check Directus is running
curl -I https://cms.sojorn.net/admin

# Check API keys are loaded
pm2 logs directus --lines 5
```

## 🔑 Where to Find Your API Keys

### OpenAI API Key
- Go to: https://platform.openai.com/api-keys
- Copy your key (starts with `sk-`)
- Format: `sk-proj-...` or `sk-...`

### Google Vision API Key
- Go to: https://console.cloud.google.com/apis/credentials
- Find your Vision API key
- Format: alphanumeric string

## ✅ Verification

Once configured, you can test the AI moderation:

1. **Access Directus**: https://cms.sojorn.net/admin
2. **Navigate to Collections**: Look for `moderation_flags`
3. **Test Content**: Create a test post with content that should be flagged
4. **Check Results**: Flags should appear in the moderation queue

## 🚨 Important Notes

- **Keep keys secure**: Don't commit them to git
- **Rate limits**: OpenAI has rate limits (60 requests/min for free tier)
- **Billing**: Both services charge per API call
- **Fallback**: System will use keyword detection if APIs fail

## 🎯 Next Steps

After setting up API keys:

1. ✅ Test with sample content
2. ✅ Configure Directus moderation interface
3. ✅ Set up user status management
4. ✅ Monitor API usage and costs

---

**Your AI moderation system is ready to go!** 🚀
