import fetch from "node-fetch"; import * as config from './config.js'; if (!config.HUGGING_TOKEN) { throw new Error("Missing variable: HUGGING_TOKEN"); } /** * @param {string} args - The input string */ async function schellwithflux(args) { const API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fblack-forest-labs%2FFLUX.1-schnell"; try { const response = await fetch(API_URL, { method: "POST", headers: { "Authorization": `Bearer ${config.HUGGING_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ inputs: args }), }); if (!response.ok) { console.error(`API Error: ${response.status}`); return null; } return await response.buffer(); } catch (error) { console.error("Error fetching data:", error.message); return null; } } export { schellwithflux };