On March 27, 2026, chatAI4R, an interactive artificial intelligence toolkit designed for data science tasks in the R programming language, was officially published as open-source software in the Journal of Open Source Software. Developed by Satoshi Kume, the toolkit provides R users with convenient features for direct interaction with large language models, supporting knowledge discovery and data analysis.
Core Design of the Toolkit
chatAI4R is an R package that integrates the OpenAI API and other AI services, extending the application scenarios of the R language using large language model technology. It is positioned as an experimental project, primarily targeting R package developers and data analysts, to assist in automating documentation generation, interpreting statistical results, and extracting insights from literature.
Multi-API Support and Feature List
The toolkit supports 6 AI services, including OpenAI (ChatGPT, GPT-4, Vision, Embeddings), Google Gemini (with search grounding), io.net (23+ models like DeepSeek-R1, Llama-4, Qwen3), Replicate, Dify, and DeepL. Core functions such as chat4R enable single-turn conversations, conversation4R supports continuous interaction with memory, interpretResult can interpret statistical results across 13 domains, and autocreateFunction4R is used for automatically creating R functions.
Four-Layer Architecture and Advanced Applications
chatAI4R adopts a unique 4-layer architecture: the first layer is for core API access, the second for intelligent processing and domain analysis, the third for multi-agent collaborative workflows, and the fourth for ecosystem integration (e.g., plumber Web API). This design goes beyond simple API wrappers, supporting multi-agent discussions like discussion_flow_v2 and parallel multi-LLM execution, making it suitable for data science scenarios such as machine learning pipeline optimization.
Installation, Usage, and Security Features
Users can install it from CRAN via install.packages(“chatAI4R”) or get the development version using devtools::install_github(“kumeS/chatAI4R”). Environment variables like OPENAI_API_KEY must be set. The package features production-grade security designs, including HTTP status validation, null-safe JSON parsing, and input validation. It contains a total of 54 functions with a test coverage of over 96%.
Significance of Open Source Publication
As paper #9283 in Volume 11, Issue 119 of the Journal of Open Source Software, the publication of chatAI4R (DOI: 10.21105/joss.09283) provides the R ecosystem with a reliable open-source AI tool. The GitHub repository kumeS/chatAI4R and the official documentation offer complete examples and support for RStudio addins.