rtc_prd/API相关/minimax-歌词生成 (Lyrics Generation).md
seaislee1209 066eb8f820 feat: music-creation page + MiniMax API integration + Flutter dev setup
Music Creation Page:
- Vinyl 3D flip to view lyrics, tonearm animation, glow rotation effect
- Circular SVG progress ring, speech bubble feedback, confirm dialog
- Playlist modal, free creation input, lyrics formatting optimization
- MiniMax API real music generation with SSE streaming progress

Backend:
- FastAPI proxy server.py for MiniMax API calls
- Music + lyrics file persistence to Capybara music/ directory
- GET /api/playlist endpoint for auto-building playlist from files

UI/UX Refinements:
- frontend-design skill compliance across all pages
- Glassmorphism effects, modal interactions, scroll tap prevention
- iPhone 12 Pro responsive layout (390x844)

Flutter Development Preparation:
- Installed flutter-expert skill with 6 reference docs
- Added 5 Cursor Rules: official Flutter, clean architecture, UI performance, testing, Dart standards

Assets:
- 9 Capybara music MP3 files + lyrics TXT files
- MiniMax API documentation

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 18:23:19 +08:00

5.5 KiB
Raw Permalink Blame History

Documentation Index

Fetch the complete documentation index at: https://platform.minimaxi.com/docs/llms.txt Use this file to discover all available pages before exploring further.

歌词生成 (Lyrics Generation)

使用本接口生成歌词,支持完整歌曲创作和歌词编辑/续写。

OpenAPI

openapi: 3.1.0
info:
  title: MiniMax Lyrics Generation API
  description: MiniMax 歌词生成 API支持完整歌曲创作和歌词编辑/续写
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.minimaxi.com
security:
  - bearerAuth: []
paths:
  /v1/lyrics_generation:
    post:
      tags:
        - Music
      summary: 歌词生成
      operationId: generateLyrics
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: 请求体的媒介类型,请设置为 `application/json`,确保请求数据的格式为 JSON
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateLyricsReq'
        required: true
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateLyricsResp'
components:
  schemas:
    GenerateLyricsReq:
      type: object
      required:
        - mode
      properties:
        mode:
          type: string
          description: 生成模式。<br>`write_full_song`:写完整歌曲<br>`edit`:编辑/续写歌词
          enum:
            - write_full_song
            - edit
        prompt:
          type: string
          description: 提示词/指令,用于描述歌曲主题、风格或编辑方向。为空时随机生成。
          maxLength: 2000
        lyrics:
          type: string
          description: 现有歌词内容,仅在 `edit` 模式下有效。可用于续写或修改已有歌词。
          maxLength: 3500
        title:
          type: string
          description: 歌曲标题。传入后输出将保持该标题不变。
      example:
        mode: write_full_song
        prompt: 一首关于夏日海边的轻快情歌
    GenerateLyricsResp:
      type: object
      properties:
        song_title:
          type: string
          description: 生成的歌名。若请求传入 `title` 则保持一致。
        style_tags:
          type: string
          description: 风格标签,逗号分隔。例如:`Pop, Upbeat, Female Vocals`
        lyrics:
          type: string
          description: >-
            生成的歌词,包含结构标签。可直接用于[音乐生成接口](/api-reference/music-generation)的
            `lyrics` 参数生成歌曲。<br>支持的结构标签14种`[Intro]`, `[Verse]`,
            `[Pre-Chorus]`, `[Chorus]`, `[Hook]`, `[Drop]`, `[Bridge]`,
            `[Solo]`, `[Build-up]`, `[Instrumental]`, `[Breakdown]`, `[Break]`,
            `[Interlude]`, `[Outro]`
        base_resp:
          $ref: '#/components/schemas/BaseResp'
      example:
        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
          沙滩上留下我们的笑
          Every moment, a sweet melody
          看着你眼中的闪耀
          Like the stars in the deep blue sea

          [Pre-Chorus]
          你说这感觉多么奇妙
          (So wonderful)
          想要永远停留在这一秒
          (Right here, right now)
          心跳加速,像海浪在奔跑

          [Chorus]
          Oh, 夏日的海边,我们的约定
          阳光下,你的身影,如此动听
          微风吹散了烦恼,只留下甜蜜
          这瞬间,只想和你,永远在一起
          (永远在一起)

          [Verse 2]
          ...
        base_resp:
          status_code: 0
          status_msg: success
    BaseResp:
      type: object
      description: 状态码及详情
      properties:
        status_code:
          type: integer
          description: |-
            状态码及其分别含义如下:

            `0`: 请求成功

            `1002`: 触发限流,请稍后再试

            `1004`: 账号鉴权失败,请检查 API-Key 是否填写正确

            `1008`: 账号余额不足

            `1026`: 输入包含敏感内容

            `2013`: 传入参数异常,请检查入参是否按要求填写

            `2049`: 无效的api key

            更多内容可查看 [错误码查询列表](/api-reference/errorcode) 了解详情
        status_msg:
          type: string
          description: 具体错误详情
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |-
        `HTTP: Bearer Auth`
         - Security Scheme Type: http
         - HTTP Authorization Scheme: Bearer API_key用于验证账户信息可在 [账户管理>接口密钥](https://platform.minimaxi.com/user-center/basic-information/interface-key) 中查看。