llm-music
LLM plugin for generating and playing playlists in Apple Music using AI.
Features
- 🤖 Generate playlists using natural language prompts
- 🎵 Automatically play generated playlists in Apple Music
- 📋 Create named playlists in your Apple Music library
- 🔍 Search your local library for matching tracks
Requirements
- macOS with Apple Music app installed
- Songs in your Apple Music library (or an Apple Music subscription)
- Python 3.8+
- LLM CLI tool
Installation
Install this plugin in the same environment as LLM:
llm install llm-music
Or install from source:
git clone https://github.com/yourusername/llm-music.git
cd llm-music
pip install -e .
Usage
The plugin adds a new command,…
llm-music
LLM plugin for generating and playing playlists in Apple Music using AI.
Features
- 🤖 Generate playlists using natural language prompts
- 🎵 Automatically play generated playlists in Apple Music
- 📋 Create named playlists in your Apple Music library
- 🔍 Search your local library for matching tracks
Requirements
- macOS with Apple Music app installed
- Songs in your Apple Music library (or an Apple Music subscription)
- Python 3.8+
- LLM CLI tool
Installation
Install this plugin in the same environment as LLM:
llm install llm-music
Or install from source:
git clone https://github.com/yourusername/llm-music.git
cd llm-music
pip install -e .
Usage
The plugin adds a new command, llm music. Simply describe the playlist you want:
# Generate and play a playlist
llm music chill indie songs for a rainy day
# Workout playlist
llm music high energy workout motivation
# Specific genre/era
llm music "90s hip hop classics"
# Late night coding session
llm music jazz for late night coding
Options
# Skip confirmation prompt
llm music relaxing piano music --yes
# Specify number of tracks
llm music summer road trip songs --tracks 20
# Use a specific LLM model
llm music party hits --model gpt-4
# Give the playlist a custom name
llm music focus music for work --playlist-name "Deep Focus"
# Play without saving a playlist to your library
llm music late night vibes --no-save
# Only show the playlist (don't play it)
llm music indie folk favorites --show-only
# Adjust creativity/randomness
llm music eclectic mix --temperature 0.9
Examples
# A mellow Sunday morning playlist
llm music lazy sunday morning coffee vibes
# Get pumped for a presentation
llm music confidence boosting power anthems
# Dinner party ambiance
llm music sophisticated dinner party jazz --tracks 15
# Throwback playlist
llm music nostalgic songs from my childhood in the 2000s
How It Works
- Prompt Processing: Your natural language description is sent to your configured LLM
- Playlist Generation: The AI generates a list of real songs that match your request
- Library Search: The plugin searches your Apple Music library for each track
- Playlist Creation: Found tracks are added to a new playlist
- Playback: The playlist starts playing automatically
Notes
- The plugin searches your local Apple Music library for tracks
- Songs not in your library will be skipped (you’ll see which ones weren’t found)
- For best results, have a well-populated Apple Music library or subscription
- The
--show-onlyflag is useful to preview playlists without Apple Music
Development
To set up this plugin locally:
cd llm-music
python3 -m venv venv
source venv/bin/activate
pip install -e '.[test]'
Run tests:
python -m pytest
Troubleshooting
"Apple Music is not available"
Make sure the Music app is installed and you’ve opened it at least once. The plugin needs to communicate with the app via AppleScript.
"No tracks were found in your library"
The generated songs aren’t in your Apple Music library. You can:
- Add the songs to your library manually
- Subscribe to Apple Music for access to a larger catalog
- Try a different prompt that might match songs you already have
Permission Issues
On first run, macOS may ask for permission to control the Music app. Grant this permission in System Preferences > Security & Privacy > Privacy > Automation.
License
MIT License - see LICENSE file for details.