gcui-art / suno-api

Use API to call the music generation AI of suno.ai, and easily integrate it into agents like GPTs.
https://suno.gcui.ai
GNU Lesser General Public License v3.0
872 stars 194 forks source link

Cookie/session error #90

Open Ippephyx opened 1 month ago

Ippephyx commented 1 month ago

Hi !

Thanks a lot for this API. I used it for about a week without a single problem. But since friday, without modifyin anything, I' can't seem to be able to get a session id :² {"error":"Internal server error. Error: Failed to get session id, you may need to update the SUNO_COOKIE"}

I've tried updating the SUNO cookie locally (export ...) and system wide (editing /etc/environment) but, still the same error. I've notice that the cookie now starts with "__cf_bm=" instead of "__client=" , µI dont know if that might be the source of the problem... ?

Thanks a lot.

blueeon commented 1 month ago

Okay, I may have a brief vacation next week, I will make time to deal with it.The new product has taken up all my time recently, I need to find a gap, although slowly, I will continue to maintain it.

Ippephyx commented 1 month ago

Thank you so much for you reply. Should you need help or testing, do not not hesitate.

haiweizhu commented 4 weeks ago

I am being troubled by the same issue.

ihebsalah commented 4 weeks ago

heeey bois, I had the same problem and it somehow works now. So I went into settings and environment variables and I had replaced them with the one in here: tokens?_clerk_js_version=4.73.2 And then I saved the changes. Then I went and redeployed my old deployment of the SUNO API app (I think environment variable changes only take effect on redeployment, im not sure) And then it worked using /api/get_limit.

Sooo get a new cookie and redeploy the entire thing after changing the environment variable. This worked for me, but I hope it works for you as well!

blueeon commented 3 weeks ago

I’m not sure if you modified the cookie in Vercel and didn’t redeploy. Is that so? Please give me some feedback. @Ippephyx @haiweizhu @ihebsalah

ihebsalah commented 3 weeks ago

Yes, so originally the vercel App was working using the old cookie method. Then it broke down, I tried to change the SUNO_COOKIE environment variable WITHOUT redeploying, and it never worked that way. ( I came from Azure where changing the environment variable works without redeploying )

Then I used the value inside of here: tokens?_clerk_js_version=4.73.2 to change the environment Variable. Then I actually redeployed this time and it worked.

So I am not sure if this: "tokens?_clerk_js_version=4.73.2" exact cookie made it work, I have not tested if the other values work, but eh just try. So my biggest mistake was actually not redeploying after changing the cookie value. And if it didnt work with the normal cookie just give this a try: tokens?_clerk_js_version=4.73.2. Maybe it works too.

FergaliciousPixelicious commented 2 weeks ago

Is your product sumosuno.com? Seems like they provide a Suno API out of the box

ihebsalah commented 2 weeks ago

Is your product sumosuno.com?

are you talking about me? xD if so thanks for asking. no that was not my product, but im using this API in an autonomous software development system. I know it's quite optimistic to make ai do the entire process of software development, but it is displaying quite good results for ai you know xD.

So I am using this so that my agents can generate music and add it to their apps. Soo the system itself is almost done cooking :D. So quite literally what Devin AI wanted to be.

cmarrades commented 4 days ago

Ill tell you my experience. I built an app on top of this api. And the cookie has been my biggest nightmare since. I didnt know there was any other way to update the cookie other than grabbing it from the google console and redeploying. These cookies may expire without any warning. I believe SUNO releases affect to them, because i got these cookies expired in 2 days, 8 days, 1 day, without a clear pattern.

I doubt there is any way to refresh this cookie automatically, since you need to login through google with your credentials, and that part I couldn´t automate. But if there is any way to do this, please share. Because every time the cookie goes nuts, all music generation on my app goes down. 😥

ihebsalah commented 4 days ago

Yeee you could probably find a way to control vercel through an API and automatically fetch the token using some kind of backend browser, every time it expires

Now I would rather have a version of the suno API wrapper that runs locally on my machine for this (best would be using a library that you could import to avoid redeployment), as you would probably have to wait a bit for the vercel app to redeploy.

Try with Claude sonnet 3.5 and not gpt 4o to make this. You can also try logging in using discord or Microsoft account if Google doesn't work. But I'm not sure as to how possible that is because I never tried.

But yeah I also gave up on music generation because of the cookie situation. I still think this is lose lose for suno ai. They could be making more money with this. They should facilitate the usage of their technology in my opinion. But maybe their focus is on normal consumers that use their apps