AI & Agents

How to Play Spotify on Raspberry Pi with OpenClaw AI Control

Spotify Connect turns a Raspberry Pi into a passive speaker that waits for your phone to pick a song. OpenClaw's spotify-player skill flips that relationship, giving you an AI agent that builds playlists, responds to natural language, and manages playback from a single low-power device. This guide walks through hardware selection, the five-step installation, and the commands that turn a $35 board into an intelligent music controller.

Fast.io Editorial Team 10 min read
AI agent managing workspace files and integrations

Why Most Pi Spotify Setups Stop Too Soon

Spotify reached 761 million monthly active users in Q1 2026. Nearly every "Raspberry Pi Spotify" tutorial on the internet covers the same thing: install Raspotify, configure Spotify Connect, and your Pi shows up as a speaker in the Spotify app. That works, but it wastes most of what a Pi can do. The Pi becomes a $35 Bluetooth speaker with extra steps.

The gap is control. Spotify Connect is a one-way street. Your phone or laptop picks the music, and the Pi receives audio. The Pi itself has no opinion about what to play, no ability to build a queue, and no way to respond to a voice request. You still reach for your phone every time you want to skip a track or switch playlists.

OpenClaw changes that. It is an open-source AI agent framework that runs on a Raspberry Pi, and its spotify-player skill connects directly to Spotify's Web API. Usage data from the skill shows that 42.5% of commands are playlist creation requests, not just play/pause. Another 30% are playback control. People are using the AI to curate music, not just press buttons.

This guide walks through the full setup: choosing hardware, installing OpenClaw on a Pi, creating a Spotify Developer app for API credentials, installing the spotify-player skill, and running your first AI-driven playback commands. By the end, your Pi will be an active music agent, not a passive receiver.

Hardware and Software You Need

The Raspberry Pi 5 with 8GB of RAM is the recommended board for running OpenClaw alongside Spotify playback. The Pi 4 (8GB) also works. OpenClaw's documentation lists 1GB as the minimum, but real-world usage with the Spotify skill, an LLM provider connection, and audio playback calls for more headroom. Skip the Pi 3 and Zero models for this project unless you plan to use PicoClaw, a lighter OpenClaw variant designed for constrained hardware.

Hardware checklist:

  • Raspberry Pi 5 (8GB) or Raspberry Pi 4 (8GB)
  • Official USB-C power supply (27W for Pi 5, 15W for Pi 4). Underpowered supplies cause throttling and audio glitches
  • MicroSD card (32GB minimum) or NVMe SSD via M.2 HAT for better reliability
  • Audio output: the Pi's 3.5mm jack works for testing, but a USB DAC or I2S DAC HAT (like the HiFiBerry DAC2 Pro) sounds dramatically better
  • Ethernet cable or stable Wi-Fi. Wired connections prevent audio dropouts during streaming

Software requirements:

  • Raspberry Pi OS (64-bit, Bookworm or later). The Lite edition without a desktop is fine since this is a headless music player
  • Node.js 24 (recommended) or Node.js 22.16+. OpenClaw needs a recent Node runtime
  • A Spotify Premium account. Free accounts cannot use on-demand playback through the API
  • An LLM provider API key (Anthropic, OpenAI, Google, or a local model via Ollama). OpenClaw sends your natural language commands to this provider for interpretation

Accounts you will create during setup:

  • A Spotify Developer account at developer.spotify.com (free, uses your existing Spotify login)
  • A Spotify "app" registration within the developer dashboard, which generates the Client ID and Client Secret the skill needs

Step-by-Step Installation

Start with a fresh Raspberry Pi OS 64-bit installation. Update the system first:

sudo apt update && sudo apt upgrade -y

1. Install OpenClaw

Run the official installer. It downloads the OpenClaw gateway, installs dependencies, and walks you through initial configuration including your LLM provider choice:

curl -fsSL https://openclaw.ai/install.sh | bash

The onboarding wizard asks which LLM provider to use. Pick whichever you have an API key for. Claude, GPT-4, and Gemini all work. If you want to avoid API costs entirely, point OpenClaw at a local model through Ollama running on a more powerful machine on your network.

2. Create a Spotify Developer App

Go to developer.spotify.com and log in with your Spotify account. Create a new app. The name and description do not matter for functionality. Set the redirect URI to exactly:

http://localhost:8888/callback

