Configure API Keys for Azure OpenAI

:bookmark: This guide explains how to configure API keys for Azure OpenAI to enable Discourse AI features that require 3rd party LLM keys.

:person_raising_hand: Required user level: Administrator

In this example, we are using Azure OpenAI to generate the keys.

Note: You will likely need a paid plan and have to pay per usage. See here for up-to-date details and pricing .

Platforms will always change so this guide may not reflect 100% process.

:information_source: In order to use certain AI modules, users must have an API Key from a 3rd party provider such as OpenAI (ChatGPT), Anthropic (Claude), Stability AI (Stable Diffusion), etc

Please check each AI module to see which 3rd party providers can be used for it.

Obtain API keys

  1. Go through the documentation here to obtain the necessary API keys depending on the OpenAI models you choose and the Discourse AI modules/features you use
  2. Once the keys are obtained, store them in a safe and secure place and copy it

Using API keys for Discourse AI

  1. Go to Admin settings-> Plugins ā†’ AI ā†’ LLMs tab
  2. Click on the + New Model button.
  3. Select the appropriate model from the list.
  4. Select Azure from the Service hosting the model list
  5. Input the URL of the service hosting the model

Example URL: https://{RESOURCE_NAME}.openai.azure.com/openai/deployments/{DEPLOYMENT_NAME}/>chat/completions?api-version=2024-02-15-preview where

  • RESOURCE_NAME is the name of your Azure OpenAI resource
  • DEPLOYMENT_NAME is the name of your GPT-4 Turbo with Vision model deployment
  1. Paste the API key into the API Key of the service hosting the model field
  2. Save the LLM

Additional settings

The settings will depend on the OpenAI model you choose and the Discourse AI modules/features you use. The following settings can be found in the Admin settings-> Plugins ā†’ AI ā†’ Settings tab:

  • ai openai API key: API key for OpenAI API
  • ai openai embeddings url: Custom URL used for OpenAI embeddings API (use specific URL for Azure)
  • ai openai dall e 3 url: Custom URL used for DALL-E 3 image generation

Last edited by @pedrom 2024-08-01T02:16:11Z

Check documentPerform check on document:
2 Likes

Hello,

Iā€™m encountering an issue with the OpenAI Azure endpoint. It seems not to be working as expected for the following URL:

https://***.openai.azure.com/openai/deployments/DEPLOYMENT_NAME/chat/completions?api-version=2023-07-01-preview

Where DEPLOYMENT_NAME is set to gpt-4-32k.

Could you please assist in resolving this issue? Any guidance or suggestions would be greatly appreciated.

Additionally, I have some queries regarding Discourse plugins:

  1. How to Fork a Discourse Plugin: Could you provide detailed instructions or a guide on how to fork an existing Discourse plugin?
  2. Testing the Forked Plugin: Once I have forked a plugin, what are the steps to test this forked version on my own Discourse instance?
  3. Uploading and Activating the Plugin: After testing, how can I upload and activate this forked plugin on my Discourse instance?

Your assistance with these queries would be extremely helpful. Thank you for your time and support.

Best regards,

1 Like