Generate 30-second instrumental music via Google Lyria (Vertex AI). Use when user requests music generation, specific styles/keys/instruments, or music itera...
Generate instrumental music from text prompts using Google Lyria API via Vertex AI.
When using this skill for the first time on a machine, follow these steps:
# Create the lyria folder structure in workspace
mkdir -p ~/.openclaw/workspace/lyria/generated_music
Check if gcloud is installed:
gcloud --version
If not installed, install Google Cloud SDK:
macOS (Homebrew):
brew install --cask google-cloud-sdk
Linux:
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
Verify installation:
gcloud --version
gcloud auth login
Follow the browser prompt to authenticate.
Get project_id:
gcloud config get-value project
Get location:
gcloud config get-value compute/region
If no region is set, use: us-central1 (recommended for Lyria)
Get bearer_token:
gcloud auth print-access-token
⚠️ Note: This token expires in approximately 1 hour. You'll need to refresh it periodically.
Create ~/.openclaw/workspace/lyria/config.json with your values:
{
"project_id": "your-project-id-here",
"location": "us-central1",
"bearer_token": "ya29.a0AfH...your-token-here",
"output_dir": "~/.openclaw/workspace/lyria/generated_music"
}
Replace the placeholders with your actual values from Step 4.
The shell wrapper is the recommended way to generate music. It reads all configuration from the config file automatically.
./scripts/music-gen.sh "<prompt>" [name]
Arguments:
prompt (required): Text description of the music you wantname (optional): Custom filename (without extension). If omitted, uses timestamp.Examples:
# With custom name:
./scripts/music-gen.sh "chill lo-fi piano C minor" "my_relaxing_track"
# Output: ~/.openclaw/workspace/lyria/generated_music/my_relaxing_track.wav
# With timestamp (default):
./scripts/music-gen.sh "energetic rock guitar solo"
# Output: ~/.openclaw/workspace/lyria/generated_music/music_20260302_143022.wav
For more control or integration with other tools, call the Python script directly:
python3 scripts/music-gen.py <config_file> "<prompt>" [name]
Arguments:
config_file (required): Path to config.jsonprompt (required): Text description of the musicname (optional): Custom filename (without extension)Example:
python3 scripts/music-gen.py ~/.openclaw/workspace/lyria/config.json "jazz saxophone smooth" "evening_jazz"
Good prompts include:
Example prompts:
"A calm acoustic folk song in C minor with gentle guitar melody and soft strings, no drums""Upbeat electronic dance music with strong synth bass and driving beats, 128 BPM feel""Melancholic jazz piano in F minor with soft brush drums and upright bass""Epic cinematic orchestral with brass and strings, heroic and uplifting mood"Since tokens expire hourly, you may need to refresh during long sessions:
Get new token:
gcloud auth print-access-token
Update config.json with the new token
Continue generating music
When a user asks you to generate music:
Check if setup is complete:
~/.openclaw/workspace/lyria/config.json existsCheck if token is valid:
Refine the prompt:
Generate:
./scripts/music-gen.sh "<refined_prompt>" "<descriptive_name>"
Deliver:
.wav file to userIterate (if needed):
| Error | Cause | Solution |
|---|---|---|
| Config file not found | First-time setup incomplete | Follow First-Time Setup steps |
| 401 Unauthorized | Bearer token expired or invalid | Refresh token: gcloud auth print-access-token |
| 403 Forbidden | No access to Lyria API | Enable Vertex AI API in Google Cloud Console |
| 404 Not Found | Project or location incorrect | Verify project_id and location in config |
| No predictions | API issue or invalid prompt | Retry with modified prompt |
~/.openclaw/workspace/
└── lyria/
├── config.json # User credentials and settings
└── generated_music/ # All generated audio files
├── music_20260302_143022.wav
├── my_relaxing_track.wav
└── ...
lyria-002https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/publishers/google/models/lyria-002:predictUser: Generate some lo-fi music for studying
Agent: I'll create a chill lo-fi track for you. First, let me check your setup...
[Checks config exists - yes]
[Checks token validity - yes]
Generating: "Chill lo-fi hip hop with soft piano melody, warm vinyl crackle, relaxed beats, no vocals"
...
Generated: ~/.openclaw/workspace/lyria/generated_music/lofi_study_track.wav
[Sends file]
Done! 30 seconds of chill lo-fi. Want me to make it longer by generating a continuation, or try a different vibe?
ZIP package — ready to use