This URI must match character for character or the OAuth flow will fail. Save the app, then copy the Client ID and Client Secret from the app's settings page.

3. Install the spotify-player Skill

Back on your Pi's terminal:

clawhub install spotify-player

This pulls the skill from the ClawHub registry and registers it with your OpenClaw instance.

4. Configure Credentials

Add your Spotify credentials to OpenClaw's config file at ~/.openclaw/config.yaml under the spotify-player skill section. You need two values:

  • SPOTIFY_CLIENT_ID: the Client ID from step 2
  • SPOTIFY_CLIENT_SECRET: the Client Secret from step 2

You can also set optional parameters like default_device (the name of your preferred Spotify playback device), volume_step (increment for volume adjustments, default 10), and queue_limit (maximum tracks added per playlist operation, default 5).

5. Authenticate

Run the OAuth flow:

clawhub auth spotify-player

This opens a browser for Spotify's authorization page. On a headless Pi, the command prints a URL you can open on another device. After approving access, the skill stores refresh tokens at ~/.openclaw/tokens/spotify-player.json. These tokens refresh automatically every 60 minutes, so you only do this once unless you change your Spotify password.

6. Test It

Open an OpenClaw session (through the terminal, Telegram, or whichever messaging interface you connected) and try a simple command like "play my Discover Weekly playlist." If audio starts on your active Spotify device, the setup is complete.

Fastio features

Persist Your Pi's Spotify Configs Across Sessions

Fast.io workspaces give your OpenClaw agent a shared config layer with 50GB free storage, MCP access, and semantic search for your audio settings. No credit card required.

What You Can Do with AI-Controlled Spotify

The spotify-player skill translates natural language into Spotify Web API calls. You do not need to learn command syntax. Describe what you want, and the skill figures out the right API endpoint.

Playlist creation and curation accounts for 42.5% of all spotify-player commands. This is the feature that separates AI control from a basic Spotify Connect setup. Ask the agent to "make a playlist for a rainy afternoon" or "queue five tracks similar to what is playing now," and it builds a queue using Spotify's recommendation endpoints. You can refine on the fly: "drop the third track and add something more upbeat."

Playback control covers 30% of commands: play, pause, skip, previous track, shuffle on/off, and repeat mode changes. These work exactly like tapping buttons in the Spotify app, except you say them out loud or type them into a chat interface. For a Pi sitting across the room connected to speakers, voice control through Telegram or a local microphone is faster than unlocking your phone.

Metadata queries (17.5% of commands) let you ask "what song is this?" or "who produced this album?" without looking at a screen. The skill pulls track, artist, and album data from Spotify's API and responds in plain text.

Device and volume management (10% of commands) handles requests like "turn it up" and "switch playback to the kitchen speaker." If you have multiple Spotify Connect devices on your network, the agent can route playback between them. This is particularly useful in a multi-room setup where several Raspberry Pis each run their own Spotify Connect endpoint.

Scheduled playback is where the always-on nature of the Pi really shines. "Play the morning news podcast at 7 AM" or "switch to ambient music after 10 PM" become actionable commands. The agent sets up timers that trigger playback on schedule. A wall-mounted Pi that wakes you up with your favorite playlist every morning is the kind of project that justifies the build.

Context-aware requests take advantage of the LLM behind OpenClaw. "Play something for cooking dinner" or "I need focus music for the next two hours" are vague by design, but the LLM interprets the intent and translates it into specific Spotify API searches. The results depend on your LLM provider's quality, and they improve the more specific you get with your prompts.

One limitation worth noting: the skill requires an active Spotify device before it can issue playback commands. If your Pi also runs Raspotify (the Spotify Connect daemon), it counts as an active device. If you only use the Spotify app on your phone, that phone needs to be awake and connected. For a dedicated Pi music player, running Raspotify alongside OpenClaw solves this cleanly.

AI chat interface showing a natural language response

Storing Configs and Playlist Data with Fast.io

A Pi music player accumulates configuration files: OpenClaw settings, Spotify credentials, skill configs, audio output preferences, and any custom automation scripts. These live on the Pi's SD card, and SD cards fail without warning. One dead card means re-doing the entire setup from scratch.

Local backups to a USB drive work, but they do not help you access configs from your laptop, share a working setup with someone else, or let a second Pi pull the same configuration. A cloud workspace solves all three problems.

