codex - 💡(How to fix) Fix feature request: codex login status expose plan tier and add --json output [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19866Fetched 2026-04-28 06:35:53
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

codex login status currently prints one of four hardcoded strings (Logged in using an API key, Logged in using ChatGPT, Logged in using Agent Identity, Not logged in) and exits. It does not expose the ChatGPT plan tier, even though that information is already parsed from the id_token JWT and stored in IdTokenInfo.chatgpt_plan_type (token_data.rs).

Root Cause

codex login status currently prints one of four hardcoded strings (Logged in using an API key, Logged in using ChatGPT, Logged in using Agent Identity, Not logged in) and exits. It does not expose the ChatGPT plan tier, even though that information is already parsed from the id_token JWT and stored in IdTokenInfo.chatgpt_plan_type (token_data.rs).

Code Example

jq -r '.tokens.id_token' ~/.codex/auth.json \
  | awk -F. '{print $2}' | tr '_-' '/+' \
  | awk '{l=length($0)%4; if(l==2)print $0"=="; else if(l==3)print $0"="; else print $0}' \
  | base64 -d | jq -r '."https://api.openai.com/auth".chatgpt_plan_type'

---

{
  "loggedIn": true,
  "authMode": "chatgpt",
  "email": "...",
  "chatgptPlanType": "plus",
  "accountId": "..."
}
RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

codex-cli 0.122.0

What feature would you like to see?

Summary

codex login status currently prints one of four hardcoded strings (Logged in using an API key, Logged in using ChatGPT, Logged in using Agent Identity, Not logged in) and exits. It does not expose the ChatGPT plan tier, even though that information is already parsed from the id_token JWT and stored in IdTokenInfo.chatgpt_plan_type (token_data.rs).

Motivation

currently building tooling that needs to know which plan a user is on (plus, pro, business, etc.) and right now the only way to get this is to manually parse the JWT in ~/.codex/auth.json:

jq -r '.tokens.id_token' ~/.codex/auth.json \
  | awk -F. '{print $2}' | tr '_-' '/+' \
  | awk '{l=length($0)%4; if(l==2)print $0"=="; else if(l==3)print $0"="; else print $0}' \
  | base64 -d | jq -r '."https://api.openai.com/auth".chatgpt_plan_type'

That works but is fragile (base64url padding, depends on undocumented claim path) and reaches into internal token storage.

Proposed

Add a --json flag to codex login status that outputs structured info, e.g.:

{
  "loggedIn": true,
  "authMode": "chatgpt",
  "email": "...",
  "chatgptPlanType": "plus",
  "accountId": "..."
}

The IdTokenInfo struct already has these fields and so this suggestion is purely surfacing change in run_login_status.

Cl*ude code has a similar approach using claude auth status (which exposes subscriptionType in JSON).

Alternatives considered

  • Parsing ~/.codex/auth.json directly: works but fragile and undocumented.
  • Reading the JWT via the codex_login crate from a Rust dep: heavyweight for shell tooling.

Additional information

No response

extent analysis

TL;DR

Add a --json flag to codex login status to output structured information, including the ChatGPT plan tier.

Guidance

  • Review the run_login_status function to determine the best way to surface the IdTokenInfo fields, including chatgpt_plan_type.
  • Consider the proposed JSON output format to ensure it meets the requirements of tooling that needs to know the user's plan.
  • Evaluate the claude auth status approach as a potential reference for implementing the --json flag.
  • Test the new flag with different authentication modes and plan types to ensure correct output.

Example

No code snippet is provided as the issue does not contain sufficient information to generate a specific example.

Notes

The solution relies on modifying the codex login status command to include a --json flag, which may require changes to the run_login_status function and potentially other parts of the codebase.

Recommendation

Apply workaround: Add the proposed --json flag to codex login status to provide a more robust and maintainable way to access the ChatGPT plan tier information.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix feature request: codex login status expose plan tier and add --json output [1 participants]