back to home

12-06-2024

Suno AI API: Revolutionizing Music Creation

The Suno AI API is an advanced tool designed to facilitate music creation using artificial intelligence. It allows users to generate complete songs with intricate lyrics, melodies, and vocals tailored to their specific styles. The API is particularly beneficial for developers looking to integrate AI-powered music features into their applications.

Key Features of Suno AI API:

  1. Instant Song Creation: Generate songs quickly with AI-powered lyrics and vocals across various genres.
  2. Custom Mode: Allows for setting specific parameters like lyrics, music style, and titles to create personalized music tracks.
  3. Integration: Compatible with platforms like GPTs and Coze, making it suitable for various AI agents and applications.
  4. API Access: Provides seamless integration with easy-to-understand documentation and supports deployment on platforms like Vercel.
  5. Support and Community: Offers support through a responsive developer community and continuous updates to enhance user experience.

Example API Usage

Here’s an example of how you can use the Suno AI API to generate music in Python:

import requests

base_url = 'http://localhost:3000'  # Replace with your deployed API base URL

# Function to generate custom audio
def custom_generate_audio(payload):
    url = f"{base_url}/api/custom_generate"
    response = requests.post(url, json=payload, headers={'Content-Type': 'application/json'})
    return response.json()

# Payload example for custom music generation
payload = {
    "prompt": "A serene melody about the ocean",
    "is_custom": True,
    "tags": "relaxing, instrumental",
    "title": "Ocean Waves",
    "make_instrumental": True,
    "model_version": "chirp-v3-5",
    "wait_audio": True
}

# Generate custom audio
response = custom_generate_audio(payload)
print(response)

Getting Started

To get started with Suno AI API:

  1. Obtain Cookie: Navigate to app.suno.ai, open the browser console, and copy the cookie value from a specific request header.
  2. Deploy API: Clone the Suno API repository from GitHub and deploy it locally or on Vercel.
  3. Configure API: Add the obtained cookie to the environment variables or configuration settings.
  4. Use API: Utilize the provided endpoints to generate music, extend audio, and retrieve song information.

For more detailed information and documentation, you can visit the Suno API documentation or the GitHub repository.