Create flux-1-schnell.js
Browse files
lib/@randydev/flux-1-schnell.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import got from 'got';
|
2 |
+
|
3 |
+
async function FluxSchnell(message) {
|
4 |
+
const run = await got.post(`https://api.cloudflare.com/client/v4/accounts/${process.env['ACCOUNT_ID']}/ai/run/@cf/black-forest-labs/flux-1-schnell`, {
|
5 |
+
headers: {
|
6 |
+
'Authorization': `Bearer ${process.env['CLOUDFLARE_API_KEY']}`,
|
7 |
+
'Content-Type': 'application/json'
|
8 |
+
},
|
9 |
+
json: {'prompt': message};
|
10 |
+
}).json();
|
11 |
+
return run.result.response;
|
12 |
+
}
|