# Discourse AI - Spam detection

**URL:** https://meta.discourse.org/t/discourse-ai-spam-detection/343541
**Category:** Site Management
**Tags:** moderation, how-to, ai, spam
**Created:** [December 20, 2024, 4:46am UTC](https://meta.discourse.org/t/discourse-ai-spam-detection/343541 "2024-12-20T04:46:26Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [August 27, 2025, 8:50pm UTC](https://meta.discourse.org/t/discourse-ai-spam-detection/343541/19 "2025-08-27T20:50:57Z")

</div>

Your API key is invalid, so it’s not doing any tests.

If you do a test at [https://www.foodtalkcentral.com/admin/plugins/discourse-ai/ai-spam](https://www.foodtalkcentral.com/admin/plugins/discourse-ai/ai-spam) and paste in that URL you get a 500 error. If you wade into the logs in  
`/var/discourse/shared/web-only/log/rails/production.log` and search for " 500 " you’ll see

```plaintext
Completed 200 OK in 399ms (Views: 123.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 22.9ms)
DiscourseAi::Completions::Endpoints::Gemini: status: 400 - body: {
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid API key.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "API_KEY_INVALID",
        "domain": "googleapis.com",
        "metadata": {
          "service": "generativelanguage.googleapis.com"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "API key not valid. Please pass a valid API key."
      }
    ]
  }
}

```

---

_[View the full topic](https://meta.discourse.org/t/discourse-ai-spam-detection/343541)._
