---
title: Protect Public AI Widgets from Bot Abuse | APIkit
description: Stop scripted bot drain on public-facing AI widgets using Turnstile verification, strict input caps, and IP burst limits.
canonical: "https://apikit.ai/j/protect-public-forms-abuse-shields"
modified: 2026-11-14
author: apikit.ai editorial team
source: "https://apikit.ai"
category: API Key Auth, Scopes & Quotas
category_url: "https://apikit.ai/j#group-api-auth-permissions"
---

# Shield public unauthenticated AI forms from bot abuse

> Keep interactive landing-page demos and public lead widgets safe from scripted prompt drain using origin checks, payload caps, and Turnstile tokens.

## Prepared starting prompt

We have an open interactive copy-helper on our marketing site and worry bots will script it to drain our LLM credits. How do we lock it down?

### Quick scenarios
- **Turnstile token check:** Verify Cloudflare Turnstile or hCaptcha tokens at the gateway before invoking any model.
- **Tiny input character cap:** Clamp public text fields to 300 characters so abusers cannot hijack the endpoint for essays.
- **Hourly IP budget cap:** Limit anonymous browser visitors to 5 demo runs per hour cleanly.

- [Request APIkit early access](https://apikit.ai/#waitlist-f73a0d)

## Checklist to harden public AI form endpoints

1. **Verify bot-challenge tokens** — Validate Cloudflare Turnstile or captcha tokens server-side inside APIkit before model execution.
2. **Lock prompt intent tightly** — Use strict schemas and tiny input length caps so attackers cannot repurpose your widget as free ChatGPT.
3. **Apply harsh anonymous IP limits** — Cap unauthenticated IPs to a handful of calls per hour while logged-in users get real quotas.
4. **Enable edge response caching** — Serve preset sample demos from zero-cost edge cache so casual clicks never touch model quotas.

## How it works in practice

### Public Widget Hardening Stack

1. Turnstile Token Verification -> required
2. Origin Lock -> https://acme.com only
3. IP Sliding Limit -> 5 runs / hour
4. Input Cap -> max 280 chars | Output -> max 120 tokens

### Blocked Bot Probe vs Legitimate Visitor

Scripted curl spam -> 403 {"error":"missing_turnstile_token"}
Verified browser -> 200 OK (served within 5/hr budget)

Marketing widgets stay interactive for genuine prospects while automated scripts fail at the edge at zero token cost.

## Frequently Asked Questions

### How do you stop someone curling a public widget endpoint directly?

Requiring a one-time verified challenge token alongside strict origin and IP limits blocks automated terminal scripts.

### Can attackers still hijack a capped public prompt for unrelated essays?

Combining a tight 280-character input limit, strict JSON schema, and low max_tokens prevents off-task general chat abuse.

### Does Turnstile verification require us to run a backend endpoint?

No. APIkit verifies the challenge token directly at the gateway before running your prompt.

## Related tasks in this category

- [Issue scoped API keys per customer and environment](https://apikit.ai/j/issue-scoped-tenant-api-keys.md)
- [Meter and cap monthly token quotas per tenant](https://apikit.ai/j/enforce-monthly-token-quotas-tenants.md)
- [Rotate API keys smoothly with overlapping grace windows](https://apikit.ai/j/rotate-compromised-keys-grace-window.md)
- [Verify end-user JWT claims directly at your AI endpoint](https://apikit.ai/j/validate-end-user-jwt-tokens.md)
- [Lock internal AI endpoints to approved IP and CIDR ranges](https://apikit.ai/j/restrict-endpoint-access-ip-allowlist.md)
- [Configure exact CORS origin policies for browser clients](https://apikit.ai/j/configure-cors-origins-browser-calls.md)

---

*Published by **Wondel.ai sp. z o.o.** · [apikit.ai](https://apikit.ai) · [About](https://apikit.ai/about) · [Editorial Guidelines](https://apikit.ai/editorial) · [Contact](https://apikit.ai/contact) · [Wondel.ai Products](https://wondel.ai/products)*