Searching for this issue, I only found two other posts and no solution.
Enable AI Helper and
GPT 3.5 is not configured despite having an API key
I’ve had OpenAI integration enabled on my self-hosted Discourse for a long time. A few days ago, I decided to use the project’s feature in OpenAI to keep better track on where my keys were used. So, I revoked my “only key” and started generating new projects and new keys in different places I use OpenAI. It works fine everywhere else, but after updating the ai openai api key
under admin, the OpenAI integration in Discourse has been broken.
For instance, when trying to use the AI for reading a post, it results in an “error 500” dialog, and the Chrome console shows an error 500 at /discourse-ai/ai-helper/suggest:1
. In the /var/www/discourse/log/production.log
, I see a:
DiscourseAi::Completions::Endpoints::OpenAi: status: 401 - body: {
"error": {
"message": "Incorrect API key provided: sk-lg0jD***************************************GBv4. You can find your API key at https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}
However, this is NOT the key I typed in the admin settings!!!
( it should say sk-proj***************************************tmDr )
I tried removing it, generating a new key, and setting it. I’ve updated Discourse to the latest version (3.3.0.beta5-dev) and restarted the server. I’ve also run ./launcher rebuild app
, but nothing works, and it just keeps failing, using the wrong key.
How do i make Discourse use the right key ?