About this project

Suno AI API is an unofficial open-source project (licensed under LGPL-3.0) that provides an API wrapper for the Suno.ai music generation service. It allows users to integrate music generation capability into AI agents like GPTs, Coze, and LangChain. Key Features: - Implements the full creation API of Suno.ai, including prompt-based generation, custom mode (with lyrics, style, and title control), lyrics generation, audio extension, stem track generation, and song concatenation. - Automatically solves hCaptcha challenges using the paid 2Captcha (or ruCaptcha) service and Playwright with rebrowser-patches. - Keeps the Suno account active in the background. - Offers an OpenAI-compatible `/v1/chat/completions` API format. - Supports one-click deployment to Vercel, local execution via Node.js, or Docker (though GPU acceleration is disabled in Docker). Configuration: To run the service, users need to provide a Suno cookie (`SUNO_COOKIE`), a 2Captcha API key (`TWOCAPTCHA_KEY`), and browser settings (such as `BROWSER=chromium`, `BROWSER_LOCALE=en`, and `BROWSER_HEADLESS=true`). macOS systems are recommended to minimize the number of CAPTCHAs encountered. API Capabilities: The project exposes several REST endpoints, including `/api/generate`, `/api/custom_generate`, `/api/get` (to retrieve music info by ID), `/api/get_limit` (to check quota), `/api/extend_audio`, `/api/generate_stems`, `/api/clip`, and `/api/concat`. It also allows overriding cookies via request headers to use multiple accounts simultaneously. Code examples in Python and JavaScript are provided in the README to demonstrate usage.