Skip to content

feat: add ChatGPT device code login method #3424

@cmraible

Description

@cmraible

What do you want to change?

Currently when running /login and selecting "ChatGPT Plus/Pro (Codex Subscription)" in the TUI, the default and only login method is the standard browser-based, localhost callback method. This option does not work on headless devices, e.g. over SSH.

This issue is a proposal to add a "Sign in with Device Code" option, similar to the Codex TUI coding agent. When a user selects the "ChatGPT Plus/Pro (Codex Subscription)" option in the /login flow, the user will be presented with a "Browser OAuth" and a "Device Code" option. The "Browser OAuth" option would continue to work as it does today, and the "Device Code" option would work the same way it does in the Codex TUI.

I have a draft of this working locally, and I'd be happy to raise a PR if approved.

Why?

It's currently not possible (AFAICT) to run pi on a remote, headless host using a ChatGPT Subscription, because the Browser OAuth login method doesn't work without a local browser. pi is IMO the ideal coding agent for remote, sandboxed environments, but it's a non-starter for me right now since I can't use my existing provider subscription in these environments.

How? (optional)

  • Extend the OAuthProviderInterface to support multiple loginMethods per provider
  • Add the deviceCode login method implementation to the openai/codex provider
  • Add OAuthLoginMethodSelector component to the interface to allow users to choose which login method to use

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions