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

Function POST

src/app/api/custom_generate/route.ts:9–47  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

7export const dynamic = "force-dynamic";
8
9export async function POST(req: NextRequest) {
10 if (req.method === 'POST') {
11 try {
12 const body = await req.json();
13 const { prompt, tags, title, make_instrumental, model, wait_audio, negative_tags } = body;
14 const audioInfo = await (await sunoApi((await cookies()).toString())).custom_generate(
15 prompt, tags, title,
16 Boolean(make_instrumental),
17 model || DEFAULT_MODEL,
18 Boolean(wait_audio),
19 negative_tags
20 );
21 return new NextResponse(JSON.stringify(audioInfo), {
22 status: 200,
23 headers: {
24 'Content-Type': 'application/json',
25 ...corsHeaders
26 }
27 });
28 } catch (error: any) {
29 console.error('Error generating custom audio:', error);
30 return new NextResponse(JSON.stringify({ error: error.response?.data?.detail || error.toString() }), {
31 status: error.response?.status || 500,
32 headers: {
33 'Content-Type': 'application/json',
34 ...corsHeaders
35 }
36 });
37 }
38 } else {
39 return new NextResponse('Method Not Allowed', {
40 headers: {
41 Allow: 'POST',
42 ...corsHeaders
43 },
44 status: 405
45 });
46 }
47}
48
49export async function OPTIONS(request: Request) {
50 return new Response(null, {

Callers

nothing calls this directly

Calls 2

sunoApiFunction · 0.90
custom_generateMethod · 0.80

Tested by

no test coverage detected