AI Engine icon
AI Tools

AI Engine hooks reference

  • By Jordy Meow
  • v3.9.4 New
  • Updated

AI Engine 3.9.4 has 10 actions and 128 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when AI Engine fires an action
add_action( 'litespeed_control_set_nocache', function( $arg1 ) {
	// Your code runs here.
}, 10, 1 );

// Change a value AI Engine is about to use
add_filter( 'mwai_mcp_stream_max_time', function( $max_time, $session_id ) {
	// Change $max_time here.
	return $max_time;
}, 10, 2 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • labs/mcp.php line 805
    /**
     * How long an idle SSE stream may hold a PHP worker, in seconds.
     */
    apply_filters( 'mwai_mcp_stream_max_time', $max_time, $session_id );
  • classes/modules/chatbot.php line 249 · used in 55 places
    apply_filters( 'mwai_ai_exception', 'Sorry, your query has been rejected.' );
  • classes/engines/anthropic.php line 127 · used in 5 places
    apply_filters( 'mwai_mcp_tools', [] );
  • classes/engines/anthropic.php line 190 · used in 4 places
    apply_filters( 'mwai_anthropic_endpoint', 'https://api.anthropic.com/v1', $this->env );
  • classes/engines/chatml.php line 516 · used in 4 places
    apply_filters( 'mwai_openai_endpoint', 'https://api.openai.com/v1', $this->env );
  • classes/modules/chatbot.php line 776 · used in 3 places
    apply_filters( 'mwai_chatbot_params', $newParams );
  • classes/modules/files.php line 30 · used in 3 places
    apply_filters( 'mwai_files_delete', $fileRefs );
  • classes/api.php line 243 · used in 3 places
    apply_filters( 'mwai_functions_list', [] );
  • classes/rest.php line 2285 · used in 3 places
    apply_filters( 'mwai_mcp_self_test_sslverify', true );
  • classes/engines/xai.php line 33 · used in 3 places
    apply_filters( 'mwai_xai_endpoint', 'https://api.x.ai/v1', $this->env );
  • common/admin.php line 659 · used in 2 places
    apply_filters( "{$this->prefix}_meowapps_is_registered", false, $this->prefix );
  • classes/admin.php line 548 · used in 2 places
    apply_filters( "{MWAI_PREFIX}_meowapps_is_registered", false, MWAI_PREFIX );
  • classes/engines/anthropic.php line 757 · used in 2 places
    apply_filters( 'mwai_ai_mcp_servers', $resolved_servers, $query );
  • classes/core.php line 1880 · used in 2 places
    apply_filters( 'mwai_anthropic_models', Meow_MWAI_Engines_Anthropic::get_models_static() );
  • classes/modules/chatbot.php line 172 · used in 2 places
    apply_filters( 'mwai_chatbot_actions', $actions, $filterParams );
  • classes/modules/chatbot.php line 173 · used in 2 places
    apply_filters( 'mwai_chatbot_blocks', [], $filterParams );
  • classes/modules/chatbot.php line 1083 · used in 2 places
    apply_filters( 'mwai_chatbot_query', $query, $params );
  • classes/modules/chatbot.php line 1012 · used in 2 places
    apply_filters( 'mwai_chatbot_reply', $takeoverAnswer, $reply, $params, [] );
  • classes/modules/chatbot.php line 174 · used in 2 places
    apply_filters( 'mwai_chatbot_shortcuts', [], $filterParams );
  • classes/modules/discussions.php line 111 · used in 2 places
    apply_filters( 'mwai_discussion_metadata_last_update', $this->core->format_discussion_date( $chat['updated'] ), $chat );
  • classes/modules/discussions.php line 112 · used in 2 places
    apply_filters( 'mwai_discussion_metadata_message_count', is_array( $messages ) ? count( $messages ) : 0, $chat );
  • classes/modules/discussions.php line 110 · used in 2 places
    apply_filters( 'mwai_discussion_metadata_start_date', $this->core->format_discussion_date( $chat['created'] ), $chat );
  • classes/core.php line 1139 · used in 2 places
    apply_filters( 'mwai_estimate_tokens', $tokenCount, $text );
  • classes/engines/google-interactions.php line 43 · used in 2 places
    apply_filters( 'mwai_google_endpoint', 'https://generativelanguage.googleapis.com/v1beta', $this->env );
  • classes/core.php line 1825 · used in 2 places
    apply_filters( 'mwai_languages', MWAI_LANGUAGES );
  • classes/modules/workspace.php line 703 · used in 2 places
    apply_filters( 'mwai_mcp_callback', null, $name, $args, 0, null );
  • classes/engines/mistral.php line 27 · used in 2 places
    apply_filters( 'mwai_mistral_endpoint', 'https://api.mistral.ai/v1', $this->env );
  • classes/engines/openai.php line 645 · used in 2 places
    apply_filters( 'mwai_openai_body', $body, $query );
  • classes/core.php line 1874 · used in 2 places
    apply_filters( 'mwai_openai_models', Meow_MWAI_Engines_OpenAI::get_models_static() );
  • classes/engines/open-router.php line 100 · used in 2 places
    apply_filters( 'mwai_openrouter_endpoint', 'https://openrouter.ai/api/v1', $this->env );
  • classes/engines/perplexity.php line 33 · used in 2 places
    apply_filters( 'mwai_perplexity_endpoint', 'https://api.perplexity.ai', $this->env );
  • classes/core.php line 1886 · used in 2 places
    apply_filters( 'mwai_perplexity_models', Meow_MWAI_Engines_Perplexity::get_models_static() );
  • classes/core.php line 1906 · used in 2 places
    apply_filters( 'mwai_sakana_models', Meow_MWAI_Engines_Sakana::get_models_static() );
  • classes/core.php line 1900 · used in 2 places
    apply_filters( 'mwai_xai_models', Meow_MWAI_Engines_XAI::get_models_static() );
  • the_content

    filter
    classes/core.php line 524 · used in 2 places
    apply_filters( 'the_content', $text );
  • common/admin.php line 745
    apply_filters( "{$this->prefix}_meowapps_status", null );
  • common/admin.php line 729
    apply_filters( "{$this->prefix}_meowapps_version_info", null );
  • labs/mcp-ops.php line 137
    apply_filters( 'https_local_ssl_verify', false );
  • common/issues.php line 19
    do_action( 'litespeed_control_set_nocache', 'Meow Apps API must not be cached.' );
  • labs/mcp-ops.php line 305
    do_action( 'litespeed_purge_all' );
  • labs/mcp-core.php line 573
    do_action( 'litespeed_purge_post', $post_id );
  • labs/mcp-oauth.php line 150
    do_action( 'litespeed_purge_url', $url );
  • common/admin.php line 785
    apply_filters( 'meowapps_plugins_status', [] );
  • classes/core.php line 2448
    apply_filters( "mwai_{$type}_enabled", defined( $constant ) && constant( $constant ) );
  • mwai_addons

    filter
    classes/core.php line 1933
    apply_filters( 'mwai_addons', [ [ 'slug' => 'mwai-notifications', 'name' => 'Notifications', 'description' => 'Get real-time alerts for new discussions in your chatbot, so you never miss a chance to engage.', 'install_url' => 'https://meowapps.com/products/mwai-notifications/', 'settings_url' => null, 'stars' => 4, 'enabled' => false ], [ 'slug' => 'mwai-ollama', 'name' => 'Ollama', 'description' => 'Leverage local LLM inte... );
  • classes/engines/core.php line 172
    apply_filters( 'mwai_ai_allowed', true, $query, $limits );
  • classes/query/base.php line 208
    apply_filters( 'mwai_ai_context', $instructions, $this );
  • classes/core.php line 354
    apply_filters( 'mwai_ai_embeddings_query', $query );
  • classes/engines/core.php line 420
    apply_filters( 'mwai_ai_feedback', null, $needFeedback, $reply );
  • classes/core.php line 357
    apply_filters( 'mwai_ai_feedback_query', $query );
  • classes/query/base.php line 212
    apply_filters( 'mwai_ai_instructions', $filtered, $this );
  • mwai_ai_query

    filter
    classes/core.php line 360
    apply_filters( 'mwai_ai_query', $query );
  • mwai_ai_reply

    filter
    classes/engines/core.php line 213
    apply_filters( 'mwai_ai_reply', $reply, $query );
  • labs/mcp.php line 223
    apply_filters( 'mwai_allow_mcp', $is_admin, $request );
  • classes/core.php line 344
    apply_filters( 'mwai_allow_public_api', $logged_in, $feature, $extra );
  • classes/services/session.php line 46
    apply_filters( 'mwai_allow_session', false );
  • classes/core.php line 334
    apply_filters( 'mwai_allow_setup', current_user_can( 'manage_options' ) );
  • classes/core.php line 339
    apply_filters( 'mwai_allow_usage', $editor_or_admin );
  • classes/engines/anthropic.php line 1133
    apply_filters( 'mwai_anthropic_body', $this->build_body( $query, $streamCallback ), $query );
  • classes/core.php line 719
    apply_filters( 'mwai_blocked_rest_params', $blocked, $params );
  • classes/modules/chatbot.php line 600
    apply_filters( 'mwai_chatbot_allow_client_server_params', $this->core->can_access_settings(), $botId, $params );
  • classes/modules/chatbot.php line 1008
    apply_filters( 'mwai_chatbot_takeover', null, $query, $params );
  • classes/modules/chatbot.php line 1376
    apply_filters( 'mwai_chatbot_texts', $texts );
  • classes/core.php line 868
    apply_filters( 'mwai_context_framing', $framing, $context );
  • classes/engines/custom.php line 82
    apply_filters( 'mwai_custom_endpoint', $endpoint, $this->env );
  • classes/modules/discussions.php line 976
    apply_filters( 'mwai_discussion_format_messages', $html, $json, $format );
  • classes/modules/chatbot.php line 1782
    apply_filters( 'mwai_discussions_refresh_interval', $frontSystem['refreshInterval'] );
  • classes/modules/discussions.php line 1124
    apply_filters( 'mwai_discussions_retention_days', (int) $retention_option );
  • classes/modules/discussions.php line 245
    apply_filters( 'mwai_discussions_title_prompt', $base_prompt, $conversation_text, $discussion );
  • classes/engines/chatml.php line 1247
    apply_filters( 'mwai_embedding_max_tokens', 8192, $query->model );
  • classes/services/model-environment.php line 195
    apply_filters( 'mwai_engine_models', [], $env, $query );
  • mwai_engines

    filter
    classes/core.php line 1871
    apply_filters( 'mwai_engines', $engines );
  • classes/services/usage-stats.php line 94
    apply_filters( 'mwai_estimate_tokens_text', $text, $model );
  • classes/engines/core.php line 152
    apply_filters( 'mwai_function_call_max_depth', $maxDepth, $query );
  • classes/engines/core.php line 402
    apply_filters( 'mwai_function_call_params', $needFeedback['arguments'], $needFeedback, $reply );
  • classes/engines/google-interactions.php line 277
    apply_filters( 'mwai_google_interactions_body', $body, $query );
  • classes/engines/google-interactions.php line 600
    apply_filters( 'mwai_google_interactions_empty_reply', __( "Sorry, I couldn't produce a response for that. Please try rephrasing your request.", 'ai-engine' ), $query );
  • classes/modules/files.php line 1001
    apply_filters( 'mwai_guest_uploads_per_hour', 20 );
  • classes/engines/factory.php line 112
    apply_filters( 'mwai_init_engine', null, $core, $env );
  • classes/modules/chatbot.php line 631
    apply_filters( 'mwai_internal_chatbot', null, $botId, $params );
  • classes/rest.php line 1056
    apply_filters( "mwai_magic_wand_{$action}", '', $data );
  • labs/mcp-abilities.php line 48
    apply_filters( 'mwai_mcp_abilities', $abilities );
  • labs/mcp.php line 1458
    apply_filters( 'mwai_mcp_instructions', implode( ' ', $parts ) );
  • labs/mcp-core.php line 3300
    do_action( 'mwai_mcp_mutate', $tool, $a, $r );
  • labs/mcp-approvals.php line 135
    apply_filters( 'mwai_mcp_needs_approval', $gated, $tool, $args );
  • labs/mcp-oauth.php line 1026
    apply_filters( 'mwai_mcp_oauth_user_can_authorize', $allowed, $user_id );
  • labs/mcp-core.php line 572
    do_action( 'mwai_mcp_post_changed', $post_id, $context );
  • labs/mcp-oauth.php line 152
    do_action( 'mwai_mcp_purge_discovery_urls', $urls );
  • labs/mcp-seo.php line 181
    apply_filters( 'mwai_mcp_seo_adapters', $adapters );
  • labs/mcp.php line 1795
    do_action( 'mwai_mcp_tool_called', [ 'tool' => $tool, 'args' => $args, 'result' => $response, 'status' => $status, 'error_msg' => $error_msg, 'duration_ms' => $duration_ms, 'client_id' => $this->auth_client_id, 'client_name' => $this->auth_client_name, 'auth_method' => $this->auth_method, 'request_id' => $id, 'user_id' => get_current_user_id(), 'access_level' => $tool_level, 'writes' => $this->is_write_call( (string) $tool, $arg... );
  • labs/mcp-undo.php line 374
    apply_filters( 'mwai_mcp_undo_kinds', self::core_kinds() );
  • labs/mcp-undo.php line 246
    apply_filters( 'mwai_mcp_undo_targets', $targets, $tool, $a );
  • classes/admin.php line 480
    apply_filters( 'mwai_meowapps_version_info', null );
  • classes/core.php line 1892
    apply_filters( 'mwai_mistral_models', Meow_MWAI_Engines_Mistral::get_models_static() );
  • classes/engines/open-router.php line 157
    apply_filters( 'mwai_openrouter_body', $body, $query );
  • classes/engines/open-router.php line 112
    apply_filters( 'mwai_openrouter_site_name', self::APP_NAME, $query );
  • classes/engines/open-router.php line 111
    apply_filters( 'mwai_openrouter_site_url', self::APP_URL, $query );
  • classes/engines/open-router.php line 143
    apply_filters( 'mwai_openrouter_web_plugin', [ 'id' => 'web' ], $query );
  • classes/engines/ovh.php line 29
    apply_filters( 'mwai_ovh_endpoint', trailingslashit( $this->endpoint ) . 'v1', $this->env );
  • classes/core.php line 569
    apply_filters( 'mwai_placeholders', $defaultPlaceholders );
  • classes/core.php line 501
    apply_filters( 'mwai_post_content', $text, $postId );
  • classes/core.php line 512
    apply_filters( 'mwai_pre_post_content', $post->post_content, $postId );
  • classes/modules/wand.php line 203
    apply_filters( 'mwai_prompt_correctText', "Correct the typos and grammar mistakes in this text without altering its content. Ensure the reply is in the same language as the original text.\n\n", $arguments );
  • classes/modules/wand.php line 211
    apply_filters( 'mwai_prompt_enhanceText', "Enhance this text by improving readability and quality, using a more suitable vocabulary, and refining its structure.\n\n", $arguments );
  • classes/modules/wand.php line 269
    apply_filters( 'mwai_prompt_generateImage', "Generate an image that is relevant to the following text:\n\n", $arguments );
  • classes/modules/wand.php line 219
    apply_filters( 'mwai_prompt_longerText', "Expand the subsequent text to a minimum of three times its original length, integrating relevant and accurate information to enrich its content. If the text is a story, amplify its charm by elaborating on essential aspects, enhancing readability, and creating a sense of engagement for the reader. Maintain consistency in tone and vocabulary throughout the expansion process.\n\n", $arguments );
  • classes/modules/wand.php line 227
    apply_filters( 'mwai_prompt_shorterText', "Condense the following text by reducing its length to half, while retaining the core elements of the original narrative. Focus on maintaining the essence of the story and its key details.\n\n", $arguments );
  • classes/modules/wand.php line 364
    apply_filters( 'mwai_prompt_suggestExcerpts', 'Craft a clear, SEO-optimized introduction for the following text, using 120 to 170 characters. Ensure the introduction is concise and relevant, without including any URLs.' . $this->keepLanguage( $language ), $arguments );
  • classes/modules/wand.php line 241
    apply_filters( 'mwai_prompt_suggestSynonyms', "Provide 5 synonyms or 5 ways of rephrasing the given word or sentence while retaining the original meaning and preserving the initial and final punctuation and spacing if any. Offer only the resulting word or expression, without additional context. If a suitable synonym or alternative cannot be identified, ensure that a creative response is still provided. Separate every suggestion with a new ... );
  • classes/modules/wand.php line 384
    apply_filters( 'mwai_prompt_suggestTitles', 'Generate a concise, SEO-optimized title for the following text, without using quotes or any other formatting. Focus on clarity and relevance to the content.' . $this->keepLanguage( $language ), $arguments );
  • classes/modules/wand.php line 309
    apply_filters( 'mwai_prompt_translateSection', $instructions, $arguments );
  • classes/modules/wand.php line 345
    apply_filters( 'mwai_prompt_translateText', "Translate the text into {$language}, preserving the tone, mood, and nuance, while staying as true as possible to the original meaning. Provide only the translated text, without any additional content.", $arguments );
  • classes/core.php line 1194
    apply_filters( 'mwai_public_error_message', $message, $exception );
  • classes/engines/replicate.php line 267
    apply_filters( 'mwai_replicate_endpoint', 'https://api.replicate.com/v1', $this->env );
  • classes/core.php line 1188
    apply_filters( 'mwai_reply_truncated_notice', $notice, $reply, $context );
  • classes/engines/google-interactions.php line 330
    apply_filters( 'mwai_request_timeout', 120, $query );
  • classes/core.php line 975
    apply_filters( 'mwai_rest_authorized', $rest_nonce, $request );
  • classes/engines/sakana.php line 43
    apply_filters( 'mwai_sakana_endpoint', 'https://api.sakana.ai/v1', $this->env );
  • classes/core.php line 2057
    apply_filters( 'mwai_seo_stats', null );
  • classes/rest.php line 2018
    apply_filters( 'mwai_stats_logs_activity', [], $hours );
  • classes/rest.php line 2038
    apply_filters( 'mwai_stats_logs_activity_daily', [], $days, $feature );
  • classes/rest.php line 2035
    apply_filters( 'mwai_stats_logs_activity_daily_by_model', [], $days );
  • classes/rest.php line 1991
    apply_filters( 'mwai_stats_logs_delete', true, $logIds );
  • classes/rest.php line 1977
    apply_filters( 'mwai_stats_logs_list', [], $offset, $limit, $filters, $sort );
  • classes/rest.php line 2005
    apply_filters( 'mwai_stats_logs_meta', [], $logId, $metaKeys );
  • classes/engines/core.php line 774
    apply_filters( 'mwai_stream_keepalive_interval', 15 );
  • classes/core.php line 1208
    apply_filters( 'mwai_stream_push', $data, $query );
  • classes/modules/tasks.php line 580
    apply_filters( "mwai_task_{$task->task_name}", null, $job );
  • mwai_task_run

    filter
    classes/modules/tasks.php line 584
    apply_filters( 'mwai_task_run', null, $job );
  • classes/rest.php line 1787
    do_action( 'mwai_tasks_run' );
  • classes/services/session.php line 275
    apply_filters( 'mwai_trusted_proxies', self::CLOUDFLARE_RANGES );
  • classes/modules/files.php line 461
    apply_filters( 'mwai_uploads_offered', $offered );
  • classes/modules/files.php line 443
    apply_filters( 'mwai_visitor_upload_extensions', $extensions );
  • classes/modules/workspace.php line 1068
    apply_filters( 'mwai_workspace_self_test_sslverify', true );
  • robots_txt

    filter
    classes/core.php line 2123
    apply_filters( 'robots_txt', $default, $public );
  • labs/mcp-ops.php line 312
    do_action( 'wpfc_clear_all_cache' );
  • classes/core.php line 552
    apply_filters( 'wpml_post_language_details', null, $postId );

Generated from AI Engine's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: