Using the AI Gateway to support Gemini APIs

The API Connect provides a UI wizard to create AI-aware APIs and products, plus integration with Gemini to forward requests and manage responses.

The AI Gateway makes it easy for enterprises to manage access to API endpoints used by AI applications. The AI Gateway simplifies the integration of AI into new and existing OpenAPI 3.0 APIs in API Connect to access a set of operations exposed by Gemini.

API Connect provides a policy that enables your API to send requests to Gemini. The following Gemini operations are supported:
  • GET /models
  • GET /models/[model]
  • POST /models/[model]:generateContent
  • POST /models/[model]:countTokens
  • POST /models/[model]:embedContent
  • POST /models/[model]:batchEmbedContents

Prerequisites for using the AI Gateway with Gemini

Before attempting to use the AI Gateway with Gemini complete the following prerequisites:

  • Register with Google Studio.
    Note: When you register with Google Studio, a default project is created for you. You can use this project or create additional projects.
  • Navigate to the API Key Management Page to create an API key. You can also manage projects and API keys in Google Cloud by following the links provided on the API Key Management Page.

Getting started with the AI Gateway and Gemini

To use the AI Gateway, complete the following steps:

  1. Set up your environment as explained in Prerequisites for using the AI Gateway with Gemini.

  2. Create an API to use as a reverse-proxy.

  3. Add the Gemini invoke policy to the API so it can access the Gemini platform.

  4. Review metrics on the API's performance in the AI usage dashboard, which tracks AI token and model usage.