Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,105 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
# Suno API
|
6 |
+
|
7 |
+
**Model Page:** [Suno API](https://piapi.ai/suno-api)
|
8 |
+
|
9 |
+
This model card illustartes the steps to use Suno API's endpoint.
|
10 |
+
You can also check out other model cards:
|
11 |
+
|
12 |
+
- [Midjourney API](https://huggingface.co/PiAPI/Midjourney-API)
|
13 |
+
- [Faceswap API](https://huggingface.co/PiAPI/Faceswap-API)
|
14 |
+
- [Dream Machine API](https://huggingface.co/PiAPI/Dream-Machine-API)
|
15 |
+
|
16 |
+
**Model Information**
|
17 |
+
|
18 |
+
Developed by the Suno team in Cambridge, MA, Suno is a leading-edge text-to-music model. While it doesn't have an official API service, PiAPI has introduced an unofficial Suno API, allowing developers globally to integrate Suno’s music creation capabilities into their applications.
|
19 |
+
|
20 |
+
|
21 |
+
## Usage Steps
|
22 |
+
|
23 |
+
Below we share the code snippets on how to use the Suno API's "Generate Full Song" endpoint.
|
24 |
+
- The programming language is Python
|
25 |
+
- This is only applicable for Extended Clips generated from the "Extend" function of the "Generate Music" endpoint.
|
26 |
+
|
27 |
+
**Create a task ID from the "Generate Full Song" endpoint**
|
28 |
+
|
29 |
+
<pre><code class="language-python">
|
30 |
+
<span class="hljs-keyword">import</span> http.client
|
31 |
+
|
32 |
+
conn = http.client.HTTPSConnection(<span class="hljs-string">"api.piapi.ai"</span>)
|
33 |
+
|
34 |
+
payload = <span class="hljs-string">"{\n \"clip_id\": \"0e764cab****************55f76ca44ed6\"\n}"</span>
|
35 |
+
|
36 |
+
headers = {
|
37 |
+
<span class="hljs-built_in">'X-API-Key': "{{x-api-key}}"</span>, //Insert your API Key here
|
38 |
+
<span class="hljs-built_in">'Content-Type': "application/json"</span>,
|
39 |
+
<span class="hljs-built_in">'Accept': "application/json"</span>
|
40 |
+
}
|
41 |
+
|
42 |
+
conn.request("POST", "/api/suno/v1/music/concat", payload, headers)
|
43 |
+
|
44 |
+
res = conn.getresponse()
|
45 |
+
data = res.read()
|
46 |
+
|
47 |
+
<span class="hljs-keyword">print</span>(data.decode("utf-8"))
|
48 |
+
</code></pre>
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
**Retrieve the task ID**
|
53 |
+
|
54 |
+
<pre><code class="language-python">
|
55 |
+
{
|
56 |
+
<span class="hljs-built_in">"code"</span>: 200,
|
57 |
+
<span class="hljs-built_in">"data"</span>: {
|
58 |
+
<span class="hljs-built_in">"task_id"</span>: "5440b19a*****************e92de94d5110" //Record the taskID provided in your response terminal
|
59 |
+
},
|
60 |
+
<span class="hljs-built_in">"message"</span>: "success"
|
61 |
+
}
|
62 |
+
</code></pre>
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
**Insert the "Generate Full Song" task ID into the fetch endpoint**
|
67 |
+
|
68 |
+
<pre><code class="language-python">
|
69 |
+
<span class="hljs-keyword">import</span> http.client
|
70 |
+
|
71 |
+
conn = http.client.HTTPSConnection(<span class="hljs-string">"api.piapi.ai"</span>)
|
72 |
+
|
73 |
+
|
74 |
+
headers = {
|
75 |
+
<span class="hljs-built_in">'Content-Type': "application/json"</span>,
|
76 |
+
<span class="hljs-built_in">'Accept': "application/json"</span>
|
77 |
+
}
|
78 |
+
|
79 |
+
conn.request("GET", "/api/suno/v1/music/task_id", headers=headers) //Replace the "task_id" with your task ID
|
80 |
+
|
81 |
+
res = conn.getresponse()
|
82 |
+
data = res.read()
|
83 |
+
|
84 |
+
<span class="hljs-keyword">print</span>(data.decode("utf-8"))
|
85 |
+
</code></pre>
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
**For fetch endpoint responses** - Refer to our [documentation](https://piapi.ai/docs) for more detailed information.
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
<br>
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
## Contact us
|
98 |
+
|
99 |
+
Contact us at <a href="mailto:[email protected]">[email protected]</a> for any inquires.
|
100 |
+
|
101 |
+
<br>
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|