Welcome to the vibrant world of music generation with the Suno AI API! This guide will walk you through the process of integrating this remarkable API into your agents, like GPTs, and unleash your creativity.
Introduction
Suno.ai v3 is an incredible AI music service that allows you to generate tunes tailored to your imagination. Even though the official API isn’t fully available yet, we’ve decided to open-source this project to help users experience its features. Let’s dive into how you can get started!
Getting Started
- Step 1: Obtain the Cookie from Your Suno Account
- Navigate to app.suno.ai in your browser.
- Open the browser console using F12 or the Developer Tools.
- Go to the Network tab.
- Refresh the page quickly.
- Look for the request containing the keyword client?_clerk_js_version, click on it, and switch to the Header tab.
- Find the Cookie section, hover over it, and copy its value.
- Step 2: Clone and Deploy the Project
You have two options for deployment:
- Step 3: Configure Suno API
- If you deployed to Vercel, go to the dashboard and add an environment variable SUNO_COOKIE with the copied cookie value.
- If running locally, add the following to your .env file:
bash SUNO_COOKIE=your-cookie
- Step 4: Run Suno API
- In Vercel, click on Deploy in the dashboard and visit the following link after deployment:
https:///api/get_limit for testing. - Locally, run npm run dev and visit http://localhost:3000/api/get_limit for testing.
- If you see a response indicating your usage limits, like:
{ credits_left: 50, period: day, monthly_limit: 50, monthly_usage: 50 }
it means everything is running smoothly!
- In Vercel, click on Deploy in the dashboard and visit the following link after deployment:
For detailed API documentation, check out suno.gcui.ai/docs.
Understanding the Code: An Analogy
Think of the Suno API as a musical kitchen and the functions in the code as various chefs who specialize in different types of dishes (music)
- custom_generate_audio: This chef creates a unique dish based on your specific tastes. You provide the ingredients (payload), and the chef meticulously prepares a unique recipe!
- extend_audio: Imagine a chef who takes an already prepared dish and extends it, adding more flavors and textures to make it more satisfying.
- generate_audio_by_prompt: This chef can whip up a brand-new dish just by hearing your craving! You simply say, “I want something like a heavy metal song,” and they go to work!
- get_audio_information: This chef retrieves information about existing dishes based on IDs—it’s all about knowing what’s available.
- get_quota_information: This chef checks how much food is still available in the pantry to ensure there are enough ingredients for the coming meals.
Troubleshooting
If you run into any hiccups along the way, consider these troubleshooting tips:
- Check your cookie value—it might be expired or copied incorrectly.
- Ensure all required environment variables are set correctly.
- Make sure you’re using the correct API endpoint in your requests.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
By following these steps, you can harness the power of the Suno AI API and create your very own music masterpieces! At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Related Links
- Project Repository: github.comgcui-artsuno-api
- Suno.ai Official Website: suno.ai
- Demo: suno.gcui.ai