This study seeks to elucidate the relationship between various elements of artificial intelligence (AI) integrated into social media platforms and consumer behavior, particularly in the context of purchasing decisions. By advancing knowledge in the domains of AI and social media marketing, the research develops a comprehensive model incorporating key variables such as AI elements (recommendation systems, intelligent search, and chatbots), social media consumer engagement, perceived ease of use, and perceived usefulness, grounded within the framework of the Technology Acceptance Model (TAM). These variables are analyzed in their influence on purchase intention. Additionally, the research model examines the moderating effect of cosmopolitanism on the relationship between AI elements and consumer engagement on social media, offering novel insights into the existing literature. The empirical investigation was conducted using a survey-based methodology, with hypotheses tested through confirmatory factor analysis (CFA), reliability assessment via Cronbach's alpha, structural equation modeling (SEM), and interaction effect analysis. Data analysis was performed using IBM SPSS and AMOS software. The findings reveal that recommendation systems and chatbots significantly impact consumer engagement, which, in conjunction with perceived ease of use and perceived usefulness, influences purchase intention. Moreover, cosmopolitanism positively moderates the relationship between AI recommendation systems and consumer engagement. This study's primary contribution lies in its exploration of the interplay between AI-integrated social media elements, consumer perceptions (ease of use and usefulness), and engagement, offering a perspective from companies operating in a developing country context, specifically the Republic of Serbia. The findings enrich the understanding of AI's role in shaping consumer behavior within social media environments.