
Songbrain
io.github.LeonUliv1.0.0更新于 Oct 6, 2026
Song in, video plan out: beat grid, best moments, timed lyrics, story and a beat-synced shot plan.
概览
Songbrain 分析歌曲并返回 JSON 视频方案:节拍网格、最佳片段、带时间轴的歌词、故事以及卡拍分镜表。
- 功能
- 该远程 MCP 服务器把 Songbrain 的音乐分析 API 暴露给助手。传入歌曲文件或音频链接后,每首歌返回一份文档,包含歌曲 DNA(曲风、速度、调性、情绪、响度)、节拍与段落时间轴、排序后的最佳片段、逐词歌词、评分、带配色方案的故事,以及分镜表——每个场景都有绝对起止秒数和可直接使用的图像或视频提示词。示例工具无需密钥即可使用;带密钥时可分析你自己的歌曲。
- 适用场景
- 适合在策划音乐视频、短视频或卡拍幻灯片时使用,让助手基于真实时间数据而不是猜测来工作。也可用于在消耗额度前先查看示例分析结果。
- 运行要求
- 远程 streamable HTTP 端点,无需本地安装。分析自己的歌曲需要可选的 Songbrain API 密钥(X-API-Key 请求头,sb_live_...);没有密钥时只能使用示例工具。需要能访问 Songbrain API 的网络。每首歌分析约需 60-90 秒。
安装
在 SourceWeft 中
- 打开 控制台中的 Songbrain,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"songbrain": {
"type": "http",
"url": "https://api.songbrain.ai/mcp"
}
}
}README
Songbrain
[CI] [PyPI] [npm] [MCP Registry] [License: MIT]
Song in, video plan out — the music analysis API for AI video.
Send a song. Get back JSON that a video model can use directly: what the song is, where the beats and sections are, which part to use, what the words are and when they are sung, what the video should show, and a shot list with a prompt for every scene that cuts on the beat.
This repository holds the official SDKs for Python and JavaScript/TypeScript, examples, and the MCP server entry.
- API docs: https://www.songbrain.ai/docs/api
- OpenAPI: https://api.songbrain.ai/v1/openapi.json
- Get a key (5 free songs a month): https://app.songbrain.ai/developers
- Changelog: SDKs · API
Try it now, no key
This returns the story and shot plan of a real song in exactly the format your songs get. GET /v1/examples lists all examples.
What one call returns
One document per song (schema songbrain.song/1). Times are seconds from the start of the song.
One scene from the shot plan:
A song takes 60–90 seconds to analyse (up to about 2 minutes when busy).
Install
Quickstart: Python
Quickstart: TypeScript / JavaScript
analyze() uploads, waits until the song is done and returns the full document. Pass wait=False (Python) or wait: false (JS) to get the id right away, then use a webhook or get_song / getSong later.
SDK methods
Python uses snake_case and JS uses camelCase method names. Response fields are the API's own names in both.
Both SDKs:
- send the key as
Authorization: Bearer sb_live_…, - raise
SongbrainError(status,code,message,request_id/requestId) and the subclassesAuthenticationError,InsufficientCredits,NotFound,RateLimited(withretry_after/retryAfter),AnalysisFailedandWaitTimeout, - send an
Idempotency-Keywith every new song and retry network errors, 429 and 5xx up to 3 times with backoff, honouringRetry-After, - keep the last rate-limit headers in
last_rate_limit/lastRateLimit.
Package docs: python/README.md · js/README.md
Without an SDK
Options on document endpoints: ?view=summary drops word timings and beat arrays (about 3x smaller). ?include=song_dna,shot_plan returns only the named sections.
Errors always look like {"error": {"code": "…", "message": "…", "request_id": "req_…"}} with HTTP 400, 401, 402, 404, 409, 413, 415 or 429. A 429 carries a Retry-After header.
Test mode
Send "test": true (or test=True / test: true in the SDKs) and the song is free, needs no audio and is done right away. You get the Sugar Rush example analysis with your title and external_ref, "livemode": false and billing.type = "test". A webhook_url still gets a signed song.done within seconds. It is made for CI and for building your integration before you spend a song.
Test songs never use your free songs, but they are rate-limited and count toward the daily cap. A pytest example: cookbook/ci_test_mode.py.
Your own lyrics
Lyrics are transcribed from the vocals, and sung words can be misheard. If you have the lyrics (Suno gives them to you), send them along: the analysis uses your exact words on the transcription's timing. Words the singer can't be heard on are left out, never guessed.
Measured or estimated?
Every song carries provenance: which fields are measured from the audio (tempo, key, beats, sections, loudness, moment windows), which are transcribed (lyrics), which are an AI model's judgement (genre, mood, scores) and which are generated (story, prompts, tagline). Scores also say "basis": "model_estimate". Details: docs.
Idempotency
POST /v1/songs accepts an Idempotency-Key header (1–255 printable characters). The same key on the same account within 24 hours returns the first answer again (same song id, no second charge) with Idempotent-Replayed: true. The same key with a different request is a 409 idempotency_key_reused; a key whose first request is still running is a 409 idempotency_in_progress (retry after a second). Failed first requests are not stored, so the key can be retried.
Both SDKs send a random key with every analyze() and reuse it across their own retries, so a timeout during an upload never creates two songs. Pass your own key (idempotency_key= / idempotencyKey), e.g. your job id, to make retries across processes safe too.
Pagination
GET /v1/songs?limit=20&starting_after=<song id> returns the newest songs first with has_more and next_cursor. Pass next_cursor as starting_after for the next page, or let the SDK do it:
Request ids and rate limits
Every response has a Songbrain-Request-Id: req_… header, and every error body repeats it as error.request_id. The SDKs put it on the error (request_id / requestId) and in its message. Quote it when you contact support.
Requests with a key return X-RateLimit-Limit (requests per minute, currently 120), X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the window has room again). The SDKs keep the last values in sb.last_rate_limit / sb.lastRateLimit.
Webhooks
Pass webhook_url when you create a song. Songbrain POSTs song.done or song.failed, and account.low_balance when you run low:
- Signature. Every webhook has the header
Songbrain-Signature: t=<unix>,v1=<hex>.v1is the HMAC-SHA256 of"<t>.<raw body>"with your key's webhook secret. Both SDKs verify it for you (webhooks.verify/verifyWebhook). - Dedupe on the event id.
id(also in theSongbrain-Event-Idheader) stays the same when an event is retried. Store the ids you have handled and answer 2xx to repeats. - Retries. Anything but a 2xx is retried, up to 10 attempts over about 3 days: right away, then 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h, 48 h and 72 h after the first attempt. Redirects are not followed.
- Test ping.
POST /v1/webhooks/test {"url": "…"}(test_webhook/testWebhook) sends a signedpingright now and tells you whether it was delivered.GET /v1/webhooks/deliveries(webhook_deliveries/webhookDeliveries) lists the last attempts with status codes.
Receivers: cookbook/webhook_receiver_fastapi.py (FastAPI, with dedupe) and examples/python/webhook_server.py (Flask).
MCP
Songbrain runs a remote MCP server at https://api.songbrain.ai/mcp (streamable HTTP). It works in Claude Code, Claude Desktop, Cursor and other MCP clients. Without a key you get the example tools. With a key you can analyse songs from a URL.
Setup for each client: examples/mcp.md. Registry name: io.github.songbrain-ai/songbrain (server.json).
Examples
Run either script with --example old-truck-home to try it without a key.
Cookbook
Runnable recipes in cookbook/. All work with --example sugar-rush (no key), and the video ones have a --dry-run that prints every call and the ffmpeg command.
Postman
Import postman/Songbrain.postman_collection.json into Postman, Insomnia or Bruno. Set apiKey, then run Songs → Create song (test mode). Every endpoint is in it, with cursor pagination and an Idempotency-Key on creates.
Pricing
- 5 free songs per account per month.
- Then 25 credits per song, about $0.50. Credits come in packs (500 credits = $10, 150 credits = $4.99).
- No subscription. Everything is included in that price: analysis, story and shot plan.
- Limits: files up to 100 MB, 30 s to 10 min; 3 songs in parallel; 200 songs per 24 h; 120 requests per minute per key.
- Over 1,000 songs a month, an invoice, a DPA or an SLA: [email protected].
Live prices: GET https://api.songbrain.ai/v1/pricing.
Commercial use
The short version of Terms §17:
- You can use the API in a paid SaaS, including products that make images or videos for your customers.
- You can pass results to your users, changed or unchanged.
- White-label is fine. No attribution to Songbrain is required.
- The results for your songs are yours. You can keep them after you delete a song or close the account.
- You can train your own models on results, except a model built to reproduce the Songbrain API for others.
- Reselling raw API access or bulk datasets needs written consent.
Audio is used only for the analysis and never for training. Uploads are deleted within 24 hours.
Repository layout
Links
- Product: https://www.songbrain.ai/api-access
- API reference: https://www.songbrain.ai/docs/api
- Interactive docs: https://api.songbrain.ai/v1/docs
- OpenAPI 3.1: https://api.songbrain.ai/v1/openapi.json
- Developer console: https://app.songbrain.ai/developers
- Changelog: SDKs · API
- Support: [email protected] · Security: SECURITY.md · Contributing: CONTRIBUTING.md
License
MIT © 2026 Songbrain. See LICENSE. The license covers the SDK code; use of the API is governed by the Terms.
来源:README.md,提交 dafeebe
工具
0版本历史
1- v1.0.0最新Oct 6, 2026


