const generate = async (text) => { const token = 'Your API Token' const model = 'facebook/musicgen-large' const prompt = text const url = `https://api.huggingface.co/v1/models/${model}` const response = await fetch(url, { method: 'POST', body: JSON.stringify({ token, prompt }), headers: { 'Content-Type': 'application/json' } }) const json = await response.json() return json.generated_text }