Stream CoHost Documentation
Welcome to the comprehensive documentation for Stream CoHost, the most advanced Twitch AI companion with 27+ interactive plugins, intelligent memory, and professional-grade performance.
AI Memory System
Intelligent memory that learns viewer preferences and community context
27+ Plugins
Production-ready plugins for games, music, analytics, and administration
Performance Optimized
95% faster database queries and intelligent caching systems
What is Stream CoHost?
Stream CoHost is a revolutionary Twitch AI companion designed for streamers who demand the best. Unlike traditional chatbots, Stream CoHost features:
- Selective Memory System: AI analyzes conversations for emotional significance and automatically saves important community moments
- Production-Ready Plugins: Comprehensive suite of interactive features including games, music management, currency systems, and analytics
- Professional Admin Control: Unified interface with dark/light themes, plugin management, and real-time configuration
- Performance Engineering: Centralized OpenAI service with 30-minute caching and 95% faster database operations
Installation Guide
Get Stream CoHost up and running in minutes with our comprehensive installation guide.
System Requirements
Operating System
- Windows 10/11 (64-bit)
- macOS 10.15 or later
- Linux (Ubuntu 18.04+)
Hardware
- 4GB RAM minimum (8GB recommended)
- 1GB free disk space
- Internet connection
Dependencies
- Node.js 18.0 or later
- npm 8.0 or later
- SQLite 3.0 or later
Quick Installation
# Download Stream CoHost
git clone https://github.com/streamcohost/streamcohost.git
cd streamcohost
# Install dependencies
npm install
# Copy configuration template
cp .env.example .env
# Start the bot
npm start
Configuration
Configure Stream CoHost with your Twitch credentials and AI service settings.
Environment Variables
Create a .env
file in the project root with the following configuration:
# Twitch Configuration
TWITCH_USERNAME=your_bot_username
TWITCH_CHANNEL=your_channel_name
TWITCH_OAUTH_TOKEN=oauth:your_oauth_token
# OpenAI Configuration
OPENAI_API_KEY=sk-your-openai-api-key
OPENAI_MODEL=gpt-4
OPENAI_MAX_TOKENS=150
OPENAI_TEMPERATURE=0.7
# Bot Configuration
EXPRESS_PORT=3710
RESPONSE_MODE=chat
MAX_USER_MEMORY=50
MEMORY_CLEANUP_THRESHOLD=100
AUTO_RESET_ON_STARTUP=false
Getting Your Twitch OAuth Token
- Visit Twitch TMI
- Click "Connect" and authorize the application
- Copy the OAuth token (starts with "oauth:")
- Add it to your
.env
file
OpenAI API Setup
- Create an account at OpenAI Platform
- Navigate to API Keys section
- Create a new API key
- Add it to your
.env
file
AI Memory System
Learn how Stream CoHost's intelligent memory system works and how to configure it for optimal performance.
How It Works
The AI Memory System uses advanced natural language processing to:
- Analyze Emotional Significance: Detects important moments in chat conversations
- Selective Retention: Only saves memories that have lasting value
- Context Learning: Builds understanding of community dynamics and viewer preferences
- Smart Cleanup: Automatically manages memory storage to prevent bloat
Memory Categories
User Preferences
Favorite games, streaming times, and personal interests
Community Jokes
Inside jokes, memes, and recurring themes
Important Events
Achievements, milestones, and significant moments
Configuration Options
// Memory configuration in botMemory plugin
const memoryConfig = {
maxUserMemory: 50, // Max memories per user
cleanupThreshold: 100, // When to trigger cleanup
emotionalThreshold: 0.7, // Minimum emotional significance
retentionDays: 30, // How long to keep memories
categories: [
'preferences',
'achievements',
'community_events',
'personal_info'
]
};
Music System
Comprehensive music management with visualizer, request system, and analytics.
Features
- Butterchurn Visualizer: Real-time audio visualizations
- Request System: Viewer song requests with queue management
- Music Analytics: Track popular songs and user preferences
- Overlay Integration: Stream overlay with now playing information
Setup Guide
- Enable the Music plugin in the admin panel
- Configure your music directory path
- Set up the stream overlay
- Configure request permissions and costs
Chat Commands
!request [song name or number]
Request a song by name or jukebox number
!skip
Skip the current song (costs currency)
!nowplaying
Show currently playing song information
!jukebox
Display available songs with numbers
Plugin Development
Learn how to create custom plugins for Stream CoHost using our comprehensive API.
Plugin Structure
All plugins follow a standardized structure for consistency and maintainability:
// plugins/myPlugin/index.js
class MyPlugin {
constructor(bot) {
this.bot = bot;
this.name = 'MyPlugin';
this.version = '1.0.0';
this.description = 'Description of my plugin';
}
async onLoad() {
// Plugin initialization code
console.log(`${this.name} v${this.version} loaded`);
// Register chat commands
this.bot.registerCommand('!mycommand', this.handleCommand.bind(this));
// Set up web routes
this.setupRoutes();
}
async handleCommand(context) {
const { username, args, message } = context;
// Command logic here
return {
success: true,
response: `Hello ${username}!`
};
}
setupRoutes() {
// Express.js routes for admin interface
this.bot.app.get('/api/myplugin/status', (req, res) => {
res.json({ status: 'active', version: this.version });
});
}
async onUnload() {
// Cleanup when plugin is disabled
this.bot.unregisterCommand('!mycommand');
}
}
module.exports = MyPlugin;
Available APIs
Chat API
Send messages, register commands, handle user input
Database API
SQLite operations, user data storage, plugin configuration
AI Services
OpenAI integration, memory management, context analysis
WebSocket API
Real-time communication, overlay updates, live data
API Reference
Complete reference for all available APIs and methods in Stream CoHost.
Bot Core API
bot.registerCommand(command, handler)
Register a new chat command with the bot.
Parameters
command
(string) - The command trigger (e.g., "!hello")handler
(function) - Function to handle the command
bot.registerCommand('!hello', async (context) => {
return { success: true, response: 'Hello World!' };
});
bot.database.query(sql, params)
Execute a SQL query on the bot's database.
Parameters
sql
(string) - SQL query stringparams
(array) - Query parameters
Memory API
bot.memory.store(username, content, category)
Store a memory for a specific user.
Parameters
username
(string) - User to store memory forcontent
(string) - Memory contentcategory
(string) - Memory category