How to integrate the OpenAi API key into the Smartsearchwp chagpt wordpress chatbot

Unlock AI search in minutes! This step-by-step WordPress tutorial shows you how to generate your OpenAI API key, integrate it with the SmartSearchWP plugin and configure GPT-4o for a fast, accurate chatbot on your website.

We cover all the essential steps – no coding required. What you’ll learn in this video:

  • How to connect to the OpenAI platform, create a project, generate your secret API key and understand permission levels (All vs Restricted vs Read-Only)
  • Copy/paste the key into SmartSearchWP and validate it, choose the best ChatGPT model: we compare GPT-3.5 Turbo and GPT-4o, and explain why GPT-4o offers faster and more reliable responses.
  • Save your settings and perform a quick test by asking “How are you?” – a generic answer means your key is working.
  • Troubleshooting tips: enable debug mode in SmartSearchWP, read error logs and disable debugging in production.
  • Security best practices: keep your API key private, rotate it if it’s exposed, and use separate keys for testing and production.

Whether you’re building an AI search assistant or experimenting with conversational chatbots, this video will get you up and running fast.

If you found this tutorial useful, please give it a 👍 and subscribe for more WordPress guides on AI.

How to connect your OpenAI API key to SmartSearchWP

After installing the SmartSearchWP plugin on your WordPress site, the next step is to connect your OpenAI API key.
This key is essential to enable SmartSearchWP to work with ChatGPT (GPT-3.5 or GPT-4o) and offer intelligent conversational search to your visitors.

In this step-by-step guide, we’ll show you how to generate your key on the OpenAI platform, paste it into SmartSearchWP, validate the connection and test that it works.


Step 1 – Create an API key on the OpenAI platform

  1. Go to platform.openai.com and log in to your account.

  2. Click on the cogwheel icon (Settings) at the top right of the screen.

  3. From the menu, select API Keys.

  4. Click on Create new secret key.

    • Give your key a clear name (e.g. SmartSearchWP Production).

    • Select a project (you’ll need to create one if none exists).

    • Select permissions:

      • All: full access, recommended if the key is dedicated to SmartSearchWP.

      • Restricted: limited access to certain models, for greater security.

      • Read Only – ⚠️ does not work with SmartSearchWP.

  5. Click on Create secret key.

  6. Copy the key immediately: it’s the only time you’ll see its full value. Keep it in a safe place.


Step 2 – Integrate and validate the key in SmartSearchWP

  1. Open the WordPress dashboard.

  2. In the menu, click on SmartSearchWP > Settings > General.

  3. Paste the key into the OpenAI API Key field.

  4. Click on Validate Key to check that it has been recognized.

  5. In the Model selection section, choose your preferred model:

    • GPT-4o (highly recommended): faster and more precise than GPT-3.5, ideal for a smooth experience.

    • GPT-3.5 Turbo: more economical but less powerful.

  6. Scroll to the bottom of the page and click on Save Changes.


Step 3 – Testing the chatbot

To check that everything is working properly :

  1. Go to the WordPress dashboard, open SmartSearchWP > Contexts.

  2. Select at least one page or article, then train the AI to generate embeddings.

  3. Make sure youactivate this context so that it is taken into account by the chatbot.

Next:

  1. Go to the front-end of your site.

  2. Open the SmartSearchWP chatbot.

  3. Ask a simple question like “How are you?”.

👉 If everything is configured correctly :

  • The chatbot will respond with a generic answer if the context is still empty.

  • Once your content is indexed and activated, it can provide relevant answers based on your site.


Step 4 – Activate Debug mode in case of problems

If the chatbot does not respond or if an error appears :

  1. Return to SmartSearchWP > Settings.

  2. Click on Activate Debug Mode.

    • ⚠️ Activate it only for diagnostics, and remember to deactivate it afterwards for production.

  3. In the left-hand menu, click on Error Logs.

    • By default, only OpenAI error messages are retained.

    • In Debug Mode, application-related errors are also displayed.

👉 A separate video explains in detail the various possible errors and their solutions.


Good safety practices

  • Never share your API key in code or on a public page.

  • Restrict access to SmartSearchWP parameters to administrators only.

  • Change the key (rotate) if it has been exposed.

  • Use separate keys for your staging and production environments.


You have now connected SmartSearchWP to the OpenAI API 🎉.
Your chatbot is up and running, ready to interact with your visitors.

👉 In the next tutorial, we’ll look at how to fine-tune template parameters and manage content contexts so that responses are always relevant and tailored to your site.

Hello, may I help you?
SmartSearch
Chatbot Image Hello, I am SmartSearchWP, how can I help you?

Powered by artificial intelligence, the bot can make mistakes. Consider checking important information.