Gatemi AI Support Developer Reference

Both editions use the same names for everything below; filters marked Full edition exist only there.

Filters — both editions

Filter Arguments
gmai_settings array $settings The merged settings
gmai_widget_visible bool $visible Whether the widget prints on this request
gmai_system_prompt string $prompt The instructions sent with every message
gmai_tools array $tools The tool definitions offered to the model
gmai_tool_result array $result, string $name, array $args, array $context A tool's answer before it goes back to the model
gmai_request_args array $body, array $conversation, int $round The body of each chat request
gmai_api_url string $url The OpenAI base URL (default https://api.openai.com/v1)
gmai_request_timeout int $seconds, string $path Request timeout, 5–120 (default 30)
gmai_model_prices array $prices Model prefix ⇒ [ input, output ] per million tokens
gmai_index_document array $document, string $type, int $id A document before it is chunked into the index
gmai_retrieval_limit int $limit, string $query Passages returned per search, 1–20
gmai_retrieved_documents array $documents, string $query The passages a search returns
gmai_ticket_email array $mail, array $ticket, string $which Each ticket email
gmai_client_ip string $ip The visitor address used for rate limiting
// Behind Cloudflare: rate-limit by the real visitor address.
add_filter( 'gmai_client_ip', function ( $ip ) {
	return isset( $_SERVER['HTTP_CF_CONNECTING_IP'] )
		? sanitize_text_field( wp_unslash( $_SERVER['HTTP_CF_CONNECTING_IP'] ) )
		: $ip;
} );

// Price a model the table does not know.
add_filter( 'gmai_model_prices', function ( $prices ) {
	$prices['gpt-5-mini'] = array( 0.25, 2.00 );
	return $prices;
} );

Filters — Full edition

gmai_order_candidates, gmai_order_summary, gmai_entitlements (orders, keys and downloads), gmai_ticket_fields, gmai_geolocate, gmai_geo_api_url, gmai_modules, and the licensing filters gmai_license_api_url, gmai_update_cache_ttl, gmai_update_retry_ttl, gmai_sync_cache_ttl. The full edition lists them on the settings screen under Filters for developers.

Constant

GMAI_OPENAI_KEY in wp-config.php supplies the API key and takes precedence over the stored one.

REST routes

Namespace gatemi-ai/v1, public by design and guarded by a session token (32 hex characters) and rate limits:

Route Method
/session POST Starts a chat; returns the token
/message POST session, message — sends a message, returns the reply
/history GET session — the customer and assistant turns so far
/rate POST session, rating — helpful or not

Free edition limits: 12 sessions and 120 messages per address per hour, plus Messages per chat.

Shortcode

[gatemi_ai_support] prints the panel inline (only once per page, and only when the assistant is live).

Storage

Tables: {prefix}gmai_conversations, {prefix}gmai_messages, {prefix}gmai_index, {prefix}gmai_usage.

Options: gmai_settings, gmai_db_version, gmai_fulltext (whether the full-text key was accepted), gmai_index_queue, gmai_reindex_cursor, gmai_indexed_at; full edition gmai_license.

Tickets: private post type gmai_ticket; replies are comments of type gmai_reply (kept out of ordinary comment queries). Post meta:

Key
_gmai_ref Reference, GM- + 6 characters
_gmai_email, _gmai_name The customer
_gmai_order_id Order number given
_gmai_conversation_id The chat that led to it
_gmai_status open, waiting, resolved, closed
_gmai_category order, product, technical, billing, other

Cron

Hook Schedule
gmai_reindex Every minute (gmai_minutely) Re-indexes queued products and pages
gmai_prune Daily Deletes transcripts past the retention period
gmai_reindex_continue, gmai_embed Full edition Continues a long rebuild; computes embeddings
gmai_license_check Full edition Licence check

Front end

Script and style handle gmai-widget, localized object gmaiConfig. The accent colour is the custom property --gmai-accent on .gmai-root.

Class Element
.gmai-root The wrapper; .gmai-floating or .gmai-inline, plus .gmai-bottom-right / .gmai-bottom-left
.gmai-launcher The floating button
.gmai-panel The chat panel
.gmai-head, .gmai-title, .gmai-badge The header and its "AI assistant" badge
.gmai-log, .gmai-bubble Messages
.gmai-starters, .gmai-starter Suggested questions
.gmai-notice The consent notice
.gmai-form, .gmai-input, .gmai-send The message form
.gmai-rate, .gmai-rate-button The helpful/unhelpful buttons
.gmai-is-open On the root while the panel is open
Shopping Cart
Scroll to Top