Call PaLM API Securely

Made by Google Cloud

Protects your API key and prevents resource abuse by deploying a backend to call the PaLM API, secured by App Check.

40+
installs
Version
0.1.5 | Source code
Tags
ai, palm, generative-ai, text-ai, language-ai, large-language-models, llm, nlp, google-ai
License
Apache-2.0
Publisher
Google Cloud
Report
Bug
Abuse

How this extension works

⚠️ The PaLM API is currently in public preview. For details and limitations, see the PaLM API documentation.
Please ensure that you have already signed up for the waitlist and have been approved before installing the extension.

This extension helps you call the PaLM API from your frontend client application without exposing your API key directly in the frontend code.

The extension provides API endpoints optionally secured by App Check that you can use to call PaLM from your Firebase app. The deployed endpoint is a thin wrapper, so you can send the same request body as you would use when directly calling the PaLM Text API. The API key is stored as a secret in Cloud Secret Manager and can be directly accessed by the API endpoint deployed by the extension, so it does not need to be provided in the request. These API endpoints are deployed as Firebase Callable Functions, and require that you are signed in with a Firebase Auth user to successfully call the Functions from your client application.

The extension also allows you to configure App Check on the deployed Callable Functions, which can help you prevent unauthorized clients from accessing the Functions deployed by this extension. If you configure the extension to use App Check, you will need to follow these instructions to also enable App Check in your Firebase app.

Three Callable Functions are provided:

  • getModels takes no arguments and will respond with detailed information about all models on the PaLM API
  • getModel takes an object {name: string} as an argument and will return information about a specific model.
  • post takes an object as an argument. The object must have properties {model: string, method: string}. It will make a POST request to the PaLM API. Any other properties of the object will be used to populate the body of this request.

Additional Setup

If you have not already done so, you will first need to apply for access to the PaLM API via this waitlist.

To use this extension, you will need to generate an API key from MakerSuite. Go to the API Access page and click the “Generate an API key” button. The extension will ask for that API key during the installation process.

Billing

To install an extension, your project must be on the Blaze (pay as you go) plan. You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s no-cost tier:

  • Cloud Functions (See FAQs)

Learn more about Firebase billing.

Additionally, this extension uses the PaLM API, which is currently in public preview. During the preview period, developers can try the PaLM API at no cost. Pricing will be announced closer to general availability. For more information on the PaLM API public preview, see the PaLM API documentation.