Install
openclaw skills install spotify-cliControl Spotify playback on any Linux device via command line, requiring Spotify Premium and an active Spotify session on another device.
openclaw skills install spotify-cliA simple command-line interface for controlling Spotify playback from a Raspberry Pi (or any Linux system).
spotipy Python librarypip3 install spotipy --break-system-packages
http://127.0.0.1:8888/callbackmkdir -p ~/.config/spotify-cli
cat << EOF > ~/.config/spotify-cli/config
SPOTIPY_CLIENT_ID=your_client_id
SPOTIPY_CLIENT_SECRET=your_client_secret
SPOTIPY_REDIRECT_URI=http://127.0.0.1:8888/callback
EOF
The script automatically loads credentials from ~/.config/spotify-cli/config.
sudo cp spotify /usr/local/bin/spotify
sudo chmod +x /usr/local/bin/spotify
Run any command (e.g., spotify status). On first run, you'll get a URL to open in your browser. After authorizing, copy the redirect URL (even if the page doesn't load) and paste it when prompted.
| Command | Description |
|---|---|
spotify search <query> | Search for songs (shows top 5 results) |
spotify play <song> | Search and play a song |
spotify pause | Pause playback |
spotify resume | Resume playback |
spotify next | Skip to next track |
spotify prev | Previous track |
spotify status | Show currently playing track |
spotify devices | List available Spotify devices |
# Search for a song
spotify search "stairway to heaven"
# Play a song (tip: include artist for better results)
spotify play "stairway to heaven led zeppelin"
# Check what's playing
spotify status
# Control playback
spotify pause
spotify resume
spotify next
When using this tool on behalf of a user:
spotify search "query" to see results.spotify play "exact song name artist" with the correct title/artist from the search results.This avoids playing the wrong song due to Spotify's fuzzy search matching.
Example workflow:
# User asks: "play voice actor u projected 2"
# Step 1: Search first
spotify search "voice actor u projected 2"
# Results show: "U Projected 2 - Voice Actor, Yarrow.co"
# Step 2: Confirm with user that this is the right song
# Step 3: Play with exact match
spotify play "U Projected 2 Voice Actor"
Open Spotify on your phone/computer and play something, then try again.
Make sure Spotify is open on at least one device and logged into the same account.
Delete ~/.cache-* files and re-authenticate.