Skip to contents

Documentación en español: empieza por Primeros pasos. Todos los artículos están disponibles en español.

ellmercodex lets you use your ChatGPT plan from R as an ellmer provider. You sign in once with your ChatGPT account, and chat_codex() gives you an ordinary ellmer Chat: no API key, and no Codex CLI. That makes it easy to bring language models into your R analysis workflows.

It uses OpenAI’s documented “Sign in with ChatGPT” flow for open-source, locally hosted apps, and the public Responses API. ellmercodex is an independent integration and is not affiliated with or endorsed by OpenAI.

Installation

Install the released version from CRAN:

install.packages("ellmercodex")

Or the development version from GitHub with pak:

install.packages("pak")
pak::pak("simxnherrera/ellmercodex")

If you are upgrading from 0.1.x, sign in again with codex_login(): the authentication flow changed and earlier credentials are not kept.

Usage

Sign in once; the credential is saved and refreshed for you:

Then create a chat and talk to it:

chat <- chat_codex(model = "gpt-6-luna", effort = "low")
chat$chat("Hello from R")
#> Hello! What are you working on in R?

Because chat_codex() returns an ellmer Chat, everything you know from ellmer applies: streaming, async, images and PDFs, tool calling, and structured data. For example, you can classify a speech from a parliamentary debate and get back an R list instead of prose:

chat$chat_structured(
  "Classify this excerpt as PREVENTIVE, PUNITIVE, or MIXED drug policy: ...",
  type = ellmer::type_object(
    stance = ellmer::type_enum(c("PREVENTIVE", "PUNITIVE", "MIXED")),
    rationale = ellmer::type_string()
  )
)

ChatGPT plan usage is an OpenAI preview: it needs an eligible plan and workspace, works one conversation at a time, and does not accept arguments such as temperature or max_tokens.

Learn more

The technical design and the ellmer compatibility inventory document the implementation in depth.