@loongphy/codex-auth 0.2.2-alpha.4 → 0.2.3-alpha.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.
Files changed (2) hide show
  1. package/README.md +7 -42
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -23,7 +23,7 @@ For the best experience, install the Codex CLI even if you mainly use the VS Cod
23
23
  npm install -g @openai/codex
24
24
  ```
25
25
 
26
- After that, you can use `codex login` or `codex-auth login` to sign in and add accounts more easily.
26
+ After that, you can use `codex login`, `codex login --device-auth`, `codex-auth login`, or `codex-auth login --device-auth` to sign in and add accounts more easily.
27
27
 
28
28
  ## Install
29
29
 
@@ -93,13 +93,11 @@ Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -Error
93
93
  | Command | Description |
94
94
  |---------|-------------|
95
95
  | `codex-auth list` | List all accounts |
96
- | `codex-auth login` | Run `codex login`, then add the current account |
96
+ | `codex-auth login [--device-auth]` | Run `codex login` (optionally with `--device-auth`), then add the current account |
97
97
  | `codex-auth switch [<email>]` | Switch active account interactively or by partial match |
98
98
  | `codex-auth remove` | Remove accounts with interactive multi-select |
99
99
  | `codex-auth status` | Show auto-switch, service, and usage status |
100
100
 
101
- > `codex-auth add` is still accepted as a deprecated alias for `codex-auth login`.
102
-
103
101
  ### Import
104
102
 
105
103
  | Command | Description |
@@ -114,7 +112,7 @@ Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -Error
114
112
  |---------|-------------|
115
113
  | `codex-auth config auto enable\|disable` | Enable or disable background auto-switching |
116
114
  | `codex-auth config auto [--5h <%>] [--weekly <%>]` | Set auto-switch thresholds |
117
- | `codex-auth config api enable\|disable` | Use API-backed fallback or local-only usage refresh |
115
+ | `codex-auth config api enable\|disable` | Enable or disable both usage refresh and team name refresh API calls |
118
116
 
119
117
  ---
120
118
 
@@ -160,6 +158,7 @@ Add the currently logged-in Codex account:
160
158
 
161
159
  ```shell
162
160
  codex-auth login
161
+ codex-auth login --device-auth
163
162
  ```
164
163
 
165
164
  ### Import
@@ -265,8 +264,6 @@ codex-auth config api disable
265
264
 
266
265
  Changing `config api` updates `registry.json` immediately. `api enable` is shown as API mode and `api disable` is shown as local mode.
267
266
 
268
- Implementation details are documented in [`docs/auto-switch.md`](docs/auto-switch.md).
269
-
270
267
  ## Q&A
271
268
 
272
269
  ### Why is my usage limit not refreshing?
@@ -294,38 +291,6 @@ Upgrade notes:
294
291
  - If you are upgrading from `v0.1.x` to the latest `v0.2.x`, API usage refresh is enabled by default.
295
292
  - 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 back to API mode.
296
293
 
297
- ### How to import tokens from cli-proxy-api?
298
-
299
- 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.
300
-
301
- The CLI can also import the flat cli-proxy-api / CPA JSON files directly:
302
-
303
- ```shell
304
- codex-auth import --cpa # default source: ~/.cli-proxy-api
305
- codex-auth import --cpa /path/to/cpa-dir # scans direct child .json files
306
- ```
307
-
308
- Each CPA file is converted in memory to the standard auth snapshot shape before it is written into `~/.codex/accounts/`. Missing or empty `refresh_token` values are skipped as `MissingRefreshToken`.
309
-
310
- The script is not bundled in the published npm package, so run it from a clone of this repository:
311
-
312
- ```shell
313
- # Convert: ~/.cli-proxy-api → /tmp/tokens
314
- python3 scripts/convert_tokens.sh
315
-
316
- # Or specify custom directories
317
- python3 scripts/convert_tokens.sh <source_dir> <output_dir>
318
- ```
319
-
320
- Then import and switch:
321
-
322
- ```shell
323
- codex-auth import /tmp/tokens/
324
- # or import the CPA files directly without a conversion step
325
- codex-auth import --cpa
326
- codex-auth switch
327
- ```
328
-
329
294
  Verify with:
330
295
 
331
296
  ```shell
@@ -339,8 +304,8 @@ This project is provided as-is and use is at your own risk.
339
304
  **Usage Data Refresh Source:**
340
305
  `codex-auth` supports two sources for refreshing account usage/usage limit information:
341
306
 
342
- 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.
343
- 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.
307
+ 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 enables both usage refresh and team name refresh.
308
+ 2. **Local-only:** When `config api disable` is on, the tool scans local `~/.codex/sessions/*/rollout-*.jsonl` files for usage data and skips team name refresh 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.
344
309
 
345
310
  **API Call Declaration:**
346
- 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.
311
+ By enabling API(`codex-auth config api enable`), this tool will send your ChatGPT access token to OpenAI's servers, including `https://chatgpt.com/backend-api/wham/usage` for usage limit and `https://chatgpt.com/backend-api/accounts/check/v4-2023-04-27` for team name. 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.2-alpha.4",
3
+ "version": "0.2.3-alpha.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.2-alpha.4",
24
- "@loongphy/codex-auth-darwin-x64": "0.2.2-alpha.4",
25
- "@loongphy/codex-auth-darwin-arm64": "0.2.2-alpha.4",
26
- "@loongphy/codex-auth-win32-x64": "0.2.2-alpha.4"
23
+ "@loongphy/codex-auth-linux-x64": "0.2.3-alpha.1",
24
+ "@loongphy/codex-auth-darwin-x64": "0.2.3-alpha.1",
25
+ "@loongphy/codex-auth-darwin-arm64": "0.2.3-alpha.1",
26
+ "@loongphy/codex-auth-win32-x64": "0.2.3-alpha.1"
27
27
  },
28
28
  "scripts": {
29
29
  "check:versions": "node scripts/npm/check-versions.mjs",