Get Related Topics using Cloudflare Workers AI free tier

Overview

Currently we offer Related Topics to all customers hosted by Discourse. For those that are self-hosted they would require getting there own Embeddings set up, which power Related topics.

In this guide we will be exploring how to get Related Topics for free using Cloudflare Workers AI.

Pre-requisites

In order for this to work you will need the following

Additionally, the following guides can be referenced

Configuration

  1. Once Discourse AI is enabled, you would need to enable Related Topics on your Discourse instance
  1. Follow API Keys for Cloudflare Workers AI to get a working key inputted
  1. Configure the plugin to respect Cloudflare Workers AI free tier rate limits:
cd /var/discourse
./launcher enter app
rails c
SiteSetting.ai_embeddings_backfill_batch_size = 20
exit
exit
exit

Caveats

4 Likes

I’ve enabled this but have very quickly hit the daily limit of 10,000 neurons with the proposal that I use a paid plan instead. This is confusing, because the monthly paid plan seems to only give 300,000 neurons, or 30 times the daily free allowance of 10,000 neurons. I might consider paying a fee to get more but I can’t see why it’s beneficial to pay extra just to get exactly what I can already get free!

Edit: Just to add this isn’t a Discourse issue…just a question about using the Cloudflare service with Discourse Ai.

The difference with the paid plan, I think, is that you can use more than the allowance, for a usage fee. With the free plan, you simply can’t go over the allowance.

1 Like

That’s what I was assuming. The page that they link you to for the paid plan doesn’t have that detail though.

I dug around the rest of the pricing info on the CF site and eventually found that they charge $0.011 / 1,000 Neurons over 10,000 per day. The $5/month charge is simply to allow you to be charged $0.011 / 1,000 Neurons - you don’t get any extra free for the $5/month fee.

1 Like

If that is correct, it is simply a terrible pricing strategy!

Seems like Workers AI is no longer free so we are removing this topic