# Connect to OpenAI-compatible API endpoints from Word

> **Info**
>
> This feature is only available if your space is on the [Business or Enterprise plan](https://autosheet.com/docs/resources/pricing/subscription) or [pay-as-you-go pricing](https://autosheet.com/docs/resources/pricing/pay-as-you-go).

GPT for Word can connect to any AI service that provides an [OpenAI-compatible API endpoint](https://developers.openai.com/api/reference/overview). You can connect to two main types of services: [**cloud-based platforms**](https://autosheet.com/docs/resources/guides/concepts#cloud-hosted-model), which provide access to models over the internet with no software installation or setup required on your part, and [**local servers**](https://autosheet.com/docs/resources/guides/concepts#local-model), which you run on a local machine, such as your own computer or another computer on a local network.

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

- **Cloud-based platforms:**

  - [Anyscale](https://www.anyscale.com/)
  - [Fireworks AI](https://fireworks.ai/)
  - [Together AI](https://www.together.ai/)

- **Local servers:**

  - [LM Studio](https://lmstudio.ai/)
  - [LocalAI](https://localai.io/)
  - [Ollama](https://ollama.com/)

**Prerequisites**

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

- The endpoint supports the following OpenAI-compatible API resource paths:

  - `/v1/models`
  - `/v1/chat/completions`

> **Info**
>
> Depending on the model you use, the model settings defined in GPT for Word (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.](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints#set-up-an-api-endpoint)
2. [Select a model available through the endpoint.](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints#select-a-model-from-the-api-endpoint)

## Set up an API endpoint

1. Sign in to the [Autosheet dashboard](https://dashboard.autosheet.com/) with your [Microsoft or Google account](https://autosheet.com/docs/gpt-for-word/setup/sign-in).

2. In the sidebar, select **Custom API endpoints**.

3. Select the **Bulk models** tab.

4. Click **OpenAI-compatible endpoints (Chat Completions 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.
   - **Display name (optional)**: Enter a short name that is prefixed to the model names in the model switcher. By default, the model names are prefixed with "custom/".
   - **API key (optional)**: If required, enter the API key for accessing the service.

   ![Define OpenAI-compatible API endpoint settings](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-openai-bulk.png)

6. Click **Check** to validate the settings and click **Save**.

   ![Save OpenAI-compatible API endpoint settings](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-openai-save.png)

   > **Tip**
   >
   > If you get an error saying that the URL is invalid, make sure that the endpoint supports:
   >
   > - **Cross-origin resource sharing (CORS).** See the LM Studio setup instructions for [macOS](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints/set-up-lm-studio-on-macos#start-and-configure-the-lm-studio-server) or [Windows](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints/set-up-lm-studio-on-windows#start-and-configure-the-lm-studio-server).
   > - **HTTPS (needed with Safari and with Microsoft Office for Mac).** See the LM Studio setup instructions for [macOS](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints/set-up-lm-studio-on-macos#enable-https-for-the-lm-studio-server).

You have set up the OpenAI-compatible API endpoint. You can now use all models available through the endpoint in GPT for Word.

## Select a model from the API endpoint

1. Open a Microsoft Word document.

2. On the [ribbon](https://support.microsoft.com/en-US/Office/foundations-experiences/show-or-hide-the-ribbon-in-office), select **Home > GPT for Excel Word – Autosheet**.

   ![GPT for Excel Word – Autosheet on the Home ribbon](https://autosheet.com/docs/article-images/gpt-for-word/launch.png)

   > **Info**
   >
   > If **GPT for Excel Word – Autosheet** is not visible on the ribbon, or if it's grayed out, select **Home > Add-ins > My Add-ins > GPT for Excel Word – Autosheet**. [Learn more.](https://autosheet.com/docs/gpt-for-word/troubleshooting/add-in-not-working#add-in-button-is-grayed-out)

3. Open the model switcher and select a model. You can find the endpoint-connected models under **Connected models**, at the end of the list.

   ![Select an endpoint-connected model](https://autosheet.com/docs/article-images/gpt-for-word/model-switcher-custom-endpoint-bulk.png)

   > **Info**
   >
   > The available models depend on the models provided by the service.

GPT for Word now uses the selected model to generate responses.

## What's next

- To try out an OpenAI-compatible service with GPT for Word, set up LM Studio on [macOS](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints/set-up-lm-studio-on-macos) or [Windows](https://autosheet.com/docs/gpt-for-word/setup/manage-models/connect-to-api-endpoints/set-up-lm-studio-on-windows).
