The auth.json file has been generated, but after upgrading sub2api to the latest version, where can I select the Agent Identity mode? Selecting “Import” under “Account Management” results in an error.
No, CPA currently does not support it.
Need to choose a proxy.
Let me translate it: Step 1: Change .txt to .py (optional but recommended)
The file contains Python code. The .txt extension doesn’t affect execution, but changing it to .py makes things clearer:
copy codex_agent.txt codex_agent.py
(The commands below use codex_agent.py; if you don’t rename it, replace codex_agent.py in the commands with codex_agent.txt and it will work just the same.)
Step 2: Obtain the accessToken (important)
The script requires a ChatGPT session JWT. Here’s how to get it:
- Log in at https://chatgpt.com in your browser
- Open a new tab in the same browser and visit:
https://chatgpt.com/api/auth/session - The page will return a JSON object. Find the
"accessToken": "eyJhbGci...."field - Copy the long value of accessToken (it starts with eyJ)
▎ This token expires after a certain period (usually a few hours). Once it expires, revisit the URL above to obtain a new one.
Step 3: Run the script
There are three methods; choose any one.
Method A — Pass the token directly (simplest):
python codex_agent.py --token “eyJhbGci…the long value you copied”
Method B — Enter it interactively (to keep the token out of your command history; more secure):
python codex_agent.py
After running it, paste the token when prompted and press Enter.
Method C — Read it from a JSON file:
Save the entire session JSON from Step 2 as session.json, then run:
python codex_agent.py --file session.json
Common optional arguments:
- -o F:\path\auth.json Specify the output location (default: auth.json in the current directory)
- –no-verify Skip the task verification step (useful when network access is restricted)
Step 4: Check the output
Normally, the script will print color-coded Step 1–5 logs:
- Step 1 Decode account_id / email / plan_type
- Step 2 Generate a key pair
- Step 3 Register the agent and obtain agent_runtime_id
- Step 4 Verify the task (failure is only a WARN and does not affect the result)
- Step 5 Saved to …/auth.json ← success indicator
The generated auth.json is the credential file for Codex CLI.
I don’t understand it, but it seems impressive.
How should I use the generated auth.json? Importing it directly into sub2api seems to result in the error shown in the image.
Okay, that’s awesome.
Everyone, take a look at this expert’s approach.
Bookmarking this.
It worked—it’s indeed usable.
Thanks, it works perfect …
Can it be used for free again?
Hey, where is this saved by default?
It’s in the same directory as your .py file.
That’s strange—it’s not there.
I set up a local proxy in CMD, then enabled global mode in V2. I launched PY from CMD but didn’t know where it was saved by default. Specifying an output directory worked—thanks, boss!
It’s a bit difficult—I don’t really know how to do it!!
Awesome, keep learning.


