const axios = require('axios'); async function text2ghibli(prompt, style = 'Spirited Away') { try { const styleList = ['Spirited Away', 'Totoro', 'Princess Mononoke', 'Howl\'s Castle']; if (!prompt) throw new Error('Prompt is required'); if (!styleList.includes(style)) throw new Error(`List available style: ${styleList.join(', ')}`); const { data } = await axios.post('https://ghibliimagegenerator.net/api/generate-image', { prompt: prompt, style: style }, { headers: { 'content-type': 'application/json', referer: 'https://ghibliimagegenerator.net/generator', 'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36' } }); return Buffer.from(data.imageData.split(',')[1], 'base64'); } catch (error) { throw new Error(error.message); } }; // Usage: const resp = await text2ghibli('girl wearing glasses'); console.log(resp);