ai administration - nself-org/nchat GitHub Wiki
Version: 1.0.0 (v0.7.0) Last Updated: January 31, 2026 Target Audience: System Administrators, DevOps Engineers, AI Platform Managers
A comprehensive guide to administering AI features in nself-chat, including usage monitoring, cost management, provider configuration, rate limiting, and troubleshooting.
- Dashboard Overview
- Usage Monitoring
- Cost Management
- Provider Configuration
- Rate Limiting
- Embedding Management
- Bot Management
- Moderation Settings
- Troubleshooting
The AI Administration Dashboard provides a unified view of all AI-related metrics and controls.
Navigation:
- Sign in as an admin user
- Go to Admin Panel (gear icon in sidebar)
- Click AI Management in the left menu
- Select Dashboard tab
Dashboard URL: /admin/ai/dashboard
The dashboard displays real-time metrics across four main areas:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฐ Total Cost โ
โ $234.56 โ
โ โ
โ โโโโโโโโโโโโโโโโ 78% of budget โ
โ $65.44 remaining โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Metrics:
- Total Cost: Current spending for selected period (daily/monthly)
- Budget Progress: Visual progress bar showing budget utilization
- Remaining Budget: How much you have left before hitting limits
- Budget Status: Color-coded indicator (green/yellow/red)
Color Codes:
- ๐ข Green (0-70%): Healthy spending
- ๐ก Yellow (71-90%): Approaching limit
- ๐ด Red (91-100%): Near or over budget
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Total Requests โ
โ 12,458 โ
โ โ
โ Avg: $0.0188 per request โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Metrics:
- Total Requests: Number of AI API calls made
- Average Cost: Cost per request calculation
- Trend: Up/down arrow showing change vs previous period
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โก Cache Hit Rate โ
โ 87.3% โ
โ โ
โ 10,879 hits ยท 1,579 misses โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Metrics:
- Hit Rate: Percentage of requests served from cache
- Total Hits: Number of cached responses used
- Total Misses: Number of requests that required API calls
- Cache Savings: Estimated cost savings from caching
Target Hit Rate: 80%+ is excellent, 60-80% is good, <60% needs optimization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โฑ๏ธ Queue Status โ
โ 47 โ
โ โ
โ 12 processing ยท 35 pending โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Metrics:
- Total Queued: Items waiting or being processed
- Processing: Currently active jobs
- Pending: Waiting in queue
- Failed: Recent failures requiring attention
Toggle between reporting periods:
[ Today ] [ This Month ]
- Today: Shows metrics since midnight (resets daily)
- This Month: Shows metrics since the 1st of the current month
Auto-refresh: Dashboard refreshes every 30 seconds automatically
Three primary action buttons in the header:
- ๐ Refresh: Manually refresh all data immediately
- ๐ฅ Export: Download current data as CSV or JSON
- โ๏ธ Settings: Quick access to AI configuration
Track which AI features consume the most API calls and budget.
View: Dashboard โ By Endpoint tab
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Requests by Endpoint โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ Summarization โโโโโโโโโโโโ 5,234 (42%) โ โ
โ โ Search โโโโโโโโ 3,456 (28%) โ โ
โ โ Embeddings โโโโโโ 2,345 (19%) โ โ
โ โ Chat โโโ 1,234 (10%) โ โ
โ โ Moderation โ 189 (1%) โ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint Breakdown:
| Endpoint | Requests | % of Total | Avg Cost | Total Cost |
|---|---|---|---|---|
/ai/summarize |
5,234 | 42% | $0.0234 | $122.47 |
/search |
3,456 | 28% | $0.0015 | $5.18 |
/ai/embed |
2,345 | 19% | $0.0002 | $0.47 |
/ai/chat |
1,234 | 10% | $0.0456 | $56.27 |
/moderation/analyze |
189 | 1% | $0.0123 | $2.32 |
Actions:
- Click any endpoint to see detailed breakdown
- Export endpoint data for analysis
- Configure rate limits per endpoint
Identify top AI users to understand usage patterns and potential optimization opportunities.
View: Dashboard โ Top Users tab
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Rank User Requests Cost % of Total โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1 sarah@example 1,847 $89.23 38.0% โโโโโโโโ โ
โ 2 mike@example 1,234 $56.78 24.2% โโโโโโ โ
โ 3 alex@example 891 $34.12 14.5% โโโโ โ
โ 4 emma@example 567 $23.45 10.0% โโโ โ
โ 5 david@example 423 $18.90 8.1% โโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Columns Explained:
- Rank: Position by cost (1 = highest spender)
- User: User email or username
- Requests: Total API calls made by this user
- Cost: Total spending attributed to this user
- % of Total: Percentage of total AI budget consumed
- Visual Bar: Quick visual comparison
Filtering Options:
- Filter by date range (last 7 days, 30 days, all time)
- Filter by feature (summarization only, search only, etc.)
- Filter by organization (for multi-tenant setups)
Use Cases:
- Power User Identification: Find users who heavily rely on AI features
- Training Opportunities: Identify users who might benefit from efficiency training
- Budget Allocation: Understand if costs are concentrated or distributed
- Abuse Detection: Spot unusual usage patterns that might indicate misuse
Actions:
- Click user to see detailed activity log
- Set per-user rate limits
- Send usage reports to users
- Configure usage alerts
Understand when AI features are most heavily used to optimize capacity and costs.
View: Dashboard โ Usage Trends tab
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Requests per Hour (Last 24 Hours) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 800 โ โ
โ โ 600 โโ โ โ
โ โ 400 โโโโโโ โ โ
โ โ 200 โโโโโโโโโโ โ โ
โ โ 0โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ 00 02 04 06 08 10 12 14 16 18 20 22 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Insights:
- Peak Hours: Typically 9 AM - 11 AM and 2 PM - 4 PM (work hours)
- Low Usage: Nights and weekends
- Patterns: Identify daily/weekly patterns
Cost Optimization Opportunities:
- Off-Peak Processing: Schedule bulk operations during low-usage hours
- Cache Pre-warming: Warm caches before peak hours
- Capacity Planning: Scale resources based on predicted demand
- Budget Pacing: Monitor real-time spending vs expected daily budget
Weekly Usage Pattern:
Monday โโโโโโโโโโโโ 2,345 requests
Tuesday โโโโโโโโโโโโ 2,123 requests
Wednesday โโโโโโโโโโโโ 2,401 requests
Thursday โโโโโโโโโโโโ 2,234 requests
Friday โโโโโโโโโโโโ 1,956 requests
Saturday โโโโโโโโโโโโ 567 requests
Sunday โโโโโโโโโโโโ 423 requests
Typical Patterns:
- Weekdays: Consistent high usage (2,000-2,500 requests/day)
- Weekends: 70-80% reduction in usage
- Monday Peak: Often highest due to catch-up activities
Live Feed: /admin/ai/monitoring/live
View AI requests in real-time as they happen:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Live AI Request Feed โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 14:23:45 sarah@example /ai/summarize $0.0234 โ
โ 14:23:43 mike@example /search $0.0015 โ
โ 14:23:41 alex@example /ai/embed $0.0002 โ
โ 14:23:39 emma@example /ai/chat $0.0456 โ
โ 14:23:37 david@example /ai/summarize $0.0234 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Features:
- Auto-updating (1-second refresh)
- Color-coded by endpoint
- Click to see full request details
- Filter by user, endpoint, or time range
- Pause/resume feed
- Export recent activity
Use Cases:
- Debug user-reported issues in real-time
- Monitor system health during deployments
- Observe effects of configuration changes
- Detect anomalies or spikes
The cost tracking system provides accurate, up-to-the-minute spending information.
Formula:
Total Cost = (Input Tokens / 1000) ร Input Price + (Output Tokens / 1000) ร Output Price
Example (GPT-4o-mini):
Request:
- Input: 2,345 tokens ร $0.00015/1k = $0.00035
- Output: 567 tokens ร $0.0006/1k = $0.00034
- Total: $0.00069
Current Model Pricing (as of January 2026):
| Model | Provider | Input ($/1k) | Output ($/1k) | Typical Use |
|---|---|---|---|---|
| GPT-4o-mini | OpenAI | $0.00015 | $0.0006 | Summarization, chat |
| GPT-4o | OpenAI | $0.005 | $0.015 | Complex reasoning |
| GPT-4 Turbo | OpenAI | $0.01 | $0.03 | High-quality summaries |
| Claude 3.5 Haiku | Anthropic | $0.0008 | $0.004 | Fast responses |
| Claude 3.5 Sonnet | Anthropic | $0.003 | $0.015 | Balanced performance |
| text-embedding-3-small | OpenAI | $0.00002 | $0 | Embeddings (default) |
Cost Tracking Features:
- Per-Request Tracking: Every API call is logged with exact token usage
- User Attribution: Costs are attributed to the requesting user
- Organization Rollup: Multi-tenant setups track per-organization costs
- Model Breakdown: See which models cost the most
- Historical Data: 90-day retention for trend analysis
Configure automatic alerts to prevent unexpected cost overruns.
Navigation: Admin Panel โ AI Configuration โ Budgets tab
Step-by-step:
-
Click "Create Budget Alert"
-
Configure Alert Settings:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Create Budget Alert โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Alert Name: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Production Daily Budget โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Budget Limit: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ $ 100.00 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Period: * โ
โ โ Daily โ Weekly โ Monthly โ
โ โ
โ Alert Thresholds: โ
โ โ 50% โ 75% โ 90% โ 100% โ
โ โ
โ Notification Recipients: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ [email protected], [email protected] โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Notification Methods: โ
โ โ Email โ Slack โ Webhook โ
โ โ
โ [ Cancel ] [ Create Alert ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Configure Notification Settings:
Email Template:
Subject: [nself-chat] AI Budget Alert - 75% Threshold Reached
Your AI spending has reached 75% of the daily budget.
Current Spending: $75.00
Daily Limit: $100.00
Remaining: $25.00
Time Left: 8 hours 23 minutes
Top Consumers:
1. [email protected] - $28.50 (38%)
2. [email protected] - $19.75 (26%)
3. [email protected] - $12.25 (16%)
View Details: https://your-instance.com/admin/ai/dashboard
Slack Notification:
โ ๏ธ AI Budget Alert - 75% Threshold Reached
Current: $75.00 / $100.00 (75%)
Remaining: $25.00
Top consumers:
โข [email protected] - $28.50 (38%)
โข [email protected] - $19.75 (26%)
[View Dashboard]
Alert Types:
- Global Budget: Workspace-wide spending limit
- Per-User Budget: Individual user spending caps
- Per-Org Budget: Organization-level limits (multi-tenant)
- Per-Feature Budget: Limit spending per AI feature
Alert Actions:
- Notify Only: Send alert but continue service
- Throttle: Reduce rate limits when threshold reached
- Suspend: Temporarily disable AI features at 100%
- Fallback: Switch to cheaper models (e.g., GPT-4o โ GPT-4o-mini)
Best Practices:
โ Do:
- Set multiple thresholds (50%, 75%, 90%, 100%)
- Include multiple notification recipients
- Test alerts before going live
- Review and adjust monthly based on usage
- Set both daily and monthly budgets
โ Avoid:
- Setting limits too low (causes service disruption)
- Only alerting at 100% (no time to respond)
- Ignoring repeated alerts (indicates need for adjustment)
- Setting budgets without baseline data
Recommendation: Use the cheapest model that meets quality requirements.
Model Tier Guide:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Task Complexity Recommended Model โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Simple summarization โ GPT-4o-mini โ
โ Search embeddings โ text-embedding-3-small โ
โ Chat responses โ Claude 3.5 Haiku โ
โ Complex analysis โ GPT-4o โ
โ High-quality content โ Claude 3.5 Sonnet โ
โ Critical accuracy โ GPT-4 Turbo โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Cost Comparison (1,000 requests, 1,000 tokens each):
| Model | Input Cost | Output Cost | Total Cost | vs GPT-4o-mini |
|---|---|---|---|---|
| GPT-4o-mini | $0.15 | $0.60 | $0.75 | 1x (baseline) |
| Claude 3.5 Haiku | $0.80 | $4.00 | $4.80 | 6.4x |
| GPT-4o | $5.00 | $15.00 | $20.00 | 26.7x |
| GPT-4 Turbo | $10.00 | $30.00 | $40.00 | 53.3x |
Optimization Strategy:
- Start with GPT-4o-mini for all features
- Monitor quality metrics
- Upgrade specific features if quality is insufficient
- A/B test to validate quality improvements justify cost increases
Cache Effectiveness:
- 80% hit rate = 80% cost reduction for cached requests
- Embedding cache saves 100% of embedding API costs on cache hits
Cache Configuration: Admin Panel โ AI Configuration โ Cache tab
Recommended TTL (Time-To-Live) Settings:
| Feature | Recommended TTL | Reasoning |
|---|---|---|
| Summarization | 1 hour | Conversations change frequently |
| Search Results | 5 minutes | Balance freshness vs cost |
| Embeddings | 24 hours | Message content is immutable |
| Chat Responses | Disabled | Each conversation is unique |
Cache Tuning:
// Increase cache TTL for stable content
{
summarizationTtl: 3600, // 1 hour
searchTtl: 300, // 5 minutes
embeddingsTtl: 86400, // 24 hours
chatTtl: 0 // Disabled
}Monitoring Cache Performance:
- Target: 80%+ hit rate for embeddings
- Target: 60%+ hit rate for summarization
- Target: 40%+ hit rate for search
Improving Hit Rate:
- Increase TTL values
- Normalize cache keys (e.g., lowercase, trim whitespace)
- Use semantic similarity for near-match caching
- Pre-populate cache for common queries
Process multiple items in a single API call to reduce overhead.
Example - Batch Embedding Generation:
// โ Bad: Individual requests (100 API calls)
for (const message of messages) {
await generateEmbedding(message)
}
// โ
Good: Batch request (1 API call)
await generateEmbeddings(messages)Cost Savings:
- Individual: 100 requests ร $0.0002 = $0.02
- Batch: 1 request ร $0.0002 = $0.0002
- Savings: 99%
Batch Processing Features:
-
Bulk Embedding Generation:
/admin/ai/embeddings/generate-bulk - Scheduled Digest Jobs: Process summaries off-peak
- Async Processing: Queue low-priority tasks
Balance user experience with cost control.
Per-User Limits (Recommended):
{
summarization: {
maxRequests: 50, // 50 requests per hour
windowMs: 3600000 // 1 hour window
},
search: {
maxRequests: 20, // 20 searches per minute
windowMs: 60000 // 1 minute window
},
chat: {
maxRequests: 10, // 10 chats per minute
windowMs: 60000 // 1 minute window
}
}Progressive Rate Limiting:
Free Tier: 10 requests/hour
Standard: 50 requests/hour
Premium: 200 requests/hour
Enterprise: Unlimited
Automatically downgrade to cheaper models on rate limits or budget exhaustion.
Configuration:
{
openai: {
defaultModel: 'gpt-4o',
fallbackModel: 'gpt-4o-mini', // 26x cheaper
maxRetries: 3
},
anthropic: {
defaultModel: 'claude-3-5-sonnet-20241022',
fallbackModel: 'claude-3-5-haiku-20241022', // 6x cheaper
maxRetries: 3
}
}Fallback Triggers:
- Rate limit exceeded โ Try fallback model
- Budget threshold (90%) โ Switch to fallback automatically
- API error (500-series) โ Retry with fallback
- Timeout โ Use faster fallback model
Cost Impact Example:
- 1,000 requests normally on GPT-4o = $20.00
- 200 fallback to GPT-4o-mini = $0.15
- Total: $16.15 (19% savings)
Configure OpenAI as your primary AI provider for summarization and embeddings.
Navigation: Admin Panel โ AI Configuration โ Providers tab โ OpenAI
1. Obtain API Key:
- Go to https://platform.openai.com/api-keys
- Click "Create new secret key"
- Copy the key (starts with
sk-) - Store securely (shown only once)
2. Configure Environment Variable:
# .env.local (for self-hosted deployments)
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx3. Enable OpenAI in Admin Panel:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenAI Configuration [ Enabled ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ API Key Status: โ
Configured (via environment) โ
โ โ
โ Default Model: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ GPT-4o-mini โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Fallback Model: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ GPT-3.5 Turbo โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Timeout (ms): * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 30000 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Max Retries: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 3 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Organization ID (optional): โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ org-xxxxxxxxxxxxx โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ [ Test Connection ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4. Test Connection:
Click "Test Connection" to verify:
โ
Connection successful
โ
Model access verified (gpt-4o-mini)
โ
Embedding model available (text-embedding-3-small)
โน๏ธ Rate limits: 10,000 RPM, 2,000,000 TPM
Summarization Models:
| Model | Speed | Cost | Quality | Best For |
|---|---|---|---|---|
| GPT-4o-mini | โกโกโก | ๐ฐ | โญโญโญ | High-volume, cost-sensitive |
| GPT-4o | โกโก | ๐ฐ๐ฐ๐ฐ | โญโญโญโญ | Balanced quality & cost |
| GPT-4 Turbo | โก | ๐ฐ๐ฐ๐ฐ๐ฐ๐ฐ | โญโญโญโญโญ | Highest quality needed |
Embedding Models:
| Model | Dimensions | Cost | Performance |
|---|---|---|---|
| text-embedding-3-small | 1536 | $0.00002/1k | Recommended (default) |
| text-embedding-3-large | 3072 | $0.00013/1k | Higher accuracy, 6.5x cost |
Recommendation: Use gpt-4o-mini + text-embedding-3-small for 99% of use cases.
Temperature (Randomness):
0.0 = Deterministic (same input โ same output)
0.7 = Balanced creativity (recommended)
1.0 = Maximum creativity
Max Tokens (Response Length):
Summarization: 500 tokens (โ375 words)
Chat: 1000 tokens (โ750 words)
Presence Penalty (Avoid repetition):
0.0 = No penalty
0.6 = Moderate (recommended)
1.0 = Strong penalty
Configure Anthropic Claude for high-quality summarization and chat.
Navigation: Admin Panel โ AI Configuration โ Providers tab โ Anthropic
1. Obtain API Key:
- Go to https://console.anthropic.com/
- Navigate to API Keys
- Click "Create Key"
- Copy the key (starts with
sk-ant-)
2. Configure Environment Variable:
# .env.local
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx3. Enable Anthropic in Admin Panel:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Anthropic Configuration [ Enabled ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ API Key Status: โ
Configured (via environment) โ
โ โ
โ Default Model: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Claude 3.5 Haiku โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Fallback Model: * โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Claude 3 Haiku โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ [ Test Connection ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4. Test Connection:
โ
Connection successful
โ
Model access verified (claude-3-5-haiku-20241022)
โน๏ธ Rate limits: 1,000 RPM, 100,000 TPM
Use Anthropic (Claude) when:
- โ Need highest quality summarization
- โ Processing very long conversations (200k token context)
- โ Want better handling of nuanced content
- โ Cost is less of a concern
Use OpenAI when:
- โ Need embeddings (Anthropic doesn't offer embeddings)
- โ Cost optimization is priority
- โ Need faster response times
- โ High request volume
Hybrid Approach (Recommended):
Summarization: Anthropic Claude 3.5 Haiku
Embeddings: OpenAI text-embedding-3-small
Search: OpenAI (requires embeddings)
Chat: Anthropic Claude 3.5 Haiku
Moderation: Local TensorFlow.js (free)
Change AI providers dynamically without downtime.
1. Navigate to Provider Settings: Admin Panel โ AI Configuration โ Providers
2. Change Primary Provider:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Primary Provider Selection โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Summarization: โ
โ โ OpenAI โ Anthropic โ Local โ
โ โ
โ Embeddings: โ
โ โ OpenAI โ Local โ
โ โ
โ Chat: โ
โ โ OpenAI โ Anthropic โ Local โ
โ โ
โ [ Apply Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. Verify Switch:
- System will test new provider
- Show confirmation message
- Log switch event for audit
4. Monitor Performance:
- Watch error rates for 24 hours
- Compare quality metrics
- Review user feedback
Best Practices:
-
Test in Staging First:
# Staging environment NEXT_PUBLIC_ENV=staging npm run test:ai-providers -
Enable Fallback Chain:
{ primary: 'anthropic', fallback: 'openai', localFallback: true }
-
Gradual Rollout:
- 10% of users for 1 day
- 50% of users for 1 day
- 100% of users
-
Monitor Metrics:
- Error rate (should stay <5%)
- Response time (should be within 20% of baseline)
- Cost per request
- User satisfaction scores
Rollback Plan:
# Quick rollback if issues detected
curl -X POST https://your-instance.com/api/admin/ai/providers/revertConfigure automatic failover when primary provider has issues.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Fallback Chain Configuration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Fallback Strategy: โ
โ โ Cascade (try each in order) โ
โ โ Round-robin (distribute load) โ
โ โ Cost-optimized (cheapest first) โ
โ โ
โ Summarization Fallback Chain: โ
โ 1. Anthropic Claude 3.5 Haiku (Primary) โ
โ 2. OpenAI GPT-4o-mini (First fallback) โ
โ 3. Local summarization (Last resort) โ
โ โ
โ Fallback Triggers: โ
โ โ Rate limit exceeded โ
โ โ API error (500-series) โ
โ โ Timeout (>30 seconds) โ
โ โ Budget threshold (90%) โ
โ โ Quality score below threshold โ
โ โ
โ [ Save Configuration ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Control individual user AI consumption to prevent abuse and manage costs.
Navigation: Admin Panel โ AI Configuration โ Rate Limits tab โ Per User
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Per-User Rate Limits โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Summarization: โ
โ Max Requests: 50 Window: 1 hour โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ 50 โ โ 3600000 โ milliseconds โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ Search: โ
โ Max Requests: 20 Window: 1 minute โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ 20 โ โ 60000 โ milliseconds โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ Chat: โ
โ Max Requests: 10 Window: 1 minute โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ 10 โ โ 60000 โ milliseconds โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ Embeddings: โ
โ Max Requests: 30 Window: 1 minute โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ 30 โ โ 60000 โ milliseconds โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ [ Reset to Defaults ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Token Bucket Implementation:
- Each user has a "bucket" of tokens
- Each request consumes 1 token
- Bucket refills at a constant rate
- When bucket is empty, requests are rejected
Example:
User Rate Limit: 50 requests/hour
Bucket Size: 50 tokens
Refill Rate: 50 tokens / 3600 seconds = 0.0139 tokens/second
Time 0:00 โ Bucket: 50 tokens (full)
Request 1 โ Bucket: 49 tokens
Request 2 โ Bucket: 48 tokens
...
Time 0:01 โ Bucket: 48.83 tokens (refilled 0.83)
Set custom limits for specific users or groups.
Navigation: Admin Panel โ Users โ [Select User] โ AI Limits
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Custom Rate Limits for [email protected] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Override Default Limits: [Enabled] โ
โ โ
โ Tier: โ Premium โ Enterprise โ Custom โ
โ โ
โ Premium Tier Limits: โ
โ Summarization: 200/hour (vs 50 default) โ
โ Search: 100/minute (vs 20 default) โ
โ Chat: 50/minute (vs 10 default) โ
โ โ
โ [ Revert to Default ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Tier Definitions:
| Tier | Summarization | Search | Chat | Cost Budget |
|---|---|---|---|---|
| Free | 10/hour | 5/min | 3/min | $5/month |
| Standard | 50/hour | 20/min | 10/min | $25/month |
| Premium | 200/hour | 100/min | 50/min | $100/month |
| Enterprise | Unlimited | Unlimited | Unlimited | Custom |
Control organization-wide AI consumption in multi-tenant environments.
Navigation: Admin Panel โ Organizations โ [Select Org] โ AI Limits
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Organization Rate Limits: Acme Corp โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Current Usage (Last Hour): โ
โ Requests: 3,847 / 5,000 (77%) โโโโโโโโโโโโโโ โ
โ โ
โ Organization Limits: โ
โ โ
โ Summarization: โ
โ Max Requests: 5000 Window: 1 hour โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ 5000 โ โ 3600000 โ milliseconds โ
โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ Total Budget: $1000/month โ
โ Current Spend: $687.34 (69%) โโโโโโโโโโโโโโโโโ โ
โ โ
โ [ View Usage Report ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Organization-Level Features:
- Aggregate Limits: Total requests across all users
- Cost Caps: Prevent runaway costs
- Fair Use Enforcement: Prevent single user from consuming all quota
- Reporting: Detailed per-org analytics
Fine-tune rate limits per AI feature/endpoint.
Configuration: /admin/ai/rate-limits/endpoints
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Endpoint-Specific Rate Limits โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ /api/ai/summarize โ
โ โโ User: 50 req/hour โ
โ โโ Org: 500 req/hour โ
โ โโ Global: 10,000 req/hour โ
โ โ
โ /api/search โ
โ โโ User: 20 req/min โ
โ โโ Org: 1,000 req/hour โ
โ โโ Global: 50,000 req/hour โ
โ โ
โ /api/ai/embed โ
โ โโ User: 30 req/min โ
โ โโ Org: 5,000 req/hour โ
โ โโ Global: 100,000 req/hour โ
โ โ
โ /api/ai/chat โ
โ โโ User: 10 req/min โ
โ โโ Org: 1,000 req/hour โ
โ โโ Global: 20,000 req/hour โ
โ โ
โ [ Edit All ] [ Export Config ] [ Reset to Defaults ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Endpoint-Specific Strategies:
-
Expensive Operations (Summarization):
- Lower limits (50/hour)
- Longer windows (hourly)
- Higher costs justify stricter controls
-
High-Volume Operations (Search):
- Higher limits (20/minute)
- Shorter windows (per-minute)
- Frequent but cheap operations
-
Real-Time Features (Chat):
- Moderate limits (10/minute)
- Short windows (per-minute)
- Balance UX and cost
Monitor how many messages have embeddings generated for search functionality.
Navigation: Admin Panel โ AI Management โ Embeddings โ Coverage
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Embedding Coverage Report โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Overall Coverage: โ
โ โโโโโโโโโโโโโโโโโโโโโโ 87.3% (45,234 / 51,823) โ
โ โ
โ By Channel: โ
โ #engineering โโโโโโโโโโโโโโโโโโโโ 95.2% โ
โ
โ #design โโโโโโโโโโโโโโโโโโโโ 89.1% โ
โ
โ #general โโโโโโโโโโโโโโโโโโโโ 71.3% โ ๏ธ โ
โ #random โโโโโโโโโโโโโโโโโโโโ 23.4% โ โ
โ โ
โ Missing Embeddings: 6,589 messages โ
โ Failed Embeddings: 234 messages (requires retry) โ
โ Queued for Processing: 1,423 messages โ
โ โ
โ [ Generate Missing ] [ Retry Failed ] [ View Log ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Coverage Thresholds:
- ๐ข 90-100%: Excellent (search works great)
- ๐ก 70-89%: Good (some search gaps)
- ๐ด <70%: Poor (search quality degraded)
Coverage Over Time (Last 30 Days):
100% โค โญโโ
90% โค โญโโโโโโโโฏ
80% โค โญโโโโโโโโฏ
70% โค โญโโโโโโโโฏ
60% โค โญโโโโโโโโฏ
50% โค โญโโโโโโโโฏ
โโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌ
1 5 10 15 20 25 30
โ
Target coverage (90%) reached on Day 28
Generate embeddings for multiple messages at once to improve search coverage.
Navigation: Admin Panel โ AI Management โ Embeddings โ Bulk Generate
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Bulk Embedding Generation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Scope: โ
โ โ All missing embeddings (6,589 messages) โ
โ โ Specific channel: [Select Channel โผ] โ
โ โ Date range: [From: ___] [To: ___] โ
โ โ
โ Estimated Cost: $0.13 (6,589 messages ร $0.00002) โ
โ Estimated Time: 12 minutes (9 requests/sec) โ
โ โ
โ Processing Options: โ
โ Priority: โ Normal โ High โ Low โ
โ Batch Size: [100] messages per request โ
โ โ
โ Schedule: โ
โ โ Start immediately โ
โ โ Schedule for: [Date/Time Picker] โ
โ โ
โ [ Cancel ] [ Start Generation ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Once started, monitor progress in real-time:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Bulk Generation in Progress โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Progress: 4,234 / 6,589 (64.3%) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Status: Processing batch 43/66... โ
โ Rate: 127 messages/min โ
โ Time Elapsed: 7m 32s โ
โ Time Remaining: ~4m 15s โ
โ โ
โ Statistics: โ
โ โ
Successful: 4,189 โ
โ โณ In Progress: 100 โ
โ โ Failed: 45 โ
โ โธ๏ธ Queued: 2,255 โ
โ โ
โ [ Pause ] [ Cancel ] [ View Details ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Best Practices:
- Off-Peak Hours: Schedule bulk jobs during low usage times (nights, weekends)
- Batch Size: Use 100-200 messages per batch for optimal performance
- Priority: Use "Low" priority to avoid impacting user requests
- Monitoring: Watch for rate limit errors; adjust rate if needed
Regenerate embeddings for existing messages (e.g., after model upgrades).
When to Re-index:
- Model Upgrade: Switched from embedding-3-small to embedding-3-large
- Quality Issues: Detecting poor search results
- Data Corruption: Embeddings corrupted or lost
- Configuration Change: Changed embedding dimensions
Navigation: Admin Panel โ AI Management โ Embeddings โ Re-index
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Re-index Embeddings โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โ ๏ธ Warning: Re-indexing will regenerate all โ
โ embeddings, incurring API costs. โ
โ โ
โ Scope: โ
โ โ All messages (51,823 messages) โ
โ โ Messages with embeddings (45,234 messages) โ
โ โ Specific date range โ
โ โ
โ New Model: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ text-embedding-3-large โผ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Estimated Cost: $6.74 (51,823 ร $0.00013) โ
โ Estimated Time: 47 minutes โ
โ โ
โ Options: โ
โ โ Keep old embeddings as backup โ
โ โ Update search index after completion โ
โ โ Send notification when complete โ
โ โ
โ Confirmation: โ
โ Type "REINDEX" to confirm: [____________] โ
โ โ
โ [ Cancel ] [ Start Re-indexing ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Re-indexing Strategy:
- Incremental Re-indexing: Re-index in batches over multiple days
- A/B Testing: Keep old embeddings, compare search quality
- Rollback Plan: Easy to revert if new embeddings perform worse
Monitor the quality and performance of your embedding index.
Navigation: Admin Panel โ AI Management โ Embeddings โ Health Check
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Embedding Index Health Report โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Overall Health: โ
Excellent (95/100) โ
โ โ
โ Metrics: โ
โ โ
โ Coverage: โโโโโโโโโโโโโโโโโโโโโ 87.3% โ
โ
โ Quality Score: โโโโโโโโโโโโโโโโโโโโโ 92.1% โ
โ
โ Search Performance: โโโโโโโโโโโโโโโโโโโโโ 94.8% โ
โ
โ Freshness: โโโโโโโโโโโโโโโโโโโโโ 89.2% โ
โ
โ Error Rate: โโโโโโโโโโโโโโโโโโโโโ 0.4% โ
โ
โ โ
โ Quality Issues Detected: โ
โ โ ๏ธ 127 low-quality embeddings (quality score <70) โ
โ โ ๏ธ 45 messages failed embedding generation โ
โ โน๏ธ 234 embeddings older than 30 days โ
โ โ
โ Recommendations: โ
โ 1. Retry failed embeddings (45 messages) โ
โ 2. Investigate low-quality cases โ
โ 3. Consider re-indexing old embeddings โ
โ โ
โ [ Run Full Diagnostics ] [ Export Report ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Health Metrics Explained:
- Coverage (87.3%): Percentage of messages with embeddings
- Quality Score (92.1%): Average embedding quality (vector magnitude, distribution)
- Search Performance (94.8%): Search relevance scores from user feedback
- Freshness (89.2%): Percentage of embeddings generated in last 7 days
- Error Rate (0.4%): Percentage of embedding generation failures
Quality Score Calculation:
qualityScore =
(vectorMagnitude * 0.3 + // Proper normalization
dimensionVariance * 0.2 + // Good distribution
noZeroValues * 0.2 + // No degenerate values
withinExpectedRange * 0.3) * // Values in expected range
100Control which bots are active in your workspace.
Navigation: Admin Panel โ Bots โ Manage
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Bot Management โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ HelloBot [Enabled โผ] โ โ
โ โ Greetings and ice-breaker jokes โ โ
โ โ Commands: /hello, /hi, /joke โ โ
โ โ Usage: 1,234 invocations this month โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ PollBot [Enabled โผ] โ โ
โ โ Create and manage polls โ โ
โ โ Commands: /poll, /vote, /results โ โ
โ โ Usage: 567 polls created โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ SummaryBot [Enabled โผ] โ โ
โ โ AI-powered summarization โ โ
โ โ Commands: /summarize, /digest โ โ
โ โ Usage: 2,345 summaries generated โ โ
โ โ AI Cost: $45.67 this month โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ [ Add Custom Bot ] [ Import from Marketplace ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Bot States:
- Enabled: Bot responds to commands and events
- Disabled: Bot is inactive (commands show "disabled" message)
- Restricted: Bot only available to specific channels/users
Disabling a Bot:
- Click dropdown next to bot name
- Select "Disabled"
- Confirm action
- Bot immediately stops responding
Track bot usage, errors, and user satisfaction.
Navigation: Admin Panel โ Bots โ Analytics
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Bot Performance Analytics โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ SummaryBot (Last 30 Days) โ
โ โ
โ Usage: โ
โ Total Invocations: 2,345 โ
โ Success Rate: 98.7% (2,315 / 2,345) โ
โ Avg Response Time: 2.3s โ
โ โ
โ Performance Trend: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 100 โญโโฎ โ โ
โ โ 80 โญโโฎ โญโโฎ โ โ โ โ
โ โ 60 โญโโฎ โ โ โญโโฎ โ โโญโโฎ โ โ โ โ
โ โ 40 โญโโฎ โ โโญโโฎ โ โ โ โโญโโฎ โ โโ โ โ โ โ โ
โ โ 20โโโโดโโดโโดโโดโดโโดโโโดโโดโโดโโดโดโโดโโโดโโดโดโโดโโดโโดโโโโโ โ
โ โ Week 1 Week 2 Week 3 Week 4 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Top Users: โ
โ 1. sarah@example - 456 invocations โ
โ 2. mike@example - 234 invocations โ
โ 3. alex@example - 189 invocations โ
โ โ
โ Recent Errors (2.3%): โ
โ โ Rate limit exceeded (23 occurrences) โ
โ โ Timeout (8 occurrences) โ
โ โ Invalid input (4 occurrences) โ
โ โ
โ [ View Detailed Logs ] [ Export Report ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Metrics:
- Success Rate: Percentage of successful bot responses
- Response Time: Average time from invocation to response
- Error Rate: Percentage of failed invocations
- User Satisfaction: Based on reactions and feedback
Performance Thresholds:
- Success Rate: >95% is good
- Response Time: <3s is good
- Error Rate: <5% is acceptable
Deep dive into bot usage patterns and ROI.
Navigation: Admin Panel โ Bots โ [Select Bot] โ Analytics
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SummaryBot - Detailed Analytics โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Command Usage Breakdown: โ
โ /summarize โโโโโโโโโโโโโโโโ 1,890 (80.6%) โ
โ /digest โโโโโโโโโโโโโโโโ 455 (19.4%) โ
โ โ
โ User Engagement: โ
โ Active Users: 87 โ
โ Avg Uses/User: 27 โ
โ Power Users (>50 uses): 12 โ
โ โ
โ Time Distribution: โ
โ Morning (6-12): โโโโโโโโ 35% โ
โ Afternoon (12-6): โโโโโโโโโ 45% โ
โ Evening (6-12): โโโโโโโโ 18% โ
โ Night (12-6): โโโโโโโโ 2% โ
โ โ
โ Value Metrics: โ
โ Time Saved: ~156 hours (estimated) โ
โ Cost: $45.67 (API calls) โ
โ ROI: $3,900 saved / $45.67 spent = 85x return โ
โ โ
โ User Satisfaction: โ
โ ๐ Positive: 92.3% โ
โ ๐ Negative: 7.7% โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ROI Calculation:
Time Saved = (Summaries Generated ร Avg Manual Summary Time)
Cost = API Calls ร Cost per Call
ROI = (Time Saved ร Hourly Wage) / Cost
Adjust sensitivity of auto-moderation to balance safety and false positives.
Navigation: Admin Panel โ Moderation โ Thresholds
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Toxicity Detection Thresholds โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Overall Toxicity: โ
โ Threshold: 70% [โโโโโโโโโโโโโโโโโโโโโโโโโโโ] โ
โ 0% 50% 70% 100% โ
โ โ
โ Actions: โ
โ 0-49%: โ
Allow โ
โ 50-69%: โ ๏ธ Flag for review โ
โ 70-89%: ๐ซ Hide message, warn user โ
โ 90-100%: ๐ Hide message, mute user (1 hour) โ
โ โ
โ Sub-Categories: โ
โ Identity Attack: 75% [โโโโโโโโโโโโโโโโโโโโโ] โ
โ Insult: 70% [โโโโโโโโโโโโโโโโโโโโโ] โ
โ Threat: 60% [โโโโโโโโโโโโโโโโโโโโโ] โ
โ Profanity: 80% [โโโโโโโโโโโโโโโโโโโโ] โ
โ Sexually Explicit: 85% [โโโโโโโโโโโโโโโโโโโโ] โ
โ โ
โ [ Reset to Defaults ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Threshold Recommendations:
| Workspace Type | Recommended Threshold | Reasoning |
|---|---|---|
| Professional (Corporate) | 60-70% | Strict, low tolerance |
| Community (Open) | 75-85% | Balanced, some tolerance |
| Gaming/Casual | 80-90% | Relaxed, high tolerance |
| Educational | 65-75% | Moderate, context-aware |
Fine-Tuning Tips:
- Start Conservative (70%): Lower threshold = stricter moderation
- Monitor False Positives: Track appeals and adjust
- Category-Specific: Adjust sub-categories independently
- A/B Test: Test changes with small user group first
Define automatic actions taken when content violates policies.
Navigation: Admin Panel โ Moderation โ Auto-Actions
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Auto-Action Rules Configuration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Rule 1: High Toxicity โ
โ Condition: Toxicity score โฅ 90% โ
โ Actions: โ
โ โ Hide message immediately โ
โ โ Send warning to user โ
โ โ Temporary mute (1 hour) โ
โ โ Notify moderators โ
โ โ Permanent ban (requires manual review) โ
โ โ
โ Rule 2: Spam Detection โ
โ Condition: Spam score โฅ 85% โ
โ Actions: โ
โ โ Hide message immediately โ
โ โ Notify user (educational message) โ
โ โ Temporary mute โ
โ โ Notify moderators โ
โ โ
โ Rule 3: Repeat Offenders โ
โ Condition: 3+ violations in 24 hours โ
โ Actions: โ
โ โ Escalate to manual review โ
โ โ Temporary mute (24 hours) โ
โ โ Email notification to user โ
โ โ Notify admin team โ
โ โ
โ [ Add New Rule ] [ Import Rules ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Available Actions:
| Action | Effect | User Impact | Reversible |
|---|---|---|---|
| Flag | Add to moderation queue | None (message visible) | N/A |
| Hide | Remove from view | Hidden from all users | Yes |
| Warn | Send warning notification | Alert displayed | N/A |
| Mute (1h) | Prevent messaging | Cannot send for 1 hour | Auto |
| Mute (24h) | Prevent messaging | Cannot send for 24 hours | Manual |
| Escalate | Add to review queue | Pending moderator decision | Yes |
| Ban | Remove from workspace | Permanent removal | Manual only |
Manage exceptions to moderation rules (allowed terms, trusted users).
Navigation: Admin Panel โ Moderation โ Whitelists
1. Term Whitelist:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Allowed Terms (False Positive Prevention) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Technical Jargon: โ
โ โข kill process โ
โ โข abort transaction โ
โ โข dump memory โ
โ โข terminate thread โ
โ โข crash report โ
โ โ
โ Industry-Specific: โ
โ โข [Your custom terms here] โ
โ โ
โ [ Add Term ] [ Import List ] [ Export ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2. User Whitelist:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Trusted Users (Bypass Moderation) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โ [email protected] (Admin) โ
โ โ [email protected] (Moderator) โ
โ โ [email protected] (Bot Account) โ
โ โ [email protected] (Trusted User) โ
โ โ
โ โ ๏ธ Warning: Whitelisted users bypass all moderation โ
โ โ
โ [ Add User ] [ Remove All ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. Channel Whitelist:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Exempt Channels (No Moderation) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โ #bot-testing (For bot development) โ
โ โ #admin-lounge (Private admin channel) โ
โ โ #general (Public channel) โ
โ โ
โ Use Case: Testing, admin channels, private groups โ
โ โ
โ [ Add Channel ] [ Save Changes ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Whitelist Best Practices:
โ Do:
- Whitelist technical terms that trigger false positives
- Exempt bot testing channels
- Document why each term/user is whitelisted
- Regular review (quarterly) to remove stale entries
โ Avoid:
- Blanket whitelisting of users (creates accountability gaps)
- Whitelisting profanity without strong justification
- Forgetting to remove former employees from whitelist
Common AI API errors and how to resolve them.
Symptom:
{
"error": "Rate limit exceeded",
"code": "rate_limit_exceeded",
"retry_after": 32
}User sees: "AI features temporarily unavailable. Please try again in 32 seconds."
Causes:
- Too many requests in short time
- Org-wide rate limit hit
- Provider-side rate limit (OpenAI/Anthropic)
Solutions:
Short-term:
# Increase rate limits temporarily
curl -X POST /api/admin/ai/rate-limits/adjust \
-d '{"endpoint": "summarization", "multiplier": 1.5}'Long-term:
- Review and adjust rate limits (see Rate Limiting)
- Implement request queuing
- Add request deduplication
- Contact provider to increase limits
Prevention:
- Monitor usage trends
- Set up rate limit alerts
- Educate users on efficient AI usage
Symptom:
{
"error": "Insufficient quota",
"code": "insufficient_quota",
"quota_remaining": 0
}Causes:
- OpenAI/Anthropic account out of credits
- Payment method failed
- Free tier limits exceeded
Solutions:
-
Check Provider Dashboard:
-
Add Credits:
- Add payment method
- Purchase credits
- Upgrade tier
-
Enable Fallback:
// Automatically fall back to local processing { autoFallbackOnQuotaExceeded: true }
Symptom:
{
"error": "Invalid API key",
"code": "invalid_api_key"
}Causes:
- API key expired or revoked
- Wrong API key for provider
- API key not set in environment
Solutions:
-
Verify Environment Variable:
# Check if API key is set echo $OPENAI_API_KEY echo $ANTHROPIC_API_KEY
-
Regenerate API Key:
- Go to provider dashboard
- Create new API key
- Update environment variable
- Restart application
-
Test Connection:
# Test OpenAI key curl https://api.openai.com/v1/models \ -H "Authorization: Bearer $OPENAI_API_KEY"
Unexpected high AI costs and how to investigate.
Step 1: Identify Spike:
Cost Trend (Last 7 Days):
$200 โค โญโโโโ
$150 โค โญโโโโฏ
$100 โค โญโโโโฏ
$50 โคโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
$0 โดโโโโโโโโฌโโโโโโโโฌโโโโโโโโฌโโโโโโโโฌโโโโโโโโฌโโโโโโโโฌ
Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7
โ ๏ธ Spike detected: Day 5-7 (400% increase)
Step 2: Drill Down by Endpoint:
Cost by Endpoint (Last 24 Hours):
/ai/summarize $89.23 (45%) โโโโโโโโโโโโ
/ai/chat $67.45 (34%) โโโโโโโโ
/search $32.10 (16%) โโโโ
/ai/embed $8.92 (5%) โ
Step 3: Identify Top Users:
Top Spenders (Last 24 Hours):
sarah@example $145.67 (73%) โโโโโโโโโโโโโโโโ
mike@example $32.45 (16%) โโโโ
alex@example $15.23 (8%) โโ
Others $4.35 (3%) โ
Step 4: Investigate User Activity:
sarah@example - Detailed Activity:
Time Range: Jan 30, 14:00 - 15:00
Requests: 1,234 (unusual: avg is 50/hour)
Cost: $89.23
Endpoint Breakdown:
/ai/summarize ร 1,200 requests = $85.50
/search ร 34 requests = $3.73
โ ๏ธ Possible automation/script detected
Step 5: Take Action:
- Contact User: Investigate if intentional
- Suspend if Abuse: Temporary suspension
- Adjust Rate Limits: Prevent future spikes
- Enable Alerts: Get notified of unusual activity
Immediate Actions:
-
Pause AI Features (Emergency):
# Admin panel or API curl -X POST /api/admin/ai/emergency-pause -
Reduce Rate Limits:
# Cut all limits by 50% curl -X POST /api/admin/ai/rate-limits/reduce \ -d '{"factor": 0.5}'
-
Switch to Cheaper Models:
# Force fallback to GPT-4o-mini curl -X POST /api/admin/ai/config/model \ -d '{"provider": "openai", "model": "gpt-4o-mini"}'
Long-term Solutions:
- Budget Caps: Set hard spending limits
- User Education: Teach efficient AI usage
- Cost Monitoring: Daily budget review
- Optimization: Improve caching, batching
Slow AI responses and how to diagnose.
1. Check Response Times:
Average Response Times (Last Hour):
Summarization: 2.3s โ
(target: <3s)
Search: 0.8s โ
(target: <1s)
Chat: 4.7s โ ๏ธ (target: <3s)
Embeddings: 1.2s โ
(target: <2s)
2. Check Provider Status:
# Check OpenAI status
curl https://status.openai.com/api/v2/status.json
# Check Anthropic status
curl https://status.anthropic.com/api/v2/status.json3. Check Queue Backlog:
Queue Status:
Summarization: 12 queued, 3 processing โ
Search: 0 queued, 0 processing โ
Chat: 347 queued, 10 processing โ ๏ธ BACKLOG
Embeddings: 23 queued, 5 processing โ
4. Check Cache Hit Rate:
Cache Performance:
Summarization: 87% hit rate โ
(target: >80%)
Search: 45% hit rate โ ๏ธ (target: >60%)
Embeddings: 92% hit rate โ
(target: >80%)
Increase Concurrency:
// Admin Panel โ AI Configuration โ Advanced
{
maxConcurrentRequests: 10, // Increase from 5
requestTimeout: 30000, // 30 seconds
retryAttempts: 3
}Optimize Caching:
// Increase cache TTL
{
summarizationTtl: 7200, // 2 hours (was 1 hour)
searchTtl: 600, // 10 minutes (was 5 minutes)
}Add Request Deduplication:
// Automatically deduplicate identical requests
{
deduplication: {
enabled: true,
windowMs: 5000 // 5 seconds
}
}Use CDN/Edge Caching:
// Cache responses at edge (Cloudflare, Vercel)
{
edgeCaching: {
enabled: true,
ttl: 300 // 5 minutes
}
}| Task | Location | Quick Action |
|---|---|---|
| View AI costs | Dashboard | /admin/ai/dashboard |
| Adjust rate limits | Rate Limits tab | Update values, save |
| Disable a bot | Bot Management | Toggle "Disabled" |
| Generate missing embeddings | Embeddings โ Bulk | Click "Generate Missing" |
| Check API key status | Provider Config | View "API Key Status" |
| View top AI users | Usage Monitoring โ Top Users | Sort by cost |
| Set budget alert | Budgets tab | Create alert, set threshold |
| Whitelist a term | Moderation โ Whitelists | Add to term whitelist |
| Export usage data | Dashboard | Click "Export" button |
| Pause AI features | Emergency | /admin/ai/emergency-pause |
Documentation:
- AI Features User Guide:
/docs/guides/features/ai-features-complete.md - Bot SDK Guide:
/docs/guides/development/bot-sdk-complete.md - API Documentation:
/docs/api/ai-endpoints.md
Community:
- Forum: community.nself.org
- Discord: discord.gg/nself
- GitHub Issues: github.com/nself/nself-chat/issues
Professional Support:
- Email: [email protected]
- Enterprise Support: [email protected]
- Slack Connect: Request invite via email
v1.0.0 (January 31, 2026):
- Initial release
- Comprehensive AI administration guide
- Coverage of all AI features
Last Updated: January 31, 2026 Version: v0.7.0 Next Review: February 28, 2026 Maintained By: nself-chat Core Team