hans-gpt
Version:
A Node.js wrapper for GPT-4o by David Cyril - Powered by Hans Tech
19 lines (12 loc) • 434 B
JavaScript
const fetch = require("node-fetch");
async function hansGpt(prompt) {
if (!prompt) throw new Error("Prompt is required!");
const url = `https://apis.davidcyriltech.my.id/ai/gpt4?text=${encodeURIComponent(prompt)}`;
const response = await fetch(url);
const data = await response.json();
if (!data.success) {
throw new Error("Failed to fetch from GPT-4o API");
}
return data.message;
}
module.exports = hansGpt;