Introduction

API Status: Active
Response time: ~0.2s
View Status Page

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.

Génération Rapide

Temps de réponse moyen < 200ms

Haute Fiabilité

Garantie de disponibilité à 99,9%

Sécurisé

Chiffrement de bout en bout

URL de Base

https://riffusionapi.com/api
99.9%
Disponibilité
200ms
Latence moyenne
24/7
Assistance

Authentication

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.

API Key Management

You can manage your API keys from your dashboard. We recommend rotating your keys periodically for enhanced security.

Manage API Keys

Endpoints

GET /status

Description

Get current API usage and limits for your account

Response

{
 "status": "active",
 "plan": "pro",
 "monthly_calls": 150,
 "remaining_calls": 9850,
 "rate_limit_remaining": 9
}
POST /generate-music

Description

Submit a music generation request (asynchronous processing)

Request Body

{
 "prompt": "jazz piano with drums"
}
Request Parameters

prompt

Text description of the music to generate

Required

Response

{
 "text": "jazz piano with drums",
 "model": "riffusion",
 "request_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
 "status": "pending",
 "created": 1745023903
}
POST /generate-music

Description

Check the status of a music generation request

Request Body

{
 "request_id": "11aeb1db-1860-4550-b221-7cbfa1169732"
}

Response (In Progress)

{
 "model": "riffusion",
 "request_id": "11aeb1db-1860-4550-b221-7cbfa1169732",
 "status": "pending",
 "message": "Waiting for callback. Check again later.",
 "created": 1745023903
}

Response (Completed)

{
 "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
}

Response (Failed)

{
 "status": "failed",
 "details": {
   "detail": "Error during music generation: Timeout"
 }
}

Rate Limits

Standard Plan

Active
  • 5 requests per minute
  • 5,000 requests per month
  • Email support
$19 /month

Pro Plan

Recommended
  • 10 requests per minute
  • 10,000 requests per month
  • Priority support
  • Advanced parameters
$49 /month

Rate Limit Headers

Our API includes rate limit information in response headers:

  • X-RateLimit-Limit: Maximum requests per minute
  • X-RateLimit-Remaining: Remaining requests in the current window
  • X-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.

Exemples

Generate Music

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"
}'

Check Generation Status

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"
}'

Error Responses

{
 "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"
 }
}