@loongphy/codex-auth 0.2.0 → 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 +71 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -103,6 +103,18 @@ Batch import from a folder:
|
|
|
103
103
|
codex-auth import /path/to/auth-exports
|
|
104
104
|
```
|
|
105
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
|
+
|
|
106
118
|
Rebuild `registry.json` from imported auth files:
|
|
107
119
|
|
|
108
120
|
```shell
|
|
@@ -177,15 +189,71 @@ Changing thresholds updates `registry.json`; Linux/WSL and Windows pick them up
|
|
|
177
189
|
Changing `config api` updates `registry.json` immediately; `api enable` means API-only and `api disable` means local-sessions-only.
|
|
178
190
|
`codex-auth help` also shows whether auto-switching and usage API calls are currently enabled.
|
|
179
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
|
+
|
|
180
248
|
## Disclaimer
|
|
181
249
|
|
|
182
250
|
This project is provided as-is and use is at your own risk.
|
|
183
251
|
|
|
184
252
|
**Usage Data Refresh Source:**
|
|
185
|
-
`codex-auth` supports two sources for refreshing account usage/
|
|
253
|
+
`codex-auth` supports two sources for refreshing account usage/usage limit information:
|
|
186
254
|
|
|
187
|
-
1. **
|
|
188
|
-
2. **
|
|
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.
|
|
189
257
|
|
|
190
258
|
**API Call Declaration:**
|
|
191
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loongphy/codex-auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CLI for switching Codex accounts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@loongphy/codex-auth-linux-x64": "0.2.
|
|
24
|
-
"@loongphy/codex-auth-darwin-x64": "0.2.
|
|
25
|
-
"@loongphy/codex-auth-darwin-arm64": "0.2.
|
|
26
|
-
"@loongphy/codex-auth-win32-x64": "0.2.
|
|
23
|
+
"@loongphy/codex-auth-linux-x64": "0.2.1",
|
|
24
|
+
"@loongphy/codex-auth-darwin-x64": "0.2.1",
|
|
25
|
+
"@loongphy/codex-auth-darwin-arm64": "0.2.1",
|
|
26
|
+
"@loongphy/codex-auth-win32-x64": "0.2.1"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"check:versions": "node scripts/npm/check-versions.mjs",
|