'ChatGPT' Plan Provider for 'ellmer'

Connects 'ellmer' chats to a 'ChatGPT' subscription through 'OpenAI''s documented "Sign in with ChatGPT" flow for open-source, locally hosted apps < https://developers.openai.com/siwc/token-sharing-open-source>. Provides a stable, explicitly bounded core of the public 'ellmer' (>= 0.5.1) Chat object, including browser sign-in with dynamic client registration, package-scoped credential storage, redacted diagnostics, multi-turn text, streaming, structured-output, function-tool, asynchronous, cancellation, cloning, metadata, multimodal chat, account-specific model discovery, and reasoning-effort selection through the public 'Responses' API. Parallel and batch helper functions are explicitly unsupported because 'ChatGPT' plan usage is stream-only. This independent third-party integration is not endorsed by 'OpenAI'.


ellmercodex ellmercodex hex sticker

R-CMD-check CRAN status CRAN downloads License: MIT

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:

library(ellmercodex)

codex_login()

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.

Citation

To cite ellmercodex in publications, please use:

Herrera, S. (2026). ellmercodex: 'ChatGPT' Plan Provider for 'ellmer'. R package version 0.2.1, https://doi.org/10.32614/CRAN.package.ellmercodex

@Manual{ellmercodex,
  title = {{ellmercodex}: 'ChatGPT' Plan Provider for 'ellmer'},
  author = {Simon Herrera},
  year = {2026},
  note = {R package version 0.2.1},
  doi = {10.32614/CRAN.package.ellmercodex},
  url = {https://CRAN.R-project.org/package=ellmercodex},
}

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ellmercodex")

0.2.2 by Simon Herrera, 7 days ago


https://simxnherrera.github.io/ellmercodex/, https://github.com/simxnherrera/ellmercodex


Report a bug at https://github.com/simxnherrera/ellmercodex/issues


Browse source code at https://github.com/cran/ellmercodex


Authors: Simon Herrera [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports coro, ellmer, httr2, httpuv, jose, jsonlite, openssl, promises, rlang, S7

Suggests callr, knitr, later, pkgload, rmarkdown, testthat


See at CRAN