[null,null,["最后更新时间 (UTC):2025-08-25。"],[],[],null,["\u003cbr /\u003e\n\nWhen you call an API directly from a mobile or web app (for example, the APIs\nthat allow access to generative AI models), the API is vulnerable to abuse by\nunauthorized clients. To help protect these APIs, you can use\n[Firebase App Check](/docs/app-check) to verify that all incoming API calls\nare from your actual app.\n\nFirebase AI Logic provides a proxy gateway that lets you integrate with\nFirebase App Check and protect the generative AI model APIs called by your\nmobile and web apps. Using App Check with the\nFirebase AI Logic SDKs supports all our configurations:\n\n- Protects both \"Gemini API\" providers: Gemini Developer API and\n Vertex AI Gemini API.\n\n- Protects all supported models, both Gemini models and Imagen\n models.\n\n| We **strongly recommend implementing\n| Firebase App Check into your app as early as possible**, even during development, so that every version of your app is protected from API abuse.\n\nHigh-level summary of how App Check works\n\nWith App Check, devices running your app use an app or device attestation\nprovider that verifies one or both of the following:\n\n- Requests originate from your authentic app\n- Requests originate from an authentic, untampered device\n\nThis attestation is attached to every request your app makes using a\nFirebase AI Logic SDK. When you enable App Check enforcement,\nrequests from clients without a valid attestation will be rejected, as will any\nrequest originating from an app or platform you haven't authorized.\n\nYou can find [detailed information about App Check](/docs/app-check) in its\ndocumentation, including its [quotas and limits](/docs/app-check#quotas_limits).\n\nAvailable providers and implementation instructions\n\nApp Check has built-in support for using the following services as\nattestation providers. **Click a provider's link to view the App Check\ndocumentation for that provider, including descriptions and implementation\ninstructions.**\n\n- **Apple platforms** : [DeviceCheck](/docs/app-check/ios/devicecheck-provider) or [App Attest](/docs/app-check/ios/app-attest-provider)\n- **Android** : [Play Integrity](/docs/app-check/android/play-integrity-provider)\n- **Web** : [reCAPTCHA Enterprise](/docs/app-check/web/recaptcha-enterprise-provider)\n- **Flutter** : Supports all the providers above (see [specific Flutter instructions](/docs/app-check/flutter/default-providers))\n - Also see [special instantiation requirements](#instantiation-flutter) for Flutter and App Check\n- **Unity** : Supports all the providers above (see [specific Unity instructions](/docs/app-check/unity/default-providers))\n\nIf these providers are insufficient for your needs, you can also implement your\nown service that uses either a third-party attestation provider or your own\nattestation techniques\n(for more details, see the [App Check documentation](/docs/app-check)).\n| **Important:** As part of implementation, **don't forget to\n| [enable enforcement of App Check](/docs/app-check/enable-enforcement)** before you release your app to real users.\n\nSpecial instantiation required for Flutter\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| *Click your Gemini API provider to view provider-specific content and code on this page.* Gemini Developer API Vertex AI Gemini API |\n\nWhen using App Check with Firebase AI Logic in Flutter apps, you need to\nexplicitly pass in App Check during instantiation, like so: \n\n // ...\n\n final ai = await FirebaseAI.googleAI(\n appCheck: FirebaseAppCheck.instance, // for Flutter, pass in App Check explicitly\n );\n\n // ...\n\nUnderstand how Firebase AI Logic integrates with App Check\n\nTo use the Firebase AI Logic SDKs, the\n[Firebase AI Logic API (`firebasevertexai.googleapis.com`)](https://console.cloud.google.com/apis/library/firebasevertexai.googleapis.com?project=_)\nmust be enabled in your Firebase project. This is because requests made by the\nFirebase AI Logic SDKs are first sent to the Firebase AI Logic\nserver, which acts as a proxy gateway where Firebase App Check verification\ntakes place *before* the request is allowed to proceed to your chosen\n\"Gemini API\" provider's backend and the APIs to access the Gemini\nand Imagen models."]]