API Documentation
Qubico/diffrhythm API Reference
Complete API documentation for the DiffRhythm model supporting AI music generation from lyrics, style prompts, and reference audio.
Quick Start
Get started with DiffRhythm model in minutes
Base URL
https://api.qubico.ai/v1/inference
Header Params
x-api-key: YOUR_API_KEY
Model ID
Qubico/diffrhythm
Base Mode Generation (txt2audio-base)
Generate 1.35 minute music compositions quickly
Request Example
POST https://api.qubico.ai/v1/inference Content-Type: application/json x-api-key: YOUR_API_KEY { "model": "Qubico/diffrhythm", "task_type": "txt2audio-base", "input": { "lyrics": "Walking down the street, feeling the beat", "style_prompt": "upbeat pop with electronic elements", "style_audio": "" }, "config": { "webhook_config": { "endpoint": "https://your-webhook.com/callback", "secret": "your_webhook_secret" } } }
Response Example
{ "task_id": "task_12345678", "status": "pending", "model": "Qubico/diffrhythm", "task_type": "txt2audio-base", "created_at": "2024-01-15T10:30:00Z", "estimated_time": 81 }
Parameters Reference
Complete list of available parameters for DiffRhythm model
Important: At least one of the three input parameters (lyrics, style_prompt, or style_audio) must be provided. You can use any combination of these parameters.
Required Parameters
model
string
required
Model identifier. Must be "Qubico/diffrhythm"
task_type
string
required
Task type. Options: "txt2audio-base"
, "txt2audio-full"
Input Parameters (At Least One Required)
input.lyrics
string
conditional
The lyrics for the song. Can include verse, chorus, bridge structures. Use line breaks to separate different sections.
input.style_prompt
string
conditional
Text description of the desired musical style, genre, instruments, or mood. Default: "pop"
input.style_audio
string
conditional
URL or base64 encoded reference audio to guide the musical style. Supports MP3, WAV, and FLAC formats.
Configuration Parameters
config.webhook_config
object
optional
Webhook configuration for async notifications
endpoint
- Webhook URLsecret
- Webhook secret for verificationResponse Format
Understanding API responses and status codes
Initial Response (202 Accepted)
{ "task_id": "task_12345678", "status": "pending", "model": "Qubico/diffrhythm", "task_type": "txt2audio-base", "created_at": "2024-01-15T10:30:00Z", "estimated_time": 81 }
Completed Response (GET /v1/tasks/task_id)
{ "task_id": "task_12345678", "status": "completed", "model": "Qubico/diffrhythm", "task_type": "txt2audio-base", "created_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:32:15Z", "results": [ { "url": "https://cdn.qubico.ai/results/audio_1.mp3", "duration": 81.5, "format": "mp3", "sample_rate": 44100, "channels": 2 } ], "usage": { "credits_used": 1 } }
Status Values
pending
Task is queuedprocessing
Task is being processedcompleted
Task completed successfullyfailed
Task failed with errorError Handling
Common error codes and how to handle them
400 Bad Request: Invalid parameters or missing required input parameters
401 Unauthorized: Invalid or missing API key
429 Too Many Requests: Rate limit exceeded
500 Internal Server Error: Server error, please retry
Error Response Format
{ "error": { "code": "MISSING_INPUT_PARAMETERS", "message": "At least one of 'lyrics', 'style_prompt', or 'style_audio' must be provided", "details": { "required_parameters": ["lyrics", "style_prompt", "style_audio"], "constraint": "at_least_one" } } }
Code Examples
Ready-to-use code snippets in popular languages
curl -X POST https://api.qubico.ai/v1/inference \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "model": "Qubico/diffrhythm", "task_type": "txt2audio-base", "input": { "lyrics": "Walking down the street, feeling the beat", "style_prompt": "upbeat pop with electronic elements" }, "config": { "webhook_config": { "endpoint": "https://your-webhook.com/callback", "secret": "your_webhook_secret" } } }'
Rate Limits & Pricing
Usage limits and cost information
Rate Limits
Requests per minute:
10
Concurrent tasks:
3
Daily requests:
100
Pricing
Base Mode (1.35 min):
$0.02
Full Mode (4.45 min):
$0.02
Free trial credits:
10 generations