ai administration - nself-org/nchat GitHub Wiki

AI Administration Guide

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.


Table of Contents

  1. Dashboard Overview
  2. Usage Monitoring
  3. Cost Management
  4. Provider Configuration
  5. Rate Limiting
  6. Embedding Management
  7. Bot Management
  8. Moderation Settings
  9. Troubleshooting

Dashboard Overview

Accessing the AI Dashboard

The AI Administration Dashboard provides a unified view of all AI-related metrics and controls.

Navigation:

  1. Sign in as an admin user
  2. Go to Admin Panel (gear icon in sidebar)
  3. Click AI Management in the left menu
  4. Select Dashboard tab

Dashboard URL: /admin/ai/dashboard

Key Metrics at a Glance

The dashboard displays real-time metrics across four main areas:

1. Cost Summary Card

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ’ฐ 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

2. Request Volume Card

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“Š 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

3. Cache Performance Card

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โšก 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

4. Queue Status Card

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โฑ๏ธ  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

Period Selector

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

Action Buttons

Three primary action buttons in the header:

  1. ๐Ÿ”„ Refresh: Manually refresh all data immediately
  2. ๐Ÿ“ฅ Export: Download current data as CSV or JSON
  3. โš™๏ธ Settings: Quick access to AI configuration

Usage Monitoring

API Calls by Feature

Track which AI features consume the most API calls and budget.

View: Dashboard โ†’ By Endpoint tab

Distribution Chart

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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

Users Consuming Most AI

Identify top AI users to understand usage patterns and potential optimization opportunities.

View: Dashboard โ†’ Top Users tab

Top Users Table

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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:

  1. Power User Identification: Find users who heavily rely on AI features
  2. Training Opportunities: Identify users who might benefit from efficiency training
  3. Budget Allocation: Understand if costs are concentrated or distributed
  4. 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

Peak Usage Times

Understand when AI features are most heavily used to optimize capacity and costs.

View: Dashboard โ†’ Usage Trends tab

Hourly Usage Chart

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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:

  1. Off-Peak Processing: Schedule bulk operations during low-usage hours
  2. Cache Pre-warming: Warm caches before peak hours
  3. Capacity Planning: Scale resources based on predicted demand
  4. Budget Pacing: Monitor real-time spending vs expected daily budget

Weekly Pattern Analysis

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

Real-Time Monitoring

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

Cost Management

Real-Time Cost Tracking

The cost tracking system provides accurate, up-to-the-minute spending information.

How Costs Are Calculated

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:

  1. Per-Request Tracking: Every API call is logged with exact token usage
  2. User Attribution: Costs are attributed to the requesting user
  3. Organization Rollup: Multi-tenant setups track per-organization costs
  4. Model Breakdown: See which models cost the most
  5. Historical Data: 90-day retention for trend analysis

Budget Alerts Setup

Configure automatic alerts to prevent unexpected cost overruns.

Navigation: Admin Panel โ†’ AI Configuration โ†’ Budgets tab

Creating a Budget Alert

Step-by-step:

  1. Click "Create Budget Alert"

  2. 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 ]        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. 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 Configuration Options

Alert Types:

  1. Global Budget: Workspace-wide spending limit
  2. Per-User Budget: Individual user spending caps
  3. Per-Org Budget: Organization-level limits (multi-tenant)
  4. 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

Cost Optimization Tips

1. Model Selection Optimization

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:

  1. Start with GPT-4o-mini for all features
  2. Monitor quality metrics
  3. Upgrade specific features if quality is insufficient
  4. A/B test to validate quality improvements justify cost increases

2. Caching Strategies

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:

  1. Increase TTL values
  2. Normalize cache keys (e.g., lowercase, trim whitespace)
  3. Use semantic similarity for near-match caching
  4. Pre-populate cache for common queries

3. Batch Processing

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:

  1. Bulk Embedding Generation: /admin/ai/embeddings/generate-bulk
  2. Scheduled Digest Jobs: Process summaries off-peak
  3. Async Processing: Queue low-priority tasks

4. Rate Limit Optimization

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

5. Model Fallback Chains

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:

  1. Rate limit exceeded โ†’ Try fallback model
  2. Budget threshold (90%) โ†’ Switch to fallback automatically
  3. API error (500-series) โ†’ Retry with fallback
  4. 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)

