Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

50.4 KB
Raw Blame
import type { Templates } from 'features/nodes/store/types';
import type { AnyEdge, InvocationTemplate } from 'features/nodes/types/invocation';
import { buildInvocationNode } from 'features/nodes/util/node/buildInvocationNode';
import type { OpenAPIV3_1 } from 'openapi-types';

export const buildEdge = (source: string, sourceHandle: string, target: string, targetHandle: string): AnyEdge => ({
  source,
  sourceHandle,
  target,
  targetHandle,
  type: 'default',
  id: `reactflow__edge-${source}${sourceHandle}-${target}${targetHandle}`,
});

export const buildNode = (template: InvocationTemplate) => buildInvocationNode({ x: 0, y: 0 }, template);

export const add: InvocationTemplate = {
  title: 'Add Integers',
  type: 'add',
  version: '1.0.1',
  tags: ['math', 'add'],
  description: 'Adds two numbers',
  outputType: 'integer_output',
  inputs: {
    a: {
      name: 'a',
      title: 'A',
      required: false,
      description: 'The first number',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 0,
    },
    b: {
      name: 'b',
      title: 'B',
      required: false,
      description: 'The second number',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 0,
    },
  },
  outputs: {
    value: {
      fieldKind: 'output',
      name: 'value',
      title: 'Value',
      description: 'The output integer',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'math',
};

export const call_saved_workflow: InvocationTemplate = {
  title: 'Call Saved Workflow',
  type: 'call_saved_workflow',
  version: '1.0.0',
  tags: ['workflow', 'saved', 'library'],
  description: 'Displays and later executes against a selected saved workflow.',
  category: 'workflow',
  outputType: 'integer_output',
  inputs: {
    workflow_id: {
      name: 'workflow_id',
      title: 'Workflow Id',
      required: false,
      description: 'The selected saved workflow ID, managed by the workflow editor UI.',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      ui_type: 'SavedWorkflowField',
      type: {
        name: 'SavedWorkflowField',
        cardinality: 'SINGLE',
        batch: false,
        originalType: {
          name: 'StringField',
          cardinality: 'SINGLE',
          batch: false,
        },
      },
      default: '',
    },
  },
  outputs: {
    value: {
      fieldKind: 'output',
      name: 'value',
      title: 'Value',
      description: 'The output integer',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: false,
  nodePack: 'invokeai',
  classification: 'beta',
};

export const workflow_return: InvocationTemplate = {
  title: 'Workflow Return',
  type: 'workflow_return',
  version: '1.0.0',
  tags: ['workflow', 'return', 'output'],
  description: 'Defines the explicit collection result returned by a callable workflow.',
  category: 'workflow',
  outputType: 'workflow_return_output',
  inputs: {
    collection: {
      name: 'collection',
      title: 'Collection',
      required: false,
      description: 'The collection returned to a calling workflow.',
      fieldKind: 'input',
      input: 'connection',
      ui_hidden: false,
      ui_type: 'CollectionField',
      type: {
        name: 'CollectionField',
        cardinality: 'COLLECTION',
        batch: false,
      },
      default: undefined,
    },
  },
  outputs: {
    collection: {
      fieldKind: 'output',
      name: 'collection',
      title: 'Collection',
      description: 'The workflow return collection',
      type: {
        name: 'CollectionField',
        cardinality: 'COLLECTION',
        batch: false,
      },
      ui_hidden: false,
      ui_type: 'CollectionField',
    },
  },
  useCache: false,
  nodePack: 'invokeai',
  classification: 'beta',
};

export const sub: InvocationTemplate = {
  title: 'Subtract Integers',
  type: 'sub',
  version: '1.0.1',
  tags: ['math', 'subtract'],
  description: 'Subtracts two numbers',
  outputType: 'integer_output',
  inputs: {
    a: {
      name: 'a',
      title: 'A',
      required: false,
      description: 'The first number',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 0,
    },
    b: {
      name: 'b',
      title: 'B',
      required: false,
      description: 'The second number',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 0,
    },
  },
  outputs: {
    value: {
      fieldKind: 'output',
      name: 'value',
      title: 'Value',
      description: 'The output integer',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'math',
};

export const collect: InvocationTemplate = {
  title: 'Collect',
  type: 'collect',
  version: '1.1.0',
  tags: [],
  description: 'Collects values into a collection',
  outputType: 'collect_output',
  inputs: {
    collection: {
      name: 'collection',
      title: 'Collection',
      required: false,
      default: undefined,
      description: 'An optional collection to append to',
      fieldKind: 'input',
      input: 'connection',
      ui_hidden: false,
      ui_type: 'CollectionField' as const,
      type: {
        name: 'CollectionField' as const,
        cardinality: 'COLLECTION',
        batch: false,
      },
    },
    item: {
      name: 'item',
      title: 'Collection Item',
      required: false,
      default: undefined,
      description: 'The item to collect (all inputs must be of the same type)',
      fieldKind: 'input',
      input: 'connection',
      ui_hidden: false,
      ui_type: 'CollectionItemField',
      type: {
        name: 'CollectionItemField',
        cardinality: 'SINGLE',
        batch: false,
      },
    },
  },
  outputs: {
    collection: {
      fieldKind: 'output',
      name: 'collection',
      title: 'Collection',
      description: 'The collection of input items',
      type: {
        name: 'CollectionField',
        cardinality: 'COLLECTION',
        batch: false,
      },
      ui_hidden: false,
      ui_type: 'CollectionField',
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'collections',
};

const scheduler: InvocationTemplate = {
  title: 'Scheduler',
  type: 'scheduler',
  version: '1.0.0',
  tags: ['scheduler'],
  description: 'Selects a scheduler.',
  outputType: 'scheduler_output',
  inputs: {
    scheduler: {
      name: 'scheduler',
      title: 'Scheduler',
      required: false,
      description: 'Scheduler to use during inference',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      ui_type: 'SchedulerField',
      type: {
        name: 'SchedulerField',
        cardinality: 'SINGLE',
        batch: false,
        originalType: {
          name: 'EnumField',
          cardinality: 'SINGLE',
          batch: false,
        },
      },
      default: 'euler',
    },
  },
  outputs: {
    scheduler: {
      fieldKind: 'output',
      name: 'scheduler',
      title: 'Scheduler',
      description: 'Scheduler to use during inference',
      type: {
        name: 'SchedulerField',
        cardinality: 'SINGLE',
        batch: false,

        originalType: {
          name: 'EnumField',
          cardinality: 'SINGLE',
          batch: false,
        },
      },
      ui_hidden: false,
      ui_type: 'SchedulerField',
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'other',
};

export const main_model_loader: InvocationTemplate = {
  title: 'Main Model',
  type: 'main_model_loader',
  version: '1.0.2',
  tags: ['model'],
  description: 'Loads a main model, outputting its submodels.',
  outputType: 'model_loader_output',
  inputs: {
    model: {
      name: 'model',
      title: 'Model',
      required: true,
      description: 'Main model (UNet, VAE, CLIP) to load',
      fieldKind: 'input',
      input: 'direct',
      ui_hidden: false,
      ui_model_base: ['sd-1'],
      ui_model_type: ['main'],
      type: {
        name: 'ModelIdentifierField',
        cardinality: 'SINGLE',
        batch: false,
      },
    },
  },
  outputs: {
    vae: {
      fieldKind: 'output',
      name: 'vae',
      title: 'VAE',
      description: 'VAE',
      type: {
        name: 'VAEField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
    clip: {
      fieldKind: 'output',
      name: 'clip',
      title: 'CLIP',
      description: 'CLIP (tokenizer, text encoder, LoRAs) and skipped layer count',
      type: {
        name: 'CLIPField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
    unet: {
      fieldKind: 'output',
      name: 'unet',
      title: 'UNet',
      description: 'UNet (scheduler, LoRAs)',
      type: {
        name: 'UNetField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'model',
};

export const img_resize: InvocationTemplate = {
  title: 'Resize Image',
  type: 'img_resize',
  version: '1.2.2',
  tags: ['image', 'resize'],
  description: 'Resizes an image to specific dimensions',
  outputType: 'image_output',
  inputs: {
    board: {
      name: 'board',
      title: 'Board',
      required: false,
      description: 'The board to save the image to',
      fieldKind: 'input',
      input: 'direct',
      ui_hidden: false,
      default: 'auto',
      type: {
        name: 'BoardField',
        cardinality: 'SINGLE',
        batch: false,
      },
    },
    metadata: {
      name: 'metadata',
      title: 'Metadata',
      required: false,
      default: undefined,
      description: 'Optional metadata to be saved with the image',
      fieldKind: 'input',
      input: 'connection',
      ui_hidden: false,
      type: {
        name: 'MetadataField',
        cardinality: 'SINGLE',
        batch: false,
      },
    },
    image: {
      name: 'image',
      title: 'Image',
      required: true,
      description: 'The image to resize',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'ImageField',
        cardinality: 'SINGLE',
        batch: false,
      },
    },
    width: {
      name: 'width',
      title: 'Width',
      required: false,
      description: 'The width to resize to (px)',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 512,
      exclusiveMinimum: 0,
    },
    height: {
      name: 'height',
      title: 'Height',
      required: false,
      description: 'The height to resize to (px)',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      default: 512,
      exclusiveMinimum: 0,
    },
    resample_mode: {
      name: 'resample_mode',
      title: 'Resample Mode',
      required: false,
      description: 'The resampling mode',
      fieldKind: 'input',
      input: 'any',
      ui_hidden: false,
      type: {
        name: 'EnumField',
        cardinality: 'SINGLE',
        batch: false,
      },
      options: ['nearest', 'box', 'bilinear', 'hamming', 'bicubic', 'lanczos'],
      default: 'bicubic',
    },
  },
  outputs: {
    image: {
      fieldKind: 'output',
      name: 'image',
      title: 'Image',
      description: 'The output image',
      type: {
        name: 'ImageField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
    width: {
      fieldKind: 'output',
      name: 'width',
      title: 'Width',
      description: 'The width of the image in pixels',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
    height: {
      fieldKind: 'output',
      name: 'height',
      title: 'Height',
      description: 'The height of the image in pixels',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'image',
};

const iterate: InvocationTemplate = {
  title: 'Iterate',
  type: 'iterate',
  version: '1.1.0',
  tags: [],
  description: 'Iterates over a list of items',
  outputType: 'iterate_output',
  inputs: {
    collection: {
      name: 'collection',
      title: 'Collection',
      required: false,
      default: undefined,
      description: 'The list of items to iterate over',
      fieldKind: 'input',
      input: 'connection',
      ui_hidden: false,
      ui_type: 'CollectionField',
      type: {
        name: 'CollectionField',
        cardinality: 'COLLECTION',
        batch: false,
      },
    },
  },
  outputs: {
    item: {
      fieldKind: 'output',
      name: 'item',
      title: 'Collection Item',
      description: 'The item being iterated over',
      type: {
        name: 'CollectionItemField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
      ui_type: 'CollectionItemField',
    },
    index: {
      fieldKind: 'output',
      name: 'index',
      title: 'Index',
      description: 'The index of the item',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
    total: {
      fieldKind: 'output',
      name: 'total',
      title: 'Total',
      description: 'The total number of items',
      type: {
        name: 'IntegerField',
        cardinality: 'SINGLE',
        batch: false,
      },
      ui_hidden: false,
    },
  },
  useCache: true,
  nodePack: 'invokeai',
  classification: 'stable',
  category: 'collections',
};

export const templates: Templates = {
  add,
  call_saved_workflow,
  workflow_return,
  sub,
  collect,
  iterate,
  scheduler,
  main_model_loader,
  img_resize,
};

export const schema = {
  openapi: '3.1.0',
  info: {
    title: 'Invoke - Community Edition',
    description: 'An API for invoking AI image operations',
    version: '1.0.0',
  },
  components: {
    schemas: {
      CallSavedWorkflowInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: false,
            field_kind: 'node_attribute',
          },
          workflow_id: {
            type: 'string',
            title: 'Workflow Id',
            description: 'The selected saved workflow ID, managed by the workflow editor UI.',
            default: '',
            field_kind: 'input',
            input: 'any',
            orig_default: '',
            orig_required: false,
            ui_hidden: false,
            ui_type: 'SavedWorkflowField',
          },
          type: {
            type: 'string',
            enum: ['call_saved_workflow'],
            const: 'call_saved_workflow',
            title: 'type',
            default: 'call_saved_workflow',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Call Saved Workflow',
        description: 'Displays and later executes against a selected saved workflow.',
        category: 'workflow',
        classification: 'beta',
        node_pack: 'invokeai',
        tags: ['workflow', 'saved', 'library'],
        version: '1.0.0',
        output: {
          $ref: '#/components/schemas/IntegerOutput',
        },
        class: 'invocation',
      },
      WorkflowReturnInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: false,
            field_kind: 'node_attribute',
          },
          collection: {
            type: 'array',
            items: {},
            title: 'Collection',
            description: 'The collection returned to a calling workflow.',
            field_kind: 'input',
            input: 'connection',
            orig_required: false,
            ui_hidden: false,
            ui_type: 'CollectionField',
          },
          type: {
            type: 'string',
            enum: ['workflow_return'],
            const: 'workflow_return',
            title: 'type',
            default: 'workflow_return',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Workflow Return',
        description: 'Defines the explicit collection result returned by a callable workflow.',
        category: 'workflow',
        classification: 'beta',
        node_pack: 'invokeai',
        tags: ['workflow', 'return', 'output'],
        version: '1.0.0',
        output: {
          $ref: '#/components/schemas/WorkflowReturnOutput',
        },
        class: 'invocation',
      },
      WorkflowReturnOutput: {
        properties: {
          type: {
            type: 'string',
            enum: ['workflow_return_output'],
            const: 'workflow_return_output',
            title: 'type',
            default: 'workflow_return_output',
            field_kind: 'node_attribute',
          },
          collection: {
            type: 'array',
            items: {},
            title: 'Collection',
            description: 'The workflow return collection',
            field_kind: 'output',
            ui_hidden: false,
            ui_type: 'CollectionField',
          },
        },
        type: 'object',
        required: ['type', 'collection'],
        title: 'Workflow Return Output',
        class: 'output',
      },
      AddInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          a: {
            type: 'integer',
            title: 'A',
            description: 'The first number',
            default: 0,
            field_kind: 'input',
            input: 'any',
            orig_default: 0,
            orig_required: false,
            ui_hidden: false,
          },
          b: {
            type: 'integer',
            title: 'B',
            description: 'The second number',
            default: 0,
            field_kind: 'input',
            input: 'any',
            orig_default: 0,
            orig_required: false,
            ui_hidden: false,
          },
          type: {
            type: 'string',
            enum: ['add'],
            const: 'add',
            title: 'type',
            default: 'add',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Add Integers',
        description: 'Adds two numbers',
        category: 'math',
        classification: 'stable',
        node_pack: 'invokeai',
        tags: ['math', 'add'],
        version: '1.0.1',
        output: {
          $ref: '#/components/schemas/IntegerOutput',
        },
        class: 'invocation',
      },
      IntegerOutput: {
        description: 'Base class for nodes that output a single integer',
        properties: {
          value: {
            description: 'The output integer',
            field_kind: 'output',
            title: 'Value',
            type: 'integer',
            ui_hidden: false,
          },
          type: {
            const: 'integer_output',
            default: 'integer_output',
            enum: ['integer_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
        },
        required: ['value', 'type', 'type'],
        title: 'IntegerOutput',
        type: 'object',
        class: 'output',
      },
      SchedulerInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          scheduler: {
            type: 'string',
            enum: [
              'ddim',
              'ddpm',
              'deis',
              'lms',
              'lms_k',
              'pndm',
              'heun',
              'heun_k',
              'euler',
              'euler_k',
              'euler_a',
              'kdpm_2',
              'kdpm_2_a',
              'dpmpp_2s',
              'dpmpp_2s_k',
              'dpmpp_2m',
              'dpmpp_2m_k',
              'dpmpp_2m_sde',
              'dpmpp_2m_sde_k',
              'dpmpp_sde',
              'dpmpp_sde_k',
              'unipc',
              'lcm',
              'tcd',
            ],
            title: 'Scheduler',
            description: 'Scheduler to use during inference',
            default: 'euler',
            field_kind: 'input',
            input: 'any',
            orig_default: 'euler',
            orig_required: false,
            ui_hidden: false,
            ui_type: 'SchedulerField',
          },
          type: {
            type: 'string',
            enum: ['scheduler'],
            const: 'scheduler',
            title: 'type',
            default: 'scheduler',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Scheduler',
        description: 'Selects a scheduler.',
        classification: 'stable',
        node_pack: 'invokeai',
        tags: ['scheduler'],
        version: '1.0.0',
        output: {
          $ref: '#/components/schemas/SchedulerOutput',
        },
        class: 'invocation',
      },
      SchedulerOutput: {
        properties: {
          scheduler: {
            description: 'Scheduler to use during inference',
            enum: [
              'ddim',
              'ddpm',
              'deis',
              'lms',
              'lms_k',
              'pndm',
              'heun',
              'heun_k',
              'euler',
              'euler_k',
              'euler_a',
              'kdpm_2',
              'kdpm_2_a',
              'dpmpp_2s',
              'dpmpp_2s_k',
              'dpmpp_2m',
              'dpmpp_2m_k',
              'dpmpp_2m_sde',
              'dpmpp_2m_sde_k',
              'dpmpp_sde',
              'dpmpp_sde_k',
              'unipc',
              'lcm',
              'tcd',
            ],
            field_kind: 'output',
            title: 'Scheduler',
            type: 'string',
            ui_hidden: false,
            ui_type: 'SchedulerField',
          },
          type: {
            const: 'scheduler_output',
            default: 'scheduler_output',
            enum: ['scheduler_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
        },
        required: ['scheduler', 'type', 'type'],
        title: 'SchedulerOutput',
        type: 'object',
        class: 'output',
      },
      MainModelLoaderInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          model: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Main model (UNet, VAE, CLIP) to load',
            field_kind: 'input',
            input: 'direct',
            orig_required: true,
            ui_hidden: false,
            ui_model_base: ['sd-1'],
            ui_model_type: ['main'],
          },
          type: {
            type: 'string',
            enum: ['main_model_loader'],
            const: 'main_model_loader',
            title: 'type',
            default: 'main_model_loader',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['model', 'type', 'id'],
        title: 'Main Model',
        description: 'Loads a main model, outputting its submodels.',
        category: 'model',
        classification: 'stable',
        node_pack: 'invokeai',
        tags: ['model'],
        version: '1.0.2',
        output: {
          $ref: '#/components/schemas/ModelLoaderOutput',
        },
        class: 'invocation',
      },
      ModelIdentifierField: {
        properties: {
          key: {
            description: "The model's unique key",
            title: 'Key',
            type: 'string',
          },
          hash: {
            description: "The model's BLAKE3 hash",
            title: 'Hash',
            type: 'string',
          },
          name: {
            description: "The model's name",
            title: 'Name',
            type: 'string',
          },
          base: {
            allOf: [
              {
                $ref: '#/components/schemas/BaseModelType',
              },
            ],
            description: "The model's base model type",
          },
          type: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelType',
              },
            ],
            description: "The model's type",
          },
          submodel_type: {
            anyOf: [
              {
                $ref: '#/components/schemas/SubModelType',
              },
              {
                type: 'null',
              },
            ],
            default: null,
            description: 'The submodel to load, if this is a main model',
          },
        },
        required: ['key', 'hash', 'name', 'base', 'type'],
        title: 'ModelIdentifierField',
        type: 'object',
      },
      BaseModelType: {
        description: 'Base model type.',
        enum: ['any', 'sd-1', 'sd-2', 'sdxl', 'sdxl-refiner'],
        title: 'BaseModelType',
        type: 'string',
      },
      ModelType: {
        description: 'Model type.',
        enum: ['onnx', 'main', 'vae', 'lora', 'controlnet', 'embedding', 'ip_adapter', 'clip_vision', 't2i_adapter'],
        title: 'ModelType',
        type: 'string',
      },
      SubModelType: {
        description: 'Submodel type.',
        enum: [
          'unet',
          'text_encoder',
          'text_encoder_2',
          'tokenizer',
          'tokenizer_2',
          'vae',
          'vae_decoder',
          'vae_encoder',
          'scheduler',
          'safety_checker',
        ],
        title: 'SubModelType',
        type: 'string',
      },
      ModelLoaderOutput: {
        description: 'Model loader output',
        properties: {
          vae: {
            allOf: [
              {
                $ref: '#/components/schemas/VAEField',
              },
            ],
            description: 'VAE',
            field_kind: 'output',
            title: 'VAE',
            ui_hidden: false,
          },
          type: {
            const: 'model_loader_output',
            default: 'model_loader_output',
            enum: ['model_loader_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
          clip: {
            allOf: [
              {
                $ref: '#/components/schemas/CLIPField',
              },
            ],
            description: 'CLIP (tokenizer, text encoder, LoRAs) and skipped layer count',
            field_kind: 'output',
            title: 'CLIP',
            ui_hidden: false,
          },
          unet: {
            allOf: [
              {
                $ref: '#/components/schemas/UNetField',
              },
            ],
            description: 'UNet (scheduler, LoRAs)',
            field_kind: 'output',
            title: 'UNet',
            ui_hidden: false,
          },
        },
        required: ['vae', 'type', 'clip', 'unet', 'type'],
        title: 'ModelLoaderOutput',
        type: 'object',
        class: 'output',
      },
      UNetField: {
        properties: {
          unet: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load unet submodel',
          },
          scheduler: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load scheduler submodel',
          },
          loras: {
            description: 'LoRAs to apply on model loading',
            items: {
              $ref: '#/components/schemas/LoRAField',
            },
            title: 'Loras',
            type: 'array',
          },
          seamless_axes: {
            description: 'Axes("x" and "y") to which apply seamless',
            items: {
              type: 'string',
            },
            title: 'Seamless Axes',
            type: 'array',
          },
          freeu_config: {
            anyOf: [
              {
                $ref: '#/components/schemas/FreeUConfig',
              },
              {
                type: 'null',
              },
            ],
            default: null,
            description: 'FreeU configuration',
          },
        },
        required: ['unet', 'scheduler', 'loras'],
        title: 'UNetField',
        type: 'object',
        class: 'output',
      },
      LoRAField: {
        properties: {
          lora: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load lora model',
          },
          weight: {
            description: 'Weight to apply to lora model',
            title: 'Weight',
            type: 'number',
          },
        },
        required: ['lora', 'weight'],
        title: 'LoRAField',
        type: 'object',
        class: 'output',
      },
      FreeUConfig: {
        description:
          'Configuration for the FreeU hyperparameters.\n- https://huggingface.co/docs/diffusers/main/en/using-diffusers/freeu\n- https://github.com/ChenyangSi/FreeU',
        properties: {
          s1: {
            description:
              'Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to mitigate the "oversmoothing effect" in the enhanced denoising process.',
            maximum: 3,
            minimum: -1,
            title: 'S1',
            type: 'number',
          },
          s2: {
            description:
              'Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to mitigate the "oversmoothing effect" in the enhanced denoising process.',
            maximum: 3,
            minimum: -1,
            title: 'S2',
            type: 'number',
          },
          b1: {
            description: 'Scaling factor for stage 1 to amplify the contributions of backbone features.',
            maximum: 3,
            minimum: -1,
            title: 'B1',
            type: 'number',
          },
          b2: {
            description: 'Scaling factor for stage 2 to amplify the contributions of backbone features.',
            maximum: 3,
            minimum: -1,
            title: 'B2',
            type: 'number',
          },
        },
        required: ['s1', 's2', 'b1', 'b2'],
        title: 'FreeUConfig',
        type: 'object',
        class: 'output',
      },
      VAEField: {
        properties: {
          vae: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load vae submodel',
          },
          seamless_axes: {
            description: 'Axes("x" and "y") to which apply seamless',
            items: {
              type: 'string',
            },
            title: 'Seamless Axes',
            type: 'array',
          },
        },
        required: ['vae'],
        title: 'VAEField',
        type: 'object',
        class: 'output',
      },
      CLIPField: {
        properties: {
          tokenizer: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load tokenizer submodel',
          },
          text_encoder: {
            allOf: [
              {
                $ref: '#/components/schemas/ModelIdentifierField',
              },
            ],
            description: 'Info to load text_encoder submodel',
          },
          skipped_layers: {
            description: 'Number of skipped layers in text_encoder',
            title: 'Skipped Layers',
            type: 'integer',
          },
          loras: {
            description: 'LoRAs to apply on model loading',
            items: {
              $ref: '#/components/schemas/LoRAField',
            },
            title: 'Loras',
            type: 'array',
          },
        },
        required: ['tokenizer', 'text_encoder', 'skipped_layers', 'loras'],
        title: 'CLIPField',
        type: 'object',
        class: 'output',
      },
      CollectInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          item: {
            anyOf: [
              {},
              {
                type: 'null',
              },
            ],
            title: 'Collection Item',
            description: 'The item to collect (all inputs must be of the same type)',
            field_kind: 'input',
            input: 'connection',
            orig_required: false,
            ui_hidden: false,
            ui_type: 'CollectionItemField',
          },
          collection: {
            items: {},
            type: 'array',
            title: 'Collection',
            description: 'An optional collection to append to',
            field_kind: 'input',
            input: 'connection',
            orig_required: false,
            ui_hidden: false,
            ui_type: 'CollectionField',
          },
          type: {
            type: 'string',
            enum: ['collect'],
            const: 'collect',
            title: 'type',
            default: 'collect',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'CollectInvocation',
        node_pack: 'invokeai',
        description: 'Collects values into a collection',
        category: 'collections',
        classification: 'stable',
        version: '1.1.0',
        output: {
          $ref: '#/components/schemas/CollectInvocationOutput',
        },
        class: 'invocation',
      },
      CollectInvocationOutput: {
        properties: {
          collection: {
            description: 'The collection of input items',
            field_kind: 'output',
            items: {},
            title: 'Collection',
            type: 'array',
            ui_hidden: false,
            ui_type: 'CollectionField',
          },
          type: {
            const: 'collect_output',
            default: 'collect_output',
            enum: ['collect_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
        },
        required: ['collection', 'type', 'type'],
        title: 'CollectInvocationOutput',
        type: 'object',
        class: 'output',
      },
      SubtractInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          a: {
            type: 'integer',
            title: 'A',
            description: 'The first number',
            default: 0,
            field_kind: 'input',
            input: 'any',
            orig_default: 0,
            orig_required: false,
            ui_hidden: false,
          },
          b: {
            type: 'integer',
            title: 'B',
            description: 'The second number',
            default: 0,
            field_kind: 'input',
            input: 'any',
            orig_default: 0,
            orig_required: false,
            ui_hidden: false,
          },
          type: {
            type: 'string',
            enum: ['sub'],
            const: 'sub',
            title: 'type',
            default: 'sub',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Subtract Integers',
        description: 'Subtracts two numbers',
        category: 'math',
        classification: 'stable',
        node_pack: 'invokeai',
        tags: ['math', 'subtract'],
        version: '1.0.1',
        output: {
          $ref: '#/components/schemas/IntegerOutput',
        },
        class: 'invocation',
      },
      ImageResizeInvocation: {
        properties: {
          board: {
            anyOf: [
              {
                $ref: '#/components/schemas/BoardField',
              },
              {
                type: 'null',
              },
            ],
            description: 'The board to save the image to',
            field_kind: 'internal',
            input: 'direct',
            orig_required: false,
            ui_hidden: false,
          },
          metadata: {
            anyOf: [
              {
                $ref: '#/components/schemas/MetadataField',
              },
              {
                type: 'null',
              },
            ],
            description: 'Optional metadata to be saved with the image',
            field_kind: 'internal',
            input: 'connection',
            orig_required: false,
            ui_hidden: false,
          },
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          image: {
            allOf: [
              {
                $ref: '#/components/schemas/ImageField',
              },
            ],
            description: 'The image to resize',
            field_kind: 'input',
            input: 'any',
            orig_required: true,
            ui_hidden: false,
          },
          width: {
            type: 'integer',
            exclusiveMinimum: 0,
            title: 'Width',
            description: 'The width to resize to (px)',
            default: 512,
            field_kind: 'input',
            input: 'any',
            orig_default: 512,
            orig_required: false,
            ui_hidden: false,
          },
          height: {
            type: 'integer',
            exclusiveMinimum: 0,
            title: 'Height',
            description: 'The height to resize to (px)',
            default: 512,
            field_kind: 'input',
            input: 'any',
            orig_default: 512,
            orig_required: false,
            ui_hidden: false,
          },
          resample_mode: {
            type: 'string',
            enum: ['nearest', 'box', 'bilinear', 'hamming', 'bicubic', 'lanczos'],
            title: 'Resample Mode',
            description: 'The resampling mode',
            default: 'bicubic',
            field_kind: 'input',
            input: 'any',
            orig_default: 'bicubic',
            orig_required: false,
            ui_hidden: false,
          },
          type: {
            type: 'string',
            enum: ['img_resize'],
            const: 'img_resize',
            title: 'type',
            default: 'img_resize',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'Resize Image',
        description: 'Resizes an image to specific dimensions',
        category: 'image',
        classification: 'stable',
        node_pack: 'invokeai',
        tags: ['image', 'resize'],
        version: '1.2.2',
        output: {
          $ref: '#/components/schemas/ImageOutput',
        },
        class: 'invocation',
      },
      ImageField: {
        description: 'An image primitive field',
        properties: {
          image_name: {
            description: 'The name of the image',
            title: 'Image Name',
            type: 'string',
          },
        },
        required: ['image_name'],
        title: 'ImageField',
        type: 'object',
        class: 'output',
      },
      ImageOutput: {
        description: 'Base class for nodes that output a single image',
        properties: {
          image: {
            allOf: [
              {
                $ref: '#/components/schemas/ImageField',
              },
            ],
            description: 'The output image',
            field_kind: 'output',
            ui_hidden: false,
          },
          width: {
            description: 'The width of the image in pixels',
            field_kind: 'output',
            title: 'Width',
            type: 'integer',
            ui_hidden: false,
          },
          height: {
            description: 'The height of the image in pixels',
            field_kind: 'output',
            title: 'Height',
            type: 'integer',
            ui_hidden: false,
          },
          type: {
            const: 'image_output',
            default: 'image_output',
            enum: ['image_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
        },
        required: ['image', 'width', 'height', 'type', 'type'],
        title: 'ImageOutput',
        type: 'object',
        class: 'output',
      },
      MetadataField: {
        description:
          'Pydantic model for metadata with custom root of type dict[str, Any].\nMetadata is stored without a strict schema.',
        title: 'MetadataField',
        type: 'object',
        class: 'output',
      },
      BoardField: {
        properties: {
          board_id: {
            type: 'string',
            title: 'Board Id',
            description: 'The id of the board',
          },
        },
        type: 'object',
        required: ['board_id'],
        title: 'BoardField',
        description: 'A board primitive field',
      },
      IterateInvocation: {
        properties: {
          id: {
            type: 'string',
            title: 'Id',
            description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
            field_kind: 'node_attribute',
          },
          is_intermediate: {
            type: 'boolean',
            title: 'Is Intermediate',
            description: 'Whether or not this is an intermediate invocation.',
            default: false,
            field_kind: 'node_attribute',
            ui_type: 'IsIntermediate',
          },
          use_cache: {
            type: 'boolean',
            title: 'Use Cache',
            description: 'Whether or not to use the cache',
            default: true,
            field_kind: 'node_attribute',
          },
          collection: {
            items: {},
            type: 'array',
            title: 'Collection',
            description: 'The list of items to iterate over',
            default: [],
            field_kind: 'input',
            input: 'any',
            orig_default: [],
            orig_required: false,
            ui_hidden: false,
            ui_type: 'CollectionField',
          },
          index: {
            type: 'integer',
            title: 'Index',
            description: 'The index, will be provided on executed iterators',
            default: 0,
            field_kind: 'input',
            input: 'any',
            orig_default: 0,
            orig_required: false,
            ui_hidden: true,
          },
          type: {
            type: 'string',
            enum: ['iterate'],
            const: 'iterate',
            title: 'type',
            default: 'iterate',
            field_kind: 'node_attribute',
          },
        },
        type: 'object',
        required: ['type', 'id'],
        title: 'IterateInvocation',
        description: 'Iterates over a list of items',
        category: 'collections',
        classification: 'stable',
        node_pack: 'invokeai',
        version: '1.1.0',
        output: {
          $ref: '#/components/schemas/IterateInvocationOutput',
        },
        class: 'invocation',
      },
      IterateInvocationOutput: {
        description: 'Used to connect iteration outputs. Will be expanded to a specific output.',
        properties: {
          item: {
            description: 'The item being iterated over',
            field_kind: 'output',
            title: 'Collection Item',
            ui_hidden: false,
            ui_type: 'CollectionItemField',
          },
          index: {
            description: 'The index of the item',
            field_kind: 'output',
            title: 'Index',
            type: 'integer',
            ui_hidden: false,
          },
          total: {
            description: 'The total number of items',
            field_kind: 'output',
            title: 'Total',
            type: 'integer',
            ui_hidden: false,
          },
          type: {
            const: 'iterate_output',
            default: 'iterate_output',
            enum: ['iterate_output'],
            field_kind: 'node_attribute',
            title: 'type',
            type: 'string',
          },
        },
        required: ['item', 'index', 'total', 'type', 'type'],
        title: 'IterateInvocationOutput',
        type: 'object',
        class: 'output',
      },
    },
  },
} as OpenAPIV3_1.Document;