Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- skrep fail karena web mati
- base : https://imagen.exomlapi.com/
- last update : 23 Mei 2025, 10:46 WITA
- catatan : servernya jangan di spam hit ya, kasih cooldown 1 menit kalau mau hit lagi.
- */
- const imagenExomlapi = async (prompt) => {
- if (!prompt.length) throw Error (`prompt tidak boleh kosong.`)
- // list config
- const model = ["imagen_3", "imagen_3_5"]
- const imageSize = ["1024x1024", "1024x1792", "1792x1024"]
- const responseFormat = ["url", "b64_json"]
- // atur konfig sesukamu
- const payload = {
- "prompt": prompt, //imajinasi kamu
- "model": model[1], // 0=imagen_3, 1=imagen_3_5
- "size": imageSize[0], // 0=square, 1=portrait, 2=landscape
- "response_format": responseFormat[0] // 0=url output, 1=base64 output
- }
- const headers = {
- "accept": "*/*",
- "content-type": "application/json",
- "Referer": "https://imagen.exomlapi.com/",
- }
- const response = await fetch("https://imagen.exomlapi.com/v1/images/generations", {
- headers,
- "body": JSON.stringify(payload),
- "method": "POST"
- });
- if (!response.ok) throw Error (`gagal membuat gambar ${prompt}. server status: ${response.status} ${response.statusText}`)
- const data = await response.json()
- return data
- }
- // cara pakai
- imagenExomlapi("furry female chibi wolf, white furr 3D look, holding paper with text info loker")
- .then(console.log)
- .catch(error => console.log(error.message))
Add Comment
Please, Sign In to add comment