Important Notice: Our service now uses Lannetech as the API provider for music generation, offering better reliability and faster response times.
Welcome to the Riffusion API documentation. Our API allows you to generate music from text descriptions using cutting-edge AI technology. Our service transforms your text prompts into high-quality musical excerpts in various genres and styles.
Temps de réponse moyen < 200ms
Garantie de disponibilité à 99,9%
Chiffrement de bout en bout
https://riffusionapi.com/api
All API requests require authentication using an API key. Include your API key in the request headers:
x-api-key: YOUR_API_KEY
Security Warning
Never share your API key or commit it to version control. Store it securely as an environment variable in production environments.
You can manage your API keys from your dashboard. We recommend rotating your keys periodically for enhanced security.
Manage API Keys/status
Get current API usage and limits for your account
{
"status": "active",
"plan": "pro",
"monthly_calls": 150,
"remaining_calls": 9850,
"rate_limit_remaining": 9
}
/generate-music
Submit a music generation request (asynchronous processing)
{
"prompt": "jazz piano with drums"
}
prompt
Text description of the music to generate
Required
{
"text": "jazz piano with drums",
"model": "riffusion",
"request_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
"status": "pending",
"created": 1745023903
}
/generate-music
Check the status of a music generation request
{
"request_id": "11aeb1db-1860-4550-b221-7cbfa1169732"
}
{
"model": "riffusion",
"request_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
"status": "pending",
"message": "Waiting for callback. Check again later.",
"created": 1745023903
}
{
"model": "riffusion",
"request_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
"status": "complete",
"audio_url": "",
"data": {
"task_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
"status": "complete",
"callback_type": "text",
"data": [
{
"stream_audio_url": "https://mfile.erweima.ai/ZTlmZTA5OGQtYzk2Mi00MjllLTlhZDItZWRkNzhlNTRmYzc5",
"title": "Jazz Piano"
},
{
"stream_audio_url": "https://mfile.erweima.ai/MDM3ODdiN2EtZThjZi00OTZiLTg0OTUtMDJiOTRkZjk4ZGE0",
"title": "Jazz Piano Variation"
}
]
},
"created": 1745023903
}
{
"status": "failed",
"details": {
"detail": "Error during music generation: Timeout"
}
}
Our API includes rate limit information in response headers:
X-RateLimit-Limit
: Maximum requests per minuteX-RateLimit-Remaining
: Remaining requests in the current windowX-RateLimit-Reset
: Time when the rate limit resets (Unix timestamp)Rate Limit Exceeded
When rate limits are exceeded, the API will return a 429 Too Many Requests
status code. Please implement appropriate backoff and retry mechanisms in your application.
curl -X POST "https://riffusionapi.com/api/generate-music" \
-H "accept: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "jazz piano with drums"
}'
curl -X POST "https://riffusionapi.com/api/generate-music" \
-H "accept: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_id": "11aeb1db-1860-4550-b221-7cbfa1169732"
}'
{
"detail": "Rate limit exceeded (10 requests per minute)"
}
{
"detail": "Invalid API key"
}
{
"detail": "Monthly API call limit exceeded (10000 calls)"
}
{
"detail": "Request not found"
}
{
"status": "failed",
"details": {
"detail": "Error during music generation: Timeout"
}
}