[ä¸æ](https://github.com/wlhtea/Suno2openai/blob/main/README_ZH.md) English
# Suno2openai
> Integrated based on [SunoSongsCreator](https://github.com/yihong0618/SunoSongsCreator) and [Suno-API](https://github.com/SunoAI-API/Suno-API) projects, offering standardized service interfaces compliant with OpenAI formats.
## Changelog
- 2024.4.14 Support for non-streaming output with `stream=False` docker version 0.1.1 No need to update if you don't need this feature.
- 2024.4.14 Updated a script to automatically retrieve cookies from registered Outlook emails and write them into the database.
- 2024.4.12 **Completed integration of new-api and one-api**, select OpenAI calls, and input the project deployment address (no need for /v1/); the key can be left empty.
- 2024.4.10 Due to Suno's official updates, some project features were inoperable, now modified. Please re-pull the projects pulled before 2024/4/10 15:04; Docker to be updated later (already updated, be mindful of the version number when pulling).
## ⨠Project Highlights
- **OpenAI Format Calls**: Supports streaming output.
- **Front-end Compatibility**: Compatible with front-end projects like `chat-next-web`.
- **Docker Deployment**: Simplifies deployment process, supports `docker-compose`, `docker`.
- **Multiple Cookie Management**: Implements rotation of multiple cookies.
## ð Future Plans
- Introduce request queueing optimizations.
- Support for custom parameters (such as `tags`, `prompt`, `style`, and song continuation).
- Explore development of official-like frontend pages.
- Welcome valuable suggestions! ð§ **Email**: [email protected]
---
## ð« Docker Deployment
This tutorial provides step-by-step guidance on running a Docker container with specific environment variables and port mappings. For the purpose of this guide, sensitive information such as SQL names, passwords, and IP addresses will be replaced with placeholders.
## Prerequisites
- Docker is installed on your machine.
- Basic knowledge of Docker CLI.
## Steps
1. **Pull Docker Image**
Ensure the Docker image `wlhtea/suno2openai:0.1.1` is available on your machine. If not, you can pull it from the Docker repository using:
```bash
docker pull wlhtea/suno2openai:0.1.1
```
2. **Run Docker Container**
Run the Docker container using necessary environment variables and port mappings. Replace `<SQL_NAME>`, `<SQL_PASSWORD>`, and `<SQL_IP>` with your actual SQL database connection values. These should be kept confidential and not shared publicly.
```bash
docker run -d --name wsunoapi \
-p 8000:8000 \
-e BASE_URL='https://studio-api.suno.ai' \
-e SESSION_ID='<your-session-id not required>' \
-e SQL_name='<SQL_NAME>' \
-e SQL_password='<SQL_PASSWORD>' \
-e SQL_IP='<SQL_IP>' \
-e SQL_dk=3306 \
--restart=always \
wlhtea/suno2openai:0.1.1
```
**Parameter Explanation:**
- `-d`: Run the container in detached mode and print the container ID.
- `--name wsunoapi`: Name your container `wsunoapi` for easy reference.
- `-p 8000:8000`: Map the container's 8000 port to the host machine's 8000 port.
- `-e`: Set environment variables for your container.
- `--restart=always`: Ensure the container always restarts, unless manually stopped.
3. **Add Cookie to Database**
Simply open the database and add cookies with the remaining count (an automatic import feature will be added later).
```mysql
id = int
cookie = Cookie
count = int
working = 0
```
Database may report error: 'NoneType' object has no attribute 'items', [check here if correct](https://github.com/wlhtea/Suno2openai/issues/10)
5. **Access the Application**
Once the container is running, the application inside should be accessible via `http://localhost:8000` or the 8000 port of your Docker host machine's IP address.
## Note
Before running the Docker container, make sure you replace placeholders like `<SQL_NAME>`, `<SQL_PASSWORD>`, `<SQL_IP>`, and `<your-session-id>` with actual values.
## ð¦ Docker-Compose Deployment
_Update Time: 2024/4/7 18:18_
### Clone the Project to Your Server
```bash
git clone https://github.com/wlhtea/Suno2openai.git
```
### Create a Database
Create a database (name it as you wish), remember to save the password, and ensure the database permissions are set correctly (allow connections from all IPs or only from Docker container IPs).
### Configure Environment Variables
**Rename the `env.example` file to `.env` and fill in the corresponding details:**
```plaintext
BASE_URL=https://studio-api.suno.ai
SESSION_ID=cookie # This item does not need to be changed
SQL_name=<Database Name>
SQL_password=<Database Password>
SQL_IP=<Database Host IP>
SQL_dk=3306 # Database port
```
### Enter the Project Directory
```bash
cd Suno2openai
```
### Update Cookie
### Start Docker
```bash
docker compose build && docker compose up
```
**Notes**:
- **Security Group Configuration**: Ensure the port 8000 is open.
- **HTTPS Support**: If the frontend project uses HTTPS, the proxy URL of this project should also use HTTPS.
## ðª Obtaining Cookies
### For Personal Use
Edit the `update_cookie_to_sql.py` file and insert your cookies into the array below:
```python
cookies = ['cookie1', 'cookie2']
```
![Example of Cookie Location](https://github.com/wlhtea/Suno2openai/assets/115779315/6edf9969-9eb6-420f-bfcd-dbf4b282ecbf)
### For Team Use
- Obtain cookies in bulk through the [file-based program](https://github.com/wlhtea/Suno2openai/tree/main/suno_%E6%89%93%E5%8F%B7%E5%8F%96cookie).
- After obtaining, place the generated `outlook.csv` in the same directory as `sign_suno.py` to retrieve cookies.
- Paste the obtained cookies into the `update_cookie_to_sql.py` file under `cookies = [paste directly here]`.
- Run `update_cookie_to_sql.py`, provided that the environment is set up correctly, whether you are deploying in Docker or locally.
## ð Integrating new-api(one-api)
In the channel's proxy settings, enter the project address as `http://<server IP>:8000`. HTTPS and a domain name are recommended.
## ð Effect Display
![chat-next-web Effect Picture](https://github.com/wlhtea/Suno2openai/assets/115779315/6495e840-b025-4667-82f6-19116ce71c8e)
## ð Internship Opportunities
If interested in welcoming a third-year student with experience in data analysis and front-end/back-end development for an internship, please contact:
- ð§ **Email**: [email protected]
**Support Us**: If you find this project helpful, please do not hesitate to star it â! We welcome any form of support and suggestions, letâs progress together!
没有合适的资源?快使用搜索试试~ 我知道了~
Suno-3-openai-提供符合OpenAI格式的接口
共40个文件
py:16个
pyc:8个
txt:3个
需积分: 5 0 下载量 23 浏览量
2024-04-15
15:41:00
上传
评论
收藏 74KB ZIP 举报
温馨提示
基于 SunoSongsCreator 和 Suno-API 项目整合,提供符合OpenAI格式的接口标准化服务。 更新日志 2024.4.14 支持非流式输出,参数设置stream=False docker版本为0.1.1 如无需该功能不必更新 2024.4.14 跟新一个脚本自动将注册的outlook邮箱获取cookie并将cookie写入数据库 2024.4.12 完成对new-api和one-api接入,选择openai调用,并填入项目部署地址(不需要/v1/)密钥空着即可。 2024.4.10 由于suno官方更新 部分项目功能无法使用 已经重新更改 在2024/4/10:15:04之前拉去的项目 请重新拉去即可 docker晚点更新(已更新,拉去时注意拉去版本号。) 项目特点 OpenAI格式调用:支持流式输出内容。 前端兼容性:适配 chat-next-web 等前端项目。 Docker部署:简化部署流程,支持 docker-compose、docker。 多Cookie管理:实现多个Cookie轮询使用。
资源推荐
资源详情
资源评论
收起资源包目录
Suno2openai-main.zip (40个子文件)
Suno2openai-main
suno
__init__.py 27B
__main__.py 62B
suno.py 10KB
__pycache__
__init__.cpython-311.pyc 225B
suno.cpython-311.pyc 14KB
utils.py 2KB
init_sql.py 2KB
cookie.py 2KB
main.py 13KB
LICENSE 1KB
update_cookie_to_sql.py 1KB
README_ZH.md 6KB
deps.py 172B
suno_songs-0.4.0.dist-info
METADATA 2KB
top_level.txt 5B
LICENSE 34KB
INSTALLER 4B
entry_points.txt 40B
REQUESTED 0B
WHEEL 92B
RECORD 1KB
suno_打号取cookie
sign_suno.py 3KB
打号机.py 6KB
README_en.md 6KB
docker-compose.yml 116B
env.example 200B
Dockerfile 649B
schemas.py 810B
sql_uilts.py 4KB
requirements.txt 2KB
打号机.py 6KB
__pycache__
sql_uilts.cpython-311.pyc 11KB
utils.cpython-311.pyc 4KB
schemas.cpython-311.pyc 2KB
deps.cpython-311.pyc 466B
cookie.cpython-311.pyc 4KB
main.cpython-311.pyc 13KB
test.py 8KB
README.md 7KB
resver_main.py 3KB
共 40 条
- 1
资源评论
Chat_lsm2024
- 粉丝: 756
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功