Update plugins/fluxai.js
Browse files- plugins/fluxai.js +60 -0
plugins/fluxai.js
CHANGED
@@ -33,6 +33,66 @@ async function schellwithflux(args) {
|
|
33 |
}
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* @swagger
|
38 |
* /api/v1/flux/fluxai-ai:
|
|
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* @swagger
|
38 |
+
* /api/v1/flux/black-forest-labs/flux-1-schnell:
|
39 |
+
* get:
|
40 |
+
* summary: Deepseek R1
|
41 |
+
* tags: [FLUX]
|
42 |
+
* parameters:
|
43 |
+
* - in: query
|
44 |
+
* name: query
|
45 |
+
* required: true
|
46 |
+
* description: User's input query
|
47 |
+
* schema:
|
48 |
+
* type: string
|
49 |
+
* - in: header
|
50 |
+
* name: x-api-key
|
51 |
+
* required: true
|
52 |
+
* description: API key for authentication
|
53 |
+
* schema:
|
54 |
+
* type: string
|
55 |
+
* responses:
|
56 |
+
* 200:
|
57 |
+
* description: Success
|
58 |
+
*/
|
59 |
+
/**
|
60 |
+
* @swagger
|
61 |
+
* /api/v1/flux/black-forest-labs/flux-1-schnell:
|
62 |
+
* get:
|
63 |
+
* summary: black forest labs
|
64 |
+
* tags: [FLUX]
|
65 |
+
* parameters:
|
66 |
+
* - in: query
|
67 |
+
* name: query
|
68 |
+
* required: true
|
69 |
+
* description: User's input query
|
70 |
+
* schema:
|
71 |
+
* type: string
|
72 |
+
* - in: header
|
73 |
+
* name: x-api-key
|
74 |
+
* required: true
|
75 |
+
* description: API key for authentication
|
76 |
+
* schema:
|
77 |
+
* type: string
|
78 |
+
* responses:
|
79 |
+
* 200:
|
80 |
+
* description: Success
|
81 |
+
*/
|
82 |
+
FluxRoutes.get('/api/v1/flux/black-forest-labs/flux-1-schnell', authenticateApiKeyPremium, apiLimiter, async (req, res) => {
|
83 |
+
try {
|
84 |
+
const query = req.query.query;
|
85 |
+
const result = await FluxSchnell(query);
|
86 |
+
const imageBytes = Buffer.from(result, "base64");
|
87 |
+
const processedImage = await sharp(imageBytes).jpeg().toBuffer();
|
88 |
+
res.set("Content-Type", "image/jpeg");
|
89 |
+
Readable.from(processedImage).pipe(res);
|
90 |
+
} catch (error) {
|
91 |
+
res.status(401).json({ error: error.message });
|
92 |
+
}
|
93 |
+
});
|
94 |
+
|
95 |
+
|
96 |
/**
|
97 |
* @swagger
|
98 |
* /api/v1/flux/fluxai-ai:
|