aisdk
Unified Interface for AI Model Providers
The self-contained core of the family. A production-grade AI toolkit for R with a layered architecture (Specification, Utilities, Providers, Core), request interception, and robust error handling with exponential retry. It ships the unified provider:model interface, the agent / tool / skill base classes, the request/retry machinery, and an interactive console.
- Status: on CRAN
- Source: github.com/YuLab-SMU/aisdk
Install
install.packages("aisdk")Highlights
- One interface over many providers via
provider:model(e.g.openai:gpt-4o,anthropic:claude-...,gemini:...). create_chat_session(),generate_text(),stream_text().- Agent / Tool / Skill base classes and a provider registry that companion packages extend on load.
- Built-in interactive console (
console_chat()) andask_ai().
Example
library(aisdk)
chat <- create_chat_session("openai:gpt-4o")
generate_text(chat, "Explain retry-with-backoff in one paragraph.")