(Superseded) Configure API Keys for Google Custom Search

Google Custom Search

In this example, we are using Google Custom Search to generate the keys.

Note: You might need to pay based on 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), Stability AI (Stable Diffusion), 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 Google Developers. Follow the instructions in their documentation to get an API key and the CX parameter
  2. Generate the API Key and get the CX parameter
  3. Once the key is generated, store it in a safe and secure place and copy it

Using API key for Discourse AI

  1. Go to Admin settings from the sidebar or profile and then Plugins
  2. Search or find Discourse AI and click settings
  3. Search or find ai_google_custom_search_api_key and input your copied-over key
  4. Search or find ai_google_custom_search_cx and input your copied-over CX parameter

3 Likes

Hello, forgive me if my question seems stupid, I’m just not a programmer :pray: I generated an API key, now how can I get the CX parameter?

EDIT:
I guess I was a little hasty with the question, although finding the instructions I needed took a lot of time. But still I found instructions in Russian. Maybe someone will find this useful:

Create your own custom search system

To get the CX parameter:

  1. Visit Programmable Search Engine by Google

  2. Click “Get Started” and sign in to your Google account.

  3. Click New Search Engine and follow the instructions to set up a custom search engine.

  1. Customize your search engine by adjusting the settings in the General and Sites to Search tabs.

  2. After saving the data, the Search engine created notification will appear. Go to the “Settings” tab to get the “cx” parameter, which will appear next to the Search Engine ID.

2 Likes

Thank you for writing up the guide! I will add it to the OP, I’m sure others will have the same question!

1 Like

Thank you but pls tell if this whole string is MX code or only the last part? And what is this ‘Get Code’? Thanks.

It’d be great if you’d shown a sample ‘CX’ code.

1 Like

It would be just the numbers after cx=

1 Like

See Google Search for Discourse AI - Programmable Search Engine and Custom Search API