Skip to content

feat(providers): add openai-chatgpt provider (ChatGPT subscription via OAuth device-code) - #128

Merged
Salil Das (sadlilas) merged 2 commits into
mainfrom
add-provider-openai-chatgpt
Aug 18, 2026
Merged

feat(providers): add openai-chatgpt provider (ChatGPT subscription via OAuth device-code)#128
Salil Das (sadlilas) merged 2 commits into
mainfrom
add-provider-openai-chatgpt

Conversation

@bkrabach

Copy link
Copy Markdown
Contributor

Summary

Adds openai-chatgpt as a first-class provider in amplifier-agent's provider catalog, wiring up the existing official module amplifier-module-provider-openai-chatgpt. It uses a ChatGPT Plus/Pro/Team subscription as the backend via OAuth device-code auth — distinct from the existing openai provider (API key, public OpenAI API).

Listed in the ecosystem MODULES.md but not previously selectable from amplifier-agent, whose provider set is hardcoded (the ISSUES.md "five literals" seam). This is a sibling to #127 (chat-completions); separate PR by design.

What changed

Code

  • config/loader.py: add openai-chatgpt to _VALID_PROVIDER_MODULES.
  • provider_sources.py: add to KNOWN_PROVIDERS and PROVIDER_CATALOG; add a dedicated resolve_credential_detailed branch that reports resolvable based on presence of the OAuth token cache (~/.amplifier/openai-chatgpt-oauth.json) — there is no api-key env var, since auth is device-code OAuth.
  • admin/auth.py: add openai-chatgpt to _CONFIG_CREDENTIAL_UNSUPPORTED, so auth set is refused (as with github-copilot) — there is no static key to store.
  • bundle.md: declare provider-openai-chatgpt in the install-only stub list.

Docs: README, docs/spec/*, docs/CONFIGURATION.md, docs/LAYERS_AND_RELEASES.md, docs/INTEGRATION.md, docs/architecture/architecture.dot, skills/amplifier-agent/SKILL.md, CHANGELOG.md.

Dependency

A fully working device-code login also needs a one-line fix in the provider module: microsoft/amplifier-module-provider-openai-chatgpt#5 (its device-code poller aborted on the first poll before the user could authorize). This catalog wiring is independent of that fix, but an end-to-end login needs both.

Verification (Digital Twin, real ChatGPT subscription — no mocks)

Verified end-to-end in an isolated container running the patched build (amplifier-agent 0.12.0), with module PR #5 applied, against a real ChatGPT account:

  • providers list: openai-chatgpt appears; reports resolvable=false/source=none with no token, and flips to resolvable=true/source=file after the device-code login — exercises the catalog entry and the credential-resolution branch.
  • Loader negative control: an invalid provider.module is rejected with a valid set that now includes openai-chatgpt.
  • auth set openai-chatgpt: refused with OAuth-only guidance (like github-copilot).
  • Cold-prepare: succeeds with the 6-provider bundle.md; the prepared bundle declares provider-openai-chatgpt.
  • Authenticated turn: a real device-code login completed and amplifier-agent run returned a correct gpt-5.5 completion in ~4s (clean terminated envelope). Routing to chatgpt.com/backend-api was proven causally — blackholing chatgpt.com made the same turn fail with ProviderUnavailableError, and restoring it made it succeed; no fallback is possible (config pins openai-chatgpt, all other providers unresolvable).

…a OAuth)

Wires the official provider-openai-chatgpt module into amplifier-agent's provider catalog.

Adds openai-chatgpt as a selectable provider that authenticates via OAuth device-code
flow to ChatGPT's backend API, enabling use of Plus/Pro/Team/Enterprise subscriptions
without per-token billing.

Changes:
- loader.py: added openai-chatgpt to _VALID_PROVIDER_MODULES
- provider_sources.py: added to KNOWN_PROVIDERS, PROVIDER_CATALOG, and new
  resolve_credential_detailed branch that checks for OAuth token cache at
  ~/.amplifier/openai-chatgpt-oauth.json (no api-key env var needed)
- auth.py: added openai-chatgpt to _CONFIG_CREDENTIAL_UNSUPPORTED to prevent
  'auth set' (device-code flow is the only auth method, like github-copilot)
- bundle.md: declared provider-openai-chatgpt in install-only stub list

Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Comprehensive documentation across all spec and integration layers for the new
openai-chatgpt provider. Updates:

- README.md: added to provider matrix
- CHANGELOG.md: release note entry
- docs/CONFIGURATION.md: configuration and credential handling (device-code OAuth)
- docs/spec/providers-and-models.md: provider overview, models, auth flow
- docs/spec/host-config.md: host config schema and examples
- docs/spec/bundle-and-cache.md: cache behavior for OAuth tokens
- docs/spec/cli.md: 'auth' command limitations for device-code flow
- docs/LAYERS_AND_RELEASES.md: release metadata
- docs/INTEGRATION.md: integration points and callbacks
- docs/architecture/architecture.dot: updated provider catalog diagram
- skills/amplifier-agent/SKILL.md: skill definition and capability index

Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@sadlilas
Salil Das (sadlilas) merged commit b1488f4 into main Aug 18, 2026
3 checks passed
@sadlilas
Salil Das (sadlilas) deleted the add-provider-openai-chatgpt branch August 18, 2026 04:45
Salil Das (sadlilas) pushed a commit that referenced this pull request Aug 24, 2026
…li's tree

Both raised by @DavidKoleczek on #142.

1. provider_sources.py read ~/.amplifier/openai-chatgpt-oauth.json directly.
   Pre-existing (PR #128), but this PR is what establishes the never-read-app-cli
   guarantee, and that was the read half. The provider accepts a token_file_path
   config key (provider.py:103), the same seam already used for anthropic's
   rate-limit file, so this is fixable rather than merely documentable. Includes
   a copy-forward so an existing login is not silently invalidated into a
   device-code prompt; copies, never moves.

2. bundle.md declared session_dir and base_path as literal YAML strings that
   nothing expands, so both ignored AMPLIFIER_AGENT_HOME. With it unset they
   equalled state_root() and the divergence was invisible -- including to every
   test either of us ran. Set it and the context-intelligence writer and reader
   split apart again, one level below where foundation_home fixed it. Now
   injected at runtime from state_root(), the same technique the vendored
   skills/modes dirs already use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants