Trickbeat for agents
Make original music for a video, podcast, stream or game. Pick a style, a seed and up to seven choices. The same input gives the same output, so you can change one layer at a time.
Start here: HTTP API · Public CLI · WebMCP · Local MCP package · Recipes · Plain text docs
Ways to make music
| Interface | Status | Use it for |
|---|---|---|
| Public CLI | Available | Shell and Node 18+, no checkout. Writes a finished WAV, MIDI or stems and prints JSON. |
| HTTP API | Live | For fetch-only agents. Send song JSON; get a finished WAV, MIDI or stems, with the duration and lead you ask for. No account or API key. |
| WebMCP | Browser only | Two tools on /make/, only if the browser exposes navigator.modelContext. |
| MCP stdio | Local package, not on npm yet | Four local tools for styles, options, WAV and stems. Build the package from a checkout with npm pack. |
HTTP render API
Base URL: https://api.trickbeat.org. The hosted endpoint is free within the daily limits below. If you have a checkout, run npm run server (Node only, no install) and use http://127.0.0.1:8787 instead. No authentication is required. Send all song settings in each request; there's no saved session or job to poll.
GET /api/v1/styleslists the style IDs.GET /api/v1/options?style=lofi&seed=7lists the seven steps and their A/B/C choices. Addpicksto see options based on choices already made.POST /api/v1/rendertakesapplication/jsonwithstyleandseed, plus optionalpicks,levels,loop,duration,leadandformat. Returns the file directly:wav(the default,audio/wav),midi(audio/midi) orstems(a ZIP of separate WAV layers,application/zip). With aduration, the response headerX-Trickbeat-Secondsholds the actual length.GET /api/v1/healthreturns JSON withstatus,queue_length(requests waiting for a slot) andglobal_remaining(unreserved renders left in the shared daily budget).
Copy-paste examples: curl for WAV, MIDI and stems, Node.js fetch and a health check.
Options: duration, lead, MIDI and stems (CLI, HTTP and MCP)
These four options work in the public CLI now, in the local MCP package and in the HTTP API. They let you finish a file without an external editor. See the recipes for complete commands.
- Duration: Use CLI
--duration <seconds>or"duration": <seconds>inPOST /api/v1/render(1–60 seconds); non-loop WAVs fit whole bars to the nearest sample by adjusting tempo and fade over the final 50 ms, while loops keep tempo and round to the nearest whole cycle count (at least one, ties round up); read the actual seconds in CLI JSON orX-Trickbeat-Seconds. - Lead instrument: Use CLI
--lead <id>or"lead": "<id>"inPOST /api/v1/render(orleadin the MCP tools) to play the lead on another instrument: the melody is written for that instrument, as in the editor; valid ids arelead,brass,epiano,bell,guitar,marimba,whistle, andchipSquare. - MIDI: Use CLI
--format midito write a.midinstead of the default WAV, send"format": "midi"toPOST /api/v1/render, or passformatmiditotrickbeat_make_song; MIDI exports notes, tempo, and approximate General MIDI programs, not the synth audio. - Stems: Add CLI
--stems <dir>to a WAV or MIDI export to also write one aligned WAV per unmuted layer, or send"format": "stems"toPOST /api/v1/renderfor a ZIP of those WAVs, or call the MCP tooltrickbeat_make_stems.
Example: a 30-second loop request returns 32 seconds, 5 whole cycles of 6.4 seconds (8-bit, seed 12). A 24-second request for the organ-house intro (seed 21) returns exactly 24 seconds.
Render limits
- Two renders at once (
TRICKBEAT_CONCURRENCY=2). If both slots are busy, a request waits up to 30 seconds for a slot, then gets503withRetry-After: 5. This is a queue timeout, not a render deadline. - 200 renders per client IP and 5,000 total per UTC day. The server uses the IP Cloudflare supplies, or the connection IP locally. A render reserves quota before it enters the queue; rejected input and queue timeouts release it. Counters reset at 00:00 UTC or on server restart. Hitting either cap returns
429withRetry-Afterin seconds until 00:00 UTC. 429and queue503include JSONerrorandhintfields. HonorRetry-Afterwhen present. Render bodies over 2,048 bytes return413if the request reaches body validation.
How a song is described
- style: one of twelve ids (table below).
- seed: a whole number from 1 to 999999.
- picks: one letter A, B or C for each of seven steps, in order: beat, bass, chords, melody, tricks, arrange, mix. 1 to 7 letters; steps you leave out use A.
- levels: volume per layer in percent, 0 to 150, for drums, bass, chords and lead. 100 is the default and 0 is off.
- loop: true makes a short loop instead of the whole song.
- duration: optional target length in seconds, 1 to 60. Without it you get the native length.
- lead: optional lead instrument id, see the options above.
The fourth pick changes the melody hook; lead plays the lead on another instrument, with the melody written for it. To lower drums without changing the other inputs, use "levels":{"drums":60} in HTTP or local MCP, or --levels drums=60 in the CLI. Levels are mix controls, not a promise of linear PCM amplitude.
A share link opens the same song in the editor, not the rendered WAV. The CLI, the HTTP API (JSON link and X-Trickbeat-Link header) and local MCP all write the editor's own link: style, seed and picks, plus levels=drums.bass.chords.lead when a level is not 100, and inst=lead:<id> when you asked for a lead (CLI, HTTP and MCP), dur=<seconds> when you passed a duration and loop=1 when you asked for a loop (for example &dur=24 or &dur=30&loop=1). A link without them opens the full song. The editor shows the length in one short line, for example "24 s version", with a button to switch to the full song, and keeps it while the person edits. It renders at 44.1 kHz, so the bytes match when you kept the default sample rate. A lead you ask for changes the melody the same way in your WAV and in the editor, so the link opens the song you heard. Keep style, seed, picks, levels, loop, duration and lead for an exact re-render.
Give the song to a person
A person opens the share link at /make/ and presses "Download as WAV": the link carries your duration and loop, so the file is byte-identical to yours.
If a call fails
Every route names the bad field and the allowed values, so you can fix the call without these docs.
- HTTP: status 400 with JSON
errorandhint, for example{"error":"Unknown field: tempo.","hint":"Allowed fields: style, seed, picks, levels, loop, format, duration, lead."}. Bad values read like "duration must be a number from 1 to 60 seconds." - CLI:
{"error": ...}on stderr and exit code 1, with the same wording ("Valid flags: ..." for an unknown flag). - MCP: a tool error (code -32602) with the same wording, for example "Unknown field: tempo. Hint: allowed fields are style, seed, picks, levels, loop, duration, lead, format, out."
| Style id | Name | BPM |
|---|---|---|
organ-house | 90s organ house | 124 |
lofi | Lo-fi | 80 |
rat-beat | Rat beat | 120 |
dembow | Reggaeton | 94 |
techno | Techno | 130 |
bossa | Bossa nova | 136 |
cat-beat | Cat beat | 108 |
christmas | Christmas | 128 |
pedal-pop | Pedal pop | 105 |
odd-five | 5/4 groove | 140 |
border-dust | Desert | 104 |
8-bit | 8-bit | 150 |
Public CLI
Download trickbeat.mjs and run it with Node 18 or newer. No checkout or install is needed. It fetches the engine on first use and caches it for a day. It writes WAV by default, MIDI with --format midi and one WAV per layer with --stems. Output is one line of JSON; errors are JSON on stderr with exit code 1.
curl -O https://trickbeat.org/make/app/trickbeat.mjs
node trickbeat.mjs styles --base https://trickbeat.org/make/app/
node trickbeat.mjs options --style lofi --seed 7 --picks AAA --base https://trickbeat.org/make/app/
node trickbeat.mjs make --style lofi --seed 7 --picks ABAAAAA --levels drums=80,lead=120 --loop --out song.wav --base https://trickbeat.org/make/app/
Finished files, with a length, a lead instrument, MIDI and stems:
node trickbeat.mjs make --style organ-house --seed 21 --picks AAAAABA --duration 24 --lead epiano --out intro-24s-epiano.wav --base https://trickbeat.org/make/app/
node trickbeat.mjs make --style 8-bit --seed 12 --picks AAAAAAA --loop --duration 30 --format midi --stems menu-stems --out menu-loop.mid --base https://trickbeat.org/make/app/
options shows only the next step: pass --picks AAA for melody options. Seven picks return done: true. The local MCP tool trickbeat_get_options returns all seven steps.
Commands: help, styles, options, make. Flags: --style, --seed, --picks, --levels (for example drums=80,lead=120), --loop, --duration (1 to 60 seconds), --lead (instrument id), --format (wav or midi), --stems (folder), --rate (sample rate), --out, --base. The make result includes the file path, duration, share link and credit. It also has review: warnings such as "lead buried under chords" are advice, and the file is still written. CLI and HTTP stems are drums.wav, bass.wav, chords.wav and lead.wav; they never include extras.wav. With --duration it also has requestedSeconds, seconds and, for loops, cycles; with --stems it lists the stem files.
WebMCP in the browser
When a browser supports WebMCP (navigator.modelContext), the /make/ page registers two tools:
trickbeat_list_styles: no input. Returns the twelve styles with id, name, tag, label, bpm, key and scale.trickbeat_make_song: inputstyle,seed,picks,levels,loop. Makes the song in the page and downloads a WAV. Returns title, bpm, key, link, licence, credit and sources note.
The same functions are on window.trickbeat as styles(), options(), make() and download() for agents that run page scripts.
MCP stdio Local package, not on npm yet
A local MCP server (stdio, Node 18+) that lets an agent make original music with the Trickbeat engine. It runs on your machine, needs no account, and writes WAV files. The package carries its own copy of the engine, so the installed server needs no checkout, and by default it makes no network call. The same input always gives the same file.
Every song can be changed step by step: change one letter in picks (A, B or C for each of the 7 steps: beat, bass, chords, melody, tricks, arrangement, mix) or one layer level, render again, and repeat until the song feels exactly right.
There is no public npm package, source URL or remote MCP endpoint yet. Today you build the package once with npm pack in a checkout of the Trickbeat repo (not public yet), then install the tarball on any machine. Without a checkout, use the public CLI, or the HTTP API.
Tools
| Tool | What it does | Input |
|---|---|---|
trickbeat_list_styles | The 12 styles: id, name, bpm, description. Read-only. | none |
trickbeat_get_options | The 7 steps with their A/B/C options, the concept and sources of each step, and the current picks. Read-only. | style, seed, picks |
trickbeat_make_song | Writes one WAV, or a MIDI file with format midi. Returns path, duration, share link, credit line and sources note. | style, seed, picks, levels, loop, duration, lead, format, out |
trickbeat_make_stems | Writes one WAV per layer: drums, bass, chords and lead, byte-identical to the CLI and the HTTP API for the same input. | as trickbeat_make_song, without format, with out_dir instead of out |
style: an id fromtrickbeat_list_styles(defaultorgan-house).seed: whole number 1 to 999999 (default 1).picks: 1 to 7 letters from A, B, C, one per step. Missing steps use A.levels:{"drums":0-150,"bass":0-150,"chords":0-150,"lead":0-150}. 100 is the default volume and 0 switches a layer off.loop:truemakes a short loop without a seam,false(default) a full song.format:wav(default) ormidi(trickbeat_make_songonly).out: file path, must end in.wav, or in.midwhenformatismidi.out_dir: stem folder. Use absolute paths; a relative path starts in the folder where the client launched the server. These are local files on the machine running the MCP client and server, not download URLs.
trickbeat_make_song overwrites the file at out if it exists, and trickbeat_make_stems overwrites files with the same names. Both tools work offline. Errors come back as tool errors with a hint (for example an unknown style tells the agent to call trickbeat_list_styles). The server does not crash on bad input.
Offline and deterministic
- Offline: the engine is bundled and the server makes no network call, unless you set
TRICKBEAT_API(see Remote mode). No account, no key. - Deterministic: the same style, seed, picks, levels and loop give the same bytes every time. A different pick gives a different file.
- Format: WAV, stereo, 16-bit, 44.1 kHz. A full song is about 65 to 125 seconds, depending on the style. A short version (6th pick B) is about 30 to 57 seconds. A loop is 6 to 12 seconds.
- Stems are the layers before the final master limiter, with the same levels applied.
- The share link in a result carries
levels,lead(inst=lead:<id>),duration(dur=<seconds>) andloop(loop=1) when you used them. - The MCP tools take
duration(1 to 60 seconds) andlead(instrument id) like the CLI flags of the same name, andformatmidiwrites MIDI. A field they do not know is an error that names the field.
Install from a checkout
There is no public npm package yet. Build the tarball once, in a checkout of the Trickbeat repo. npm install is not needed for this step, and the tarball is git-ignored. Replace /absolute/path/to/checkout with its local path:
cd /absolute/path/to/checkout/mcp
npm pack
This writes trickbeat-mcp-0.1.0.tgz (about 70 kB) in mcp/. On any machine with Node 18+, install it into a folder of your choice. The install downloads the MCP dependencies from the npm registry once; after that the server renders offline:
mkdir ~/trickbeat-mcp && cd ~/trickbeat-mcp
npm install /absolute/path/to/checkout/mcp/trickbeat-mcp-0.1.0.tgz
echo "$(pwd)/node_modules/trickbeat-mcp/src/server.js"
Replace /ABSOLUTE/PATH/TO/node_modules/trickbeat-mcp/src/server.js in each snippet below with the output of the echo. To try the server inside a checkout without packing, run npm install in mcp/, then node "$PWD/src/server.js". To use another copy of the engine, set TRICKBEAT_APP=/path/to/app.
To check the install without an MCP client, run this in the install folder. It sends three JSON-RPC lines to the server and writes the 24-second intro; the second output line is the result. For the same input the WAV, MIDI and stems are byte-identical to the CLI files.
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"check","version":"1"}}}' '{"jsonrpc":"2.0","method":"notifications/initialized"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"trickbeat_make_song","arguments":{"style":"organ-house","seed":21,"picks":"AAAAABA","duration":24,"lead":"bell","out":"/tmp/intro-24s-bell.wav"}}}' | node node_modules/trickbeat-mcp/src/server.js
Claude Desktop
Add to claude_desktop_config.json (Settings, Developer, Edit Config), then restart Claude Desktop:
{
"mcpServers": {
"trickbeat": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/node_modules/trickbeat-mcp/src/server.js"]
}
}
}
Claude Code
claude mcp add trickbeat -- node /ABSOLUTE/PATH/TO/node_modules/trickbeat-mcp/src/server.js
Codex
Add to ~/.codex/config.toml:
[mcp_servers.trickbeat]
command = "node"
args = ["/ABSOLUTE/PATH/TO/node_modules/trickbeat-mcp/src/server.js"]
Cursor
Add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"trickbeat": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/node_modules/trickbeat-mcp/src/server.js"]
}
}
}
Remote mode (optional)
Set TRICKBEAT_API to make trickbeat_make_song and trickbeat_make_stems ask a Trickbeat render API instead of rendering locally. It is unset by default. Set it to https://api.trickbeat.org for the hosted API, or run npm run server in a checkout and set TRICKBEAT_API=http://127.0.0.1:8787; in a config, add "env": {"TRICKBEAT_API": "http://127.0.0.1:8787"} next to args.
The WAV is byte-identical to the local one. Stems come from the API: the same four WAVs as the local ones. duration, lead and format go to the API too. If the API cannot be reached, the tool error says so; unset TRICKBEAT_API to render locally.
First call
Call trickbeat_make_song with {"style":"lofi","seed":7,"picks":"ABAAAAA","loop":true,"out":"/absolute/path/song.wav"}. The result has the path, the duration in seconds and a share link a person can open at /make/ to keep changing the song. More in the examples.
Examples
Copy-paste HTTP API examples and recipes for HTTP or the public CLI. Each returns the finished file:
- A 24-second podcast or stream intro
- The same intro with another lead instrument
- Background music for a 60-second video
- A seamless game menu loop of about 30 seconds
- MIDI and stems for that loop
Licence and credit
Songs made with Trickbeat are free to use, including commercially in videos, podcasts, streams and games. Credit is appreciated, not required: Made with Trickbeat (trickbeat.org). The code licence is separate and not yet decided.
Tricks are common music-production techniques, described in our own words. The sources list gives the concept of each one and links to lessons that explain it.
For models and crawlers
/llms.txt is the short index. /llms-full.txt has everything on this page in one plain file. Crawlers are welcome: see /robots.txt.