Skip to content

helpers : isAIAssistant()

isAIAssistant(ua: string): boolean

Check whether user-agent is an AI assistant (an AI bot that browses or acts for a user).

OperatorUser-Agent
AmazonNovaAct
AnthropicClaude-User
CohereCohere-AI
DuckDuckGoDuckAssistBot
GoogleGemini-Deep-Research
Mistral AIMistralAI-User
OpenAIChatGPT-User
PerplexityPerplexity-User

TIP

See list of all possible values for Fetchers (including non-AI assistants) here.

Code Example

example.js
js
import { isAIAssistant } from 'ua-parser-js/bot-detection';

const gpt_bot = 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)';
const gpt_user = 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot';

console.log(isAIAssistant(gpt_bot)); // false
console.log(isAIAssistant(gpt_user)); // true

UAParser.js v2 is licensed under AGPLv3 or PRO licenses.