Skill detail
text-to-music
Generates licensed, commercially cleared music from a text prompt via Sonilo for instrumentals, background beds, jingles, and loops.
Needs (stated): MCP server · Credentials · CLI tool
Inspect before use
Automated review checks relevance, not safety or endorsement. Read the source instructions before using this skill.
SKILL.md
The saved excerpt is a snapshot from review. The external source remains the complete and most current version.
---
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, with or without a length. 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](../setup-api-key) skill to connect the Sonilo MCP server and authenticate — `sonilo login` (no key) or `SONILO_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](../account) skill) if you're unsure whether free-trial runs remain.
> **Scoring a video instead?** Use [video-to-music](../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.
1. **Sonilo MCP tools visible in this session** (`text_to_music` and 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.
2. **No usable Sonilo MCP tools, but `sonilo account` exits 0** — use the CLI commands below. Same API, same account, same credential file. Probe with `sonilo account`, not `sonilo whoami`: whoami exits 0 even when signed out, so it cannot tell the two states apart.
3. **Neither** — stop and run the [setup-api-key](../setup-api-key) skill. Do not call `api.sonilo.com` with 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`)
```python
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`)
```ts
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`)
```bash
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)
```bash
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_formRead the full source on GitHub (opens external page)