> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ImageGenModel

> A model for generating images from a text prompt (with optional reference images), speaking Simular's wire contract.

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

```typescript
ImageGenModel(): ImageGenModel
```

### Returns

`ImageGenModel`

## Properties

<ResponseField name={"name"} type={"string"} required>
  The model identifier from provider configuration. Nominal — the
  endpoint selects the concrete model from the \[`ImageQuality`] argument.
</ResponseField>

## Methods

### availableAliases()

```typescript
availableAliases(): string[]
```

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()

```typescript
byAlias(alias: string): ImageGenModel
```

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

<ResponseField name={"alias"} type={"string"} required />

#### Returns

`ImageGenModel`

### checkAuth()

```typescript
checkAuth(): void
```

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:

```ts
try { model.checkAuth() } catch { process.exit(1) }
```

### default()

```typescript
default(): ImageGenModel
```

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()

```typescript
generate(prompt: string, quality?: null | ImageQuality, aspectRatio?: null | ImageAspectRatio, images?: null | Image[]): [Image, string]
```

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

<ResponseField name={"prompt"} type={"string"} required />

<ResponseField name={"quality"} type={"null | ImageQuality"} />

<ResponseField name={"aspectRatio"} type={"null | ImageAspectRatio"} />

<ResponseField name={"images"} type={"null | Image[]"} />

#### Returns

`[Image, string]`

### simularImageGen()

```typescript
simularImageGen(): ImageGenModel
```

Convenience shim for the bundled Simular image-gen alias.

#### Returns

`ImageGenModel`
