feat(rate-limit): bypass per-IP throttle for known AI crawler UAs - #615
Merged
Conversation
Adds Meta-ExternalAgent, Meta-ExternalFetcher, cohere-ai, Perplexity-User (all already in robots.txt), plus AI2Bot, Ai2Bot-Dolma, Kagibot, FacebookBot, MistralAI-User, TimpiBot, Webzio-Extended for completeness. Comment now states the regex must stay in sync with src/app/robots.ts. Western LLM coverage is at ~95 percent after this. Chinese models other than ByteDance (Bytespider) do not publish a documented bot UA, so they fetch via generic browser UAs and stay throttled by design.
Flotapponnier
added a commit
that referenced
this pull request
Jun 21, 2026
…) (#617) * feat(rate-limit): bypass per-IP throttle for known AI crawler user agents * rate-limit: expand AI bot allowlist to match robots.txt Adds Meta-ExternalAgent, Meta-ExternalFetcher, cohere-ai, Perplexity-User (all already in robots.txt), plus AI2Bot, Ai2Bot-Dolma, Kagibot, FacebookBot, MistralAI-User, TimpiBot, Webzio-Extended for completeness. Comment now states the regex must stay in sync with src/app/robots.ts. Western LLM coverage is at ~95 percent after this. Chinese models other than ByteDance (Bytespider) do not publish a documented bot UA, so they fetch via generic browser UAs and stay throttled by design.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI crawlers (PerplexityBot, GPTBot, ClaudeBot, etc.) often share a small
pool of egress IPs across many user queries. The per-IP rate limit on
/api/citable, /api/llm-context, /llms-full.txt (which re-exports
llm-context), /api/stat/[slug], /api/mcp/[transport] and adjacent
read-only endpoints was triggering 429 responses to legitimate AI
citation fetches, lowering OCB visibility in Perplexity, ChatGPT search,
Claude, and Google AI Overviews.
This change adds a User-Agent allowlist in rate-limit.ts. Requests with
a known AI crawler UA bypass the throttle without consuming a token.
Human traffic and unknown UAs remain throttled. UA spoofing is possible
but the read-only nature of these endpoints makes it a non-concern: we
WANT to be cited.
Allowlist patterns (case-insensitive substring match): GPTBot,
ChatGPT-User, OAI-SearchBot, ClaudeBot, anthropic-ai, Claude-Web,
PerplexityBot, Google-Extended, GoogleOther, CCBot, Bytespider,
Applebot-Extended, Amazonbot, Diffbot, YouBot, DuckAssistBot.
Optional
AI_BYPASS_DEBUG=trueenv var enables a one-line console logper bypass for debugging.
Adds tests covering: known AI UA bypasses a drained bucket, default
Chrome UA still throttled after capacity, missing UA defaults to
throttled, omitting the optional req argument keeps original behaviour.
Validation: