Skip to content

Instantly share code, notes, and snippets.

@ZTRdiamond
Created August 13, 2025 17:29
Show Gist options
  • Select an option

  • Save ZTRdiamond/a36606b61f4fd80ff99f3b802bbe2564 to your computer and use it in GitHub Desktop.

Select an option

Save ZTRdiamond/a36606b61f4fd80ff99f3b802bbe2564 to your computer and use it in GitHub Desktop.
n8n tools text2image testing from their website
import axios from "axios";
function ip() {
const x = (a) => (Math.random() * a).toFixed();
return `${x(300)}.${x(300)}.${x(300)}.${x(300)}`;
}
export default async function txt2img(prompt) {
try {
return new Promise((resolve, reject) => {
if(!prompt) throw "missing prompt input";
axios.post("https://internal.users.n8n.cloud/webhook/ai_image_generator", {
prompt
}, {
headers: {
'Content-Type': 'application/json',
'User-Agent': 'Zanixon/1.0.0',
'X-Client-Ip': ip()
}
}).then(raw => {
const data = raw.data;
if(!data.result) throw "failed generatig image";
resolve({
success: true,
images: data.result
})
}).catch(reject)
})
} catch (e) {
return {
success: true,
errors: e
}
}
}
txt2img("kucing lucu berjalan di pinggir trotoar")
.then(console.log)
.catch(console.log)
@ZTRdiamond
Copy link
Author

FB_IMG_1754715857194
FB_IMG_1754372640906
FB_IMG_1754402549123
FB_IMG_1753679516637

VID_20250807_202535_292.mp4

IMG_20250806_211214_666
FB_IMG_1755059957793

@Bayyzp
Copy link

Bayyzp commented Aug 13, 2025

Jembo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment