Overview

Use your API key to generate music via our HTTP endpoints. We support multiple generation modes.

Base URL

https://api.sunomusic.fun/v1/music

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

1. Query Music Status

Check the status of your music generation tasks.

  • Endpoint: GET /status
  • Query Params: ids (comma-separated Task IDs)
GET https://api.sunomusic.fun/v1/music/status?ids=TASK_ID_1,TASK_ID_2
Authorization: Bearer YOUR_API_KEY

Response Example:

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "id": "TASK_ID_1",
      "status": "success",
      "data": {
        "clips": [
          {
            "id": "task_id_1",
            "clip_id": "clip_id_1",
            "status": "streaming",
            "audio_url": "https://...",
            "video_url": "https://...",
            "image_url": "https://...",
            "title": "Song Title",
            "duration": 120,
            "model_name": "chirp-v4",
            "metadata": {
              "tags": "xxx",
              "prompt": "xxx",
              "gpt_description_prompt": "xxx"
            },
            "created_at": "2025-01-10T16:40:23.000Z"
          },
          {
            "id": "task_id_2",
            "clip_id": "clip_id_2",
            "status": "streaming",
            "audio_url": "https://...",
            "video_url": "https://...",
            "image_url": "https://...",
            "title": "Song Title",
            "duration": 120,
            "model_name": "chirp-v4",
            "metadata": {
              "tags": "xxx",
              "prompt": "xxx",
              "gpt_description_prompt": "xxx"
            },
            "created_at": "2025-01-10T16:40:23.000Z"
          }
        ]
      }
    }
  ]
}

2. Generate Music

Create new music using different modes.

  • Endpoint: POST /generate
  • Body: JSON object

Parameters

ParameterTypeRequiredDescription
modelstringNoModel ID (e.g., chirp-v3-5, chirp-v4)
gpt_description_promptstringNoInspiration Mode: Description of the music style/topic
promptstringNoCustom Mode: Lyrics.
titlestringNoCustom Mode: Title of the song
tagsstringNoCustom Mode: Style tags (e.g., "pop, rock")
make_instrumentalbooleanNoGenerate instrumental music (no vocals)
continue_clip_idstringNoExtension: ID of the clip to extend
continue_atnumberNoExtension: Timestamp to start extension (seconds)
callback_urlstringNoWebhook URL for async notification

Mode 1: Inspiration (Description)

Generate music by describing a topic or style.

POST /generate
{
  "gpt_description_prompt": "A cheerful pop song about summer by the beach",
  "model": "chirp-v4"
}

Mode 2: Custom (Lyrics)

Generate music with specific lyrics, title, and tags.

POST /generate
{
  "prompt": "[Verse]\nSummer breeze blowing gently\nWaves crashing on the sand\n\n[Chorus]\nLet's dance together",
  "title": "Summer Beach",
  "tags": "pop, summer, energetic",
  "model": "chirp-v3-5"
}

Mode 3: Instrumental

Generate music without vocals.

POST /generate
{
  "gpt_description_prompt": "An electronic dance track",
  "make_instrumental": true,
  "model": "chirp-v4"
}

Mode 4: Extension

Continue an existing track.

POST /generate
{
  "continue_clip_id": "EXISTING_CLIP_ID",
  "continue_at": 60,
  "prompt": "[Outro]\nFading out into the sunset...",
  "model": "chirp-v4"
}

Async Notification (Webhook)

You can provide a callback_url in the /generate endpoint to receive a POST request when generation is complete.

{
  "prompt": "Test song",
  "callback_url": "https://your-server.com/callback"
}

Callback Content:

{
  "clips": [
    {
      "id": "task_id_1",
      "clip_id": "clip_id_1",
      "status": "streaming",
      "audio_url": "https://...",
      "video_url": "https://...",
      "image_url": "https://...",
      "title": "Song Title",
      "duration": 120,
      "model_name": "chirp-v4",
      "metadata": {
        "tags": "xxx",
        "prompt": "xxx",
        "gpt_description_prompt": "xxx"
      },
      "created_at": "2025-01-10T16:40:23.000Z"
    },
    {
      "id": "task_id_2",
      "clip_id": "clip_id_2",
      "status": "streaming",
      "audio_url": "https://...",
      "video_url": "https://...",
      "image_url": "https://...",
      "title": "Song Title",
      "duration": 120,
      "model_name": "chirp-v4",
      "metadata": {
        "tags": "xxx",
        "prompt": "xxx",
        "gpt_description_prompt": "xxx"
      },
      "created_at": "2025-01-10T16:40:23.000Z"
    }
  ],
  "status": "completed"
}