MCPcopy
hub / github.com/gcui-art/suno-api / GET

Function GET

src/app/api/get_limit/route.ts:8–42  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

6export const dynamic = "force-dynamic";
7
8export async function GET(req: NextRequest) {
9 if (req.method === 'GET') {
10 try {
11
12 const limit = await (await sunoApi((await cookies()).toString())).get_credits();
13
14
15 return new NextResponse(JSON.stringify(limit), {
16 status: 200,
17 headers: {
18 'Content-Type': 'application/json',
19 ...corsHeaders
20 }
21 });
22 } catch (error) {
23 console.error('Error fetching limit:', error);
24
25 return new NextResponse(JSON.stringify({ error: 'Internal server error. ' + error }), {
26 status: 500,
27 headers: {
28 'Content-Type': 'application/json',
29 ...corsHeaders
30 }
31 });
32 }
33 } else {
34 return new NextResponse('Method Not Allowed', {
35 headers: {
36 Allow: 'GET',
37 ...corsHeaders
38 },
39 status: 405
40 });
41 }
42}
43
44export async function OPTIONS(request: Request) {
45 return new Response(null, {

Callers

nothing calls this directly

Calls 2

sunoApiFunction · 0.90
get_creditsMethod · 0.80

Tested by

no test coverage detected