feature request: codex login status expose plan tier and add --json output
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.jsondirectly: works but fragile and undocumented. - Reading the JWT via the
codex_logincrate from a Rust dep: heavyweight for shell tooling.
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