DeepAi Coder
JavaScriptPublicby zx-apiAug 20, 2026, 04:39 PMExpires: Never85 views
1/**
2 * Name Scrape: Deepai Coder
3 * Deskripsi: Sesuai Namanya ai Yang khusus untuk koding
4 * Sumber Kode: https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o
5 * Note: Kalau Mau Di Sher Harap Kasih Sumber Link ya
6**/
7
8const axios = require('axios');
9const FormData = require('form-data');
10const { v4: uuidv4 } = require('uuid');
11
12class DeepAiCoder {
13 /**
14 * @param {string} apiKey - Token sesi (format: "tryit-..."). Bisa diambil dari cookie browser atau LocalStorage.
15 * @param {string} model - Model AI yang digunakan (default: "gemma-4").
16 */
17 constructor(apiKey, model = 'gemma-4') {
18 this.apiKey = apiKey;
19 this.model = model;
20 this.baseUrl = 'https://api.deepai.org';
21 this.sessionUuid = uuidv4();
22 this.chatStyle = 'ai-code';
23 this.history = [];
24
25 this.baseHeaders = {
26 'origin': 'https://deepai.org',
27 'referer': 'https://deepai.org/',
28 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36',
29 'accept': '*/*',
30 'accept-language': 'id,en-US;q=0.9,en;q=0.8',
31 'sec-fetch-dest': 'empty',
32 'sec-fetch-mode': 'cors',
33 'sec-fetch-site': 'same-site'
34 };
35 }
36
37 getAuthHeaders() {
38 return { ...this.baseHeaders, 'api-key': this.apiKey };
39 }
40
41 async saveSession(messages) {
42 const form = new FormData();
43 form.append('uuid', this.sessionUuid);
44 form.append('title', '');
45 form.append('chat_style', this.chatStyle);
46 form.append('chat_model', this.model);
47 form.append('messages', JSON.stringify(messages));
48
49 try {
50 await axios.post(`${this.baseUrl}/save_chat_session`, form, {
51 headers: { ...this.baseHeaders, ...form.getHeaders() }
52 });
53 } catch (error) {
54 console.warn('[Warning] Gagal menyimpan sesi:', error.message);
55 }
56 }
57
58 async checkSensitivity(requestId) {
59 try {
60 const response = await axios.get(`${this.baseUrl}/check-sensitivity`, {
61 params: { request_id: requestId },
62 headers: this.baseHeaders
63 });
64 return response.data; // { sensitive: false, score: 0.2 }
65 } catch (error) {
66 return { sensitive: false, score: 0.2 };
67 }
68 }
69
70 /**
71 * Mengirim pesan ke AI dan mendapatkan respons ai
72 * @param {string} prompt - Pertanyaan atau instruksi kode.
73 * @returns {Promise<string>} - Respons Markdown dari AI.
74 */
75 async sendMessage(prompt) {
76 const userMessage = { role: 'user', content: prompt };
77 this.history.push(userMessage);
78
79 await this.saveSession(this.history);
80
81 const sensitivityRequestId = uuidv4();
82
83 const form = new FormData();
84 form.append('chat_style', this.chatStyle);
85 form.append('chatHistory', JSON.stringify(this.history));
86 form.append('model', this.model);
87 form.append('session_uuid', this.sessionUuid);
88 form.append('sensitivity_request_id', sensitivityRequestId);
89 form.append('tool_activity_support', '1');
90 form.append('hacker_is_stinky', 'very_stinky'); // Honeypot Anti-Bot
91 form.append('enabled_tools', JSON.stringify(["image_generator", "image_editor"]));
92
93 try {
94 console.log('[Info] Mengirim prompt ke AI...');
95
96 const response = await axios.post(`${this.baseUrl}/hacking_is_a_serious_crime`, form, {
97 headers: { ...this.getAuthHeaders(), ...form.getHeaders() },
98 responseType: 'text',
99 timeout: 60000 // Timeout 60 detik karena respons bisa cukup lama
100 });
101
102 const assistantMessage = { role: 'assistant', content: response.data };
103 this.history.push(assistantMessage);
104
105 const sensitivityResult = await this.checkSensitivity(sensitivityRequestId);
106
107 const finalHistory = this.history.map((msg, idx) => {
108 if (idx === this.history.length - 2 && msg.role === 'user') {
109 return { ...msg, sensitive_score: sensitivityResult.score || 0.2 };
110 }
111 return msg;
112 });
113 await this.saveSession(finalHistory);
114
115 return response.data;
116
117 } catch (error) {
118 this.history.pop();
119 const errMsg = error.response ? error.response.data : error.message;
120 throw new Error(`Gagal mendapatkan respons dari DeepAI: ${errMsg}`);
121 }
122 }
123
124 resetSession() {
125 this.sessionUuid = uuidv4();
126 this.history = [];
127 console.log('[Info] Sesi chat telah direset.');
128 }
129}
130
131module.exports = DeepAiCoder;
132
133//contoh penggunaan 🗿
134
135// GANTI DENGAN API KEY / TOKEN "tryit-..." KALIAN SUKI KALAU MAU
136// Token ini bisa kalian ambil dari Network Tab browser -> Request Headers -> api-key ya cuki
137const API_KEY = 'tryit-96688139466-7827b3d69016fe0cae7c45f8f358cba3';
138
139async function main() {
140 const aicode = new DeepAiCoder(API_KEY);
141
142 try {
143 console.log('=== Memulai Sesi Chat AI Code ===');
144
145 const prompt = "Buatkan aku kode website uploader file sederhana menggunakan Next.js App Router dan Tailwind CSS.";
146 console.log(`\n[User]: ${prompt}\n`);
147
148 const response = await aicode.sendMessage(prompt);
149
150 console.log('=== Respons AI ===');
151 console.log(response);
152
153 } catch (error) {
154 console.error('Terjadi kesalahan:', error.message);
155 }
156}
157
158main();
159159 lines·5,655 chars·5.5 KB
Wwrap·Ffullscreen