Skip to main content
A model for generating images from a text prompt (with optional reference images), speaking Simular’s v1/image-gen wire contract. This targets a dedicated Simular endpoint rather than an OpenAI-compatible one; the endpoint picks the concrete backend model from the [ImageQuality] argument, so the resolved model name is nominal (used only for name). Reference images are downscaled / transcoded and size-checked against the model’s configured image limits before sending, exactly as the VLM/LLM image paths do.

Constructor

Returns

ImageGenModel

Properties

string
required
The model identifier from provider configuration. Nominal — the endpoint selects the concrete model from the [ImageQuality] argument.

Methods

availableAliases()

Every image-gen model alias advertised by the loaded configuration, deduplicated and sorted alphabetically. Use to discover what byAlias will accept on the current machine.

Returns

string[]

byAlias()

Resolve a model alias against the loaded configuration. The alias is looked up across every loaded provider in alphabetical order; the first provider that advertises this alias wins. Throws if the alias is unknown.

Parameters

string
required

Returns

ImageGenModel

checkAuth()

Check that provider credentials work. Throws (and logs a warning) if they do not. Call right after creating the model so a bad key fails fast:

default()

First image-gen model advertised by the first capable provider in the loaded configuration whose credentials are currently available. Providers that advertise the service but lack working credentials are skipped. Throws only if no provider is left after that filter.

Returns

ImageGenModel

generate()

Generate an image from prompt.
  • prompt: a description of the image to generate.
  • quality: selects the model tier; defaults to ImageQuality.Fast.
  • aspectRatio: the output shape; defaults to ImageAspectRatio.Square.
  • images: reference images (count capped by the model’s configured max_images_per_request image limit) that condition the result; each is downscaled / transcoded to a supported format and size-checked before sending. Pass null / omit for none.
Returns a [image, description] tuple: the first generated [Image] and the model’s text description (an empty string when the model returns none).

Parameters

string
required
null | ImageQuality
null | ImageAspectRatio
null | Image[]

Returns

[Image, string]

simularImageGen()

Convenience shim for the bundled Simular image-gen alias.

Returns

ImageGenModel