This guide explains how to configure API keys for Azure OpenAI to enable Discourse AI features that require 3rd party LLM keys.
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.
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
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
Once the keys are obtained, store them in a safe and secure place and copy it
Using API keys for Discourse AI
Go to Admin settings-> Plugins β AI β LLMs tab
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
I am trying to configure this, but getting a 500 Internal error. I donβt think the request is even going to the gateway as there are no logs in the gateway. I used curl to get a test embedding and I am able to do so from command prompt. I am not sure what I am missing.
Here are the logs and it also shows the configuration
Started GET "/admin/plugins/discourse-ai/ai-llms/test.json?ai_llm%5Bmax_prompt_tokens%5D=131072&ai_llm%5Bapi_key%5D=[FILTERED]&ai_llm%5Btokenizer%5D=DiscourseAi%3A%3ATokenizer%3A%3AOpenAiTokenizer&ai_llm%5Burl%5D=https%3A%2F%2Faigateway-amrs.com%2Fv0%2Fr0%2Fopenai%2Fdeployments%2Fgpt-4o_2024-11-20-pgo-amrs%2Fchat%2Fcompletions%3Fapi-version%3D2024-10-21&ai_llm%5Bdisplay_name%5D=GPT-4&ai_llm%5Bname%5D=gpt-4o_2024-11-20-pgo-amrs&ai_llm%5Bprovider%5D=azure&ai_llm%5Benabled_chat_bot%5D=false&ai_llm%5Bvision_enabled%5D=false&ai_llm%5Bprovider_params%5D%5Bdisable_native_tools%5D=" for 100.64.76.177 at 2025-07-22 19:26:04 +0000
Processing by DiscourseAi::Admin::AiLlmsController#test as JSON
Parameters: {"ai_llm"=>{"max_prompt_tokens"=>"131072", "api_key"=>"[FILTERED]", "tokenizer"=>"DiscourseAi::Tokenizer::OpenAiTokenizer", "url"=>"https://aigateway-amrs.com/v0/r0/openai/deployments/gpt-4o_2024-11-20-pgo-amrs/chat/completions?api-version=2024-10-21", "display_name"=>"GPT-4", "name"=>"gpt-4o_2024-11-20-pgo-amrs", "provider"=>"azure", "enabled_chat_bot"=>"false", "vision_enabled"=>"false", "provider_params"=>{"disable_native_tools"=>""}}}
Completed 500 Internal Server Error in 20ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
Discourse doesnβt have any other logs, which is not helpful at all.
Can anyone please guide what I might be missing here?