Created
June 20, 2025 11:26
-
-
Save ZTRdiamond/17cbaa83f3c6c8770aca88002487d4e2 to your computer and use it in GitHub Desktop.
Exomlapi backend sniffed, yep it is a scraper!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from "axios"; | |
| const api = axios.create({ | |
| baseURL: "https://exomlapi.com/api", | |
| timeout: 120_000, | |
| headers: { | |
| 'Authority': 'exomlapi.com', | |
| 'Accept': '*/*', | |
| 'Content-Type': 'application/json,*/*', | |
| 'Origin': 'https://exomlapi.com', | |
| 'Referer': 'https://exomlapi.com/', | |
| 'User-Agent': 'Zanixon/1.0.0' | |
| } | |
| }); | |
| // completions | |
| async function generateAntibot() { | |
| const res = await api.post('/genid'); | |
| const data = res.data; | |
| if (!data?.antiBotId) throw 'failed fetch antibot id!'; | |
| return data; | |
| } | |
| function parseRawtext(input) { | |
| const matches = [...input.matchAll(/\d+:"(.*?)"/g)]; | |
| return matches.map(m => m[1]).join(""); | |
| } | |
| async function completions(payload = {}) { | |
| try { | |
| return await new Promise(async (resolve, reject) => { | |
| const models = [ | |
| "llama", | |
| "gemma", | |
| "qwen-3-235b", | |
| "gpt-4.1", | |
| "gpt-4o", | |
| "gpt-4o-mini", | |
| "llama-4-scout", | |
| "llama-4-maverick", | |
| "deepseek-r1", | |
| "qwq-32b" | |
| ]; | |
| if (!payload?.model) return reject('missing model, please input the model first!'); | |
| if (!models.includes(payload?.model)) return reject('invalid model, please input the model correctly!', models); | |
| if (!payload?.messages) return reject('missing messages input!'); | |
| if (!Array.isArray(payload.messages)) return reject('invalid array messages, please input the payload correctly!'); | |
| const id = Math.floor(Math.random() * 9999999999) + 1; | |
| const chatId = `chat-${Date.now()}-${Math.floor(Math.random() * 999999) + 1}`; | |
| const userId = `local-user-${Date.now()}-${Math.floor(Math.random() * 9999999) + 1}`; | |
| const antiBotId = (await generateAntibot().catch(reject))?.antiBotId; | |
| api.post('/chat', { | |
| id, | |
| chatId, | |
| userId, | |
| antiBotId, | |
| messages: payload.messages, | |
| model: payload.model, | |
| systemPrompt: payload?.systemPrompt || '', | |
| isAuthenticated: true | |
| }).then(res => { | |
| const answer = parseRawtext(res.data); | |
| if (!answer) return reject('failed get response.'); | |
| return resolve({ success: true, answer }); | |
| }).catch(reject); | |
| }); | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: e | |
| }; | |
| } | |
| } | |
| async function llmSearch(query, count = 10) { | |
| try { | |
| return await new Promise(async(resolve, reject) => { | |
| if(!query) return reject('missing query input!'); | |
| if(!count) return reject('missing count input!'); | |
| if(!Number.isInteger(count)) return reject('invalid number inpur at count param!'); | |
| axios.post('https://search.exomlapi.com/api/ml_search', { | |
| query, | |
| count | |
| }, { | |
| headers: { | |
| 'Accept': '*/*', | |
| 'Content-Type': 'application/json', | |
| 'Origin': 'https://exomlapi.com', | |
| 'Referer': 'https://exomlapi.com/', | |
| 'User-Agent': 'Zanixon/1.0.0' | |
| } | |
| }).then(res => { | |
| const data = res.data; | |
| if(!data?.llm_response) return reject('failed generate response!'); | |
| return resolve({ | |
| success: true, | |
| result: { | |
| answer: data?.llm_response, | |
| searchResult: data?.results.map(d => ({ | |
| url: d.url, | |
| title: d.title, | |
| description: d.text | |
| })) | |
| } | |
| }) | |
| }) | |
| }) | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: e | |
| } | |
| } | |
| } | |
| // image generation | |
| async function enhancePrompt(prompt) { | |
| try { | |
| return await new Promise(async(resolve, reject) => { | |
| if(!prompt) return reject('missing prompt input!'); | |
| api.post('/prompts/enhance', { | |
| prompt | |
| }).then(res => { | |
| const data = res.data; | |
| if(!data?.enhancedPrompt) return reject('failed generate response!'); | |
| return resolve({ | |
| success: true, | |
| prompt: data?.enhancedPrompt | |
| }) | |
| }) | |
| }) | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: e | |
| } | |
| } | |
| } | |
| async function generateImage(prompt, model = "exo-image") { | |
| try { | |
| return await new Promise(async(resolve, reject) => { | |
| const models = [ | |
| "exo-image", | |
| "flux.1-schnell", | |
| "flux.1-pro", | |
| "flux.1-dev" | |
| ] | |
| if(!prompt) return reject('missing prompt input!'); | |
| if(!models.includes(model)) return reject('invalid model input!', models) | |
| api.post('/images/generate', { | |
| prompt, | |
| model, | |
| size: '1024x1024' | |
| }).then(res => { | |
| const data = res.data; | |
| if(data?.data.length < 1) return reject('failed generate response!'); | |
| return resolve({ | |
| success: true, | |
| result: data?.data.map(d => ({ | |
| url: d.url, | |
| prompt: d.revised_prompt | |
| })) | |
| }) | |
| }) | |
| }) | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: e | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
π·οΈ ExoML API Scraper
Unofficial wrapper/scraper untuk layanan ExoML API, yang menyediakan antarmuka untuk:
π¦ Instalasi
π Struktur Modul
π API Docs
π
generateAntibot()Ambil
antiBotIdyang diperlukan sebelum mengirim permintaan ke endpoint chat.π§
completions(payload)Mengirim permintaan completion berbasis
chat. Butuh arraymessagesdanmodel.β Payload
π§ͺ Model yang didukung:
"llama""gemma""qwen-3-235b""gpt-4.1""gpt-4o""gpt-4o-mini""llama-4-scout""llama-4-maverick""deepseek-r1""qwq-32b"π
llmSearch(query, count = 10)Search berbasis query + LLM summarization dari hasil web.
β Hasil:
πͺ
enhancePrompt(prompt)Meningkatkan prompt sebelum digunakan untuk image generation.
πΌοΈ
generateImage(prompt, model)Generate gambar dari prompt. Default model:
"exo-image"π¨ Model yang tersedia:
"exo-image""flux.1-schnell""flux.1-pro""flux.1-dev"π οΈ Utils
π§
parseRawtext(input)Utility internal untuk parsing raw response dari chat completion.