Configure API Keys for OpenAI

:bookmark: This guide explains how to configure API keys for 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 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), Google (Gemini), etc.

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

Generate the API key

  1. Log in to Open AI. An API key can be obtained here OpenAI Platform
  2. Generate the API Key
  3. Once the key is generated, store it in a safe and secure place and copy it

Using API key for Discourse AI

Discourse AI uses a Secrets system to manage API keys. Instead of pasting keys directly into individual LLM configurations, you create a named secret and then reference it from one or more LLMs.

Create a Secret (optional can be done inline)

  1. Go to Admin β†’ Plugins β†’ AI β†’ Secrets tab
  2. Click New Secret
  3. Enter a name for the secret (e.g. β€œOpenAI API Key”)
  4. Paste your API key into the Secret field
  5. Save the secret

Configure an LLM

  1. Go to Admin β†’ Plugins β†’ AI β†’ LLMs tab
  2. Select a pre-configured model template (e.g. an OpenAI model) and click its Configure button, or click Edit on an already configured LLM
  3. In the API Key field, select the secret you created from the dropdown. You can also create a new secret inline by clicking the + button next to the dropdown.
  4. Save the LLM

Last edited by @sam 2026-03-23T21:53:37Z

Check documentPerform check on document:
6 Likes