Skip to content

🎬 Open-source, self-hosted AI agent that runs a YouTube channel end to end: researches topics, writes scripts, generates narration, visuals and video, optimizes SEO, and publishes after your approval, then learns from analytics. Works with Gemini, OpenAI, OpenRouter, DeepSeek and more.

v2.0: Update all AI models to current (June 2026) and rewrite README

darkzOGxc9864b947b6a
diff --git a/.env.example b/.env.example
index bf2cc32..63dec8a 100644
--- a/.env.example
+++ b/.env.example
@@ -1,8 +1,20 @@
# YouTube Automation Agent Environment Configuration
# Copy this file to .env and fill in your actual values
-# OpenAI Configuration (Required for DALL-E, TTS, and GPT)
+# AI Provider - Choose one or both
OPENAI_API_KEY=your-openai-api-key-here
+# GEMINI_API_KEY=your-gemini-api-key-here
+
+# ElevenLabs TTS (optional, higher quality than OpenAI TTS)
+# ELEVENLABS_API_KEY=your-elevenlabs-api-key-here
+# ELEVENLABS_VOICE_ID=your-voice-id-here
+
+# Replicate (optional, for AI video generation)
+# REPLICATE_API_KEY=your-replicate-api-key-here
+
+# Azure Speech TTS (optional alternative)
+# AZURE_SPEECH_KEY=your-azure-speech-key-here
+# AZURE_SPEECH_REGION=eastus
# Application Settings
NODE_ENV=production
@@ -31,9 +43,6 @@ IMAGE_QUALITY=90
GLOBAL_RATE_LIMIT_PER_HOUR=50
DEFAULT_DELAY_BETWEEN_POSTS=60000
-# TTS Settings
-TTS_VOICE=en-US-JennyNeural
-
# Security
JWT_SECRET=generate-a-random-secret-here
diff --git a/README.md b/README.md
index 748ee28..e8470a6 100644
--- a/README.md
+++ b/README.md
@@ -1,264 +1,227 @@
-# 🎬 YouTube Automation Agent
+# YouTube Automation Agent
-A fully automated YouTube channel management system that creates, optimizes, and publishes content daily using AI agents. No coding required - just configure and let the AI agents handle your YouTube channel 24/7!
+## What's New in v2.0
-## ✨ What This Does
+- **Model upgrades across the board** β€” GPT-5.5 / GPT-5.5 Instant replace GPT-4-turbo, GPT Image 2 replaces DALL-E 3, Gemini 3.5 Flash/Pro replace Gemini 1.x, ElevenLabs Eleven v3 replaces v1, Wan 2.7 replaces Stable Video Diffusion
+- **OpenAI SDK v6** β€” upgraded from v4, along with `@google/genai` v2.9, `replicate` v1.4, `googleapis` v173
+- **Revamped setup wizard** β€” new TTS service picker (OpenAI TTS / ElevenLabs / Azure), ElevenLabs credential setup, updated model selection menus
+- **Fixed deprecated API patterns** β€” OpenAI v3 SDK calls in credential testing replaced with v4+ patterns
+- **Dynamic year in content strategy** β€” no more hardcoded "2025" in trend analysis prompts
+- **README rewrite** β€” developer-focused docs with Mermaid architecture diagrams, no fluff
-This system runs 24/7 to:
-- 🎯 Research trending topics in your niche
-- ✍️ Write engaging video scripts automatically
-- 🎨 Generate eye-catching thumbnails
-- πŸ“ˆ Optimize SEO for maximum reach
-- πŸ“… Upload and schedule videos
-- πŸ“Š Analyze performance and improve over time
+---
-## πŸ’‘ How It Works - No Claude Required!
+Fully automated YouTube channel management system. AI agents handle content strategy, scriptwriting, thumbnail generation, SEO, publishing, and analytics β€” end to end, on a daily schedule.
-**You do NOT need Claude to use this system!** The YouTube Automation Agent is designed to work with multiple AI providers, giving you flexibility and cost control.
+## Architecture
-### πŸ€– AI Provider Options
+```mermaid
+graph TD
+ A[Content Strategy Agent] --> B[Script Writer Agent]
+ B --> C[Thumbnail Designer Agent]
+ B --> D[SEO Optimizer Agent]
+ C --> E[Production Management Agent]
+ D --> E
+ E --> F[Publishing & Scheduling Agent]
+ F --> G[Analytics & Optimization Agent]
+ G -->|feedback loop| A
+```
-1. **OpenAI (Recommended)**
- - GPT-4 for intelligent content generation
- - DALL-E 3 for stunning thumbnails
- - Whisper for speech processing
- - **Cost**: ~$0.10-0.30 per video
- - **Best for**: Professional creators wanting highest quality
+## How It Works
-2. **Google Gemini (Budget-Friendly)**
- - Free tier: 60 requests/minute
- - Can generate multiple videos daily at no cost
- - **Cost**: FREE for most users
- - **Best for**: Beginners and hobby creators
+Each agent handles one stage of the pipeline:
-3. **Custom AI Integration**
- - Support for Anthropic Claude (if you prefer)
- - Local models via Ollama
- - Any OpenAI-compatible API
+| Agent | Role |
+|-------|------|
+| **Content Strategy** | Analyzes YouTube trends, identifies topics, plans content calendar |
+| **Script Writer** | Generates scripts with hooks, storytelling, CTAs |
+| **Thumbnail Designer** | Creates thumbnails, runs A/B variations |
+| **SEO Optimizer** | Keywords, titles, descriptions, tags |
+| **Production** | Coordinates TTS audio, image assets, video assembly |
+| **Publishing** | Uploads, schedules, manages playlists |
+| **Analytics** | Tracks performance, feeds insights back to strategy |
-### πŸ“Š What Each Agent Does
+## AI Providers
-```javascript
-// Content Strategy Agent
-β†’ Analyzes YouTube trends via API
-β†’ Identifies viral topics in your niche
-β†’ Plans content calendar automatically
-
-// Script Writer Agent
-β†’ Writes engaging scripts with hooks
-β†’ Adds storytelling and call-to-actions
-β†’ Optimizes for watch time
-
-// Thumbnail Designer Agent
-β†’ Generates eye-catching thumbnails
-β†’ A/B tests different designs
-β†’ Optimizes for click-through rate
-
-// SEO Optimizer Agent
-β†’ Researches high-performing keywords
-β†’ Optimizes titles and descriptions
-β†’ Manages tags and metadata
-
-// Publishing Agent
-β†’ Uploads videos automatically
-β†’ Schedules for optimal times
-β†’ Manages playlists and end screens
-```
+### OpenAI (recommended)
+
+- **Language**: GPT-5.5 / GPT-5.5 Instant
+- **Images**: GPT Image 2
+- **TTS**: GPT-4o-mini-tts
+- **Cost**: ~$0.05–0.20 per video
-### πŸ’° Cost Breakdown
+### Google Gemini (free tier)
-| Component | Free Tier | Paid Usage |
-|-----------|-----------|------------|
-| **YouTube API** | βœ… 10,000 units/day | βœ… Same |
-| **OpenAI** | ❌ None | ~$0.20/video |
-| **Google Gemini** | βœ… 60 req/min | $0.00035/1k chars |
-| **Hosting** | βœ… Local PC | $5-20/month VPS |
-| **Total Monthly** | **$0** | **$6-50** |
+- **Language**: Gemini 3.5 Flash / Gemini 3.5 Pro
+- **Cost**: Free for most usage volumes
-### πŸ–₯️ Deployment Options
+### Other integrations
-- **Local Computer**: Run on your PC/Mac (free)
-- **Raspberry Pi**: Low-power home automation (~$50 one-time)
-- **Cloud VPS**: DigitalOcean, Linode ($5/month)
-- **Free Cloud**: Railway, Render (with limitations)
-- **Serverless**: Vercel, Netlify (pay-per-use)
+- Anthropic Claude (`claude-opus-4-8`, `claude-haiku-4-5`)
+- ElevenLabs (premium TTS with Eleven v3)
+- Replicate (Wan 2.7 video generation)
+- Local models via Ollama
+- Any OpenAI-compatible API
-## πŸš€ Quick Start
+## Quick Start
+
+```bash
+git clone https://github.com/darkzOGx/youtube-automation-agent.git
+cd youtube-automation-agent
+npm install
+cp .env.example .env
+cp config/credentials.example.json config/credentials.json
+npm run setup # interactive credential wizard
+npm start
+```
+
+Dashboard runs at `http://localhost:3456`.
### Prerequisites
-- Node.js 18+ ([Download here](https://nodejs.org/))
-- Google Account (for YouTube API)
-- AI Provider Account (choose one):
- - OpenAI account ([Sign up](https://platform.openai.com/signup)) OR
- - Google AI Studio account ([Sign up - FREE](https://makersuite.google.com/))
-- 10 minutes for initial setup
-
-### Installation
-
-1. **Clone the repository**
- ```bash
- git clone https://github.com/darkzOGx/youtube-automation-agent.git
- cd youtube-automation-agent
- npm install
- ```
-
-2. **Configure your credentials**
- ```bash
- # Copy example files
- cp .env.example .env
- cp config/credentials.example.json config/credentials.json
-
- # Run interactive setup
- npm run setup
- ```
-
- The setup wizard will help you:
- - Get YouTube API credentials (step-by-step guide included)
- - Choose and configure AI provider
- - Set your channel preferences
- - Configure automation schedule
-
-3. **Start the system**
- ```bash
- npm start
- ```
-
-4. **Access the dashboard**
- Open http://localhost:3456 in your browser
-
-## 🎯 Use Cases
-
-- **Educational Channels**: Automate tutorial and explainer videos
-- **News Channels**: Auto-generate daily news summaries
-- **Story Channels**: Create animated story content
-- **Gaming Channels**: Generate game guides and tips
-- **Tech Channels**: Automate product reviews and comparisons
-- **Kids Content**: Create educational kids videos
-- **Meditation/Relaxation**: Generate ambient content
-- **Compilation Channels**: Automate "Top 10" style videos
-
-## πŸ”§ Configuration
-
-### Getting Your API Keys (Step-by-Step)
-
-#### Option 1: YouTube Data API (Required - FREE)
-1. Go to [Google Cloud Console](https://console.cloud.google.com/)
-2. Click "Create Project" (name it "YouTube Automation")
-3. In the left menu, go to "APIs & Services" β†’ "Library"
-4. Search for "YouTube Data API v3" and click "Enable"
-5. Go to "Credentials" β†’ "Create Credentials" β†’ "OAuth client ID"
-6. Choose "Desktop app" as application type
-7. Download the JSON file and save as `config/credentials.json`
-
-**Visual Guide**: [YouTube API Setup Tutorial](https://developers.google.com/youtube/v3/getting-started)
-
-#### Option 2A: OpenAI API (Recommended for Quality)
-1. Visit [OpenAI Platform](https://platform.openai.com/)
-2. Click "API Keys" in sidebar
-3. Click "Create new secret key"
-4. Copy key to `.env` file as `OPENAI_API_KEY`
-5. Add $5-10 credits to get started
-
-**Pricing**: ~$0.01 per 1K tokens (approx 750 words)
-
-#### Option 2B: Google Gemini API (FREE Alternative)
-1. Visit [Google AI Studio](https://makersuite.google.com/)
-2. Click "Get API Key"
-3. Create API key for new or existing project
-4. Copy key to `.env` file as `GEMINI_API_KEY`
-
-**Pricing**: FREE for 60 requests/minute, perfect for most users!
+
+- Node.js 18+
+- Google account (YouTube Data API β€” free)
+- At least one AI provider key (OpenAI or Gemini)
+
+## Configuration
+
+### API Keys
+
+#### YouTube Data API (required, free)
+
+1. Create a project in [Google Cloud Console](https://console.cloud.google.com/)
+2. Enable **YouTube Data API v3**
+3. Create an OAuth 2.0 client (Desktop app)
+4. Save the JSON as `config/credentials.json`
+
+#### OpenAI
+
+1. Get a key from [platform.openai.com](https://platform.openai.com/)
+2. Set `OPENAI_API_KEY` in `.env`
+
+#### Google Gemini
+
+1. Get a key from [Google AI Studio](https://aistudio.google.com/)
+2. Set `GEMINI_API_KEY` in `.env`
### Environment Variables
```env
-# Core Settings
-NODE_ENV=production
-PORT=3456
-LOG_LEVEL=info
+# AI providers (pick one or both)
+OPENAI_API_KEY=sk-...
+# GEMINI_API_KEY=...
-# AI Provider (choose one)
-OPENAI_API_KEY=your-key-here
-# OR
-GEMINI_API_KEY=your-key-here
+# Optional: premium TTS
+# ELEVENLABS_API_KEY=...
+# ELEVENLABS_VOICE_ID=...
-# YouTube Settings
-YOUTUBE_REGION=US
-DEFAULT_PRIVACY_STATUS=public
+# Optional: AI video generation
+# REPLICATE_API_KEY=...
-# Content Settings
+# App config
+NODE_ENV=production
+PORT=3456
CHANNEL_NAME=Your Channel Name
TARGET_AUDIENCE=Your target audience
-POSTING_FREQUENCY=daily
+YOUTUBE_REGION=US
+DEFAULT_PRIVACY_STATUS=public
```
-## 🚦 First Run Tutorial
+## Automation Schedule
-After setup, here's how to generate your first video:
+```mermaid
+gantt
+ title Daily Pipeline
+ dateFormat HH:mm
+ axisFormat %H:%M
-```bash
-# Test content generation
-npm run test
+ section Content
+ Generate content (strategy + script + thumbnail + SEO) :06:00, 2h
-# Generate a single video manually
-curl -X POST http://localhost:3456/generate \
- -H "Content-Type: application/json" \
- -d '{"topic": "Top 10 Life Hacks", "style": "listicle"}'
+ section Publishing
+ Process publishing queue :crit, 08:00, 14h
-# Start full automation
-npm start
+ section Analytics
+ Collect analytics :09:00, 1h
+ Run optimizations :22:00, 1h
```
-## πŸ“‹ Daily Usage
-
-### Automation Schedule
-Once configured, the system runs automatically:
-
-- **6:00 AM**: Generates new content (strategy, script, thumbnail, SEO)
-- **Every 15 minutes**: Processes publishing queue
-- **9:00 AM**: Collects analytics data
-- **10:00 PM**: Runs optimization tasks
-- **Weekly**: Strategy review and performance analysis
+The scheduler runs automatically after `npm start`. Content generation at 06:00, publishing queue processed every 15 minutes, analytics at 09:00, optimization at 22:00. Weekly strategy reviews run on Sundays.
-### Manual Operations
+## API
-#### Generate Content Immediately
```bash
+# health check
+curl http://localhost:3456/health
+
+# generate a video on demand
curl -X POST http://localhost:3456/generate \
-H "Content-Type: application/json" \
- -d '{"topic": "Your Topic", "style": "tutorial"}'
-```
+ -d '{"topic": "Top 10 Life Hacks", "style": "listicle"}'
-#### View Schedule
-```bash
+# view schedule
curl http://localhost:3456/schedule
-```
-#### Get Analytics
-```bash
+# get analytics
curl http://localhost:3456/analytics
+
+# publish a specific content item
+curl -X POST http://localhost:3456/publish/:contentId
```
-## πŸ› οΈ Customization Guide
+## Production Pipeline
+
+```mermaid
+flowchart LR
+ subgraph TTS["Audio Generation"]
+ direction TB
+ EL[ElevenLabs v3] -.->|fallback| OA[OpenAI TTS]
+ OA -.->|fallback| SIM1[Simulation]
+ end
+
+ subgraph IMG["Image Generation"]
+ direction TB
+ GPT[GPT Image 2] -.->|fallback| SIM2[Simulation]
+ end
+
+ subgraph VID["Video Assembly"]
+ direction TB
+ WAN[Wan 2.7 I2V] -.->|fallback| PW[Playwright Slideshow]
+ PW -.->|fallback| SIM3[Simulation]
+ end
+
+ TTS --> MIX[FFmpeg Mux]
+ IMG --> VID
+ VID --> MIX
+ MIX --> OUT[Final Video]
+```
+
+Each stage has graceful fallbacks. If a paid API key isn't configured, the system simulates that step so the rest of the pipeline still runs.
-### Switching AI Providers
+## Extending
-To use Claude instead of OpenAI:
+### Custom AI provider
```javascript
// utils/ai-service.js
+const Anthropic = require('@anthropic-ai/sdk');
+
class ClaudeAIService {
+ constructor(apiKey) {
+ this.client = new Anthropic({ apiKey });
+ }
async generateContent(prompt) {
- return await anthropic.complete({
- model: 'claude-3-sonnet',
- prompt: prompt,
- max_tokens: 1000
+ const message = await this.client.messages.create({
+ model: 'claude-opus-4-8',
+ max_tokens: 1024,
+ messages: [{ role: 'user', content: prompt }]
});
+ return message.content[0].text;
}
}
```
-### Adding Custom Content Types
+### Custom content types
```javascript
// agents/content-strategy-agent.js
@@ -268,124 +231,45 @@ const contentTypes = {
style: 'conversational',
thumbnail: 'podcast-style'
},
- // Add your custom type here
};
```
-## πŸ—οΈ Architecture
+## Project Structure
-### Agent Communication Flow
-```
-Content Strategy Agent
- ↓
-Script Writer Agent
- ↓
-Thumbnail Designer Agent β†’ Production Management Agent
- ↓ ↓
-SEO Optimizer Agent β†’ Publishing & Scheduling Agent
- ↓ ↓
-Analytics & Optimization Agent ← YouTube Upload
-```
-
-### File Structure
```
youtube-automation-agent/
-β”œβ”€β”€ agents/ # AI agent implementations
-β”œβ”€β”€ config/ # Configuration files
-β”œβ”€β”€ database/ # Database management
-β”œβ”€β”€ data/ # Generated content and assets
-β”œβ”€β”€ logs/ # Application logs
-β”œβ”€β”€ schedules/ # Automation schedulers
-β”œβ”€β”€ utils/ # Utility functions
-β”œβ”€β”€ workflows/ # Content workflows
-└── uploads/ # Temporary upload files
+β”œβ”€β”€ agents/ # one file per agent
+β”œβ”€β”€ config/ # credentials, example configs
+β”œβ”€β”€ database/ # SQLite schema and access layer
+β”œβ”€β”€ data/ # generated content and assets
+β”œβ”€β”€ schedules/ # cron-based automation
+β”œβ”€β”€ utils/ # AI service wrappers, logging, credential management
+β”œβ”€β”€ workflows/ # daily and weekly pipeline orchestration
+β”œβ”€β”€ uploads/ # temporary upload staging
+└── index.js # Express server + agent initialization
```
-## πŸ”’ Security & Privacy
-
-- All API keys are stored locally in encrypted configuration
-- No content is sent to external services except configured APIs
-- Local database with automatic backups
-- Rate limiting to respect API quotas
-- Error logging without sensitive data exposure
-
-## πŸ“ˆ Performance Optimization
-
-### Content Strategy
-- **Trend Analysis**: Real-time monitoring of trending topics
-- **Competitor Research**: Automated analysis of successful channels
-- **Audience Insights**: Performance-based audience targeting
-- **Seasonal Optimization**: Content timing based on seasonal trends
-
-### Technical Optimization
-- **Thumbnail A/B Testing**: Automatic testing of different designs
-- **Title Optimization**: SEO-optimized titles with power words
-- **Publishing Time**: Data-driven optimal scheduling
-- **Keyword Research**: Performance-based keyword optimization
-
-## 🌟 Success Stories
-
-- **Educational Channel**: 50K subscribers in 3 months
-- **Story Channel**: 1M+ views per month on autopilot
-- **News Channel**: 24/7 automated news coverage
-- **Kids Channel**: $5K/month ad revenue, fully automated
-
-## ❓ Frequently Asked Questions
-
-**Q: Do I need coding knowledge?**
-A: No! Just follow the setup wizard and you're ready to go.
-
-**Q: Can I use this for multiple channels?**
-A: Yes! Run multiple instances with different configurations.
-
-**Q: Is this against YouTube ToS?**
-A: No, as long as you create original content and follow YouTube guidelines.
-
-**Q: How much does it cost to run?**
-A: Can be completely FREE with Gemini, or ~$10-50/month with OpenAI.
+## Troubleshooting
-**Q: Can I customize the content style?**
-A: Yes! Full control over tone, style, topics, and format.
+| Problem | Fix |
+|---------|-----|
+| YouTube API quota exceeded | Check quotas in Google Cloud Console; reduce posting frequency |
+| Content generation failed | Verify API keys and credits; check `logs/` |
+| Publishing failed | Re-authenticate YouTube OAuth tokens; check video format |
-## πŸ†˜ Troubleshooting
+Enable debug logging:
-### Common Issues
-
-#### "YouTube API quota exceeded"
-- Check your Google Cloud Console quotas
-- Implement additional rate limiting if needed
-- Consider upgrading your quota limits
-
-#### "Content generation failed"
-- Verify AI service API keys and credits
-- Check internet connectivity
-- Review error logs in `logs/` directory
-
-#### "Publishing failed"
-- Confirm YouTube OAuth tokens are valid
-- Check video file sizes and formats
-- Verify channel permissions
-
-### Debug Mode
-Enable detailed logging:
```bash
NODE_ENV=development DEBUG_MODE=true npm start
```
-### Health Check
-```bash
-curl http://localhost:3456/health
-```
-
-## 🀝 Contributing
+## Contributing
-1. Fork the repository
+1. Fork the repo
2. Create a feature branch
-3. Make your changes
-4. Add tests for new functionality
-5. Submit a pull request
+3. Make changes and add tests
+4. Submit a PR
-### Development Setup
```bash
git clone <your-fork>
cd youtube-automation-agent
@@ -393,39 +277,17 @@ npm install
npm run dev
```
-## πŸ“„ License
-
-This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
-
-## πŸ™ Acknowledgments
-
-- **OpenAI** for GPT models
-- **Google** for YouTube Data API and Gemini
-- **YouTube Creator Community** for inspiration and feedback
+## License
-## πŸ“ž Support
+MIT β€” see [LICENSE](LICENSE).
-- **Issues**: [GitHub Issues](https://github.com/darkzOGx/youtube-automation-agent/issues)
-- **Discussions**: [GitHub Discussions](https://github.com/darkzOGx/youtube-automation-agent/discussions)
-- **Wiki**: [Setup Guides & Tutorials](https://github.com/darkzOGx/youtube-automation-agent/wiki)
+## Acknowledgments
-## πŸš€ Get Started in 10 Minutes!
-
-```bash
-# Quick start commands
-git clone https://github.com/darkzOGx/youtube-automation-agent.git
-cd youtube-automation-agent
-npm install
-npm run setup
-npm start
-```
-
-**⭐ Star this repository if it helps you automate your YouTube success!**
-
-**πŸ”” Watch this repo to get notified of new features and updates!**
+- [OpenAI](https://openai.com/) β€” GPT-5.5, GPT Image 2, GPT-4o-mini-tts
+- [Google](https://ai.google.dev/) β€” YouTube Data API, Gemini 3.5
+- [ElevenLabs](https://elevenlabs.io/) β€” Eleven v3 TTS
+- [Replicate](https://replicate.com/) β€” Wan 2.7 video generation
---
-**⚠️ Disclaimer**: This tool is designed for legitimate content creation. Please comply with YouTube's Terms of Service and Community Guidelines. The creators are not responsible for any misuse of this software.
-
-*Built with ❀️ by the community. Making YouTube automation accessible to everyone.*
\ No newline at end of file
+> This tool is for legitimate content creation. Comply with [YouTube's Terms of Service](https://www.youtube.com/t/terms) and Community Guidelines.
diff --git a/agents/content-strategy-agent.js b/agents/content-strategy-agent.js
index 7189610..bb09813 100644
--- a/agents/content-strategy-agent.js
+++ b/agents/content-strategy-agent.js
@@ -265,7 +265,7 @@ class ContentStrategyAgent {
const angles = [
`The Ultimate Guide to ${topic}`,
`${topic}: What Nobody Is Telling You`,
- `How ${topic} Will Change Everything in 2025`,
+ `How ${topic} Will Change Everything in ${new Date().getFullYear()}`,
`The Hidden Truth About ${topic}`,
`${topic} Explained in 5 Minutes`,
`Why ${topic} Is More Important Than You Think`,
diff --git a/config/credentials.example.json b/config/credentials.example.json
index aa28034..f5722a9 100644
--- a/config/credentials.example.json
+++ b/config/credentials.example.json
@@ -8,7 +8,7 @@
},
"openai": {
"apiKey": "YOUR_OPENAI_API_KEY",
- "model": "gpt-4-turbo-preview"
+ "model": "gpt-5.5"
},
"channel": {
"channelName": "Your Channel Name",
diff --git a/index.js b/index.js
index 5b08038..8444cfa 100644
--- a/index.js
+++ b/index.js
@@ -25,7 +25,7 @@ class YouTubeAutomationAgent {
async initialize() {
try {
- console.log(chalk.cyan.bold('\n🎬 YouTube Automation Agent v1.0'));
+ console.log(chalk.cyan.bold('\n🎬 YouTube Automation Agent v2.0'));
console.log(chalk.gray('─'.repeat(50)));
// Initialize database
diff --git a/package.json b/package.json
index 2ef71f4..472be7f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "youtube-automation-agent",
- "version": "1.0.0",
+ "version": "2.0.0",
"description": "Fully automated YouTube channel management system with specialized AI agents",
"main": "index.js",
"scripts": {
@@ -22,22 +22,22 @@
},
"dependencies": {
"@google-cloud/local-auth": "^3.0.0",
- "@google/generative-ai": "^0.1.3",
- "axios": "^1.6.0",
+ "@google/genai": "^2.9.0",
+ "axios": "^1.7.0",
"chalk": "^4.1.2",
"cron": "^3.1.6",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"form-data": "^4.0.4",
- "googleapis": "^128.0.0",
+ "googleapis": "^173.0.0",
"inquirer": "^8.2.6",
"jimp": "^0.22.10",
"microsoft-cognitiveservices-speech-sdk": "^1.45.0",
"moment": "^2.29.4",
"node-cron": "^3.0.2",
- "openai": "^4.20.0",
+ "openai": "^6.0.0",
"playwright": "^1.54.2",
- "replicate": "^1.0.1",
+ "replicate": "^1.4.0",
"sqlite3": "^5.1.6",
"winston": "^3.11.0"
},
diff --git a/utils/ai-video-generator.js b/utils/ai-video-generator.js
index 2b26276..aced014 100644
--- a/utils/ai-video-generator.js
+++ b/utils/ai-video-generator.js
@@ -68,7 +68,7 @@ class AIVideoGenerator {
const data = {
text: text,
- model_id: "eleven_monolingual_v1",
+ model_id: "eleven_v3",
voice_settings: {
stability: 0.5,
similarity_boost: 0.8,
@@ -103,8 +103,8 @@ class AIVideoGenerator {
async generateOpenAITTS(text, outputPath) {
const response = await this.openai.audio.speech.create({
- model: "tts-1-hd",
- voice: "nova",
+ model: "gpt-4o-mini-tts",
+ voice: "coral",
input: text,
speed: 1.0
});
@@ -125,24 +125,24 @@ class AIVideoGenerator {
}
const enhancedPrompt = this.enhanceVisualPrompt(prompt, style);
-
- // Use DALL-E 3 for high-quality images
- const response = await this.openai.images.generate({
- model: "dall-e-3",
- prompt: enhancedPrompt,
- n: count,
- size: "1792x1024", // 16:9 aspect ratio for video
- quality: "hd",
- style: "natural"
- });
-
- const imageUrls = response.data.map(img => img.url);
const localPaths = [];
- // Download images locally
- for (let i = 0; i < imageUrls.length; i++) {
+ for (let i = 0; i < count; i++) {
+ const response = await this.openai.images.generate({
+ model: "gpt-image-2",
+ prompt: enhancedPrompt,
+ n: 1,
+ size: "1536x1024",
+ quality: "high",
+ });
+
const imagePath = path.join(__dirname, '..', 'data', 'assets', `visual_${Date.now()}_${i}.png`);
- await this.downloadImage(imageUrls[i], imagePath);
+ if (response.data[0].b64_json) {
+ const buffer = Buffer.from(response.data[0].b64_json, 'base64');
+ await fs.writeFile(imagePath, buffer);
+ } else {
+ await this.downloadImage(response.data[0].url, imagePath);
+ }
localPaths.push(imagePath);
}
@@ -201,18 +201,14 @@ class AIVideoGenerator {
}
async generateReplicateVideo(script, visualAssets, audioPath, outputPath) {
- // Use Stable Video Diffusion or similar model
const output = await this.replicate.run(
- "stability-ai/stable-video-diffusion:3f0457e4619daac51203dedb1a4f46e66251bb3bfb18edd25d728dda8aa28ab7",
+ "wan-video/wan-2.7-i2v",
{
input: {
- cond_aug: 0.02,
- decoding_t: 7,
- input_image: visualAssets[0], // Use first image as base
- video_length: "14_frames_with_svd",
- sizing_strategy: "maintain_aspect_ratio",
- motion_bucket_id: 127,
- fps_id: 6
+ image: visualAssets[0],
+ prompt: script.title || "smooth cinematic motion",
+ duration: 5,
+ resolution: "720p"
}
}
);
@@ -552,22 +548,26 @@ class AIVideoGenerator {
const prompt = `YouTube thumbnail for "${script.title}", ${style} style, eye-catching, high contrast text, professional design, clickable, engaging`;
const response = await this.openai.images.generate({
- model: "dall-e-3",
+ model: "gpt-image-2",
prompt: prompt,
n: 1,
- size: "1792x1024",
- quality: "hd"
+ size: "1536x1024",
+ quality: "high"
});
const thumbnailPath = path.join(__dirname, '..', 'uploads', 'thumbnails', `thumbnail_${Date.now()}.png`);
await fs.mkdir(path.dirname(thumbnailPath), { recursive: true });
-
- await this.downloadImage(response.data[0].url, thumbnailPath);
-
+
+ if (response.data[0].b64_json) {
+ const buffer = Buffer.from(response.data[0].b64_json, 'base64');
+ await fs.writeFile(thumbnailPath, buffer);
+ } else {
+ await this.downloadImage(response.data[0].url, thumbnailPath);
+ }
+
return {
path: thumbnailPath,
- url: response.data[0].url,
- dimensions: { width: 1792, height: 1024 },
+ dimensions: { width: 1536, height: 1024 },
fileSize: await this.getFileSize(thumbnailPath)
};
} catch (error) {
diff --git a/utils/credential-manager.js b/utils/credential-manager.js
index 5131c9a..9ca0e61 100644
--- a/utils/credential-manager.js
+++ b/utils/credential-manager.js
@@ -171,12 +171,11 @@ class CredentialManager {
name: 'model',
message: 'Select your preferred model:',
choices: [
- 'gpt-4-turbo-preview',
- 'gpt-4',
- 'gpt-3.5-turbo',
- 'gpt-3.5-turbo-16k'
+ 'gpt-5.5',
+ 'gpt-5.5-instant',
+ 'gpt-5.4'
],
- default: 'gpt-4-turbo-preview'
+ default: 'gpt-5.5'
}
]);
@@ -192,19 +191,30 @@ class CredentialManager {
// Google Gemini API Setup
async setupGeminiCredentials() {
console.log(chalk.cyan('\nπŸ’Ž Google Gemini API Setup'));
- console.log(chalk.gray('Get your API key from: https://makersuite.google.com/app/apikey'));
-
+ console.log(chalk.gray('Get your API key from: https://aistudio.google.com/apikey'));
+
const answers = await inquirer.prompt([
{
type: 'password',
name: 'apiKey',
message: 'Enter your Gemini API Key:',
validate: input => input.length > 0 || 'API key is required'
+ },
+ {
+ type: 'list',
+ name: 'model',
+ message: 'Select your preferred Gemini model:',
+ choices: [
+ 'gemini-3.5-flash',
+ 'gemini-3.5-pro'
+ ],
+ default: 'gemini-3.5-flash'
}
]);
this.credentials.gemini = {
- apiKey: answers.apiKey
+ apiKey: answers.apiKey,
+ model: answers.model
};
await this.saveCredentials();
@@ -427,13 +437,10 @@ class CredentialManager {
// Test OpenAI API
if (this.credentials.openai) {
try {
- const { Configuration, OpenAIApi } = require('openai');
- const configuration = new Configuration({
- apiKey: this.credentials.openai.apiKey,
- });
- const openai = new OpenAIApi(configuration);
-
- await openai.listModels();
+ const OpenAI = require('openai');
+ const openai = new OpenAI({ apiKey: this.credentials.openai.apiKey });
+
+ await openai.models.list();
results.openai = true;
console.log(chalk.green('βœ… OpenAI API connection successful'));
} catch (error) {
@@ -477,8 +484,8 @@ class CredentialManager {
name: 'service',
message: 'Select your preferred AI service:',
choices: [
- { name: 'OpenAI (GPT-4/GPT-3.5)', value: 'openai' },
- { name: 'Google Gemini', value: 'gemini' },
+ { name: 'OpenAI (GPT-5.5)', value: 'openai' },
+ { name: 'Google Gemini (Gemini 3.5)', value: 'gemini' },
{ name: 'Both (OpenAI primary)', value: 'both' }
]
}
@@ -500,21 +507,50 @@ class CredentialManager {
name: 'service',
message: 'Select your preferred Text-to-Speech service:',
choices: [
- { name: 'Azure Speech Services (Recommended)', value: 'azure' },
- { name: 'Google Cloud TTS', value: 'google' },
- { name: 'AWS Polly', value: 'aws' },
+ { name: 'OpenAI TTS (gpt-4o-mini-tts, uses your OpenAI key)', value: 'openai-tts' },
+ { name: 'ElevenLabs (highest quality)', value: 'elevenlabs' },
+ { name: 'Azure Speech Services', value: 'azure' },
{ name: 'Skip TTS Setup', value: 'skip' }
]
}
]);
- if (service === 'azure') {
+ if (service === 'openai-tts') {
+ console.log(chalk.green('βœ… OpenAI TTS will use your existing OpenAI API key'));
+ } else if (service === 'elevenlabs') {
+ await this.setupElevenLabsCredentials();
+ } else if (service === 'azure') {
await this.setupAzureSpeechCredentials();
- } else if (service !== 'skip') {
- console.log(chalk.yellow(`\n⚠️ ${service.toUpperCase()} TTS setup not implemented yet.`));
- console.log(chalk.gray('You can manually configure it later in config/credentials.json'));
}
}
+
+ async setupElevenLabsCredentials() {
+ console.log(chalk.cyan('\nπŸŽ™οΈ ElevenLabs Setup'));
+ console.log(chalk.gray('Get your API key from: https://elevenlabs.io'));
+
+ const answers = await inquirer.prompt([
+ {
+ type: 'password',
+ name: 'apiKey',
+ message: 'Enter your ElevenLabs API Key:',
+ validate: input => input.length > 0 || 'API key is required'
+ },
+ {
+ type: 'input',
+ name: 'voiceId',
+ message: 'Enter your preferred Voice ID:',
+ validate: input => input.length > 0 || 'Voice ID is required'
+ }
+ ]);
+
+ this.credentials.elevenLabs = {
+ apiKey: answers.apiKey,
+ voiceId: answers.voiceId
+ };
+
+ await this.saveCredentials();
+ console.log(chalk.green('βœ… ElevenLabs credentials configured successfully!'));
+ }
}
// CLI interface for credential setup