---
title: "ImageGenerationModel"
sidebar_label: "ImageGenerationModel"
description: "Kotlin binding reference: ImageGenerationModel."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[ImageGenerationModel](index.md)

# ImageGenerationModel

[common]\
class [ImageGenerationModel](index.md) : [PreTrainedModel](../PreTrainedModel/index.md)

An image-generation model: a prompt in, pictures out (the `text-to-image` kind), each as the RGBA pixels an Android bitmap takes.

Open it with [open](Companion/open.md) from a checkpoint the model library's image-generation families claim (a family that declares a picture out of text). Hand it a prompt with [generate](generate.md); the pictures arrive through the listener on the model's own worker thread, one request at a time per model. [close](close.md) frees the weights.

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [capabilities](capabilities.md) | [common]<br>val [capabilities](capabilities.md): [Capabilities](../Capabilities/index.md)<br>What the model takes and gives, read when it opened: [Capabilities.defaultImageWidth](../Capabilities/defaultImageWidth.md) and [Capabilities.defaultImageHeight](../Capabilities/defaultImageHeight.md) are the picture size a request of 0 by 0 takes. |
| [config](config.md) | [common]<br>open override val [config](config.md): [PretrainedConfig](../PretrainedConfig/index.md)<br>The checkpoint's identity, read when the model opened. |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)()<br>Free the model. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent. |
| [generate](generate.md) | [common]<br>fun [generate](generate.md)(prompt: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), options: [ImageGenerationOptions](../ImageGenerationOptions/index.md) = ImageGenerationOptions(), listener: [ImageGenerationListener](../ImageGenerationListener/index.md)): [ImageGenerationHandle](../ImageGenerationHandle/index.md)<br>Generate pictures for [prompt](generate.md) under [options](generate.md). Returns at once; the worker runs the request and calls [listener](generate.md) on its thread: [ImageGenerationListener.onImages](../ImageGenerationListener/onImages.md) with the pictures and the seed the model drew, then [ImageGenerationListener.onDone](../ImageGenerationListener/onDone.md) with the [ImageGenerationReport](../ImageGenerationReport/index.md). A knob left at its zero keeps the model's own default. |
| [residency](residency.md) | [common]<br>open override fun [residency](residency.md)(): [ResidencyReport](../ResidencyReport/index.md)<br>What the model holds on each device right now ([ResidencyReport](../ResidencyReport/index.md)); a closed model refuses with [ModelverseException](../ModelverseException/index.md). |