Using the AI Gateway to support OpenAI APIs

The API Connect provides a UI wizard to create AI-aware APIs and products, plus integration with OpenAI 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 OpenAI.

API Connect provides a policy that enables your API to send requests to OpenAI. The following OpenAI operations are supported:
  • POST /chat/completions
  • POST /embeddings
  • GET /models
  • GET /models/[model-id]

Prerequisites for using the AI Gateway with OpenAI

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

  • Register with OpenAI.
    Note: When you register your OpenAI id, a default project is created for you. You can use this project or create additional projects. OpenAI projects will allow customers to organize their work within the OpenAI platform. From the AI Gateway perspective, the OpenAI project id is an optional property that will associate an OpenAI request to a specific project.
  • Obtain an OpenAI API key.

Getting started with the AI Gateway and OpenAI

To use the AI Gateway, complete the following steps:

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

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

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

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