A custom FirebaseApp used for initialization; if not specified, uses the default
FirebaseApp.
backend
The backend API for the Firebase AI SDK; if not specified, uses the default
googleAI() (Gemini Developer API).
useLimitedUseAppCheckTokens
When sending tokens to the backend, this option enables
the usage of App Check’s limited-use tokens instead of the standard cached tokens. Learn
more about
limited-use tokens, including
their nuances, when to use them, and best practices for integrating them into your app.
Return Value
A FirebaseAI instance, configured with the custom FirebaseApp.
[Public Preview] Initializes an ImagenModel with the given parameters.
Warning
For Firebase AI SDK, image generation using Imagen 3 models is in Public
Preview, which means that the feature is not subject to any SLA or deprecation policy and
could change in backwards-incompatible ways.
Important: Only Imagen 3 models (named imagen-3.0-*) are supported.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-27 UTC."],[],[],null,["# FirebaseAI Framework Reference\n\nFirebaseAI\n==========\n\n @available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)\n public final class FirebaseAI : Sendable\n\nThe Firebase AI SDK provides access to Gemini models directly from your app.\n[Public APIs\n-----------](#/Public-APIs)\n\n- `\n ``\n ``\n `\n\n ### [firebaseAI(app:backend:)](#/s:10FirebaseAIAAC08firebaseB03app7backendABSo6FIRAppCSg_AA7BackendVtFZ)\n\n `\n ` \n Creates an instance of `FirebaseAI`. \n\n #### Declaration\n\n Swift \n\n public static func firebaseAI(app: FirebaseApp? = nil,\n backend: ../Structs/Backend.html = .googleAI()) -\u003e FirebaseAI\n\n #### Return Value\n\n A `FirebaseAI` instance, configured with the custom `FirebaseApp`.\n- `\n ``\n ``\n `\n\n ### [generativeModel(modelName:generationConfig:safetySettings:tools:toolConfig:systemInstruction:requestOptions:)](#/s:10FirebaseAIAAC15generativeModel9modelName16generationConfig14safetySettings5tools04toolH017systemInstruction14requestOptionsAA010GenerativeD0CSS_AA010GenerationH0VSgSayAA13SafetySettingVGSgSayAA4ToolVGSgAA0uH0VSgAA0D7ContentVSgAA07RequestP0VtF)\n\n `\n ` \n Initializes a generative model with the given parameters. \n Note\n\n Refer to [Gemini models](https://firebase.google.com/docs/vertex-ai/gemini-models) for\n guidance on choosing an appropriate model for your use case. \n\n #### Declaration\n\n Swift \n\n public func generativeModel(modelName: String,\n generationConfig: ../Structs/GenerationConfig.html? = nil,\n safetySettings: [../Structs/SafetySetting.html]? = nil,\n tools: [../Structs/Tool.html]? = nil,\n toolConfig: ../Structs/ToolConfig.html? = nil,\n systemInstruction: ../Structs/ModelContent.html? = nil,\n requestOptions: ../Structs/RequestOptions.html = ../Structs/RequestOptions.html())\n -\u003e ../Classes/GenerativeModel.html\n\n #### Parameters\n\n |---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*modelName*` ` | The name of the model to use, for example `\"gemini-1.5-flash\"`; see [available model names](https://firebase.google.com/docs/vertex-ai/gemini-models#available-model-names) for a list of supported model names. |\n | ` `*generationConfig*` ` | The content generation parameters your model should use. |\n | ` `*safetySettings*` ` | A value describing what types of harmful content your model should allow. |\n | ` `*tools*` ` | A list of [Tool](../Structs/Tool.html) objects that the model may use to generate the next response. |\n | ` `*toolConfig*` ` | Tool configuration for any [Tool](../Structs/Tool.html) specified in the request. |\n | ` `*systemInstruction*` ` | Instructions that direct the model to behave a certain way; currently only text content is supported. |\n | ` `*requestOptions*` ` | Configuration parameters for sending requests to the backend. |\n\n- `\n ``\n ``\n `\n\n ### [imagenModel(modelName:generationConfig:safetySettings:requestOptions:)](#/s:10FirebaseAIAAC11imagenModel9modelName16generationConfig14safetySettings14requestOptionsAA06ImagenD0CSS_AA0m10GenerationH0VSgAA0m6SafetyJ0VSgAA07RequestL0VtF)\n\n `\n ` \n **\\[Public Preview\\]** Initializes an [ImagenModel](../Classes/ImagenModel.html) with the given parameters. \n Warning\n\n For Firebase AI SDK, image generation using Imagen 3 models is in Public\n Preview, which means that the feature is not subject to any SLA or deprecation policy and\n could change in backwards-incompatible ways.\n\n Important: Only Imagen 3 models (named `imagen-3.0-*`) are supported. \n\n #### Declaration\n\n Swift \n\n public func imagenModel(modelName: String, generationConfig: ../Structs/ImagenGenerationConfig.html? = nil,\n safetySettings: ../Structs/ImagenSafetySettings.html? = nil,\n requestOptions: ../Structs/RequestOptions.html = ../Structs/RequestOptions.html()) -\u003e ../Classes/ImagenModel.html\n\n #### Parameters\n\n |--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*modelName*` ` | The name of the Imagen 3 model to use, for example `\"imagen-3.0-generate-002\"`; see [model versions](https://firebase.google.com/docs/vertex-ai/models) for a list of supported Imagen 3 models. |\n | ` `*generationConfig*` ` | Configuration options for generating images with Imagen. |\n | ` `*safetySettings*` ` | Settings describing what types of potentially harmful content your model should allow. |\n | ` `*requestOptions*` ` | Configuration parameters for sending requests to the backend. |"]]