We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export async function POST(req: Request) {
// Removed the API key for this post but it's setup in my instance correctly. const leap = new Leap(apiKey);
if (!prompt || prompt.length === 0 || !apiKey) { console.log("Invalid request. Check key and prompt.") return; } if (req.method === 'POST') { try { const { data, error } = await leap.music.submitMusicGenerationJob({ prompt: "A suspenseful orchestral piece for a thriller chase scene.", duration: 30, }); if (error) { return { status: 500, body: JSON.stringify({ message: 'Internal Server Error' }), }; } return { status: 200, body: JSON.stringify(data), };
} catch (err) { console.error(err); return { status: 500, body: JSON.stringify({ message: 'Internal Server Error' }), }; }
} else { return { status: 405, headers: { Allow: 'POST' }, body: 'Method Not Allowed', }; } }
The text was updated successfully, but these errors were encountered:
Hello, looks like the call was missing the mode parameter.
This SDK is now deprecated and we recommend using the newest version here: https://github.com/leap-ai/leap-sdks
You can read the docs here: https://github.com/leap-ai/leap-sdks/blob/main/sdks/typescript/README.md
Sorry, something went wrong.
No branches or pull requests
export async function POST(req: Request) {
// Removed the API key for this post but it's setup in my instance correctly.
const leap = new Leap(apiKey);
if (!prompt || prompt.length === 0 || !apiKey) {
console.log("Invalid request. Check key and prompt.")
return;
}
if (req.method === 'POST') {
try {
const { data, error } = await leap.music.submitMusicGenerationJob({
prompt: "A suspenseful orchestral piece for a thriller chase scene.",
duration: 30,
});
if (error) {
return {
status: 500,
body: JSON.stringify({ message: 'Internal Server Error' }),
};
}
return {
status: 200,
body: JSON.stringify(data),
};
} else {
return {
status: 405,
headers: { Allow: 'POST' },
body: 'Method Not Allowed',
};
}
}
The text was updated successfully, but these errors were encountered: