deepimg.js

javascriptCreated 30 Nov 2025, 08:4051 views
image generator text to image with many style models
#tools#email#utility
javascript
/***
  @ Base: https://deepimg.ai/
  @ Author: Shannz
  @ Note: Use the styles provided in the styles array
***/

import axios from 'axios';
import crypto from 'crypto';

const styles = ["Headsot", "Anime", "Tatto", "ID Photo", "Cartoon", "Fantasy 3D"];

export async function deepimg(prompt, style) {
    if (!styles.includes(style)) {
        return `Style tidak valid. Silakan pilih salah satu dari: ${styles.join(", ")}`;
    }

    let device_id = crypto.randomBytes(16).toString('hex');
    let data = JSON.stringify({
        "device_id": device_id,
        "prompt": `${prompt} -style ${style}`,
        "size": "1024x1024"
    });

    let config = {
        method: 'POST',
        url: 'https://api-preview.chatgot.io/api/v1/deepimg/flux-1-dev',
        headers: {
            'User-Agent': 'ScRaPe/9.9 (KaliLinux; Nusantara Os; My/Shannz)',
            'Content-Type': 'application/json',
            'accept-language': 'id-ID',
            'referer': 'https://deepimg.ai/',
            'origin': 'https://deepimg.ai',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'cross-site',
            'priority': 'u=0',
            'te': 'trailers'
        },
        data: data
    };

    try {
        const api = await axios.request(config);
        return JSON.stringify(api.data, null, 2);
    } catch (error) {
        return `Terjadi kesalahan: ${error.message}`;
    }
}