Skill: raydoomed/minimax-lyrics (version 1.0.0)

--- name: minimax-lyrics description: Generate song lyrics with structure tags using MiniMax lyrics_generation API. Use when user asks to write lyrics, generate a song, or create a song. Triggers on: "帮我写歌词", "生成歌词", "写首歌词", "generate lyrics", "song lyrics". --- # MiniMax Lyrics Generation Generate structured song lyrics using MiniMax `lyrics_generation` API. ## Setup Create `~/.openclaw/workspace/skills/minimax-lyrics/lyrics_config.json`: ```json { "api_key": "YOUR_MINIMAX_API_KEY" } ``` ## Quick Use ```bash python3 ~/.openclaw/workspace/skills/minimax-lyrics/scripts/generate_lyrics.py \ --prompt "轻柔抒情流行，温柔女声，慢节奏，深情浪漫" \ --title "夏日海风" ``` ## API Parameters | 参数 | 说明 | |------|------| | `mode` | `write_full_song`（写完整歌曲）或 `edit`（编辑/续写） | | `prompt` | 歌曲主题、风格描述（0-2000字符） | | `title` | 歌曲标题（传入后输出保持该标题） | | `lyrics` | 现有歌词（仅 `edit` 模式） | ## Output Returns: - `song_title`: 生成的歌名 - `style_tags`: 风格标签（如 `Mandopop, Summer Vibe`） - `lyrics`: 带结构标签的完整歌词，支持14种标签：`[Intro]` `[Verse]` `[Pre-Chorus]` `[Chorus]` `[Hook]` `[Drop]` `[Bridge]` `[Solo]` `[Build-up]` `[Instrumental]` `[Breakdown]` `[Break]` `[Interlude]` `[Outro]` 歌词可直接传给 `minimax-feishu-music` skill 生成歌曲。 ## Example Output ``` song_title: 夏日海风的约定 style_tags: Mandopop, Summer Vibe, Romance, Lighthearted, Beach Pop lyrics: | [Intro] (Ooh-ooh-ooh) (Yeah) 阳光洒满了海面 [Verse 1] 海风轻轻吹拂你发梢 Smiling face, like a summer dream 浪花拍打着脚边 Leaving footprints, you and me [Pre-Chorus] 你说这感觉多么奇妙 (So wonderful) 想要永远停留在这一秒 [Chorus] Oh, 夏日的海边，我们的约定 阳光下，你的身影，如此动听 [Hook] 永远在一起 [Bridge] 时间慢慢走，我们一起老 [Solo] 器乐演奏段落 [Interlude] (Ooh-ooh) [Break] 突然安静 [Outro] (Ooh-ooh-ooh) ``` ## Notes - `write_full_song` 模式：根据 prompt 自动生成完整歌词结构 - `edit` 模式：续写或修改已有歌词 - 生成后展示给用户看，用户确认后再生成歌曲

path: lyrics_config.json
content: api_key: YOUR_MINIMAX_API_KEY

path: scripts/generate_lyrics.py
content: #!/usr/bin/env python3
"""
Generate song lyrics using MiniMax lyrics_generation API.

Usage:
  python3 generate_lyrics.py --prompt "<style description>" --title "<song title>"

Example:
  python3 generate_lyrics.py --prompt "轻柔抒情流行，温柔女声，慢节奏，深情浪漫" --title "夏日海风"
"""

import sys
import json
import argparse
import os

def get_minimax_key() -> str:
    """Extract MiniMax API key from this skill's lyrics_config.json."""
    config_path = os.path.expanduser('~/.openclaw/workspace/skills/minimax-lyrics/lyrics_config.json')
    with open(config_path, 'r') as f:
        config = json.load(f)
    [REDACTED_SECRET]'api_key')
    if not api_key:
        raise ValueError(f"No 'api_key' found in {config_path}")
    return api_key

def generate_lyrics(prompt: str, api_key: str, title: str = None, mode: str = "write_full_song", existing_lyrics: str = None) -> dict:
    """Generate lyrics via MiniMax API. Returns dict with song_title, style_tags, lyrics."""
    import urllib.request

    url = "https://api.minimaxi.com/v1/lyrics_generation"
    payload = {
        "mode": mode,
        "prompt": prompt,
    }
    if title:
        payload["title"] = title
    if mode == "edit" and existing_lyrics:
        payload["lyrics"] = existing_lyrics

    req = urllib.request.Request(
        url,
        data=json.dumps(payload).encode('utf-8'),
        headers={
            'Content-Type': 'application/json',
            'Authorization': f'Bearer {api_key}'
        },
        method='POST'
    )

    print(f"Calling MiniMax lyrics API...", file=sys.stderr)
    with urllib.request.urlopen(req, timeout=60) as resp:
        result = json.loads(resp.read())

    if result.get('base_resp', {}).get('status_code') != 0:
        raise ValueError(f"Lyrics API error: {result}")

    return {
        'song_title': result.get('song_title'),
        'style_tags': result.get('style_tags'),
        'lyrics': result.get('lyrics')
    }

def main():
    parser = argparse.ArgumentParser(description='Generate song lyrics via MiniMax API')
    parser.add_argument('--prompt', required=True, help='Song style/theme description')
    parser.add_argument('--title', help='Song title (optional)')
    parser.add_argument('--mode', default='write_full_song', help='Generation mode: write_full_song or edit')
    parser.add_argument('--lyrics', help='Existing lyrics for edit mode')
    args = parser.parse_args()

    [REDACTED_SECRET])
    result = generate_lyrics(args.prompt, api_key, args.title, args.mode, args.lyrics)

    # Print as formatted output for human reading
    print(f"\n=== Generated Lyrics ===", file=sys.stderr)
    print(f"Title: {result['song_title']}", file=sys.stderr)
    print(f"Style: {result['style_tags']}", file=sys.stderr)
    print(f"\n{result['lyrics']}", file=sys.stderr)

    # Also output clean JSON for parsing
    print(json.dumps(result, ensure_ascii=False, indent=2))

if __name__ == '__main__':
    main()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)