Tried librespot-org/librespot Today: A Spotify Connect Building Block for AI Developers
librespot-org/librespot is an open-source Rust library and client implementation for Spotify Connect. It lets developers build headless players, custom audio appliances, CLI playback tools, and embedded Spotify receivers without starting from a full desktop application.
It picked up +6 GitHub stars today, which makes sense: lightweight self-hosted media projects are still a great fit for Raspberry Pis, home servers, and developer-controlled smart speakers.
The important distinction: librespot is the Spotify playback/connect layer. Your AI assistant can sit above it, translate a request such as “play my focus playlist,” then call your own playback controller that wraps librespot.
A practical architecture looks like this:
Cursor / Cline / Aider
|
v
OpenAI-compatible AI gateway
|
v
Tool call: play_spotify(uri, device)
|
v
Local control service
|
v
librespot Spotify Connect client
Here is a simple custom gateway configuration for an OpenAI-compatible client. I use claude-fable-5 as the primary coding model:
{
"name": "B-Lost Claude Fable",
"baseURL": "https://b-lost.com/v1",
"apiKey": "${B_LOST_API_KEY}",
"model": "claude-fable-5"
}
For example, this fits nicely into IDE workflows where Cursor uses a custom OpenAI Base URL, or where Cline/Roo Code needs a provider endpoint. Keep the Spotify credentials and playback controls in a local tool service rather than exposing them directly to the model.
A minimal tool contract can stay boring and reliable:
{
"name": "play_spotify",
"description": "Start playback through the local librespot device.",
"parameters": {
"type": "object",
"properties": {
"uri": { "type": "string" },
"device": { "type": "string" }
},
"required": ["uri"]
}
}
For long-lived coding sessions, an Anthropic-native /v1/messages route is also useful: B-Lost supports native Prompt Caching, with 90% off cache hits. Reusing a 20,000-token repository/system context can avoid repeatedly paying for the same large prompt while the agent iterates on a librespot controller.
The relay’s advertised 0.8x official list pricing is a practical extra, but the real win here is the setup: AI handles intent, your local service enforces permissions, and librespot handles Spotify Connect playback.
Top comments (0)