# Class: ComfyUIImageModel (/pixi-vn-ai/comfyui/classes/ComfyUIImageModel)



Defined in: [src/comfyui/ComfyUIImageModel.ts:55](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L55)

An [AI SDK](https://ai-sdk.dev) `ImageModelV2` backed by a self-hosted
[ComfyUI](https://github.com/comfyanonymous/ComfyUI) server, so it can be passed directly as
`ai.init({ imageProvider: new ComfyUIImageModel({ ... }) })`.

Since ComfyUI runs arbitrary node graphs rather than accepting a plain prompt, this model only
injects the developer request into the workflow node/input given by [ComfyUIImageModelOptions.promptNodeId](/pixi-vn-ai/comfyui/interfaces/ComfyUIImageModelOptions#promptnodeid)/[ComfyUIImageModelOptions.promptInputName](/pixi-vn-ai/comfyui/interfaces/ComfyUIImageModelOptions#promptinputname): every
other parameter (checkpoint, sampler, seed, size, ...) is whatever the given workflow specifies.

## Implements [#implements]

* `ImageModelV2`

## Constructors [#constructors]

### Constructor [#constructor]

\> **new ComfyUIImageModel**(`options`): `ComfyUIImageModel`

Defined in: [src/comfyui/ComfyUIImageModel.ts:63](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L63)

#### Parameters [#parameters]

##### options [#options]

[`ComfyUIImageModelOptions`](/pixi-vn-ai/comfyui/interfaces/ComfyUIImageModelOptions)

#### Returns [#returns]

`ComfyUIImageModel`

## Properties [#properties]

### maxImagesPerCall [#maximagespercall]

\> `readonly` **maxImagesPerCall**: `1` = `1`

Defined in: [src/comfyui/ComfyUIImageModel.ts:59](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L59)

Limit of how many images can be generated in a single API call.
Can be set to a number for a fixed limit, to undefined to use
the global limit, or a function that returns a number or undefined,
optionally as a promise.

#### Implementation of [#implementation-of]

`ImageModelV2.maxImagesPerCall`

***

### modelId [#modelid]

\> `readonly` **modelId**: `string`

Defined in: [src/comfyui/ComfyUIImageModel.ts:58](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L58)

Provider-specific model ID for logging purposes.

#### Implementation of [#implementation-of-1]

`ImageModelV2.modelId`

***

### provider [#provider]

\> `readonly` **provider**: `"comfyui"` = `"comfyui"`

Defined in: [src/comfyui/ComfyUIImageModel.ts:57](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L57)

Name of the provider for logging purposes.

#### Implementation of [#implementation-of-2]

`ImageModelV2.provider`

***

### specificationVersion [#specificationversion]

\> `readonly` **specificationVersion**: `"v2"`

Defined in: [src/comfyui/ComfyUIImageModel.ts:56](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L56)

The image model must specify which image model interface
version it implements. This will allow us to evolve the image
model interface and retain backwards compatibility. The different
implementation versions can be handled as a discriminated union
on our side.

#### Implementation of [#implementation-of-3]

`ImageModelV2.specificationVersion`

## Methods [#methods]

### doGenerate() [#dogenerate]

\> **doGenerate**(`callOptions`): `Promise`\<\{ `images`: `string`\[]; `response`: \{ `headers`: `undefined`; `modelId`: `string`; `timestamp`: `Date`; }; `warnings`: `never`\[]; }>

Defined in: [src/comfyui/ComfyUIImageModel.ts:68](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/comfyui/ComfyUIImageModel.ts#L68)

Generates an array of images.

#### Parameters [#parameters-1]

##### callOptions [#calloptions]

`ImageModelV2CallOptions`

#### Returns [#returns-1]

`Promise`\<\{ `images`: `string`\[]; `response`: \{ `headers`: `undefined`; `modelId`: `string`; `timestamp`: `Date`; }; `warnings`: `never`\[]; }>

#### Implementation of [#implementation-of-4]

`ImageModelV2.doGenerate`
