text-to-music
Generate music from a text prompt using Sonilo — instrumental tracks, background beds, jingles, loops — when there is no video to score. Use when the user describes the music they want in words and gives a duration. Every track is licensed and cleared for commercial use. For scoring an existing video, use the video-to-music skill instead.
sonilo-ai · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add sonilo-ai/skills --skill text-to-musicAbout this skill
name: text-to-music
description: Generate music from a text prompt using Sonilo — instrumental tracks, background beds, jingles, loops — when there is no video to score. Use when the user describes the music they want in words and gives a duration. Every track is licensed and cleared for commercial use. For scoring an existing video, use the video-to-music skill instead.
license: MIT
compatibility: "Requires Sonilo through either transport — the MCP server connected, or the sonilo CLI installed and signed in — plus credentials: a sonilo login sign-in, the hosted OAuth plugin, or SONILO_API_KEY. See the setup-api-key skill."
allowed-tools: Bash, Read, Write, mcp__sonilo__*
Sonilo Text-to-Music
Generate music from a text description alone — no video involved. The prompt IS the input, so the brief carries everything: genre, mood, energy arc, instrumentation, and what must not appear. Every track is licensed (music licensed via Shutterstock) and cleared for commercial use on social, brand content, and advertising.
Setup: See the setup-api-key skill to connect the Sonilo MCP server and authenticate —
sonilo login(no key) orSONILO_API_KEY.
⚠️ Cost: this tool makes an API call that may incur charges. Only call it when the user has actually asked for a generation. Check
get_account_services(see the account skill) if you're unsure whether free-trial runs remain.
Scoring a video instead? Use video-to-music — it matches pacing, motion, and emotion to the actual cut, which a text prompt cannot do.
Transport: MCP or CLI
Pick one at the start of the session and stay on it. Do not mix the two inside a single job, and do not announce the choice.
- Sonilo MCP tools visible in this session (
text_to_musicand friends) — use them. This is the preferred path: it needs no shell, and it is the only one that survives a very long generation. If a call fails to authenticate — rather than failing on its inputs — this transport is not usable in this session: go to 2 instead of retrying it. - No usable Sonilo MCP tools, but
sonilo accountexits 0 — use the CLI commands below. Same API, same account, same credential file. Probe withsonilo account, notsonilo whoami: whoami exits 0 even when signed out, so it cannot tell the two states apart. - Neither — stop and run the setup-api-key skill. Do not call
api.sonilo.comwith curl to work around it; both transports handle uploads, polling and retries that a bare request does not.
Quick Start
MCP tool call (recommended)
text_to_music(
prompt="A chill lo-fi hip hop beat with jazzy piano chords",
duration=30
)
Saves the generated file(s) to SONILO_MCP_BASE_PATH (~/Desktop by default) and returns the saved path(s) as text.
Python (pip install sonilo)
from sonilo import Sonilo
client = Sonilo() # reads SONILO_API_KEY
track = client.text_to_music.generate(prompt="A chill lo-fi hip hop beat with jazzy piano chords", duration=30)
track.save("output.mp3")
JavaScript / TypeScript (npm install sonilo)
import { SoniloClient } from "sonilo";
const client = new SoniloClient(); // reads SONILO_API_KEY
const track = await client.textToMusic.generate({
prompt: "A chill lo-fi hip hop beat with jazzy piano chords",
duration: 30,
});
CLI (npm install -g sonilo-cli or pip install sonilo-cli)
sonilo text-to-music --prompt "A chill lo-fi hip hop beat with jazzy piano chords" --duration 30
cURL (raw REST API, no MCP host)
curl -X POST "https://api.sonilo.com/v1/text-to-music" \
-H "Authorization: Bearer $SONILO_API_KEY" \
--data-urlencode "prompt=A chill lo-fi hip hop beat with jazzy piano chords" \
--data-urlencode "duration=30" \
--output output.m4a
Tool
| Tool | Description |
|---|---|
text_to_music(prompt, duration, output_format?, variants_num?, stems?, output_directory?) | Generate music from a text description only — no video. |
Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
prompt | string | — | Required. 1–1000 chars. |
duration | int | — | Required. 1–360 seconds. Unlike the video tools, there is no source to take the length from, so you must set it. |
variants_num | int | 1 | 1–10. Generates that many distinct creative directions in one request — different takes, not re-renders of one. Cost scales linearly with the count, and any value above 1 is never covered by the free trial, so confirm the number with the user first. Above 1 writes one file per variant and forces the backend's async mode. |
output_format | string | m4a | m4a or wav. wav triggers the backend's async mode internally — no user-facing "mode" param needed. |
stems | bool | false | Free. Additionally splits each generated track into four separated instrument tracks — drums, bass, vocals, other — returned alongside the untouched full mix. Async-only on REST (stems=true without mode=async is a 400). See Stems. |
output_directory | string | SONILO_MCP_BASE_PATH | Absolute, or relative to the base path. |
Stems
stems=true additionally returns each generated track split into four
separated instrument tracks — drums, bass, vocals, other — free of
charge. The full mix is untouched; the stems arrive alongside it in the task
result as a stems array next to audio:
"stems": [
{
"stream_index": 0,
"drums": { "url": "…", "content_type": "audio/mp4", "file_size": 2913044 },
"bass": { "url": "…", "content_type": "audio/mp4", "file_size": 2870211 },
"vocals": { "url": "…", "content_type": "audio/mp4", "file_size": 2794560 },
"other": { "url": "…", "content_type": "audio/mp4", "file_size": 3011830 }
}
]
What matters when you use it:
- Async only on REST.