PiAPI
HomeWorkspace
HomeWorkspace
Join Discord
  1. DiffRhythm
  • Get Started
    • Overview
    • Quickstart
    • Make Instruction: How to Use PiAPI to Build a Workflow on Make?
  • Endpoints
    • Song(Udio)
      • Song API Task Creation Examples
      • [Udio] Song Extend
      • Get Task
      • Create Task
      • [Udio] Generate Lyrics
    • Kling
      • Lipsync With PiAPI Kling API Examples
      • Motion Brush With PiAPI Kling API Example
      • Kling Elements Video Generation API
      • Kling Effects Video Generation
      • Cancel Task
        • Cancel Tasks
        • Cancel Task
      • Get Task
      • Create Task
      • Kling Virtual Try-On
      • Kling Effects
      • Kling Sound
    • Hailuo
      • Hailuo Director Mode Example
      • Generate Video
      • Get Task
    • Flux
      • Flux with LoRA and Controlnet
      • Available LoRA and Controlnet
      • Flux API with Redux Variation, Fill, Inpaint and Outpaint
      • Create Task
        • Text to Image
        • Image to Image
        • Kontext
      • Get task
    • AI Hug
      • Get Task
      • Create Task
    • LLM
      • Use Cases for GPT-4o Image API
      • How To Avoid Timeouts in Completion API
      • GPT-4o Image Generation API
      • LLM API | Basic Completions
      • Get Task
    • Midjourney
      • PiAPI Penalties on Midjourney Usage
      • Detailed Explaination on Midjourney Task Result
      • Midjourney V7 API Instructions
      • Create Task
        • Imagine
        • Upscale
        • Variation
        • Reroll
        • Describe
        • Seed
        • Blend
        • Inpaint
        • Outpaint
        • Pan
      • Cancel Task
        • Cancel Task
        • Cancel Tasks
      • Get Task
    • Faceswap
      • Multi Faceswap
      • Image Faceswap
      • Video Faceswap
      • Get Task
    • TTS
      • Zeroshot Text-to-Speech F5-TTS
      • Get Task
    • Trellis
      • Create Task
      • Get Task
    • Luma Dream Machine
      • Cancel Task
        • Cancel Tasks
        • Cancel Task
      • Create Task
      • Get Task
    • WanX
      • Generate WanX Task with LoRA Using PiAPI
      • Available LoRA Types for Wanx
      • Use Cases for Wanx LoRA
      • Use Cases for Wanx Control Camera
      • Create Task
      • Get Task
    • Skyreels
      • Create Task
      • Get Task
    • Framepack
      • Create Task
      • Get Task
    • Hunyuan Video
      • How to Make a Hunyuan API Call
      • Get Task
      • Generate Video
    • Mmaudio
      • Get Task
      • Generate Audio
    • DiffRhythm
      • Generate Audio
        POST
      • Get Task
        GET
    • Ace Step
      • Create Task
        • Text to Audio
        • Audio to Audio
        • Audio Edit
        • Audio Extend
      • Get Task
    • Joycaption
      • Image Caption
      • Get Task
    • Tools
      • File Upload API
      • Remove Background API
      • Remove Background-Get Task
      • Segment With Prompt API
      • Segment With Prompt API-Get Task
      • Image Upscale(Super Resolution) API
      • Image Upscale-Get Task
      • Video Upscale
      • Video Upscale-Get Task
      • Video Remove Background
      • Video Remove Background-Get task
    • PiAPI Account Management
      • PiAPI Account Info
      • Task List Info
      • User Task History
  • Resources
    • Change Log
    • Output Storage
    • Unified API Schema
    • Webhook
    • Bulk Generation Service
    • Billings
    • PiAPI MCP Server
    • Workspace Manual
      • Host-your-account (HYA) | Back-up Account
      • Host-your-account (HYA) | Debug Checklist
      • Host-your-account (HYA) | Connected Account Status
    • Announcements
      • PiAPI 2025 January 1st Pricing Update
  • Legacy Documentation
    • Midjourney
      • Midjourney Webhook
      • Imagine
      • Reroll
      • Upscale
      • Variation
      • Inpaint
      • Outpaint
      • Pan
      • Describe
      • Blend
      • Seed
      • Fetch
      • Multi Fetch
      • Cancel
    • Face Swap
      • Video Faceswap
      • Multi-face-swap
      • Fetch
    • Dream Machine
      • Video Generation
      • Video Extend
      • Get Video Generation
    • Kling
      • Video Generation
      • Video Extend
      • Get Video Generation
  1. DiffRhythm

Generate Audio

POST
https://api.piapi.ai/api/v1/task

Overview#

This endpoint from PiAPI's DiffRhythm API can generate audio based on prompt or reference audio with lyrics.
The lyric placement is highly flexible—PiAPI users can customize lyric integration using structured input formats. They can also choose different task-type depending on the target duration of the music they want.

Information&Pricing#

ModelTask TypeGenerate Audio DurationPrice (USD)
Qubico/diffrhythmtxt2audio-base1.35 min$0.02/generation
Qubico/diffrhythmtxt2audio-full4.45 min$0.02/generation

Example#

To generate reasonable audio, Users could choose audio style(e.g., pop) based on text or upload Base64 or url of reference audio.
Here is an example that users could follow when they need to generate a song with lyrics:
[00:10.00] Drifting through the Milky Way’s glow, stars hum low and bright
[00:17.00] Every shadow hides a cosmos, burning without light
[00:24.00] You said you loved black holes’ silence, where time turns to dust
[00:31.00] I clung to supernova whispers, aching with their trust
[00:38.00] Orion’s belt held promises we strung like comet trails
[00:45.00] Now Saturn’s rings just echo how our gravity fails
[00:52.00] Your voice became a distant pulse, a quasars’ fading song
[00:59.00] I chart the void where constellations swore we’d belong
[01:06.00] Nebulas bleed hues we named—our scarlet, our chrome
[01:13.00] But cold dark matter cradles what the stars left alone…
[01:20.00] (Instrumental fade: synth waves & celestial chimes)
Users can control the musical style/tone through prompts when adding lyrics to precise time positions.

Request

Header Params

Body Params application/json

Example
{
    "model": "Qubico/diffrhythm",
    "task_type": "txt2audio-base",
    "input": {
        "lyrics": "",
        "style_prompt": "pop",
        "style_audio": ""
    },
    "config": {
        "webhook_config": {
            "endpoint": "",
            "secret": ""
        }
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.piapi.ai/api/v1/task' \
--header 'x-api-key;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "Qubico/diffrhythm",
    "task_type": "txt2audio-base",
    "input": {
        "lyrics": "",
        "style_prompt": "pop",
        "style_audio": ""
    },
    "config": {
        "webhook_config": {
            "endpoint": "",
            "secret": ""
        }
    }
}'

Responses

🟢200Success
application/json
Body

Example
{
    "model": "Qubico/diffrhythm",
    "task_type": "txt2audio-base",
    "input": {
        "lyrics": "",
        "style_prompt": "pop",
        "style_audio": ""
    },
    "config": {
        "webhook_config": {
            "endpoint": "",
            "secret": ""
        }
    }
}
Modified at 2025-06-11 09:01:24
Previous
Generate Audio
Next
Get Task