Repolode
tidyverse

tidyverse/ellmer

An R package for calling large language model APIs from R, with chat, streaming, tool calling and structured data extraction.

Stars
622
Forks
145
Open issues
69
Last commit
11 hours ago

What is it?

ellmer lets R users call large language models from R code and the console. It works with a range of providers, including Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, Ollama and several community-maintained services, so the same workflow can run against hosted or locally run models.

A chat object is a stateful R6 object that keeps the conversation context, so each query builds on earlier ones. Responses can stream to the console, be returned as a string, or be used interactively through a chat console or browser. Images can be passed in as files or URLs.

Beyond plain chat, ellmer covers tool and function calling, structured data extraction, and streaming and async APIs. Authentication uses API keys stored in environment variables, and it can detect many OAuth or IAM credentials from major cloud platforms.

Key features

  • 01Chat with many LLM providers through a consistent set of chat_*() functions.
  • 02Stateful chat objects that keep conversation context across calls.
  • 03Streaming output to the console, or capturing responses as strings.
  • 04Tool and function calling from R functions.
  • 05Structured data extraction from model responses.
  • 06Interactive chat in the R console or browser, and image input from files or URLs.

Use cases

  • Adding LLM-powered summarization or classification to an R analysis script.
  • Extracting structured fields from text into data frames.
  • Running local models through Ollama while keeping data on your own machine.
  • Building R tools where the model calls your own R functions.

Quick start

  1. 1

    Install ellmer from CRAN

    install.packages("ellmer")
  2. 2

    Load the package and create a chat object (needs a provider API key saved in an environment variable)

    library(ellmer) chat <- chat_openai("Be terse", model = "gpt-5.4-mini")

Things to know

  • Most hosted providers require an API key, and usage may incur costs.
  • The lifecycle is marked experimental, so the API may change.
  • The license is not clearly identified in the metadata.

In collections

Topics

FAQ

What is ellmer?
An R package for calling large language model APIs from R, with chat, streaming, tool calling and structured data extraction. ellmer lets R users call large language models from R code and the console. It works with a range of providers, including Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, Ollama and several community-maintained services, so the same workflow can run against hosted or locally run models.
Is ellmer free to use? What license does it have?
ellmer is open source under the Other license. Check the license terms before using it in commercial products.
Is ellmer still maintained?
Actively maintained. The last commit to ellmer was on Nov 6, 2026.
What can I use ellmer for?
Adding LLM-powered summarization or classification to an R analysis script. Extracting structured fields from text into data frames. Running local models through Ollama while keeping data on your own machine. Building R tools where the model calls your own R functions.
How do I install ellmer?
Install ellmer from CRAN: install.packages("ellmer") Load the package and create a chat object (needs a provider API key saved in an environment variable): library(ellmer) chat <- chat_openai("Be terse", model = "gpt-5.4-mini")
Where can I get ellmer?
The source code and installation instructions are on GitHub: https://github.com/tidyverse/ellmer

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects