# Agent Tollbooth (Nginx HTTP 402 Paywall Snippet for AI Bots)
# Drop into /etc/nginx/snippets/agent_tollbooth.conf and include inside server block.

map $http_user_agent $is_ai_bot {
    default 0;
    "~*gptbot" 1;
    "~*chatgpt-user" 1;
    "~*claudebot" 1;
    "~*claude-web" 1;
    "~*anthropic-ai" 1;
    "~*perplexitybot" 1;
    "~*bytespider" 1;
    "~*ccbot" 1;
    "~*diffbot" 1;
    "~*facebookbot" 1;
    "~*google-extended" 1;
    "~*cohere-ai" 1;
    "~*scrapy" 1;
}

map $http_x_agent_token $has_valid_token {
    default 0;
    "~^tb_live_" 1;
}

# Usage inside location block:
# if ($is_ai_bot) {
#     return 402 '{"status":402,"error":"Payment Required","message":"AI Agent access requires an Agent Token.","checkout_url":"https://proofchain.us/tollbooth/"}';
# }
