<p style="text-align:center;" align="center">
<img align="center" src="https://raw.githubusercontent.com/Malith-Rukshan/Suno-API/main/Logo.png" width="300px" height="300px"/>
</p>
<h1 align="center">โจ Suno AI API ๐ต</h1>
<div align='center'>
[](https://pypi.org/project/SunoAI/)
[](https://t.me/SunoAPI)
[](https://github.com/Malith-Rukshan/Suno-AI-BOT)
</div>
<h4 align="center">โจ Python API Library for Suno AI โ Create Music with Generative AI ! ๐</h4>
<div align="center">
- Available as Both Python Library and REST API -
<br />
<br />
<a href="https://pypi.org/project/SunoAI/">Python Library</a>
ยท
<a href="https://github.com/Malith-Rukshan/Suno-API/issues/new">Update Channel</a>
</div>
</br>
**๐ SunoAI API Library is an unofficial Python client for interacting with [Suno AI](https://suno.ai/)'s music generator**. This library facilitates generating music using Suno's Chirp v3 model and includes main functions of Suno AI with a built-in music downloader. It can be deployed as a **[REST API](#-deployment---rest-api)** using FastAPI, Local, Docker, on a PaaS provider like Heroku.
## โจ Features
- **Python Client ๐**: Easily interact with Suno AI.
- **Song Generation ๐ถ**: Utilize the Chirp v3 model for generating music.
- **Retrieve Song Info by ID ๐ต**: Access detailed information about any song on Suno AI.
- **Music Downloader ๐ฅ**: Built-in functionality to download any music on Suno AI directly.
- **REST API Deployment ๐**: Deployable as a REST API on PasS Platform , VPS or Local.
- **Comprehensive Documentation ๐**: Includes detailed examples and usage guides.
- **Docker Support ๐ณ**: Enables containerized deployment with Docker for flexibility.
- **PaaS Deployment โ๏ธ:** Facilitates deployment on platforms like Heroku for convenient accessibility.
# ๐ท Prerequisites
๐ Before using the library or REST API, <b>you must sign up on the [suno.ai](https://app.suno.ai/) website and obtain your cookie</b> as shown in this screenshot.
๐ก You can find cookie from the Web Browser's **Developer Tools -> Network Tab**
<details>
<summary>Click to view - Screenshot</summary>
<img src="https://raw.githubusercontent.com/Malith-Rukshan/Suno-API/main/Screenshot.jpg" alt="How to get Cookie from Suno.AI">
Just right click & open Inspect. Filter : `_clerk_js_version`
</details>
</br>
Set this cookie as `SUNO_COOKIE` environment variable or initialize the library as shown below.
```python
from suno import Suno, ModelVersions
client = Suno(
cookie='YOUR_COOKIE_HERE',
model_version=ModelVersions.CHIRP_V3_5)
```
## ๐พ Installation
Install the library using pip:
```shell
pip install SunoAI
```
<a href='https://pypi.org/project/SunoAI/'>
<img src='https://img.shields.io/badge/PyPi-Library-1cd760?logo=pypi&style=flat'>
</a>
## ๐ Deployment - REST API
### Deploy on PasS
Set `SUNO_COOKIE` as an Environmental variable before deploy. - [Instructions](#-prerequisites)
[](https://heroku.com/deploy)
[](https://app.netlify.com/start/deploy?repository=https://github.com/Malith-Rukshan/Suno-API)
[](https://railway.app/template/IdlBP8?referralCode=jC4ZQ_)
[](https://render.com/deploy)
</br>
### Deploy on Local or VPS
```shell
export SUNO_COOKIE="YOUR_COOKIE_HERE"
git clone git@github.com:Malith-Rukshan/Suno-API.git
pip3 install -r requirements.txt
cd Suno-API
fastapi run api.py --port 8080
```
๐ Available at : http://127.0.0.1:8080
## ๐ ๏ธ Usage
[](https://github.com/Malith-Rukshan/Suno-AI-BOT)
**โก๏ธ Quick Start :**
```python
from suno import Suno, ModelVersions
client = Suno(
cookie='YOUR_COOKIE_HERE',
model_version=ModelVersions.CHIRP_V3_5)
# Generate a song
songs = client.generate(prompt="A serene landscape", is_custom=False, wait_audio=True)
# Download generated songs
for song in songs:
file_path = client.download(song=song)
print(f"Song downloaded to: {file_path}")
```
### ๐ Library Methods
`Suno()` <- Initializing
- <b>Arguments</b>:
- cookie (Optional[str]): Optional. The authentication cookie for the Suno API. If not provided, it will use the cookie from the environment variable SUNO_COOKIE.
- model_version (str): Optional. The model version to use for generating audio. Available models: `chirp-v3-5`, `chirp-v3-0`, `chirp-v2-0` default is `chirp-v3-5`. | [Detailed view](#-available-suno-ai-models)
`generate()`
- <b>Arguments</b>:
- prompt (str): Description or lyrics for the song.
- is_custom (bool): Determines whether to use custom lyrics (True) or a description (False).
- tags (Optional[str]): Describes desired voice type or characteristics.
- title (Optional[str]): Title for the generated music.
- make_instrumental (Optional[bool]): Generates an instrumental version if True.
- wait_audio (bool): Waits until the audio URLs are ready if True.
- model_version (Optional[str]): The model version to use for generating audio. Defaults to the initialization value if not provided.
- <b>Returns</b>: A list of `Clip` objects containing song data with IDs.
- <b>Example:</b>
- **By Description**
```python
clips = client.generate(
prompt="A peaceful melody reflecting a serene landscape",
is_custom=False,
wait_audio=True
)
print(clips)
```
- **By Lyrics - Custom**
```python
clips = client.generate(
prompt="I found a love, for me\nDarling, just dive right in and follow my lead\nWell, I found a girl, beautiful and sweet\nOh, I never knew you were the someone waiting for me...",
tags="English men voice",
title="Perfect by Malith-Rukshan/Suno-API",
make_instrumental= False,
is_custom=True,
wait_audio=True
)
print(clips)
```
**โ๏ธ Usage Note :**
- When setting `is_custom` to `True`, ensure that the prompt parameter contains the lyrics of the song you wish to generate. Conversely, if `is_custom` is set to `False`, provide a descriptive prompt detailing the essence of the song you want.
- When `wait_audio` is set to **True**, the request will take longer as it waits for the audio URLs to be ready. If not set, the response will return without `audio_url` but with audio IDs. In such cases, you'll need to call the **get_songs** or **get_song** method after a short interval to retrieve the response with the `audio_url` included, once the generation process is complete.
`get_songs()`
- <b>Arguments</b>:
- <b>song_ids</b> (Optional[str]): A list of song IDs to fetch specific songs.
- <b>Returns</b>: A list of `Clip` objects representing the retrieved songs.
- Example:
```python
songs = client.get_songs(song_ids="123,456")
print(songs)
```
`set_visibility()`
- **Arguments**:
- **song_id** (str): The ID of the song to update.
- **is_public** (bool): A string indicating whether the song should be public (True) or private (False).
- **Returns** (bool): Status of the public visibility of the song. True if the song is public, False if private.
- **Example**:
```python
response = client.set_visibility(song_id="uuid-type-songid-1234", is_public=False)
print(response)
```
`get_credits()`
- Returns: Current billing and credits information as a `CreditsInfo` object.
- Example:
```python
credits_info = client.get_credits()
print(credits_info)
```
`download()`
- Arguments:
- song (str | Clip): The song to be downloaded. This can be either the ID of the song as a string or a Clip object containing the song's metadata.
- path (str): The directory path where the song will be saved. If not specified, defaults to "./downloads".
- Returns: str - The full filepath to the downloaded song.
- Raises:
- TypeError: If the song argument is neither a string ID nor a Clip object.
- Exception: If the download fails due to issues like an invalid URL or network errors.
- Example:
```python
# Using a song ID
file_path = client.download(song="uuid-type-songid-1234")
print(f"Song downloaded to: {file_path}")
# Using a Clip object
clip = client.get_song("uuid-type-songid-1234")
file_path = client.download(song=clip)
print(f"Song downloaded to: {file_path}")
```
### ๐ Available Suno AI Models:
Models provided by Suno AI to Generate music.
- **CHIRP_V3_5** - `chirp-v3-5` : Newest model, better song structure, max 4 minutes.
- **CHIRP_V3_0** - `chirp-v3-0` : Broad, versatile, max 2 minutes.
- **CHIRP_V2_0** - `chirp-v2-0` : Vintage Suno model, max 1.3 minutes.
Example How to use:
```python
from suno import Suno, ModelVersions
client = Suno(model_version=ModelVersions.CHIRP_V3_5)
```
or
```python
from suno import Suno
client = Suno(model_version='chirp-v3-5')
```
### ๐ Library Responses
- **Clip Model:**
The **Clip** class encapsulates the details of a music track generated by the Suno AI. Each attribute of this class provides specific information about the track:
- **id** (str): Unique identifier for the clip.
- **video_url** (str): URL of the video version of the song, if available.
- **audio_url** (str): URL where the audio track can be streamed or downloaded.
- **image_url** (str): URL of the song's image cover.
- **image_large_url** (str): URL of a larger version of the song's image cover.
- **is_video_pending** (bool): Indicates whether the video for the song is still processing.
- **major_model_version** (str): The major version of the model used to generate the song.
- **model_name** (str): Name of the model used to generate the track.
- **metadata** (ClipMetadata): Additional metadata related to the clip including tags, prompts, and other information.
- **is_liked** (bool): Indicates whether the song has been liked by the user.
- **user_id** (str): User ID of the person who created or requested the song.
- **display_name** (str): Display name of the user associated with the song.
- **handle** (str): User's handle or username.
- **is_handle_updated** (bool): Specifies whether the user's handle has been updated.
- **is_trashed** (bool): Indicates if the clip has been marked as trashed.
- **reaction** (dict): Reactions to the song from users, if any.
- **created_at** (str): Timestamp indicating when the song was created.
- **status** (str): Current status of the song (e.g., processing, completed).
- **title** (str): Title of the song.
- **play_count** (int): How many times the song has been played.
- **upvote_count** (int): Number of upvotes the song has received.
- **is_public** (bool): Indicates whether the song is publicly accessible.
- **CreditsInfo Model:**
The **CreditsInfo** class provides information about the user's credit balance and usage within the Suno AI system.
- **credits_left** (int): The number of credits remaining for the user.
- **period** (int): The current billing period for the credits, represented in some form of date or timeframe.
- **monthly_limit** (int): The total number of credits allocated to the user for the current month.
- **monthly_usage** (int): The amount of credits used by the user during the current month.
## ๐ REST API Usage
**1. Generate Music**
`POST /generate`
- **Request Body:**
```json
{
"prompt": "A serene melody about the ocean",
"is_custom": false,
"tags": "relaxing, instrumental",
"title": "Ocean Waves",
"make_instrumental": true,
"model_version": "chirp-v3-5",
"wait_audio": true
}
```
- **Response:**
<details>
<summary>Click to view</summary>
```json
[
{
"id": "124b735f-7fb0-42b9-8b35-761aed65a7f6",
"video_url": "",
"audio_url": "https://audiopipe.suno.ai/item_id=124b735f-7fb0-42b9-8b35-761aed65a7f6",
"image_url": "https://cdn1.suno.aiimage_124b735f-7fb0-42b9-8b35-761aed65a7f6.png",
"image_large_url": "https://cdn1.suno.aiimage_large_124b735f-7fb0-42b9-8b35-761aed65a7f.png",
"is_video_pending": False,
"major_model_version": "v3",
"model_name": "chirp-v3",
"metadata": {
"tags": "English men voice",
"prompt": "I found a love, for me\nDarling,just dive right in and follow mylead\nWell, I found a girl, beautiful andsweet\nOh, I never knew you were thesomeone waiting for me\n\nโฒCause we werejust kids when we fell in love\nNot knowingwhat it was\nI will not give you up thistime\nBut darling, just kiss me slow\nYourheart is all I own\nAnd in your eyes,you're holding mine\n\nBaby, Iโฒm dancing inthe dark\nWith you between myarms\nBarefoot on the grass\nListening toour favourite song\nWhen you said youlooked a mess\nI whispered underneath mybreath\nBut you heard it\nDarling, you lookperfect tonight",
"gpt_description_prompt": None,
"audio_prompt_id": None,
"history": None,
"concat_history": None,
"type": "gen",
"duration": None,
"refund_credits": None,
"stream": True,
"error_type": None,
"error_message": None
},
"is_liked": False,
"user_id":"2340653f-32cb-4343-artb-09203ty749e9",
"display_name": "Snonymous",
"handle": "anonymous",
"is_handle_updated": False,
"is_trashed": False,
"reaction": None,
"created_at": "2024-05-05T11:54:09.356Z",
"status": "streaming",
"title": "Perfect by Malith-Rukshan/Suno-API",
"play_count": 0,
"upvote_count": 0,
"is_public": False
}
]
```
</details>
**2. Retrieve Songs**
`POST /songs`
- **Request Body:**
```json
{
"song_ids": "uuid-format-1234,4567-abcd"
}
```
- **Response:**
Array of Clips - Same to `/generate` Response
**3. Get a Specific Song**
`POST /get_song`
- **Request Body:**
```json
{
"song_id": "uuid-song-id"
}
```
- **Response:**
Just Clip Response - Same to `/generate` Response but Only Clip
`POST /set_visibility`
- **Request Body:**
```json
{
"song_id": "uuid-song-id",
"is_public": true
}
```
- **Response:**
```json
{
"is_public": true
}
```
**4. Retrieve Credit Information**
`GET /credits`
- **Response:**
```json
{
"credits_left": 50,
"period": "2024-05",
"monthly_limit": 100,
"monthly_usage": 25
}
```
> According to [Suno.ai](https://suno.ai/) Each song generation consumes 5 credits, thus a total of 10 credits is necessary for each successful call.
## ๐ค Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
## ๐ฏ Credits and Other
All content and music generated through this library are credited to [Suno AI](https://suno.ai/). This unofficial API provides a convenient way to interact with Suno AI's services but does not claim any ownership or rights over the music generated. Please respect the terms of service of Suno AI when using their platform โค๏ธ.
> This library is intended primarily for educational and development purposes. It aims to enhance and simplify access to Suno AI's music generation capabilities. If you enjoy the music generated, consider supporting Suno AI directly.
> Logo Credit : [@rejaul43](https://dribbble.com/rejaul43)
## โ๏ธ License
This project is distributed under the MIT License. This license allows everyone to use, modify, and redistribute the code. However, it comes with no warranties regarding its functionality. For more details, see the [LICENSE](https://github.com/Malith-Rukshan/Suno-API/blob/main/LICENSE) file in the repository.
## ๐ Support and Community
If you found this project helpful, **don't forget to give it a โญ on GitHub.** This helps others find and use the project too! ๐ซถ
#### ๐ฐ Support Me
<a href="https://ko-fi.com/malith" target="_blank" alt="KoFi"><img height="40" src="https://az743702.vo.msecnd.net/cdn/kofi3.png"/></a>
Join our Telegram channels,
- [@SingleDevelopers](https://t.me/SingleDevelopers), for more amazing projects and updates โ
- [@SunoAPI](https://t.me/SunoAPI), for this project updates โ
## ๐ฌ Contact
If you have any questions, feedback, or just want to say hi, you can reach out to me:
- Developer : [@MalithRukshan](https://t.me/MalithRukshan)
- Support Group : [@Suno_API](https://t.me/Suno_API)
๐งโ๐ป Built with ๐ by [Single Developers </> ](https://t.me/SingleDevelopers)
Raw data
{
"_id": null,
"home_page": "https://github.com/Malith-Rukshan/Suno-API",
"name": "SunoAI",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Malith Rukshan",
"author_email": "hello@malith.dev",
"download_url": "https://files.pythonhosted.org/packages/ca/d6/f6884356a1d33990bc7d5f383c2d6f6ee42825e4798e350d80bad875eb7e/sunoai-1.0.7.tar.gz",
"platform": null,
"description": "<p style=\"text-align:center;\" align=\"center\">\n <img align=\"center\" src=\"https://raw.githubusercontent.com/Malith-Rukshan/Suno-API/main/Logo.png\" width=\"300px\" height=\"300px\"/>\n</p>\n<h1 align=\"center\">\u2728 Suno AI API \ud83c\udfb5</h1>\n<div align='center'>\n\n[](https://pypi.org/project/SunoAI/)\n[](https://t.me/SunoAPI)\n[](https://github.com/Malith-Rukshan/Suno-AI-BOT)\n\n</div>\n<h4 align=\"center\">\u2728 Python API Library for Suno AI \u2014 Create Music with Generative AI ! \ud83d\ude80</h4>\n<div align=\"center\">\n - Available as Both Python Library and REST API -\n <br />\n <br />\n <a href=\"https://pypi.org/project/SunoAI/\">Python Library</a>\n \u00b7\n <a href=\"https://github.com/Malith-Rukshan/Suno-API/issues/new\">Update Channel</a>\n</div>\n</br>\n\n**\ud83d\udcda SunoAI API Library is an unofficial Python client for interacting with [Suno AI](https://suno.ai/)'s music generator**. This library facilitates generating music using Suno's Chirp v3 model and includes main functions of Suno AI with a built-in music downloader. It can be deployed as a **[REST API](#-deployment---rest-api)** using FastAPI, Local, Docker, on a PaaS provider like Heroku.\n\n## \u2728 Features\n- **Python Client \ud83d\udc0d**: Easily interact with Suno AI.\n- **Song Generation \ud83c\udfb6**: Utilize the Chirp v3 model for generating music.\n- **Retrieve Song Info by ID \ud83c\udfb5**: Access detailed information about any song on Suno AI.\n- **Music Downloader \ud83d\udce5**: Built-in functionality to download any music on Suno AI directly.\n- **REST API Deployment \ud83c\udf10**: Deployable as a REST API on PasS Platform , VPS or Local.\n- **Comprehensive Documentation \ud83d\udcda**: Includes detailed examples and usage guides.\n- **Docker Support \ud83d\udc33**: Enables containerized deployment with Docker for flexibility.\n- **PaaS Deployment \u2601\ufe0f:** Facilitates deployment on platforms like Heroku for convenient accessibility.\n\n# \ud83c\udff7 Prerequisites\n \ud83d\udccb Before using the library or REST API, <b>you must sign up on the [suno.ai](https://app.suno.ai/) website and obtain your cookie</b> as shown in this screenshot.\n\n\ud83d\udca1 You can find cookie from the Web Browser's **Developer Tools -> Network Tab**\n\n<details>\n <summary>Click to view - Screenshot</summary>\n<img src=\"https://raw.githubusercontent.com/Malith-Rukshan/Suno-API/main/Screenshot.jpg\" alt=\"How to get Cookie from Suno.AI\">\n\nJust right click & open Inspect. Filter : `_clerk_js_version`\n</details>\n</br>\n\nSet this cookie as `SUNO_COOKIE` environment variable or initialize the library as shown below.\n\n```python\nfrom suno import Suno, ModelVersions\nclient = Suno(\n cookie='YOUR_COOKIE_HERE',\n model_version=ModelVersions.CHIRP_V3_5)\n```\n\n## \ud83d\udcbe Installation\nInstall the library using pip: \n\n```shell\npip install SunoAI\n```\n\n<a href='https://pypi.org/project/SunoAI/'>\n<img src='https://img.shields.io/badge/PyPi-Library-1cd760?logo=pypi&style=flat'>\n</a>\n\n## \ud83d\ude80 Deployment - REST API\n\n### Deploy on PasS\n\nSet `SUNO_COOKIE` as an Environmental variable before deploy. - [Instructions](#-prerequisites)\n\n[](https://heroku.com/deploy)\n[](https://app.netlify.com/start/deploy?repository=https://github.com/Malith-Rukshan/Suno-API)\n\n[](https://railway.app/template/IdlBP8?referralCode=jC4ZQ_)\n[](https://render.com/deploy)\n</br>\n\n### Deploy on Local or VPS\n\n```shell\nexport SUNO_COOKIE=\"YOUR_COOKIE_HERE\"\ngit clone git@github.com:Malith-Rukshan/Suno-API.git\npip3 install -r requirements.txt\ncd Suno-API\nfastapi run api.py --port 8080\n```\n\ud83d\udd17 Available at : http://127.0.0.1:8080\n\n## \ud83d\udee0\ufe0f Usage\n\n[](https://github.com/Malith-Rukshan/Suno-AI-BOT)\n\n**\u26a1\ufe0f Quick Start :**\n```python\nfrom suno import Suno, ModelVersions\nclient = Suno(\n cookie='YOUR_COOKIE_HERE',\n model_version=ModelVersions.CHIRP_V3_5)\n\n# Generate a song\nsongs = client.generate(prompt=\"A serene landscape\", is_custom=False, wait_audio=True)\n\n# Download generated songs\nfor song in songs:\n file_path = client.download(song=song)\n print(f\"Song downloaded to: {file_path}\")\n```\n\n### \ud83d\udcda Library Methods\n\n`Suno()` <- Initializing\n- <b>Arguments</b>:\n - cookie (Optional[str]): Optional. The authentication cookie for the Suno API. If not provided, it will use the cookie from the environment variable SUNO_COOKIE.\n - model_version (str): Optional. The model version to use for generating audio. Available models: `chirp-v3-5`, `chirp-v3-0`, `chirp-v2-0` default is `chirp-v3-5`. | [Detailed view](#-available-suno-ai-models)\n\n`generate()`\n- <b>Arguments</b>:\n - prompt (str): Description or lyrics for the song.\n - is_custom (bool): Determines whether to use custom lyrics (True) or a description (False).\n - tags (Optional[str]): Describes desired voice type or characteristics.\n - title (Optional[str]): Title for the generated music.\n - make_instrumental (Optional[bool]): Generates an instrumental version if True.\n - wait_audio (bool): Waits until the audio URLs are ready if True.\n - model_version (Optional[str]): The model version to use for generating audio. Defaults to the initialization value if not provided.\n- <b>Returns</b>: A list of `Clip` objects containing song data with IDs.\n- <b>Example:</b>\n - **By Description**\n ```python\n clips = client.generate(\n prompt=\"A peaceful melody reflecting a serene landscape\",\n is_custom=False,\n wait_audio=True\n )\n print(clips)\n ```\n - **By Lyrics - Custom**\n ```python\n clips = client.generate(\n prompt=\"I found a love, for me\\nDarling, just dive right in and follow my lead\\nWell, I found a girl, beautiful and sweet\\nOh, I never knew you were the someone waiting for me...\",\n tags=\"English men voice\",\n title=\"Perfect by Malith-Rukshan/Suno-API\",\n make_instrumental= False,\n is_custom=True,\n wait_audio=True\n )\n print(clips)\n ```\n**\u270d\ufe0f Usage Note :**\n - When setting `is_custom` to `True`, ensure that the prompt parameter contains the lyrics of the song you wish to generate. Conversely, if `is_custom` is set to `False`, provide a descriptive prompt detailing the essence of the song you want.\n - When `wait_audio` is set to **True**, the request will take longer as it waits for the audio URLs to be ready. If not set, the response will return without `audio_url` but with audio IDs. In such cases, you'll need to call the **get_songs** or **get_song** method after a short interval to retrieve the response with the `audio_url` included, once the generation process is complete.\n\n`get_songs()`\n- <b>Arguments</b>:\n - <b>song_ids</b> (Optional[str]): A list of song IDs to fetch specific songs.\n- <b>Returns</b>: A list of `Clip` objects representing the retrieved songs.\n- Example:\n ```python\n songs = client.get_songs(song_ids=\"123,456\")\n print(songs)\n ```\n`set_visibility()`\n- **Arguments**:\n - **song_id** (str): The ID of the song to update.\n - **is_public** (bool): A string indicating whether the song should be public (True) or private (False).\n- **Returns** (bool): Status of the public visibility of the song. True if the song is public, False if private.\n- **Example**:\n```python\nresponse = client.set_visibility(song_id=\"uuid-type-songid-1234\", is_public=False)\nprint(response)\n```\n\n`get_credits()`\n- Returns: Current billing and credits information as a `CreditsInfo` object.\n- Example:\n ```python\n credits_info = client.get_credits()\n print(credits_info)\n ```\n\n`download()`\n- Arguments:\n - song (str | Clip): The song to be downloaded. This can be either the ID of the song as a string or a Clip object containing the song's metadata.\n - path (str): The directory path where the song will be saved. If not specified, defaults to \"./downloads\".\n- Returns: str - The full filepath to the downloaded song.\n- Raises:\n - TypeError: If the song argument is neither a string ID nor a Clip object.\n - Exception: If the download fails due to issues like an invalid URL or network errors.\n- Example:\n ```python\n # Using a song ID\n file_path = client.download(song=\"uuid-type-songid-1234\")\n print(f\"Song downloaded to: {file_path}\")\n\n # Using a Clip object\n clip = client.get_song(\"uuid-type-songid-1234\")\n file_path = client.download(song=clip)\n print(f\"Song downloaded to: {file_path}\")\n ```\n### \ud83d\udcdd Available Suno AI Models:\n\nModels provided by Suno AI to Generate music.\n - **CHIRP_V3_5** - `chirp-v3-5` : Newest model, better song structure, max 4 minutes.\n - **CHIRP_V3_0** - `chirp-v3-0` : Broad, versatile, max 2 minutes.\n - **CHIRP_V2_0** - `chirp-v2-0` : Vintage Suno model, max 1.3 minutes.\n \n Example How to use:\n ```python\n from suno import Suno, ModelVersions\n \n client = Suno(model_version=ModelVersions.CHIRP_V3_5)\n ```\n\n or\n\n ```python\n from suno import Suno\n\n client = Suno(model_version='chirp-v3-5')\n ```\n\n### \ud83d\udcda Library Responses\n\n- **Clip Model:**\n\n The **Clip** class encapsulates the details of a music track generated by the Suno AI. Each attribute of this class provides specific information about the track:\n - **id** (str): Unique identifier for the clip.\n - **video_url** (str): URL of the video version of the song, if available.\n - **audio_url** (str): URL where the audio track can be streamed or downloaded.\n - **image_url** (str): URL of the song's image cover.\n - **image_large_url** (str): URL of a larger version of the song's image cover.\n - **is_video_pending** (bool): Indicates whether the video for the song is still processing.\n - **major_model_version** (str): The major version of the model used to generate the song.\n - **model_name** (str): Name of the model used to generate the track.\n - **metadata** (ClipMetadata): Additional metadata related to the clip including tags, prompts, and other information.\n - **is_liked** (bool): Indicates whether the song has been liked by the user.\n - **user_id** (str): User ID of the person who created or requested the song.\n - **display_name** (str): Display name of the user associated with the song.\n - **handle** (str): User's handle or username.\n - **is_handle_updated** (bool): Specifies whether the user's handle has been updated.\n - **is_trashed** (bool): Indicates if the clip has been marked as trashed.\n - **reaction** (dict): Reactions to the song from users, if any.\n - **created_at** (str): Timestamp indicating when the song was created.\n - **status** (str): Current status of the song (e.g., processing, completed).\n - **title** (str): Title of the song.\n - **play_count** (int): How many times the song has been played.\n - **upvote_count** (int): Number of upvotes the song has received.\n - **is_public** (bool): Indicates whether the song is publicly accessible.\n\n- **CreditsInfo Model:**\n\n The **CreditsInfo** class provides information about the user's credit balance and usage within the Suno AI system.\n - **credits_left** (int): The number of credits remaining for the user.\n - **period** (int): The current billing period for the credits, represented in some form of date or timeframe.\n - **monthly_limit** (int): The total number of credits allocated to the user for the current month.\n - **monthly_usage** (int): The amount of credits used by the user during the current month.\n\n\n## \ud83c\udf10 REST API Usage\n\n**1. Generate Music**\n\n`POST /generate`\n\n - **Request Body:**\n ```json\n {\n \"prompt\": \"A serene melody about the ocean\",\n \"is_custom\": false,\n \"tags\": \"relaxing, instrumental\",\n \"title\": \"Ocean Waves\",\n \"make_instrumental\": true,\n \"model_version\": \"chirp-v3-5\",\n \"wait_audio\": true\n }\n ```\n\n - **Response:**\n <details>\n <summary>Click to view</summary>\n \n ```json\n [\n {\n \"id\": \"124b735f-7fb0-42b9-8b35-761aed65a7f6\",\n \"video_url\": \"\",\n \"audio_url\": \"https://audiopipe.suno.ai/item_id=124b735f-7fb0-42b9-8b35-761aed65a7f6\",\n \"image_url\": \"https://cdn1.suno.aiimage_124b735f-7fb0-42b9-8b35-761aed65a7f6.png\",\n \"image_large_url\": \"https://cdn1.suno.aiimage_large_124b735f-7fb0-42b9-8b35-761aed65a7f.png\",\n \"is_video_pending\": False,\n \"major_model_version\": \"v3\",\n \"model_name\": \"chirp-v3\",\n \"metadata\": {\n \"tags\": \"English men voice\",\n \"prompt\": \"I found a love, for me\\nDarling,just dive right in and follow mylead\\nWell, I found a girl, beautiful andsweet\\nOh, I never knew you were thesomeone waiting for me\\n\\n\u2032Cause we werejust kids when we fell in love\\nNot knowingwhat it was\\nI will not give you up thistime\\nBut darling, just kiss me slow\\nYourheart is all I own\\nAnd in your eyes,you're holding mine\\n\\nBaby, I\u2032m dancing inthe dark\\nWith you between myarms\\nBarefoot on the grass\\nListening toour favourite song\\nWhen you said youlooked a mess\\nI whispered underneath mybreath\\nBut you heard it\\nDarling, you lookperfect tonight\",\n \"gpt_description_prompt\": None,\n \"audio_prompt_id\": None,\n \"history\": None,\n \"concat_history\": None,\n \"type\": \"gen\",\n \"duration\": None,\n \"refund_credits\": None,\n \"stream\": True,\n \"error_type\": None,\n \"error_message\": None\n },\n \"is_liked\": False,\n \"user_id\":\"2340653f-32cb-4343-artb-09203ty749e9\",\n \"display_name\": \"Snonymous\",\n \"handle\": \"anonymous\",\n \"is_handle_updated\": False,\n \"is_trashed\": False,\n \"reaction\": None,\n \"created_at\": \"2024-05-05T11:54:09.356Z\",\n \"status\": \"streaming\",\n \"title\": \"Perfect by Malith-Rukshan/Suno-API\",\n \"play_count\": 0,\n \"upvote_count\": 0,\n \"is_public\": False\n }\n ]\n ```\n </details>\n\n**2. Retrieve Songs**\n\n`POST /songs`\n\n - **Request Body:**\n ```json\n {\n \"song_ids\": \"uuid-format-1234,4567-abcd\"\n }\n ```\n - **Response:**\n Array of Clips - Same to `/generate` Response\n\n**3. Get a Specific Song**\n\n`POST /get_song`\n\n - **Request Body:**\n ```json\n {\n \"song_id\": \"uuid-song-id\"\n }\n ```\n - **Response:**\n Just Clip Response - Same to `/generate` Response but Only Clip\n\n`POST /set_visibility`\n\n - **Request Body:**\n ```json\n {\n \"song_id\": \"uuid-song-id\",\n \"is_public\": true\n }\n ```\n - **Response:**\n ```json\n {\n \"is_public\": true\n }\n ```\n\n**4. Retrieve Credit Information**\n\n`GET /credits`\n\n - **Response:**\n ```json\n {\n \"credits_left\": 50,\n \"period\": \"2024-05\",\n \"monthly_limit\": 100,\n \"monthly_usage\": 25\n }\n ```\n> According to [Suno.ai](https://suno.ai/) Each song generation consumes 5 credits, thus a total of 10 credits is necessary for each successful call.\n\n\n## \ud83e\udd1d Contributing\nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.\n\n## \ud83c\udfaf Credits and Other\nAll content and music generated through this library are credited to [Suno AI](https://suno.ai/). This unofficial API provides a convenient way to interact with Suno AI's services but does not claim any ownership or rights over the music generated. Please respect the terms of service of Suno AI when using their platform \u2764\ufe0f.\n\n> This library is intended primarily for educational and development purposes. It aims to enhance and simplify access to Suno AI's music generation capabilities. If you enjoy the music generated, consider supporting Suno AI directly.\n> Logo Credit : [@rejaul43](https://dribbble.com/rejaul43)\n\n## \u2696\ufe0f License\nThis project is distributed under the MIT License. This license allows everyone to use, modify, and redistribute the code. However, it comes with no warranties regarding its functionality. For more details, see the [LICENSE](https://github.com/Malith-Rukshan/Suno-API/blob/main/LICENSE) file in the repository.\n\n## \ud83c\udf1f Support and Community\nIf you found this project helpful, **don't forget to give it a \u2b50 on GitHub.** This helps others find and use the project too! \ud83e\udef6\n\n#### \ud83d\udcb0 Support Me\n<a href=\"https://ko-fi.com/malith\" target=\"_blank\" alt=\"KoFi\"><img height=\"40\" src=\"https://az743702.vo.msecnd.net/cdn/kofi3.png\"/></a>\n\nJoin our Telegram channels, \n\n- [@SingleDevelopers](https://t.me/SingleDevelopers), for more amazing projects and updates \u2713\n- [@SunoAPI](https://t.me/SunoAPI), for this project updates \u2713\n\n## \ud83d\udcec Contact\nIf you have any questions, feedback, or just want to say hi, you can reach out to me:\n\n- Developer : [@MalithRukshan](https://t.me/MalithRukshan)\n- Support Group : [@Suno_API](https://t.me/Suno_API)\n\n\ud83e\uddd1\u200d\ud83d\udcbb Built with \ud83d\udc96 by [Single Developers </> ](https://t.me/SingleDevelopers)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API for interacting with the Suno AI music generator - Unofficial",
"version": "1.0.7",
"project_urls": {
"Homepage": "https://github.com/Malith-Rukshan/Suno-API"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d988c967215db102ea7f34965df81f6db703b9e4206063b498028955a69ece19",
"md5": "c7bd59885c335f2062b76d21c337ce62",
"sha256": "ef4ee504d6493b4927339403ba6ceef04cc1fee7c2ceab14d0e7217338bdd51c"
},
"downloads": -1,
"filename": "SunoAI-1.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c7bd59885c335f2062b76d21c337ce62",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 15129,
"upload_time": "2024-06-26T03:54:48",
"upload_time_iso_8601": "2024-06-26T03:54:48.654452Z",
"url": "https://files.pythonhosted.org/packages/d9/88/c967215db102ea7f34965df81f6db703b9e4206063b498028955a69ece19/SunoAI-1.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cad6f6884356a1d33990bc7d5f383c2d6f6ee42825e4798e350d80bad875eb7e",
"md5": "bbcbaa191de253fe67d274798b8772da",
"sha256": "4f8f130beca601e1573704ae09f421bacdbcbc3242afa677f47fe6e2d8174bcf"
},
"downloads": -1,
"filename": "sunoai-1.0.7.tar.gz",
"has_sig": false,
"md5_digest": "bbcbaa191de253fe67d274798b8772da",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 14079,
"upload_time": "2024-06-26T03:54:51",
"upload_time_iso_8601": "2024-06-26T03:54:51.268213Z",
"url": "https://files.pythonhosted.org/packages/ca/d6/f6884356a1d33990bc7d5f383c2d6f6ee42825e4798e350d80bad875eb7e/sunoai-1.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-26 03:54:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Malith-Rukshan",
"github_project": "Suno-API",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "fastapi",
"specs": []
},
{
"name": "uvicorn",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "pydantic",
"specs": []
}
],
"lcname": "sunoai"
}