VertexAI

Deprecated @react-native-firebase/vertexai pointer: getVertexAI() returns an AI instance. Migrate to getAI() with AgentPlatformBackend from @react-native-firebase/ai.

Vertex AI in Firebase has been deprecated by Google in favor of Firebase AI Logic. @react-native-firebase/vertexai is a deprecation pointer: use @react-native-firebase/ai instead. See AI Logic usage for the full API.

The official migration guide calls the API behind @react-native-firebase/vertexai the Agent Platform Gemini API (formerly Vertex AI). In @react-native-firebase/ai, pass AgentPlatformBackend to getAI() to keep calling the Agent Platform Gemini API.

Migrate to AI Logic

Install the replacement package. The @react-native-firebase/app module must already be set up; see Getting Started.

bash
yarn add @react-native-firebase/ai

The deprecated form:

js
// WARNING: @react-native-firebase/vertexai is deprecated. Use @react-native-firebase/ai.
import { getApp } from '@react-native-firebase/app';
import { getVertexAI, getGenerativeModel } from '@react-native-firebase/vertexai';

function createDeprecatedModel() {
  const vertexAI = getVertexAI(getApp(), { location: 'global' });
  return getGenerativeModel(vertexAI, { model: 'gemini-3.8-flash' });
}

The replacement:

js
import { getApp } from '@react-native-firebase/app';
import { AgentPlatformBackend, getAI, getGenerativeModel } from '@react-native-firebase/ai';

function createModel() {
  const ai = getAI(getApp(), { backend: new AgentPlatformBackend() });
  return getGenerativeModel(ai, { model: 'gemini-3.8-flash' });
}

new AgentPlatformBackend() uses the global location. getVertexAI() defaults to us-central1, so the deprecated sample sets location: 'global'. Gemini 3.x models such as gemini-3.8-flash are not offered in us-central1, which only suits older models, so keep global for the samples above. Model availability depends on location, and a model that is unavailable in the location you choose returns a 404 error; see the locations page.

getAI() without a backend option uses GoogleAIBackend (the Gemini Developer API), not the Agent Platform Gemini API.

After every import uses @react-native-firebase/ai, remove @react-native-firebase/vertexai from your dependencies.

Exports of the deprecated package

The package depends on @react-native-firebase/ai and re-exports everything from it. It adds these deprecated names:

  • getVertexAI(app?, options?) returns an AI instance. options accepts location (default us-central1), appCheck, and auth.
  • VertexAIModel, VertexAIError, and VertexAIErrorCode are aliases of AIModel, AIError, and AIErrorCode.
  • VertexAI is a type alias of AI, and VertexAIOptions is the options type for getVertexAI().
  • VERTEX_TYPE is the string constant 'vertexAI', kept for compatibility. It has no replacement.

AIModel and AIError are re-exported from @react-native-firebase/ai unchanged.

Platform support

This package is pure JavaScript; New Architecture is not required for @react-native-firebase/vertexai alone.

{/* prettier-ignore */}

PlatformsAndroid, iOS, and Web (pure JavaScript)
New ArchitectureNot required. Pure JavaScript package with no native TurboModule.

Deprecated: Use @react-native-firebase/ai. See the Firebase migration guide.

On this page