Skip to main content

Codex CLI and Sign in with ChatGPT

Updated over a month ago

This article covers Codex CLI and the new Sign in with ChatGPT flow for the Codex CLI that links your ChatGPT identity to an API account in one step.

For information about Codex in ChatGPT see the Codex in ChatGPT FAQ.

Access & incentives

Who can use the new sign-in flow?

  • Free, Plus, and Pro ChatGPT accounts.

  • Enterprise, Edu, and Team workspaces are excluded for now.

How long is the launch-promo credit offer available?

  • Complete the sign-in flow by June 15 to receive promo credits.

What is the codex-mini-latest model?

  • codex-mini-latest is an o4-mini snapshot tuned for Codex CLI workflows. See more details on our platform docs.

  • Price: $1.50 / M input tokens, $6 / M output tokens.

  • codex-mini-latest is not recommended for general API usage. The snapshot will refresh regularly as we improve the underlying model for Codex CLI use cases.

What credits do I receive?

Plus users who Sign in with ChatGPT to the Codex CLI receive $5 in API credits, and Pro users receive $50 in API credits. All promotional credits expire 30 days after they’re granted.

To be eligible to receive Sign in with ChatGPT promotional credits, ChatGPT Plus or Pro subscriptions must be >7 days old & have a default payment method set in the selected API org.

Setup

How do I connect my ChatGPT account to Codex CLI?

  1. Install the CLI.

  2. Run the following command.

    codex --login
  3. Click Sign in with ChatGPT.

    • The flow links your ChatGPT identity to an API account and stores credentials locally.

  4. Start prompting in your terminal.

Do I get API keys?

The flow creates a key for you automatically; no manual key copy-paste required.

Security & data sharing

Is data shared with OpenAI for training?

By default, OpenAI does not use any inputs or outputs from our products for business users, including ChatGPT Team, ChatGPT Enterprise, and the API, to improve our models. However, API organization owners can choose to opt-in to share API data with OpenAI. This setting is not available to certain organizations, including Enterprise and customers with Zero Data Retention enabled.

Can my organization opt in and receive extra incentives?

There is an option to opt in to share data with OpenAI in the new organization onboarding flow in Sign in with ChatGPT. Toggle data sharing on during sign-in; incentives will apply for eligible Tier 1+ orgs automatically once enabled. Learn more about the program and limitations here.

Revoking Codex CLI access scenarios

Scenario 1:

Does “Disconnect” remove only the ChatGPT OAuth grant or both the grant and the CLI key, and what happens to the key afterwards?

Using Settings → Connectors → Codex CLI → Disconnect deletes only the ChatGPT OAuth authorization. The “Codex CLI (auto‑generated)” API key remains fully active. To disable it, open the API dashboard, select API keys, click the trash‑can beside that key, and confirm by clicking Revoke key.

Scenario 2:

If the CLI can’t auto‑revoke the key, where do users revoke it and can the service do it programmatically?

For now, revocation is manual through the API dashboard UI described above; no public endpoint exists for automated deletion. Once such an endpoint is exposed, the CLI can call it in a future release.

Scenario 3:

What final wording appears in the authorization prompt and the disconnect confirmation?

  • OAuth sign‑in: “By continuing, ChatGPT will share your name, email, and profile picture with Codex CLI. You are also agreeing to Codex CLI’s Privacy Policy and Terms of Service.”

  • OAuth permission: “Codex CLI will receive a refresh token that allows it to generate API keys, consume credits, and manage your API organization.”

  • Disconnect confirmation: “Disconnecting will remove Codex CLI’s authorization with ChatGPT. Any API keys it created remain active until you revoke them from the API dashboard.”

  • Key‑revoke modal: “This API key will immediately be disabled. API requests made using this key will be rejected… Once revoked, you’ll no longer be able to view or modify this API key.”

Scenario 4:

Are ChatGPT and API logins still tied together, and what’s the rule now?

Yes. You sign in once with your OpenAI identity, but the ChatGPT session token and CLI‑generated secret keys are separate. Revoking one does not affect the other; you must disconnect the OAuth grant and, if desired, delete the key.

Limitations

  1. You can use codex-mini-latest outside the Codex CLI through the Responses API, but we recommend using gpt-4.1 for most tasks. The codex-mini-latest model is optimized for use in Codex CLI.

  2. Network disabled during execution: integration tests that call external services will fail.

  3. Enterprise sign-in support: coming later; use traditional API key provisioning for now.

FAQ

Having Trouble Redeeming Credit?

We’ve made it easier to redeem credits (if you’re eligible). Just follow these steps:

  1. Make sure you’re using the latest version of Codex CLI: npm i -g @openai/codex

  2. Run the command: codex --free

This will walk you through the login and redemption flow.

Eligibility requirements:
• Your Plus/Pro subscription is older than 7 days
• You haven’t already redeemed this offer
• Your API organization has a valid default payment method on file

Did this answer your question?