@loongphy/codex-auth-linux-x64 0.2.0-alpha.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,27 +60,6 @@ irm https://raw.githubusercontent.com/loongphy/codex-auth/main/scripts/install.p
60
60
  The installer adds the install dir to current/user `PATH` by default.
61
61
  Use `-NoAddToPath` to skip user `PATH` persistence.
62
62
 
63
- ## Upgrade
64
-
65
- If you are upgrading from any `v0.1.x` release to `v0.2.0`, back up these files first to avoid data loss:
66
-
67
- - Always back up `~/.codex/auth.json`
68
- - If you have already used `codex-auth`, also back up `~/.codex/accounts/`
69
-
70
- Then complete these steps:
71
-
72
- 1. Install the latest `v0.2.0` release:
73
-
74
- ```shell
75
- npm install -g @loongphy/codex-auth@latest
76
- ```
77
-
78
- 1. Enable API-based usage refresh if needed (see the Disclaimer for more details):
79
-
80
- ```shell
81
- codex-auth config api enable
82
- ```
83
-
84
63
  ## Full Commands
85
64
 
86
65
  ```shell
@@ -124,6 +103,18 @@ Batch import from a folder:
124
103
  codex-auth import /path/to/auth-exports
125
104
  ```
126
105
 
106
+ Typical batch import output:
107
+
108
+ ```text
109
+ Scanning /path/to/auth-exports...
110
+ ✓ imported token_ryan.taylor.alpha@email.com
111
+ ✓ updated token_jane.smith.alpha@email.com
112
+ ✗ skipped token_invalid: MalformedJson
113
+ Import Summary: 1 imported, 1 updated, 1 skipped (total 3 files)
114
+ ```
115
+
116
+ `stdout` carries scanning/success/summary lines. Skipped files and warnings stay on `stderr`.
117
+
127
118
  Rebuild `registry.json` from imported auth files:
128
119
 
129
120
  ```shell
@@ -198,15 +189,71 @@ Changing thresholds updates `registry.json`; Linux/WSL and Windows pick them up
198
189
  Changing `config api` updates `registry.json` immediately; `api enable` means API-only and `api disable` means local-sessions-only.
199
190
  `codex-auth help` also shows whether auto-switching and usage API calls are currently enabled.
200
191
 
192
+ ## Q&A
193
+
194
+ ### Why is my usage limit not refreshing?
195
+
196
+ If `codex-auth` is using local-only usage refresh, it reads the newest `~/.codex/sessions/**/rollout-*.jsonl` file. Recent Codex builds often write `token_count` events with `rate_limits: null`. The local files may still contain older usable usage limit data, but in practice they can lag by several hours, so local-only refresh may show a usage limit snapshot from hours ago instead of your latest state.
197
+
198
+ - Upstream Codex issue: [openai/codex#14880](https://github.com/openai/codex/issues/14880)
199
+
200
+ You can switch usage limit refresh to the usage API with:
201
+
202
+ ```shell
203
+ codex-auth config api enable
204
+ ```
205
+
206
+ Then confirm the current mode with:
207
+
208
+ ```shell
209
+ codex-auth status
210
+ ```
211
+
212
+ `status` should show `usage: api`.
213
+
214
+ Upgrade notes:
215
+
216
+ - If you are upgrading from `v0.1.x` to the latest `v0.2.x`, API usage refresh is enabled by default.
217
+ - If you previously used an early `v0.2` prerelease/test build and `status` still shows `usage: local`, run `codex-auth config api enable` once to switch to API mode.
218
+
219
+ ### How to import tokens from cli-proxy-api?
220
+
221
+ If you have token files from `~/.cli-proxy-api/token*.json`, this repository includes a helper script that can convert them into a format codex-auth can read.
222
+
223
+ The script is not bundled in the published npm package, so run it from a clone of this repository:
224
+
225
+ ```shell
226
+ # Convert: ~/.cli-proxy-api → /tmp/tokens
227
+ python3 scripts/convert_tokens.sh
228
+
229
+ # Or specify custom directories
230
+ python3 scripts/convert_tokens.sh <source_dir> <output_dir>
231
+ ```
232
+
233
+ Then import and switch:
234
+
235
+ ```shell
236
+ codex-auth import /tmp/tokens/
237
+ codex-auth switch
238
+ ```
239
+
240
+ Verify with:
241
+
242
+ ```shell
243
+ codex exec "say hello"
244
+ ```
245
+
246
+ > **Output format:** Each converted file contains `auth_mode`, `OPENAI_API_KEY`, `tokens` (with `id_token`, `access_token`, `refresh_token`, `account_id`), and `last_refresh`. The `refresh_token` field is required for token refresh to work.
247
+
201
248
  ## Disclaimer
202
249
 
203
250
  This project is provided as-is and use is at your own risk.
204
251
 
205
252
  **Usage Data Refresh Source:**
206
- `codex-auth` supports two sources for refreshing account usage/quota information:
253
+ `codex-auth` supports two sources for refreshing account usage/usage limit information:
207
254
 
208
- 1. **Local (default):** Scans local `~/.codex/sessions/*/rollout-*.jsonl` files. This mode is strictly local.
209
- 2. **API:** When `config api enable` is on, the tool will make direct HTTPS requests to OpenAI's endpoints using your account's access token.
255
+ 1. **API (default):** When `config api enable` is on, the tool makes direct HTTPS requests to OpenAI's endpoints using your account's access token. This is the current default mode.
256
+ 2. **Local-only:** When `config api disable` is on, the tool scans local `~/.codex/sessions/*/rollout-*.jsonl` files without making API calls. This mode is safer, but it can be less accurate because recent Codex rollout files often contain `rate_limits: null`, so the latest local usage limit data may lag by several hours.
210
257
 
211
258
  **API Call Declaration:**
212
259
  By enabling API-based usage refresh, this tool will send your ChatGPT access token to OpenAI's servers (specifically `https://chatgpt.com/backend-api/wham/usage`) to fetch current quota information. This behavior may be detected by OpenAI and could violate their terms of service, potentially leading to account suspension or other risks. The decision to use this feature and any resulting consequences are entirely yours.
package/bin/codex-auth CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loongphy/codex-auth-linux-x64",
3
- "version": "0.2.0-alpha.1",
3
+ "version": "0.2.1",
4
4
  "description": "@loongphy/codex-auth binary for linux x64",
5
5
  "license": "MIT",
6
6
  "repository": {