Provider Configuration

OpenAI Setup

Configure OpenAI as your primary AI provider for summarization and embeddings.

Navigation: Admin Panel โ†’ AI Configuration โ†’ Providers tab โ†’ OpenAI

Step-by-Step Configuration

1. Obtain API Key:

2. Configure Environment Variable:

# .env.local (for self-hosted deployments)
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. 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

Model Selection Guide

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.

Advanced Settings

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

Anthropic Setup

Configure Anthropic Claude for high-quality summarization and chat.

Navigation: Admin Panel โ†’ AI Configuration โ†’ Providers tab โ†’ Anthropic

Step-by-Step Configuration

1. Obtain API Key:

2. Configure Environment Variable:

# .env.local
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. 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

When to Use Anthropic vs OpenAI

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)

Switching Providers

Change AI providers dynamically without downtime.

Provider Switching Process

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

Graceful Migration

Best Practices:

  1. Test in Staging First:

    # Staging environment
    NEXT_PUBLIC_ENV=staging npm run test:ai-providers
  2. Enable Fallback Chain:

    {
      primary: 'anthropic',
      fallback: 'openai',
      localFallback: true
    }
  3. Gradual Rollout:

    • 10% of users for 1 day
    • 50% of users for 1 day
    • 100% of users
  4. 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/revert

Fallback Configuration

Configure 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 ]                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Rate Limiting

Per-User Limits

Control individual user AI consumption to prevent abuse and manage costs.

Navigation: Admin Panel โ†’ AI Configuration โ†’ Rate Limits tab โ†’ Per User

Default User Rate Limits

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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 ]        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Rate Limit Algorithm

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)

User-Specific Overrides

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

Per-Organization Limits

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:

  1. Aggregate Limits: Total requests across all users
  2. Cost Caps: Prevent runaway costs
  3. Fair Use Enforcement: Prevent single user from consuming all quota
  4. Reporting: Detailed per-org analytics

Endpoint-Specific Limits

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:

  1. Expensive Operations (Summarization):

    • Lower limits (50/hour)
    • Longer windows (hourly)
    • Higher costs justify stricter controls
  2. High-Volume Operations (Search):

    • Higher limits (20/minute)
    • Shorter windows (per-minute)
    • Frequent but cheap operations
  3. Real-Time Features (Chat):

    • Moderate limits (10/minute)
    • Short windows (per-minute)
    • Balance UX and cost

Embedding Management

Coverage Statistics

Monitor how many messages have embeddings generated for search functionality.

Navigation: Admin Panel โ†’ AI Management โ†’ Embeddings โ†’ Coverage

Coverage Dashboard

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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)

Historical Coverage Trends

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

Bulk Generation

Generate embeddings for multiple messages at once to improve search coverage.

Navigation: Admin Panel โ†’ AI Management โ†’ Embeddings โ†’ Bulk Generate

Bulk Generation Interface

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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 ]     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Bulk Generation Progress

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:

  1. Off-Peak Hours: Schedule bulk jobs during low usage times (nights, weekends)
  2. Batch Size: Use 100-200 messages per batch for optimal performance
  3. Priority: Use "Low" priority to avoid impacting user requests
  4. Monitoring: Watch for rate limit errors; adjust rate if needed

Re-indexing

Regenerate embeddings for existing messages (e.g., after model upgrades).

When to Re-index:

  1. Model Upgrade: Switched from embedding-3-small to embedding-3-large
  2. Quality Issues: Detecting poor search results
  3. Data Corruption: Embeddings corrupted or lost
  4. 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:

  1. Incremental Re-indexing: Re-index in batches over multiple days
  2. A/B Testing: Keep old embeddings, compare search quality
  3. Rollback Plan: Easy to revert if new embeddings perform worse

Index Health

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:

  1. Coverage (87.3%): Percentage of messages with embeddings
  2. Quality Score (92.1%): Average embedding quality (vector magnitude, distribution)
  3. Search Performance (94.8%): Search relevance scores from user feedback
  4. Freshness (89.2%): Percentage of embeddings generated in last 7 days
  5. 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
  100

Bot Management

Enabling/Disabling Bots

