Function: image()
@providerprotocol/ai / @providerprotocol/ai / image
Function: image()
Section titled “Function: image()”image<
TParams>(options):ImageInstance<TParams>
Defined in: src/core/image.ts:67
Creates an image generation instance configured with the specified options.
This is the primary factory function for creating image generation instances.
It validates provider capabilities, binds the model, and returns an instance
with generate, stream, and edit methods.
Type Parameters
Section titled “Type Parameters”TParams
Section titled “TParams”TParams = unknown
Provider-specific parameter type for model configuration
Parameters
Section titled “Parameters”options
Section titled “options”ImageOptions<TParams>
Configuration options for the image instance
Returns
Section titled “Returns”ImageInstance<TParams>
A configured image instance ready for generation
Throws
Section titled “Throws”When the provider does not support the image modality
Example
Section titled “Example”import { image } from 'upp';import { openai } from 'upp/providers/openai';
const dalle = image({ model: openai('dall-e-3'), params: { size: '1024x1024', quality: 'hd' }});
const result = await dalle.generate('A sunset over mountains');console.log(result.images.length);