Power your WordPress with AI! Generate content, enhance it, improve your SEO, add a ChatGPT-like chatbot, etc. It uses OpenAI directly, so no worries about extra fees with a third-party service. AI Engine also keeps track of your usage of OpenAI.

As the plugin is changing on a daily basis, I’m not ready to write the perfect tutorial about it yet. So this is a draft I am sharing with you, you might even find what you are looking for 🙂

The User Interface


Content Generator


ChatBot (ChatGPT-like discussion)

You can simply drop the shortcode [mwai_chatbot] and you’re done!

  context="Converse as if you were Michael Jackson."
  ai_name="Michael: "
  user_name="You: "
  start_sentence="Hi, my friend."

There are many arguments available. Here is the list of the ones you can use, with their default value.

  • id: random (will be used to name the elements – also, if the ID is fixed, the conversation will be saved and reloaded if the visitor reloads the page or visit another page)
  • model: “text-davinci-003”
  • temperature: “0.8”
  • text_send: “Send” (button text)
  • text_input_placeholder: “Type your message…” (input placeholder)
  • api_key (if you want to override the one you have in the settings)


If you set the user_name and ai_name to “” (empty), the bot will use avatars instead. For an OpenAI model, it will be the OpenAI logo (same as with ChatGPT). If the user is connected, its avatar will be used. Otherwise, defaults one will be used.

Content-Aware Bot

If you set content_aware to true, the chatbot will be able to read the content of the current page. You will also need to modify the prompt and add {CONTENT}. I recommend adding line breaks to make sure the article is well-separated. Here is an example:

  start_sentence="Is there anything you would like to discuss about this article?"

Images Bot

It’s a bot similar to chatbot, except that it uses DALL-E to return images, so it’s not really a discussion.

  ai_name="AI: "
  user_name="You: "
  start_sentence="What kind of images would you like?"

And you can use those extra arguments:

  • id: random (will be used to name the elements in the HTML)
  • text_send: “Send” (button text)
  • text_input_placeholder: “Type your message…” (input placeholder)
  • api_key (if you want to override the one you have in the settings)

How to train the AI

With Open AI, this process is called fine tuning. It’s really cool, and I wrote an article about the subject, and how to do it with AI Engine. It’s here: Fine-tune an AI model for your WordPress ChatBot.

If you are interested, I can offer my services to train a model based on your data, for you. In that case, contact me here.

Statistics & Usage Control

With the Pro Version, if you check the Statistics module, two tables added to your WordPress database. For every request, a row will be added in it.

This section is going to evolve a lot. This is a new feature and I am actively improving it, based on your use cases and feedback.

The Database Tables

The two tables are mwai_logs that is light, easy and fast to query, and a mwai_logmeta, that can store whatever you like (in which the data or conversations could be kept, for example). The mwai_logs table look like this:

If you know a bit about databases, you’ll see that it is really easy to query. If the userId is null, it simply means that the request came from an unauthenticated (in this case, you can refer to the IP address).

The Statistics API

In your code, you can call the Statistics API. I’ll keep it simple, and add new helpers as we go. Typically, the Statistics API will be used to get, you guessed it, statistics 🙂 Here is how to use it:

global $mwai_stats;
$stats = $mwai_stats->query([  'query' => 'user/month' ]);

For now, the only query available is the user/month one. It will return the usage statistics of the current authenticated user for the current month.

Note that this is really the beginning; I will make this more and more powerful, with better helpers. But for this, I need to know your use cases and I’ll improve this as we go.

Usage Control

The filter called mwai_ai_allowed will let you decide if a request should be run or not. You should return the default $allowed variable, but if you want to stop it, simply return the reason, or false. If a reason is specified, it will be sent to the user.

Here is an example that we will discuss:

add_filter( 'mwai_ai_allowed', function ( $allowed, $query ) {
  global $mwai_stats;
  if ( !empty( $mwai_stats ) ) {
    $stats = $mwai_stats->query([  'query' => 'user/month' ]);
    if ( $stats['price'] > 3 ) {
      return "The monthly limit of 3$ has been reached.";
  return $allowed;
}, 10, 2 );

Here, I am making sure that $mwai_stats is initialized; it might not be the case if the Statistics Module is disabled, or if the Pro Version is not installed. Then, by using the API of the Statistic Module, I am getting the total amount of money that you spent for that user (what it really cost you).