Filter reference

Every filter Aimogen Pro exposes, with its parameters and purpose, plus the per-provider API key filters.

Aimogen Pro exposes 107 filters. They are the documented way to change plugin behaviour without touching its code.

The ones you will use most#

FilterUse it to
aiomatic_modify_ai_queryChange any prompt before it is sent
aiomatic_modify_ai_replyChange any response after it returns
aiomatic_ai_functionsRegister your own AI tools
aiomatic_model_selectionRedirect a request to a different model
aiomatic_ai_allowedBlock a request entirely
aiomatic_<provider>_api_keySupply credentials from code instead of the database

Examples#

Append a house-style instruction to every prompt:

php
add_filter( 'aiomatic_modify_ai_query', function ( $query ) {
    if ( is_string( $query ) ) {
        return $query . "\n\nWrite in British English. Do not use the word 'delve'.";
    }
    return $query;
} );

Strip a phrase the model keeps adding:

php
add_filter( 'aiomatic_modify_ai_reply', function ( $text, $query ) {
    return preg_replace( '/^\s*In conclusion,\s*/mi', '', $text );
}, 10, 2 );

Route expensive work to a cheaper model:

php
add_filter( 'aiomatic_model_selection', function ( $model ) {
    // Titles and excerpts do not need the flagship model.
    if ( did_action( 'aiomatic_before_completion_ai_query' ) && $model === 'gpt-5.5' ) {
        return 'gpt-5-nano';
    }
    return $model;
} );

Block AI use outside working hours:

php
add_filter( 'aiomatic_ai_allowed', function ( $allowed, $limits, $query ) {
    $hour = (int) current_time( 'G' );
    return ( $hour >= 8 && $hour < 20 ) ? $allowed : false;
}, 10, 3 );

Supply an API key from a constant instead of the database:

php
add_filter( 'aimogen_openai_api_key', function () {
    return defined( 'MY_OPENAI_KEY' ) ? MY_OPENAI_KEY : '';
} );

Correct the visitor IP behind a CDN:

php
add_filter( 'aiomatic_get_ip', function ( $ip ) {
    if ( ! empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) {
        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_CF_CONNECTING_IP'] ) );
    }
    return $ip;
} );

Without this, per-IP limits and blocks see every visitor as one address.

Provider credential filters#

Each provider credential passes through a filter, so keys can be supplied from wp-config.php, an environment variable or a secrets manager rather than stored in the database.

Where both an aimogen_ and an aiomatic_ filter exist for the same credential, the aiomatic_ one runs second and therefore wins.

FilterProvider credential
aimogen_anthropic_api_keyanthropic
aimogen_cloudflare_worker_secretcloudflare worker secret
aimogen_cloudflare_worker_urlcloudflare worker url
aimogen_did_api_keydid
aimogen_elevenlabs_api_keyelevenlabs
aimogen_goapi_api_keygoapi
aimogen_google_api_keygoogle
aimogen_groq_api_keygroq
aimogen_huggingface_api_keyhuggingface
aimogen_ideogram_api_keyideogram
aimogen_nvidia_api_keynvidia
aimogen_openai_api_keyopenai
aimogen_openrouter_api_keyopenrouter
aimogen_perplexity_api_keyperplexity
aimogen_replicate_api_keyreplicate
aimogen_stability_api_keystability
aimogen_xai_api_keyxai
aiomatic_anthropic_api_keyanthropic
aiomatic_cloudflare_worker_secretcloudflare worker secret
aiomatic_cloudflare_worker_urlcloudflare worker url
aiomatic_did_api_keydid
aiomatic_elevenlabs_api_keyelevenlabs
aiomatic_goapi_api_keygoapi
aiomatic_google_api_keygoogle
aiomatic_groq_api_keygroq
aiomatic_huggingface_api_keyhuggingface
aiomatic_ideogram_api_keyideogram
aiomatic_nvidia_api_keynvidia
aiomatic_openai_api_keyopenai
aiomatic_openrouter_api_keyopenrouter
aiomatic_perplexity_api_keyperplexity
aiomatic_replicate_api_keyreplicate
aiomatic_stability_api_keystability
aiomatic_xai_api_keyxai

See Where credentials are stored.

Complete reference#

FilterParametersPurpose
aimogen_super_page_component_aliases$this->aliases, $thisAlternative names mapped onto Omni Pages components.
aimogen_super_page_components$this->components, $thisThe AI Omni Pages component registry.
aimogen_super_page_image_tools$tools, $settings, $agentImage tools available to AI Omni Pages.
aiomatic_agent_context[]The context assembled for an agent step.
aiomatic_ai_allowedtrue, $aiomatic_Limit_Settings, $queryWhether this AI request is permitted at all. Return false to block it.
aiomatic_ai_functionsfalseThe list of tools offered to the model. The registration point for custom tools.
aiomatic_ai_reply$ai_json->result, $queryThe parsed AI reply.
aiomatic_ai_reply_raw$func_call, ''The raw provider response object, before parsing. Used for custom tool handling.
aiomatic_ai_reply_text$query, $messageThe reply text alongside the original query.
aiomatic_ai_responses_reply_raw$simulate_ai_response, ''The raw response from the Responses API path.
aiomatic_aicontent_try_fix$aicontent, $error, $modelA chance to recover after an [aicontent] generation failure.
aiomatic_assistant_id_custom_logic$assistant_id, $aicontent, $modelChoose the assistant dynamically for this request.
aiomatic_assistant_id_fallback$assistant_id, $error, $aicontentA fallback assistant after an assistant failure.
aiomatic_available_tokens_before_check$available_tokens, $aicontent, $model, $assistant_idThe computed token budget, before validation.
aiomatic_available_tokens_try_fix$available_tokens, $error, $modelA chance to adjust the token budget after a context-length failure.
aiomatic_content_try_fix$content, $error, $modelA chance to recover after a content generation failure.
aiomatic_dalle_reply_raw$result, $promptThe raw response from an OpenAI image request.
aiomatic_edit_reply_raw$ai_json, $instruction, $aicontentThe raw response from an edit request.
aiomatic_embedding_namespace$embedding_namespace, $aicontent, $model, $assistant_idThe embeddings namespace used for retrieval on this request.
aiomatic_embeddings_reply_raw$response, $aiomatic_messageThe raw response from an embeddings request.
aiomatic_final_response_text$response_text, $aicontent, $model, $assistant_idThe response text at the very end of processing, after all other handling.
aiomatic_frequency_penalty$frequency_penalty, $aicontent, $model, $assistant_idFrequency penalty for this request.
aiomatic_function_result$function_result, $aicontent, $model, $assistant_idThe result of a tool call, before it is returned to the model.
aiomatic_get_ip$ipThe detected visitor IP. Adjust it behind a proxy or CDN.
aiomatic_get_items$logs, $queryThe log items returned by a query.
aiomatic_god_mode_builtin_blacklist$blacklistThe built-in God Mode function blacklist.
aiomatic_google_tools_ai_reply_raw$filter_tool_objectThe raw tool-call object from the Google provider path.
aiomatic_is_ai_edit_allowedtrue, $instruction, $aicontentWhether an edit request is permitted.
aiomatic_is_ai_image_allowedtrue, $promptWhether an image request is permitted.
aiomatic_is_ai_query_allowedtrue, $aicontentWhether a text query is permitted.
aiomatic_is_ai_video_allowedtrue, $image_urlWhether a video request is permitted.
aiomatic_local_assistant_id_id_fallback$local_assistant_id, $error, $aicontentThe local-ID equivalent of the assistant fallback.
aiomatic_model_fallback$model, $error, $aicontentThe fallback model chosen after a failure. See Reliability Mode.
aiomatic_model_selection$modelThe model name, before the request is routed. Override to redirect a request to a different model.
aiomatic_modify_ai_edit_content$instruction, $aicontentThe content passed to the AI Content Editor.
aiomatic_modify_ai_edit_instruction$instruction, $aicontentThe editing instruction passed to the AI Content Editor.
aiomatic_modify_ai_embeddings$emb_templateThe embedding template before content is embedded.
aiomatic_modify_ai_error$errorThe error message before it is shown or logged.
aiomatic_modify_ai_image_query$promptAn image prompt before it is sent.
aiomatic_modify_ai_query$aicontentThe final prompt, immediately before it is sent. The main interception point for text generation.
aiomatic_modify_ai_reply$response_text, $aicontentThe generated text, immediately after it returns.
aiomatic_modify_ai_video_text$textText before it is used for video generation.
aiomatic_modify_ai_video_url$image_urlThe source image URL for video generation.
aiomatic_modify_ai_voice_text$textText before it is sent to text-to-speech.
aiomatic_ollama_url$ollama_urlThe Ollama server URL.
aiomatic_sideload_skip_domains$domainsDomains never sideloaded when importing images.
aiomatic_post_ai_functions$functionsThe tool list after built-in tools have been added.
aiomatic_presence_penalty$presence_penalty, $aicontent, $model, $assistant_idPresence penalty for this request.
aiomatic_replace_aicontent_shortcode$the_contentContent before [aicontent] shortcodes are replaced.
aiomatic_retry_count$retry_count, $aicontent, $model, $assistant_idThe retry count for this request.
aiomatic_should_store_data$store_data, $aicontent, $model, $assistant_idWhether the provider is asked to retain this request.
aiomatic_stability_reply_raw$json_resp, $textThe raw response from a Stability.AI image request.
aiomatic_stability_video_reply_raw$response, $image_urlThe raw response from a Stability.AI video request.
aiomatic_super_pages_allow_external_image_urlfalse, $url, $attachment_idWhether an external image URL may be used directly. Default false.
aiomatic_super_pages_allowed_tools_for_image_source$tools, $source, $available_toolsWhich tools are allowed for a given image source.
aiomatic_super_pages_max_scrape_urls5How many reference URLs AI Omni Pages may fetch. Default 5.
aiomatic_super_pages_scrape_max_chars8000How much text is kept per scraped URL. Default 8000.
aiomatic_temperature$temperature, $aicontent, $model, $assistant_idTemperature for this request.
aiomatic_thread_id$thread_id, $aicontent, $model, $assistant_idThe Assistants API thread ID for this request.
aiomatic_thread_id_try_fix$thread_id, $error, $modelA chance to supply a new thread ID after a thread failure.
aiomatic_toc_extract_headings$contentContent from which table-of-contents headings are extracted.
aiomatic_toc_url_anchor_target$returnThe anchor target format used in the table of contents.
aiomatic_top_p$top_p, $aicontent, $model, $assistant_idTop_p for this request.
aiomatic_tts_allowedtrue, $aiomatic_Limit_Settings, $queryWhether a text-to-speech request is permitted.
aiomatic_user_question$user_question, $role, $model, $aicontentThe user question passed alongside the prompt.
aiomatic_user_role_adjustment$role, $aicontent, $model, $assistant_idThe message role (user, system, assistant) for this request.
aiomatic_vision_file$vision_file, $aicontent, $model, $assistant_idThe image file passed for vision requests.
aiomatic_wp_ai_connectors_approved_callersarray( 'ai/ai.php', self::plugi...Plugins permitted to interact with the Connectors bridge.
aiomatic_wp_ai_connectors_demote_competitorstrueWhether competing provider plugin cards are demoted on the Connectors screen.
aiomatic_wp_ai_connectors_learn_more_url'https://getaimogen.com/wordpre...The learn-more URL on the Connectors banner.
aiomatic_wpai_no_sampling_model_prefixes$prefixes, $model_idModel prefixes that do not accept sampling parameters.
aiomatic_wpai_provider_adapters$configProvider adapter configuration for the WordPress AI feature plugin.

Notes#

Parameter counts. Always pass the correct $accepted_args to add_filter(). Filters listed with several parameters give none of them unless you ask for them.

Return the value. A filter that returns nothing sets the filtered value to null, usually with dramatic results.

Filters run for every request, including the PHP API, the REST API, WP-CLI, the chatbot and agents. Scope your logic if you only mean to affect one of them — the env value passed to many hooks helps.

Still stuck? Open a support ticket and include the diagnostics from Aimogen Pro › System & Logs › System Info.