Loading repository dataβ¦
Loading repository dataβ¦
darkzOGx / repository
π¬ Fully automated YouTube channel management with AI agents. Creates, optimizes & publishes videos 24/7. Works with FREE Gemini API or OpenAI. No coding required!
API_KEY in .env and the mutating endpoints (POST /generate, POST /publish/:id) require a matching x-api-key header. Request bodies are validated and size-limited.private (set DEFAULT_PRIVACY_STATUS=public to opt in), and the uploader streams the real video file β it refuses to upload placeholder assets from simulated runs.sharp dependency (the app previously crashed on boot), created the missing automation_events table (every scheduled task previously threw on logging), fixed the double-insert in the content pipeline, and fixed the publish-queue removal.authenticate.js, simple-auth.js used Google's long-deprecated OOB flow), dead dependencies (cron, jimp), broken npm scripts, and committed build artifacts. Added ESLint (npm run lint) and GitHub Actions CI.@google/genai v2.9, replicate v1.4, googleapis v173Fully automated YouTube channel management system. AI agents handle content strategy, scriptwriting, thumbnail generation, SEO, publishing, and analytics β end to end, on a daily schedule.
@darkzOGx. Solo builder shipping AI automation and developer tools.
Find me on X and laderalabs.io.
If this saves you time, a star helps it reach more developers.
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
Each agent handles one stage of the pipeline:
| 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 |
All OpenAI-compatible providers work out of the box β the system auto-configures the SDK base URL. Pick one, or use OpenRouter to access everything through a single key.
graph LR
subgraph Direct
OA[OpenAI<br/>GPT-5.5]
GM[Gemini<br/>3.5 Flash/Pro]
KM[Kimi<br/>K2.6]
MM[MiMo<br/>V2.5 Pro]
GL[GLM<br/>GLM-5]
end
subgraph Router
OR[OpenRouter<br/>300+ models]
end
Direct --> YAA[YouTube Automation Agent]
Router --> YAA
| Provider | Models | Base URL | Cost |
|---|---|---|---|
| OpenAI | GPT-5.5, GPT-5.5 Instant | api.openai.com/v1 | ~$0.05β0.20/video |
| OpenRouter | 300+ (GPT, Claude, Gemini, Kimi, GLM, etc.) | openrouter.ai/api/v1 | varies by model |
| Google Gemini | Gemini 3.5 Flash, 3.5 Pro | via @google/genai SDK | free tier available |
| Kimi (Moonshot AI) | Kimi K2.6, K2.5 | api.moonshot.ai/v1 | ~80% cheaper than GPT-5.5 |
| MiMo (Xiaomi) | MiMo V2.5 Pro, V2.5 | api.xiaomimimo.com/v1 | competitive |
| GLM (Zhipu AI) | GLM-5, GLM-5.1 | api.z.ai/api/paas/v4/ | ~$1/M input tokens |
Additional integrations: Anthropic Claude (claude-opus-4-8), ElevenLabs (Eleven v3 TTS), Replicate (Wan 2.7 video), local models via Ollama, any OpenAI-compatible endpoint.
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.
config/credentials.jsonOPENAI_API_KEY in .envOPENROUTER_API_KEY in .envGEMINI_API_KEY in .env| Provider | Get key at | Env var |
|---|---|---|
| Kimi (Moonshot AI) | platform.kimi.ai | MOONSHOT_API_KEY |
| MiMo (Xiaomi) | mimo.mi.com | MIMO_API_KEY |
| GLM (Zhipu AI) | z.ai | GLM_API_KEY |
# AI provider β pick one (or use OpenRouter for access to all)
OPENAI_API_KEY=sk-...
# OPENROUTER_API_KEY=sk-or-...
# GEMINI_API_KEY=...
# MOONSHOT_API_KEY=...
# MIMO_API_KEY=...
# GLM_API_KEY=...
# Optional: premium TTS
# ELEVENLABS_API_KEY=...
# ELEVENLABS_VOICE_ID=...
# Optional: AI video generation
# REPLICATE_API_KEY=...
# App config
NODE_ENV=production
PORT=3456
CHANNEL_NAME=Your Channel Name
TARGET_AUDIENCE=Your target audience
YOUTUBE_REGION=US
DEFAULT_PRIVACY_STATUS=private
# Optional: protect mutating API routes (POST /generate, /publish)
# API_KEY=some-long-random-string
gantt
title Daily Pipeline
dateFormat HH:mm
axisFormat %H:%M
section Content
Generate content (strategy + script + thumbnail + SEO) :06:00, 2h
section Publishing
Process publishing queue :crit, 08:00, 14h
section Analytics
Collect analytics :09:00, 1h
Run optimizations :22:00, 1h
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.
# health check
curl http://localhost:3456/health
# generate a video on demand (send x-api-key if API_KEY is set in .env)
curl -X POST http://localhost:3456/generate \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
-d '{"topic": "Top 10 Life Hacks", "style": "list"}'
# view schedule
curl http://localhost:3456/schedule
# get analytics
curl http://localhost:3456/analytics
# publish a specific content item
curl -X POST http://localhost:3456/publish/:contentId
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.
// utils/ai-service.js
const Anthropic = require('@anthropic-ai/sdk');
class ClaudeAIService {
constructor(apiKey) {
this.client = new Anthropic({ apiKey });
}
async generateContent(prompt) {
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;
}
}
// agents/content-strategy-agent.js
const contentTypes = {
'podcast': {
duration: '10-15 minutes',
style: 'conversational',
thumbnail: 'podcast-style'
},
};
youtube-automation-agent/
βββ 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
βββ .github/ # CI workflow (lint + tests on every push/PR)
βββ index.js # Express server + agent initialization
| 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 |
Enable debug logging:
NODE_ENV=development DEBUG_MODE=true npm start
If this was useful, check out:
git clone <your-fork>
cd youtube-automation-agent
npm install
npm run lint # must pass β CI runs this on every PR
npm test
MIT β see LICENSE.