Use API to call the music generation AI of Suno.ai and easily integrate it into agents like GPTs.
👉 We update quickly, please star.
English | 简体中文 | русский | Demo | Docs | Deploy with Vercel
> 🔥 Check out my new project: [ReadPo - 10x Speed Up Your Reading and Writing](https://readpo.com?utm_source=github&utm_medium=suno-ai)  ## Introduction Suno is an amazing AI music service. Although the official API is not yet available, we couldn't wait to integrate its capabilities somewhere. We discovered that some users have similar needs, so we decided to open-source this project, hoping you'll like it. This implementation uses the paid [2Captcha](https://2captcha.com/about) service (a.k.a. ruCaptcha) to solve the hCaptcha challenges automatically and does not use any already made closed-source paid Suno API implementations. ## Demo We have deployed an example bound to a free Suno account, so it has daily usage limits, but you can see how it runs: [suno.gcui.ai](https://suno.gcui.ai) ## Features - Perfectly implements the creation API from suno.ai. - Automatically keep the account active. - Solve CAPTCHAs automatically using [2Captcha](https://2captcha.com) and [Playwright](https://playwright.dev) with [rebrowser-patches](https://github.com/rebrowser/rebrowser-patches). - Compatible with the format of OpenAI’s `/v1/chat/completions` API. - Supports Custom Mode. - One-click deployment to [Vercel](#deploy-to-vercel) & [Docker](#docker). - In addition to the standard API, it also adapts to the API Schema of Agent platforms like GPTs and Coze, so you can use it as a tool/plugin/Action for LLMs and integrate it into any AI Agent. - Permissive open-source license, allowing you to freely integrate and modify. ## Getting Started ### 1. Obtain the cookie of your Suno account 1. Head over to [suno.com/create](https://suno.com/create) using your browser. 2. Open up the browser console: hit `F12` or access the `Developer Tools`. 3. Navigate to the `Network` tab. 4. Give the page a quick refresh. 5. Identify the latest request that includes the keyword `?__clerk_api_version`. 6. Click on it and switch over to the `Header` tab. 7. Locate the `Cookie` section, hover your mouse over it, and copy the value of the Cookie.  ### 2. Register on 2Captcha and top up your balance [2Captcha](https://2captcha.com/about) is a paid CAPTCHA solving service that uses real workers to solve the CAPTCHA and has high accuracy. It is needed because of Suno constantly requesting hCaptcha solving that currently isn't possible for free by any means. [Create](https://2captcha.com/auth/register?userType=customer) a new 2Captcha account, [top up](https://2captcha.com/pay) your balance and [get your API key](https://2captcha.com/enterpage#recognition). If you are located in Russia or Belarus, use the [ruCaptcha](https://rucaptcha.com) interface instead of 2Captcha. It's the same service, but it supports payments from those countries. ### 3. Clone and deploy this project You can choose your preferred deployment method: #### Deploy to Vercel [](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fgcui-art%2Fsuno-api&env=SUNO_COOKIE,TWOCAPTCHA_KEY,BROWSER,BROWSER_GHOST_CURSOR,BROWSER_LOCALE,BROWSER_HEADLESS&project-name=suno-api&repository-name=suno-api) #### Run locally ```bash git clone https://github.com/gcui-art/suno-api.git cd suno-api npm install npx playwright install chromium ``` #### Docker Alternatively, you can use [Docker Compose](https://docs.docker.com/compose/). However, follow the step below before running. ```bash docker compose build && docker compose up ``` ### 4. Configure suno-api - If deployed to Vercel, please add the environment variables in the Vercel dashboard. - If you’re running this locally, be sure to add the following to your `.env` file: #### Environment variables - `SUNO_COOKIE` — the `Cookie` header you obtained in the first step. - `TWOCAPTCHA_KEY` — your 2Captcha API key from the second step. - `BROWSER` — the name of the browser that is going to be used to solve the CAPTCHA. Only `chromium` and `firefox` supported. - `BROWSER_GHOST_CURSOR` — use ghost-cursor-playwright to simulate smooth mouse movements. Please note that it doesn't seem to make any difference in the rate of CAPTCHAs, so you can set it to `false`. Retained for future testing. - `BROWSER_LOCALE` — the language of the browser. Using either `en` or `ru` is recommended, since those have the most workers on 2Captcha. [List of supported languages](https://2captcha.com/2captcha-api#language) - `BROWSER_HEADLESS` — run the browser without the window. You probably want to set this to `true`. ```bash SUNO_COOKIE=<…> TWOCAPTCHA_KEY=<…> BROWSER=chromium BROWSER_GHOST_CURSOR=false BROWSER_LOCALE=en BROWSER_HEADLESS=true ``` ### 5. Run suno-api - If you’ve deployed to Vercel: - Please click on Deploy in the Vercel dashboard and wait for the deployment to be successful. - Visit the `https://