User Limits
Overview
WPiko Chatbot’s User Limits feature lets you cap how many chat requests a single visitor can make, bucketed per IP address. It is designed to protect you against runaway OpenAI API costs and to prevent abuse of your chatbot. The feature is opt-in and disabled by default, so it will not affect your visitors until you explicitly enable it.
Limits are enforced as a hard block: once a visitor reaches the configured threshold, further requests are rejected with a friendly, customizable message. Blocked requests are logged into the conversation with the error role so you can review them later.
How It Works
Per-IP Rate Limiting
REMOTE_ADDR by default, which cannot be spoofed at the TCP level).Admin Take Over Bypass
When an admin is actively handling a conversation through the Pro version’s Take Over feature, the per-IP limit is automatically bypassed for that conversation. Messages exchanged during a takeover are neither blocked nor counted, so live human support is never interrupted by rate limiting.
Fail-Open Behavior
If the plugin cannot determine a visitor’s IP address, the request is allowed through rather than blocking everyone. This ensures the chatbot keeps working even on unusual server configurations.
Configuring User Limits
Steps
Setting Values
0, no limit is enforced even when the feature is enabled.How Blocked Requests Are Handled
When a visitor hits the limit:
- The configured (or default) friendly message is shown to the visitor in the chatbot interface.
- The blocked request is logged into the conversation with the
errorrole, so it appears in the conversation transcript and debug log for admin review. - For streaming requests, an
errorevent withtype: rate_limitis sent to the client. For non-streaming requests, a JSON error response with the sametypeis returned.
Troubleshooting
Limits Not Being Enforced
0All Visitors Blocked
wpiko_chatbot_client_ip filter to read the real visitor IP from the appropriate forwarded header.Limits Reset Too Quickly
Best Practices
wpiko_chatbot_client_ip filter so limits apply to real visitors rather than the proxy IP