Install
openclaw skills install sunomakerAutomated Suno AI Music Generation - Create professional songs without manual intervention. Headless browser automation for servers with Gemini 3.1 Pro integration.
openclaw skills install sunomakerDesigned for Linux servers without a graphical interface (Headless). Uses Xvfb Virtual Display to run Chrome in GUI mode without a monitor, bypassing Google's anti-automation systems.
Two core functions: Account Login (via Google OAuth) and Song Creation (custom lyrics + style + download).
Before any operation, the environment must be checked:
bash {baseDir}/suno-headless/check_env.sh
Return values:
0 = OK, logged in → songs can be created directly1 = Dependencies missing → installation required2 = Not logged in → start the login process# Xvfb Virtual Display (core dependency for headless environments)
sudo apt update && sudo apt install -y xvfb
# Google Chrome Browser
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update && sudo apt install -y google-chrome-stable
# Fonts for various languages
sudo apt install -y fonts-noto-cjk
cd {baseDir}/suno-headless
pip3 install -r requirements.txt
playwright install
⚠️ Important: Never hardcode credentials in the code! Always ask the user.
Two login methods are available:
The most stable login method for cloud servers. Completely bypasses Google's security checks.
Steps:
If login is required, explain to the user:
🍪 Recommended Cookie Import Method (bypasses Google security checks):
Step 1: On your local computer (with a browser), run:
pip install playwright && playwright install python3 export_cookies.pyA browser window will open. Log in to Suno manually. After a successful login, cookies will be exported automatically.
Step 2: Upload the cookie file to the server:
scp <exported-cookie-file> user@server:/root/suno_cookie/suno_cookies.jsonStep 3: After uploading, perform the import.
After uploading, run the import (default path: /root/suno_cookie/suno_cookies.json):
cd {baseDir}/suno-headless
python3 suno_login.py --import-cookies
⚠️ Caution: On cloud servers, this can trigger Google security prompts. Prefer Method A.
If login is required, always ask the user:
Suno.com login required (via Google account). Please provide:
- Gmail address
- Gmail password
⚠️ Credentials are only used for this login, not stored or shared with third parties.
After user input:
cd {baseDir}/suno-headless
python3 suno_login.py --email "<user-email>" --password "<user-password>"
Headless Linux Mode Explanation:
$DISPLAY variable)headless=False), but nothing is displayed on the screencd {baseDir}/suno-headless
python3 suno_login.py --check-only
Exit codes: 0 = Logged in, 2 = Not logged in
# Method A: Re-import cookies
cd {baseDir}/suno-headless
python3 suno_login.py --import-cookies "<new-cookie-file>"
# Method B: Re-enter email/password
cd {baseDir}/suno-headless
python3 suno_login.py --email "<email>" --password "<password>" --force-login
suno_login.py --check-only returns 0)If the user does not have a Gemini API Key:
When creating a song, Suno shows captchas. A Gemini API Key is required for automatic solving.
- Visit https://aistudio.google.com/app/apikey
- Click "Create API key"
- Copy the generated key
Save it in an environment file:
mkdir -p ~/.suno
echo "GEMINI_API_KEY=<user-key>" > ~/.suno/.env
Or as an environment variable:
export GEMINI_API_KEY="<user-key>"
Run this once before the first use (Suno uses its own hCaptcha domain, a patch is required):
cd {baseDir}/suno-headless
python3 patch_hcaptcha.py
cd {baseDir}/suno-headless
python3 suno_create_song.py \
--lyrics "<lyrics-content>" \
--style "<music-style-tags>" \
--title "<song-title>" \
--output-dir "<download-dir>"
Read lyrics from a file:
cd {baseDir}/suno-headless
python3 suno_create_song.py \
--lyrics-file "<lyrics-file-path>" \
--style "<music-style-tags>" \
--title "<song-title>"
Headless Mode Explanation:
suno_create_song.py automatically detects a GUI-free environment| Parameter | Description | Required | Default Value |
|---|---|---|---|
--lyrics | Song lyrics (alternative to --lyrics-file) | ✅ | - |
--lyrics-file | Path to the lyrics file (alternative to --lyrics) | ✅ | - |
--style | Music style tags (English, comma-separated) | ❌ | rock, electric guitar, energetic, male vocals |
--title | Song title | ❌ | My Song |
--output-dir | MP3 download directory | ❌ | {baseDir}/output_mp3 |
--gemini-key | Gemini API Key (alternatively: environment variable or ~/.suno/.env) | ❌ | Auto-Read |
Common style tags (English, combinable):
Examples:
rock, electric guitar, energetic, male vocals, englishpop, piano, emotional, female vocals, slow tempo, englishelectronic, synthesizer, upbeat, fast tempo, dancehip-hop, rap, bass, drums, energetic, english# 1. Check environment (automatically detects Xvfb, Chrome, etc.)
bash {baseDir}/suno-headless/check_env.sh
# 2. If not logged in, use the cookie import method (recommended)
# Step 1: Run export_cookies.py on the local computer
# Step 2: scp <cookie-file> user@server:/root/suno_cookie/suno_cookies.json
# Step 3: Import on the server (default: /root/suno_cookie/suno_cookies.json)
cd {baseDir}/suno-headless
python3 suno_login.py --import-cookies
# Or use the email/password method (can trigger Google security prompts)
# python3 suno_login.py --email "user@gmail.com" --password "password123"
# 3. Apply hCaptcha patch
python3 patch_hcaptcha.py
# 4. Create song (automatically with Xvfb Virtual Display)
python3 suno_create_song.py \
--lyrics "The sun rises over the city
A new day is dawning
We walk through the streets
And sing our song" \
--style "rock, electric guitar, energetic, male vocals, english" \
--title "Morning Song Rock Version"
| Feature | suno (Original) | suno-headless (This Version) |
|---|---|---|
| Target Environment | macOS / Linux with GUI | Linux Server without GUI |
| Display Mode | Real Chrome window | Xvfb Virtual Display (RAM simulation) |
| Additional Dependencies | None | xvfb + PyVirtualDisplay |
| Login Xvfb | ✅ Supported | ✅ Supported |
| Song Creation Xvfb | ❌ Not supported | ✅ Supported |
| Environment Check | Basic | Incl. Xvfb/Chrome/Font Check |
┌─────────────────────────────────────────┐
│ Linux Server (no monitor) │
│ │
│ ┌─────────────┐ ┌────────────────┐ │
│ │ Xvfb │ │ Chrome │ │
│ │ (Virtual │◄───│ (GUI Mode) │ │
│ │ Display) │ │ headless=False │ │
│ │ :99 1280x800│ └────────────────┘ │
│ └─────────────┘ │ │
│ ▲ │ │
│ │ Automated │
│ PyVirtualDisplay Suno.com Control │
│ Auto-Lifecycle │ │
│ │ ▼ │
│ │ ┌────────────────┐ │
│ │ │ Song Generation│ │
│ │ │ + Download │ │
│ │ └────────────────┘ │
└────────┼────────────────────────────────┘
│
▼
Memory (RAM)
$DISPLAY environment variable and starts Xvfb automatically if no GUI is presentchannel='chrome')persistent context maintains browser state (cookies, localStorage)headless=False + Xvfb Virtual Display bypasses Google's anti-automationstudio-api.prod.suno.com) polls the song generation statussuno-headless/
├── suno_login.py # Login tool (Google OAuth / Cookie Import + Xvfb)
├── suno_create_song.py # Song creation + download (Xvfb support)
├── export_cookies.py # Cookie export tool (run on local computer)
├── patch_hcaptcha.py # hCaptcha domain compatibility patch
├── check_env.sh # Environment check (incl. Xvfb/Chrome check)
├── requirements.txt # Python dependencies (incl. PyVirtualDisplay)
└── SKILL.md # This documentation
sudo apt install -y xvfb, otherwise it won't run in a headless environment# Check environment (incl. Xvfb status)
bash {baseDir}/suno-headless/check_env.sh
# Test Xvfb manually
Xvfb :99 -screen 0 1280x800x24 &
DISPLAY=:99 google-chrome --no-sandbox --version
kill %1
# View login screenshots
ls -la /tmp/suno_debug_*.png
# Check persistent context
ls -la ~/.suno/chrome_gui_profile/
# View cookies
python3 -c "import json; d=json.load(open('$HOME/.suno/cookies.json')); print(f'{len(d)} cookies')"
# Check Gemini API Key
cat ~/.suno/.env
# View downloaded songs
ls -la {baseDir}/output_mp3/