Back to Firebase Js Sdk

TemplateImagenModel class

docs-devsite/ai.templateimagenmodel.md

12.12.13.5 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

TemplateImagenModel class

Warning: This API is now obsolete.

All Imagen models are deprecated and will shut down as early as June 2026. As a replacement, you can migrate your apps to use Gemini Image models (the "Nano Banana" models)<!-- -->.

Class for Imagen model APIs that execute on a server-side template.

This class should only be instantiated with getTemplateImagenModel()<!-- -->.

<b>Signature:</b>

typescript
export declare class TemplateImagenModel 

Constructors

ConstructorModifiersDescription
(constructor)(ai, requestOptions)Constructs a new instance of the <code>TemplateImagenModel</code> class

Properties

PropertyModifiersTypeDescription
requestOptionsRequestOptionsAdditional options to use when making requests.

Methods

MethodModifiersDescription
generateImages(templateId, templateVariables, singleRequestOptions)<b><i>(Public Preview)</i></b> Makes a single call to the model and returns an object containing a single ImagenGenerationResponse<!-- -->.

TemplateImagenModel.(constructor)

Constructs a new instance of the TemplateImagenModel class

<b>Signature:</b>

typescript
constructor(ai: AI, requestOptions?: RequestOptions);

Parameters

ParameterTypeDescription
aiAI
requestOptionsRequestOptions

TemplateImagenModel.requestOptions

Additional options to use when making requests.

<b>Signature:</b>

typescript
requestOptions?: RequestOptions;

TemplateImagenModel.generateImages()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Makes a single call to the model and returns an object containing a single ImagenGenerationResponse<!-- -->.

<b>Signature:</b>

typescript
generateImages(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<ImagenGenerationResponse<ImagenInlineImage>>;

Parameters

ParameterTypeDescription
templateIdstringThe ID of the server-side template to execute.
templateVariablesobjectA key-value map of variables to populate the template with.
singleRequestOptionsSingleRequestOptions

<b>Returns:</b>

Promise<ImagenGenerationResponse<!-- --><ImagenInlineImage<!-- -->>>