Fast.io provides workspaces where both you and your OpenClaw agent can store and retrieve files. Create a workspace for your Spotify Pi project, push your config files to it, and the workspace becomes the backup and the sharing layer. The free tier includes 50GB of storage, 5,000 AI credits per month, and 5 workspaces with no credit card required.

The practical workflow: export your ~/.openclaw/config.yaml, your skill configurations, and any automation scripts to a Fast.io workspace. If the SD card dies, flash a fresh Pi OS image, install OpenClaw, and pull your configs from the workspace. You are back to a working setup in minutes instead of hours. If you build a second Pi for another room, that Pi's agent pulls the same configuration without you manually copying files over SSH.

Fast.io's MCP server lets your OpenClaw agent interact with the workspace directly. The agent can upload logs when something breaks, download updated configs you have edited from your laptop, or query the workspace for notes you left about specific settings. Enable Intelligence Mode on the workspace and your files are automatically indexed for semantic search, so asking "what volume_step did I set for the bedroom Pi?" returns an answer grounded in your actual config files rather than a guess.

Other storage works too. Google Drive, Dropbox, or a self-hosted Nextcloud instance all sync files. The difference with Fast.io is the agent integration: the MCP server and Intelligence Mode let your OpenClaw agent treat the workspace as a queryable knowledge base, not just a file dump. S3 handles raw backup but has no semantic search. For a single Pi without OpenClaw, any cloud backup is fine. Once an AI agent enters the picture, workspace-native intelligence features save real time.

AI-powered document analysis and search interface

Frequently Asked Questions

Can you play Spotify on a Raspberry Pi?

Yes. The most common method is Raspotify, an open-source package that turns the Pi into a Spotify Connect device using the librespot library. Install it on Raspberry Pi OS, and your Pi appears as a speaker in the Spotify app on your phone or laptop. You need a Spotify Premium account for Spotify Connect. For AI-controlled playback, adding OpenClaw with the spotify-player skill gives you natural language control over playlists, queue management, and playback commands.

How do I set up Spotify Connect on Raspberry Pi?

Install Raspotify on Raspberry Pi OS by adding its apt repository and running sudo apt install raspotify. After installation, the service starts automatically and registers your Pi as a Spotify Connect device. Open Spotify on any device, tap the speaker icon, and select your Pi from the device list. You can customize the device name, audio bitrate (96, 160, or 320 kbps), and audio output in the Raspotify configuration file at /etc/raspotify/conf.

What is the best Spotify player for Raspberry Pi?

For passive streaming where your phone picks the music and the Pi plays it, Raspotify is the simplest and most reliable option. For a full music distribution with a web interface, Moode Audio and Volumio both include Spotify Connect alongside AirPlay, Bluetooth, and local file playback. For AI-controlled playback where the Pi itself manages playlists and responds to voice commands, OpenClaw with the spotify-player skill adds an intelligent control layer on top of any of these options.

Can Raspberry Pi be used as a music player?

A Raspberry Pi makes an excellent dedicated music player. With Spotify Connect, AirPlay 2, and Bluetooth A2DP support, it handles most streaming protocols out of the box. Add a DAC HAT like the HiFiBerry DAC2 Pro for high-quality audio output, and the Pi rivals commercial streamers that cost five to ten times more. The Pi 5 separated its USB and Ethernet buses, eliminating the audio dropout issues that affected the Pi 3 under heavy network load.

Does OpenClaw work on Raspberry Pi 4?

Yes. OpenClaw runs on both the Raspberry Pi 5 and Pi 4 with 8GB of RAM. The Pi handles the gateway process while the LLM runs on a cloud provider, so the Pi does not need heavy compute power. The 8GB model is recommended because OpenClaw, the Spotify skill, and audio daemons share memory. The Pi 4 with 4GB works for basic setups but may struggle if you add multiple skills or run additional services alongside the audio stack.

Is Spotify Premium required for the OpenClaw spotify-player skill?

Yes. Spotify's Web API restricts on-demand playback to Premium accounts. Free accounts are limited to shuffle mode and cannot select specific tracks or build custom queues. Since the core value of the spotify-player skill is AI-driven playlist creation and precise playback control, a Premium subscription is a practical requirement for this setup.

Related Resources

Fastio features

Persist Your Pi's Spotify Configs Across Sessions

Fast.io workspaces give your OpenClaw agent a shared config layer with 50GB free storage, MCP access, and semantic search for your audio settings. No credit card required.