Skip to main content

Connect to OpenAI-compatible API endpoints from Excel

GPT for Excel can connect to any AI service that provides an OpenAI-compatible API endpoint. You can connect to two main types of services: cloud-based platforms, which provide access to models over the internet with no software installation or setup required on your part, and local servers, which you run on a local machine, such as your own computer or another computer on a local network.

You can use models from OpenAI-compatible API endpoints as Agent models and as bulk models. The endpoint requirements are different for each type of model:

  • Agent models: The endpoint must be compatible with OpenAI's Responses API and be publicly accessible over the internet through HTTPS. The model must support a context length of at least 32K tokens.

  • Bulk models: The endpoint must be compatible with OpenAI's Chat Completions API.

info

Custom API endpoints are available if your space is on the Business or Enterprise plan or pay-as-you-go pricing.

Here are some popular services that provide an OpenAI-compatible API endpoint:

info

Depending on the model you use, the model settings defined in GPT for Excel (temperature (creativity), top-p, frequency penalty, and presence penalty) may not work as expected. If you get bad results, try tweaking the settings.

To use models from an OpenAI-compatible API endpoint:

  1. Set up the endpoint.

  2. Select a model available through the endpoint.

Set up an API endpoint​

Prerequisites
  • You have an endpoint URL and, if needed, an API key for accessing the service.

  • The endpoint supports the /v1/responses OpenAI-compatible API resource path.

  • The endpoint is publicly accessible over the internet through HTTPS.

  • The model supports a context length of at least 32K tokens.

  1. Sign in to the GPT for Work dashboard with your Microsoft account.

  2. In the sidebar, select Custom API endpoints.

  3. Select the Agent models tab.

  4. Click OpenAI-compatible endpoints (Responses API).

    tip

    If you already have OpenAI-compatible API endpoints set up, click Add an OpenAI-compatible API endpoint.

  5. Define the endpoint settings:

    • Endpoint URL: Enter the URL of the service that provides the endpoint. The endpoint must support OpenAI's Responses API and be publicly accessible over the internet.

    • Model ID: Enter the ID of the model to use through the endpoint. The model ID is sent to the endpoint in the request payload.

    • Display name (optional): Enter a short name that identifies the model in the Agent model switcher.

    • API key (optional): If required, enter the API key for accessing the service.

    Define OpenAI-compatible API endpoint settings
  6. Click Check to validate the settings and click Save.

You have set up the OpenAI-compatible API endpoint. The model is now available in the Agent model switcher and in the Agent models page of the GPT for Work dashboard.

Select a model from the API endpoint​

  1. Open a Microsoft Excel workbook.

  2. On the ribbon, select Home > GPT for Excel Word.

    GPT for Excel Word on the Home ribbon
    info

    If GPT for Excel Word is not visible on the ribbon, or if it's grayed out, select Home > Add-ins > My Add-ins > GPT for Excel Word. Learn more.

  3. In the sidebar, select Agent.

  4. Open the model switcher and select the model.

    Select the endpoint-connected Agent model

The Agent now uses the endpoint-connected model as the Agent model.

info

Some Agent tools, such as web search, are not available when the Agent uses an endpoint-connected model.

What's next​

  • To try out an OpenAI-compatible AI service with GPT for Excel, set up LM Studio on macOS or Windows.