File size: 1,763 Bytes
b8b3fc1
 
 
 
 
 
1763953
b8b3fc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
_id: together_ai
title: Together AI
description: ""
version: 1
readme: ""
author: Anton Breslavskii | https://github.com/breslavsky
url: https://huggingface.co/PiperMy/Node-Packages/resolve/main/together.yaml
nodes:
  generate_flux_together_ai:
    _id: generate_flux_together_ai
    arrange:
      x: 130
      y: 110
    category:
      id: generate_images
      title: en=Generate images;ru=Генерация изображений
    environment:
      TOGETHER_API_KEY:
        title: Together API key
        type: string
        scope: global
    inputs:
      prompt:
        order: 1
        title: Prompt
        type: string
        required: true
        multiline: true
        default: cat at a moon
    outputs:
      image:
        title: Image
        type: image
    package: together_ai
    script: |-
      export async function run({ inputs }) {

          const { FatalError, NextNode } = DEFINITIONS;
          const { prompt } = inputs;

          const TOGETHER_API_KEY = env?.variables?.get('TOGETHER_API_KEY');
          if (!TOGETHER_API_KEY) {
              throw new FatalError('Please, set your API key for Together AI');
          }

          const Together = require('together-ai');
          const together = new Together({ apiKey: TOGETHER_API_KEY });

          const { data } = await together.images.create({
              model: "black-forest-labs/FLUX.1-schnell-Free",
              prompt,
              width: 1024,
              height: 1024,
              steps: 4,
              n: 1
          });
          const [{ url }] = data;
          return NextNode.from({ outputs: { image: url } });

      }
    source: catalog
    title: en=Generate Flux Free;ru=Генерация Flux бесплатно
    version: 1