Class: ComfyUIImageModel
Defined in: src/comfyui/ComfyUIImageModel.ts:55
An AI SDK ImageModelV2 backed by a self-hosted
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/ComfyUIImageModelOptions.promptInputName: every other parameter (checkpoint, sampler, seed, size, ...) is whatever the given workflow specifies.
Implements
ImageModelV2
Constructors
Constructor
> new ComfyUIImageModel(options): ComfyUIImageModel
Defined in: src/comfyui/ComfyUIImageModel.ts:63
Parameters
options
Returns
ComfyUIImageModel
Properties
maxImagesPerCall
> readonly maxImagesPerCall: 1 = 1
Defined in: src/comfyui/ComfyUIImageModel.ts:59
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
ImageModelV2.maxImagesPerCall
modelId
> readonly modelId: string
Defined in: src/comfyui/ComfyUIImageModel.ts:58
Provider-specific model ID for logging purposes.
Implementation of
ImageModelV2.modelId
provider
> readonly provider: "comfyui" = "comfyui"
Defined in: src/comfyui/ComfyUIImageModel.ts:57
Name of the provider for logging purposes.
Implementation of
ImageModelV2.provider
specificationVersion
> readonly specificationVersion: "v2"
Defined in: src/comfyui/ComfyUIImageModel.ts:56
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
ImageModelV2.specificationVersion
Methods
doGenerate()
> doGenerate(callOptions): Promise<{ images: string[]; response: { headers: undefined; modelId: string; timestamp: Date; }; warnings: never[]; }>
Defined in: src/comfyui/ComfyUIImageModel.ts:68
Generates an array of images.
Parameters
callOptions
ImageModelV2CallOptions
Returns
Promise<{ images: string[]; response: { headers: undefined; modelId: string; timestamp: Date; }; warnings: never[]; }>
Implementation of
ImageModelV2.doGenerate