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 the shared model-setup and session-persistence layer that the family’s front ends build on.
- 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.
ask_ai()error-context assistant; the interactive terminal REPL lives in aisdk.console (since aisdk 1.5.0) and is offered for install on first use.
Example
library(aisdk)
chat <- create_chat_session("openai:gpt-4o")
generate_text(chat, "Explain retry-with-backoff in one paragraph.")