Control which bots are active in your workspace.

Navigation: Admin Panel โ†’ Bots โ†’ Manage

Bot Management Interface

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  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:

  1. Click dropdown next to bot name
  2. Select "Disabled"
  3. Confirm action
  4. Bot immediately stops responding

Monitoring Bot Performance

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:

  1. Success Rate: Percentage of successful bot responses
  2. Response Time: Average time from invocation to response
  3. Error Rate: Percentage of failed invocations
  4. User Satisfaction: Based on reactions and feedback

Performance Thresholds:

  • Success Rate: >95% is good
  • Response Time: <3s is good
  • Error Rate: <5% is acceptable

Bot Analytics

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

Moderation Settings

Threshold Configuration

Adjust sensitivity of auto-moderation to balance safety and false positives.

Navigation: Admin Panel โ†’ Moderation โ†’ Thresholds

Toxicity 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:

  1. Start Conservative (70%): Lower threshold = stricter moderation
  2. Monitor False Positives: Track appeals and adjust
  3. Category-Specific: Adjust sub-categories independently
  4. A/B Test: Test changes with small user group first

Auto-Action Rules

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

Whitelist Management

Manage exceptions to moderation rules (allowed terms, trusted users).

Navigation: Admin Panel โ†’ Moderation โ†’ Whitelists

Whitelist Types

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

Troubleshooting

API Errors

Common AI API errors and how to resolve them.

Error: Rate Limit Exceeded

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:

  1. Too many requests in short time
  2. Org-wide rate limit hit
  3. 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:

  1. Review and adjust rate limits (see Rate Limiting)
  2. Implement request queuing
  3. Add request deduplication
  4. Contact provider to increase limits

Prevention:

  • Monitor usage trends
  • Set up rate limit alerts
  • Educate users on efficient AI usage

Error: Insufficient Quota

Symptom:

{
  "error": "Insufficient quota",
  "code": "insufficient_quota",
  "quota_remaining": 0
}

Causes:

  1. OpenAI/Anthropic account out of credits
  2. Payment method failed
  3. Free tier limits exceeded

Solutions:

  1. Check Provider Dashboard:

  2. Add Credits:

    • Add payment method
    • Purchase credits
    • Upgrade tier
  3. Enable Fallback:

    // Automatically fall back to local processing
    {
      autoFallbackOnQuotaExceeded: true
    }

Error: Invalid API Key

Symptom:

{
  "error": "Invalid API key",
  "code": "invalid_api_key"
}

Causes:

  1. API key expired or revoked
  2. Wrong API key for provider
  3. API key not set in environment

Solutions:

  1. Verify Environment Variable:

    # Check if API key is set
    echo $OPENAI_API_KEY
    echo $ANTHROPIC_API_KEY
  2. Regenerate API Key:

    • Go to provider dashboard
    • Create new API key
    • Update environment variable
    • Restart application
  3. Test Connection:

    # Test OpenAI key
    curl https://api.openai.com/v1/models \
      -H "Authorization: Bearer $OPENAI_API_KEY"

Cost Overruns

Unexpected high AI costs and how to investigate.

Investigating Cost Spikes

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:

  1. Contact User: Investigate if intentional
  2. Suspend if Abuse: Temporary suspension
  3. Adjust Rate Limits: Prevent future spikes
  4. Enable Alerts: Get notified of unusual activity

Cost Control Measures

Immediate Actions:

  1. Pause AI Features (Emergency):

    # Admin panel or API
    curl -X POST /api/admin/ai/emergency-pause
  2. Reduce Rate Limits:

    # Cut all limits by 50%
    curl -X POST /api/admin/ai/rate-limits/reduce \
      -d '{"factor": 0.5}'
  3. 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:

  1. Budget Caps: Set hard spending limits
  2. User Education: Teach efficient AI usage
  3. Cost Monitoring: Daily budget review
  4. Optimization: Improve caching, batching

Performance Issues

Slow AI responses and how to diagnose.

Diagnosis Checklist

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.json

3. 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%)

Performance Optimization

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
  }
}

Appendix

Common Admin Tasks Quick Reference

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

Support Resources

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:

Professional Support:

Changelog

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

โš ๏ธ **GitHub.com Fallback** โš ๏ธ