wolfyflutter

❌ imagen exomlapi

May 22nd, 2025 (edited)
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.50 KB | Source Code | 0 0
  1. /*
  2.     skrep fail karena web mati
  3.     base : https://imagen.exomlapi.com/
  4.     last update : 23 Mei 2025, 10:46 WITA
  5.     catatan : servernya jangan di spam hit ya, kasih cooldown 1 menit kalau mau hit lagi.
  6. */
  7.  
  8. const imagenExomlapi = async (prompt) => {
  9.  
  10.     if (!prompt.length) throw Error (`prompt tidak boleh kosong.`)
  11.  
  12.     // list config
  13.     const model = ["imagen_3", "imagen_3_5"]
  14.     const imageSize = ["1024x1024", "1024x1792", "1792x1024"]
  15.     const responseFormat = ["url", "b64_json"]
  16.  
  17.     // atur konfig sesukamu
  18.     const payload = {
  19.         "prompt": prompt, //imajinasi kamu
  20.         "model": model[1], // 0=imagen_3, 1=imagen_3_5
  21.         "size": imageSize[0], // 0=square, 1=portrait, 2=landscape
  22.         "response_format": responseFormat[0] // 0=url output, 1=base64 output
  23.     }
  24.  
  25.     const headers = {
  26.         "accept": "*/*",
  27.             "content-type": "application/json",
  28.             "Referer": "https://imagen.exomlapi.com/",
  29.     }
  30.  
  31.     const response = await fetch("https://imagen.exomlapi.com/v1/images/generations", {
  32.         headers,
  33.         "body": JSON.stringify(payload),
  34.         "method": "POST"
  35.     });
  36.  
  37.     if (!response.ok) throw Error (`gagal membuat gambar ${prompt}. server status: ${response.status} ${response.statusText}`)
  38.  
  39.     const data = await response.json()
  40.  
  41.     return data
  42. }
  43.  
  44. // cara pakai
  45. imagenExomlapi("furry female chibi wolf, white furr 3D look, holding paper with text info loker")
  46. .then(console.log)
  47. .catch(error => console.log(error.message))
Tags: ai
Add Comment
Please, Sign In to add comment