Openrouter text2music
Skill QinghongLin/data2story-skill/skills/data2story/designer/scripts/openrouter-text2music
Generate music (NOT speech) via OpenRouter using Google Lyria 3 Pro.From its SKILL.md
npx -y skills add QinghongLin/data2story-skill --skill openrouter-text2musicAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- reads credentialsReads from 1 credential source: `OPENROUTER_API_KEY`.
- runs commandsInstructs the agent to run 1 command, including `python3 TOOL_DIR/scripts/generate_music.py --prompt "Driving synthwave, 120 BPM, nostalgic lead over a pulsing arpeggio, no vocals" --download PROJECT_DIR/assets/bg_music.wav`.
- fetches URLsInstructs the agent to fetch 1 URL, including POST /api/v1/chat/completions.
SKILL.md
1.6 KB, 401 tokens by cl100k_base, as published. Nobody here has run it
openrouter-text2music
Text → music via OpenRouter. Default model: google/lyria-3-pro-preview.
⚠️ This is a music-generation model, not TTS. It produces 48kHz stereo audio with instrumentation, and can include vocals and timed lyrics based on the prompt. For narration/voiceover, use a dedicated TTS tool (e.g., OpenAI tts-1, ElevenLabs).
Usage
Resolve TOOL_DIR = the directory containing this SKILL.md. Commands below use TOOL_DIR as a symbolic placeholder; replace it with the resolved, quoted path before running Bash.
export OPENROUTER_API_KEY=sk-or-v1-...
python3 TOOL_DIR/scripts/generate_music.py \
--prompt "Driving synthwave, 120 BPM, nostalgic lead over a pulsing arpeggio, no vocals" \
--download PROJECT_DIR/assets/bg_music.wav
Flags
| Flag | Default | Description |
|---|---|---|
--prompt | required | Text prompt (genre, mood, instruments, tempo, optional lyrics) |
--download | required | Output audio file path |
--model | google/lyria-3-pro-preview | Alt: google/lyria-3-clip-preview (shorter clips) |
Pricing
lyria-3-pro-preview: $0.08 per song
Notes
- Request uses
POST /api/v1/chat/completionswithmodalities: ["audio","text"]. - Response parsing handles several shapes:
message.audio, a content part withtype=audio, or adata:audio/...URL embedded in the text content. - Output format is typically WAV (48kHz stereo); the script saves whatever bytes the API returns — choose the extension to match.
What ships with it: 2 files
4.4 KB alongside SKILL.md, 1 of them executable
scripts/
- generate_music.pyruns4.1 KB
- config.json272 B