1. REST Route for Chat #
From the docs:
- Namespace:
davix-ai-engine/v1 - Route:
/chat - Registered in
register_rest_routes()ofDavix_Chatbot.
This endpoint is responsible for receiving user messages and returning AI responses.
2. Permission Check #
Permission callback: chat_permission_check()
- Validates:
- REST nonces (security).
- Login status, especially when
login_requiredis ON.
- If checks fail, the request is denied.
3. Handling a Chat Request #
Handler: handle_chat_request()
It performs the following steps:
- Read Input:
- Extracts the user’s message from the request.
- Loads Chatbot options (name, login requirements, site search toggles, etc.).
- Optional Site Search:
- If site search is enabled (
enable_site_search,search_posts,search_pages,search_products), the handler may perform WordPress queries to gather contextual content.
- If site search is enabled (
- Build OpenAI Request:
- Uses:
openai_api_keyopenai_modelsystem_prompttemperature
- Attaches any site-search context to the prompt when configured.
- Uses:
- Call OpenAI API:
- Sends a chat completion request using your configured model and parameters.
- Return Response:
- Formats the AI response and returns it as REST JSON.
image IMAGE PLACEHOLDER: Screenshot of Debug Logs (chat channel) showing sample REST request and OpenAI response lines. IMAGE image
4. Free vs Pro Behavior in Handler #
The same handler is used in Free and Pro, but:
- In Free, model is effectively fixed to
gpt-4o-mini(no model switch). - In Pro, additional options (model select, human colors, extended search scopes) are recognized and affect context and output.
5. Debugging Chat Requests #
You can use the Debug Logs module:
- Turn on
debug_chatbot_enabledin Davix AI Engine → Debug Logs. - This logs chat-related events, such as REST calls, to a log file in
debug/logs/.
This is further detailed in the Debug Logs category, but it is important for understanding Chatbot behavior.

