|
import express from 'express'; |
|
import { OpenaiRes } from '../lib/scrapper.js'; |
|
import { audioContent } from '../lib/all.js'; |
|
import { NvidiaTogether } from '../lib/@randydev/together/llama.js'; |
|
import { CohereAI } from '../lib/@randydev/together/cohere.js'; |
|
import { |
|
SYSTEMJAWA, |
|
SYSTEMSUNDA, |
|
SYSTEMMIA, |
|
PowerFullModerator, |
|
SENSIFIFNOCODE, |
|
ALLQURAN_SHOLAWAT, |
|
LIRIKLAGU, |
|
QUOTESLUCU, |
|
QUOTESSEDIH, |
|
PythonToJS, |
|
JsToPython, |
|
curlCommandCode, |
|
} from '../models.js'; |
|
import { |
|
AlibabaTogether, |
|
AlibabaTurboTogether, |
|
CloudFlareQwenTogether, |
|
DeepseekQwenTogether, |
|
} from '../lib/@randydev/together/qwen-ai.js'; |
|
|
|
import { CloudFlareMistralTogether } from '../lib/@randydev/together/cloudflare-ai.js'; |
|
import { DeepSeekR1 } from '../lib/@randydev/together/blackbox.js'; |
|
import { authenticateApiKey, authenticateApiKeyPremium, apiLimiter } from '../middleware/midware.js'; |
|
const GptRoutes = express.Router(); |
|
|
|
import fs from "fs"; |
|
import got from "got"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get("/api/v1/ai/openai/whisper-large-v3-turbo", authenticateApiKey, apiLimiter, async (req, res) => { |
|
const API_BASE_URL = `https://api.cloudflare.com/client/v4/accounts/${process.env['ACCOUNT_ID']}/ai/run/@cf/openai/whisper-large-v3-turbo`; |
|
const headers = { |
|
"Authorization": `Bearer ${process.env['CLOUDFLARE_API_KEY']}`, |
|
"Content-Type": "application/json" |
|
}; |
|
const url = req.query.url; |
|
const language = req.query.language || "en"; |
|
const task = req.query.task || "transcribe"; |
|
|
|
if (!url) { |
|
return res.status(500).json({ error: "url required" }); |
|
} |
|
|
|
const path = await audioContent(url); |
|
if (!path) { |
|
return res.status(500).json({ error: "Failed to download audio file" }); |
|
} |
|
|
|
try { |
|
const audioBytes = fs.readFileSync(path); |
|
const audioBase64 = Buffer.from(audioBytes).toString("base64"); |
|
|
|
const inputData = { |
|
audio: audioBase64, |
|
language: language, |
|
task: task |
|
}; |
|
|
|
const response = await got.post(API_BASE_URL, { |
|
headers, |
|
json: inputData, |
|
}).json(); |
|
return res.json(response); |
|
} catch (error) { |
|
console.error("Error making API request:", error.message); |
|
return res.status(500).json({ error: null }); |
|
} finally { |
|
if (fs.existsSync(path)) { |
|
fs.unlinkSync(path); |
|
} |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/deepseek/deepseek-r1-distill-qwen-32b', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await DeepseekQwenTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/deepseek/deepseek-R1', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const results = await DeepSeekR1(query); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/mistral/mistral-7b-instruct-v0.1', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await CloudFlareMistralTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/lu-melayu', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: SYSTEMJAWA |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/nocodefou', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await AlibabaTogether(query, { |
|
system_prompt: SENSIFIFNOCODE |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/mia-khalifah', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await AlibabaTogether(query, { |
|
system_prompt: SYSTEMMIA |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/curl-command-code', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: curlCommandCode |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/python-to-js-api', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: PythonToJS |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/js-to-python-api', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: JsToPython |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/quotes-sad', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: QUOTESSEDIH |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/quotes-lucu', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: QUOTESLUCU |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/lirik-end', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: LIRIKLAGU |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/al-sholawat', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: ALLQURAN_SHOLAWAT |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/moderator', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const username = req.query.username; |
|
if (!username) { |
|
return res.status(500).json({ error: "username required" }); |
|
} |
|
if (!query) { |
|
return res.status(500).json({ error: "query required" }); |
|
} |
|
const systemResult = PowerFullModerator(username); |
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: systemResult |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/qwen/qwen1.5-1.8b-chat', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await CloudFlareQwenTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/akenox/lu-sunda', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const results = await AlibabaTogether(query, { |
|
system_prompt: SYSTEMSUNDA |
|
}); |
|
|
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/alibaba/qwen-turbo-latest', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await AlibabaTurboTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
|
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/alibaba/qwen-plus', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await AlibabaTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
|
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/cohere/command-plus', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
const chatHistory = req.query.chatHistory ? JSON.parse(req.query.chatHistory) : []; |
|
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required."; |
|
|
|
const results = await CohereAI(query, { |
|
system_prompt: system_prompt, |
|
chatHistory: chatHistory |
|
}); |
|
|
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GptRoutes.get('/api/v1/ai/nvidia/llama-31-70b', authenticateApiKeyPremium, apiLimiter, async (req, res) => { |
|
try { |
|
const query = req.query.query; |
|
let system_prompt = "Your name is AkenoX AI A kind and friendly AI assistant that answers in\na short and concise answer. Give short step-by-step reasoning if required.\n"; |
|
system_prompt = req.query.system_prompt ? req.query.system_prompt : system_prompt; |
|
const results = await NvidiaTogether(query, { |
|
system_prompt: system_prompt |
|
}); |
|
res.json({ results }); |
|
} catch (error) { |
|
res.status(401).json({ error: error.message }); |
|
} |
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export { GptRoutes }; |