'ChatGPT' Plan Provider for 'ellmer'
Overview
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.0) 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'.
Breaking changes: documented "Sign in with ChatGPT" flow
- Authentication now follows OpenAI's documented "Sign in with ChatGPT" flow for open-source, locally hosted apps (<https://developers.openai.com/siwc/token-sharing-open-source>). The package no longer reuses the Codex CLI OAuth client or calls the undocumented
chatgpt.com/backend-api/codexendpoints. **Existing credentials cannot be migrated: runcodex_login()again.** codex_login()registers dynamically withclient_id=dynamic_agent_client, stores the client ID that OpenAI issues for the chosen account and workspace, and reauthorizes that registration on later sign-ins. It sends a stableext_agent_host_id, created once per host, and uses PKCE and a nonce. The ID token is verified against OpenAI's published keys, and sign-in fails with the newcodex_plan_scope_errorwhen ChatGPT plan usage (chatgpt.tokens.use.direct) is not granted. The package now importsjosefor ID token verification.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- The OAuth callback moved from
http://localhost:1455/auth/callbacktohttp://127.0.0.1:1455/callback, as the documentation requires. SetELLMERCODEX_CALLBACK_PORTto use another port. - Credentials moved from httr2's OAuth cache to a package-owned
credentials.json(mode0600, atomic writes) intools::R_user_dir("ellmercodex", "config"), or in the directory named byELLMERCODEX_HOME.HTTR2_OAUTH_CACHEno longer applies. Refreshes are serialized across R processes because refresh tokens rotate. codex_logout()gainsrevoke = TRUEand now revokes the refresh token with OpenAI before deleting the local credential. It also removes the old httr2 cache entry. To switch account or workspace, log out and sign in again.- Chats and
codex_models()use the publichttps://api.openai.com/v1Responses and Models endpoints with only the bearer token; theChatGPT-Account-Id,OpenAI-Beta, andoriginatorheaders are gone.codex_models()keeps models withvisibility: "list", and itsclient_versionargument is deprecated and ignored (ELLMERCODEX_CLIENT_VERSIONis no longer read). - Requests follow the ChatGPT plan usage preview limits: system prompts are sent as
developermessages, function tools are grouped in anellmernamespace, andtemperature,top_p,max_tokens,metadata,previous_response_id, and the other excluded Responses arguments now fail withcodex_chat_argument_errorbefore a request is sent. - A
response.incompleteevent now fails a Chat turn withcodex_incomplete_errorinstead of returning a truncated turn. - Documented plan error codes map to new subclasses that keep the existing parents:
codex_usage_limit_error(acodex_rate_limit_error),codex_usage_unavailable_error(acodex_server_error),codex_plan_ineligible_error(acodex_authentication_error), andcodex_unsupported_capability_error(acodex_malformed_request_error). Synchronous chats now raise these package conditions, rather than httr2 errors, for HTTP failures before the stream opens.
Other changes
- Codex generation requests no longer inherit ellmer's automatic retries, as documented in the technical design: a retried request could duplicate a generation the service already accepted.
- Codex requests and turn costs are now built without five unexported ellmer helpers, reducing the private ellmer surface ahead of a CRAN submission.
chat_codex()now accepts explicitly selected models omitted from the account catalog. The service validates those model IDs and reasoning efforts.
From NEWS.md in the release
Install
Health
- OK12 OKNow
- OK7 OK2026-10-17
Documentation
- Help pages
- 9 (1 internal)includes a package overview page
- Examples that run
- 100%7 run in a plain check (5 of them under a condition)
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 2
- Median days to close, 50 most recently updated closed PRs
- 0
Commits over time
5 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/simxnherrera/ellmercodex on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-10-06Pull request it wrote: opened by a project memberCommits: at least 10 crediting it in the message
- Claude Opus 5.510 commits · Oct 2026
Dependencies
Code & Tests
People & History
- 0.2.0Latest2026-10-16 · current release ·
9 days in CRAN's queue
Listed in CRAN's incoming queue from 2026-10-06 20:42 to 2026-10-16 07:45 UTC, in 44 readings. - RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-10-16
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 446 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("ellmercodex")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.