Skip to content

Conversation

ScriptedAlchemy
Copy link
Contributor

@ScriptedAlchemy ScriptedAlchemy commented Sep 6, 2025

This pull request enhances the authentication flow for the OpenAI provider in the CLI, giving users a choice between logging in with ChatGPT (OAuth) or using an API key. It also introduces a more robust OAuth login implementation and adds a custom header for requests to the OpenAI API. The most important changes are grouped below:

OpenAI Authentication Improvements:

  • Added a prompt for OpenAI users to choose between signing in with ChatGPT (OAuth) or using an API key during auth login. If "Sign in with ChatGPT" is selected, the new OAuth flow is initiated.
  • Implemented a complete OAuth login flow for OpenAI, including PKCE challenge generation, local callback server, token exchange, and storing both API and refresh tokens.
  • Improved handling for API key authentication, including validation and proper storage of credentials. [1] [2]

Provider Request Customization:

  • Added an originator: "codex_cli_rs" header to all OpenAI API requests to help identify requests coming from this codex (might not be needed, will confirm).

@ScriptedAlchemy
Copy link
Contributor Author

in china right now so i cannot properly test authenticating in with a new token, but will check it in the office on monday

@ScriptedAlchemy ScriptedAlchemy changed the title feat: add chatgpt auth login WIP feat: add chatgpt auth login Sep 6, 2025
@asafyish
Copy link

Does it allow us to use the pro package quota ?

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