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#
| Filter | Use it to |
|---|---|
aiomatic_modify_ai_query | Change any prompt before it is sent |
aiomatic_modify_ai_reply | Change any response after it returns |
aiomatic_ai_functions | Register your own AI tools |
aiomatic_model_selection | Redirect a request to a different model |
aiomatic_ai_allowed | Block a request entirely |
aiomatic_<provider>_api_key | Supply credentials from code instead of the database |
Examples#
Append a house-style instruction to every prompt:
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:
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:
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:
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:
add_filter( 'aimogen_openai_api_key', function () {
return defined( 'MY_OPENAI_KEY' ) ? MY_OPENAI_KEY : '';
} );Correct the visitor IP behind a CDN:
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.
| Filter | Provider credential |
|---|---|
aimogen_anthropic_api_key | anthropic |
aimogen_cloudflare_worker_secret | cloudflare worker secret |
aimogen_cloudflare_worker_url | cloudflare worker url |
aimogen_did_api_key | did |
aimogen_elevenlabs_api_key | elevenlabs |
aimogen_goapi_api_key | goapi |
aimogen_google_api_key | |
aimogen_groq_api_key | groq |
aimogen_huggingface_api_key | huggingface |
aimogen_ideogram_api_key | ideogram |
aimogen_nvidia_api_key | nvidia |
aimogen_openai_api_key | openai |
aimogen_openrouter_api_key | openrouter |
aimogen_perplexity_api_key | perplexity |
aimogen_replicate_api_key | replicate |
aimogen_stability_api_key | stability |
aimogen_xai_api_key | xai |
aiomatic_anthropic_api_key | anthropic |
aiomatic_cloudflare_worker_secret | cloudflare worker secret |
aiomatic_cloudflare_worker_url | cloudflare worker url |
aiomatic_did_api_key | did |
aiomatic_elevenlabs_api_key | elevenlabs |
aiomatic_goapi_api_key | goapi |
aiomatic_google_api_key | |
aiomatic_groq_api_key | groq |
aiomatic_huggingface_api_key | huggingface |
aiomatic_ideogram_api_key | ideogram |
aiomatic_nvidia_api_key | nvidia |
aiomatic_openai_api_key | openai |
aiomatic_openrouter_api_key | openrouter |
aiomatic_perplexity_api_key | perplexity |
aiomatic_replicate_api_key | replicate |
aiomatic_stability_api_key | stability |
aiomatic_xai_api_key | xai |
See Where credentials are stored.
Complete reference#
| Filter | Parameters | Purpose |
|---|---|---|
aimogen_super_page_component_aliases | $this->aliases, $this | Alternative names mapped onto Omni Pages components. |
aimogen_super_page_components | $this->components, $this | The AI Omni Pages component registry. |
aimogen_super_page_image_tools | $tools, $settings, $agent | Image tools available to AI Omni Pages. |
aiomatic_agent_context | [] | The context assembled for an agent step. |
aiomatic_ai_allowed | true, $aiomatic_Limit_Settings, $query | Whether this AI request is permitted at all. Return false to block it. |
aiomatic_ai_functions | false | The list of tools offered to the model. The registration point for custom tools. |
aiomatic_ai_reply | $ai_json->result, $query | The 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, $message | The 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, $model | A chance to recover after an [aicontent] generation failure. |
aiomatic_assistant_id_custom_logic | $assistant_id, $aicontent, $model | Choose the assistant dynamically for this request. |
aiomatic_assistant_id_fallback | $assistant_id, $error, $aicontent | A fallback assistant after an assistant failure. |
aiomatic_available_tokens_before_check | $available_tokens, $aicontent, $model, $assistant_id | The computed token budget, before validation. |
aiomatic_available_tokens_try_fix | $available_tokens, $error, $model | A chance to adjust the token budget after a context-length failure. |
aiomatic_content_try_fix | $content, $error, $model | A chance to recover after a content generation failure. |
aiomatic_dalle_reply_raw | $result, $prompt | The raw response from an OpenAI image request. |
aiomatic_edit_reply_raw | $ai_json, $instruction, $aicontent | The raw response from an edit request. |
aiomatic_embedding_namespace | $embedding_namespace, $aicontent, $model, $assistant_id | The embeddings namespace used for retrieval on this request. |
aiomatic_embeddings_reply_raw | $response, $aiomatic_message | The raw response from an embeddings request. |
aiomatic_final_response_text | $response_text, $aicontent, $model, $assistant_id | The response text at the very end of processing, after all other handling. |
aiomatic_frequency_penalty | $frequency_penalty, $aicontent, $model, $assistant_id | Frequency penalty for this request. |
aiomatic_function_result | $function_result, $aicontent, $model, $assistant_id | The result of a tool call, before it is returned to the model. |
aiomatic_get_ip | $ip | The detected visitor IP. Adjust it behind a proxy or CDN. |
aiomatic_get_items | $logs, $query | The log items returned by a query. |
aiomatic_god_mode_builtin_blacklist | $blacklist | The built-in God Mode function blacklist. |
aiomatic_google_tools_ai_reply_raw | $filter_tool_object | The raw tool-call object from the Google provider path. |
aiomatic_is_ai_edit_allowed | true, $instruction, $aicontent | Whether an edit request is permitted. |
aiomatic_is_ai_image_allowed | true, $prompt | Whether an image request is permitted. |
aiomatic_is_ai_query_allowed | true, $aicontent | Whether a text query is permitted. |
aiomatic_is_ai_video_allowed | true, $image_url | Whether a video request is permitted. |
aiomatic_local_assistant_id_id_fallback | $local_assistant_id, $error, $aicontent | The local-ID equivalent of the assistant fallback. |
aiomatic_model_fallback | $model, $error, $aicontent | The fallback model chosen after a failure. See Reliability Mode. |
aiomatic_model_selection | $model | The model name, before the request is routed. Override to redirect a request to a different model. |
aiomatic_modify_ai_edit_content | $instruction, $aicontent | The content passed to the AI Content Editor. |
aiomatic_modify_ai_edit_instruction | $instruction, $aicontent | The editing instruction passed to the AI Content Editor. |
aiomatic_modify_ai_embeddings | $emb_template | The embedding template before content is embedded. |
aiomatic_modify_ai_error | $error | The error message before it is shown or logged. |
aiomatic_modify_ai_image_query | $prompt | An image prompt before it is sent. |
aiomatic_modify_ai_query | $aicontent | The final prompt, immediately before it is sent. The main interception point for text generation. |
aiomatic_modify_ai_reply | $response_text, $aicontent | The generated text, immediately after it returns. |
aiomatic_modify_ai_video_text | $text | Text before it is used for video generation. |
aiomatic_modify_ai_video_url | $image_url | The source image URL for video generation. |
aiomatic_modify_ai_voice_text | $text | Text before it is sent to text-to-speech. |
aiomatic_ollama_url | $ollama_url | The Ollama server URL. |
aiomatic_sideload_skip_domains | $domains | Domains never sideloaded when importing images. |
aiomatic_post_ai_functions | $functions | The tool list after built-in tools have been added. |
aiomatic_presence_penalty | $presence_penalty, $aicontent, $model, $assistant_id | Presence penalty for this request. |
aiomatic_replace_aicontent_shortcode | $the_content | Content before [aicontent] shortcodes are replaced. |
aiomatic_retry_count | $retry_count, $aicontent, $model, $assistant_id | The retry count for this request. |
aiomatic_should_store_data | $store_data, $aicontent, $model, $assistant_id | Whether the provider is asked to retain this request. |
aiomatic_stability_reply_raw | $json_resp, $text | The raw response from a Stability.AI image request. |
aiomatic_stability_video_reply_raw | $response, $image_url | The raw response from a Stability.AI video request. |
aiomatic_super_pages_allow_external_image_url | false, $url, $attachment_id | Whether an external image URL may be used directly. Default false. |
aiomatic_super_pages_allowed_tools_for_image_source | $tools, $source, $available_tools | Which tools are allowed for a given image source. |
aiomatic_super_pages_max_scrape_urls | 5 | How many reference URLs AI Omni Pages may fetch. Default 5. |
aiomatic_super_pages_scrape_max_chars | 8000 | How much text is kept per scraped URL. Default 8000. |
aiomatic_temperature | $temperature, $aicontent, $model, $assistant_id | Temperature for this request. |
aiomatic_thread_id | $thread_id, $aicontent, $model, $assistant_id | The Assistants API thread ID for this request. |
aiomatic_thread_id_try_fix | $thread_id, $error, $model | A chance to supply a new thread ID after a thread failure. |
aiomatic_toc_extract_headings | $content | Content from which table-of-contents headings are extracted. |
aiomatic_toc_url_anchor_target | $return | The anchor target format used in the table of contents. |
aiomatic_top_p | $top_p, $aicontent, $model, $assistant_id | Top_p for this request. |
aiomatic_tts_allowed | true, $aiomatic_Limit_Settings, $query | Whether a text-to-speech request is permitted. |
aiomatic_user_question | $user_question, $role, $model, $aicontent | The user question passed alongside the prompt. |
aiomatic_user_role_adjustment | $role, $aicontent, $model, $assistant_id | The message role (user, system, assistant) for this request. |
aiomatic_vision_file | $vision_file, $aicontent, $model, $assistant_id | The image file passed for vision requests. |
aiomatic_wp_ai_connectors_approved_callers | array( 'ai/ai.php', self::plugi... | Plugins permitted to interact with the Connectors bridge. |
aiomatic_wp_ai_connectors_demote_competitors | true | Whether 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_id | Model prefixes that do not accept sampling parameters. |
aiomatic_wpai_provider_adapters | $config | Provider 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.
Related#
Still stuck? Open a support ticket and include the diagnostics from Aimogen Pro › System & Logs › System Info.