@loongphy/codex-auth 0.3.0-alpha.6 → 0.3.0-alpha.8

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 +58 -44
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -4,27 +4,6 @@
4
4
 
5
5
  `codex-auth` is a command-line tool for switching Codex accounts.
6
6
 
7
- > [!IMPORTANT]
8
- > For **Codex CLI** and **Codex App** users, switch accounts, then restart the client for the new account to take effect.
9
- >
10
- > If you use the CLI and want seamless automatic account switching without restarting, use the forked [`codext`](https://github.com/Loongphy/codext), an enhanced Codex CLI. Install it with `npm i -g @loongphy/codext` and run `codext`.
11
-
12
- ## Supported Platforms
13
-
14
- `codex-auth` works with these Codex clients:
15
-
16
- - Codex CLI
17
- - VS Code extension
18
- - Codex App
19
-
20
- For the best experience, install the Codex CLI even if you mainly use the VS Code extension or the App, because it makes adding accounts easier:
21
-
22
- ```shell
23
- npm install -g @openai/codex
24
- ```
25
-
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
-
28
7
  ## Install
29
8
 
30
9
  Install with npm:
@@ -33,24 +12,37 @@ Install with npm:
33
12
  npm install -g @loongphy/codex-auth
34
13
  ```
35
14
 
36
- You can also run it without a global install:
15
+ You can also run it without a global install:
37
16
 
38
17
  ```shell
39
18
  npx @loongphy/codex-auth list
40
19
  ```
41
20
 
42
- npm packages currently support Linux x64, Linux arm64, macOS x64, macOS arm64, Windows x64, and Windows arm64.
21
+ ## Supported Platforms
43
22
 
44
- ### Uninstall
23
+ `codex-auth` works with these Codex clients:
45
24
 
46
- #### npm
25
+ - Codex CLI
26
+ - VS Code extension
27
+ - Codex App
47
28
 
48
- Remove the npm package:
29
+ > [!IMPORTANT]
30
+ > For **Codex CLI** and **Codex App** users, switch accounts, then restart the client for the new account to take effect.
31
+ >
32
+ > If you want seamless automatic account switching without restarting, use the forked [`codext`](https://github.com/Loongphy/codext), an enhanced Codex CLI.
33
+ >
34
+ > Install it with `npm i -g @loongphy/codext` and run `codext`.
35
+ >
36
+ > Codex App users can use `codex-auth app`, but it is not stable. See [Details](#codex-app).
37
+
38
+ Install the Codex CLI even if you mainly use the VS Code extension or the App, because it makes adding accounts easier:
49
39
 
50
40
  ```shell
51
- npm uninstall -g @loongphy/codex-auth
41
+ npm install -g @openai/codex
52
42
  ```
53
43
 
44
+ After that, you can use `codex-auth login`, or `codex-auth login --device-auth` to sign in and add accounts more easily.
45
+
54
46
  ## Commands
55
47
 
56
48
  Detailed command documentation lives in [docs/commands/README.md](./docs/commands/README.md).
@@ -59,14 +51,13 @@ Detailed command documentation lives in [docs/commands/README.md](./docs/command
59
51
 
60
52
  | Command | Description |
61
53
  |---------|-------------|
62
- | [`codex-auth list [--live] [--api\|--skip-api]`](./docs/commands/list.md) | List stored accounts and usage state |
54
+ | [`codex-auth list [--live] [--active] [--api\|--skip-api]`](./docs/commands/list.md) | List stored accounts and usage state |
63
55
  | [`codex-auth login [--device-auth]`](./docs/commands/login.md) | Run `codex login`, then add the current account |
64
56
  | [`codex-auth switch [--live] [--api\|--skip-api]`](./docs/commands/switch.md) | Switch the active account interactively |
65
57
  | [`codex-auth switch <query>`](./docs/commands/switch.md) | Switch directly by row number or account selector |
66
58
  | [`codex-auth remove [--live] [--api\|--skip-api]`](./docs/commands/remove.md) | Remove accounts interactively |
67
59
  | [`codex-auth remove <query> [<query>...]`](./docs/commands/remove.md) | Remove accounts by selector |
68
60
  | [`codex-auth remove --all`](./docs/commands/remove.md) | Remove all stored accounts |
69
- | [`codex-auth status`](./docs/commands/status.md) | Show auto-switch, service, and usage status |
70
61
 
71
62
  ### Import and Maintenance
72
63
 
@@ -83,44 +74,67 @@ Detailed command documentation lives in [docs/commands/README.md](./docs/command
83
74
 
84
75
  | Command | Description |
85
76
  |---------|-------------|
86
- | [`codex-auth config auto enable\|disable`](./docs/commands/config.md) | Enable or disable background auto-switching |
87
- | [`codex-auth config auto --5h <percent> [--weekly <percent>]`](./docs/commands/config.md) | Configure background auto-switch thresholds |
88
- | [`codex-auth config api enable\|disable`](./docs/commands/config.md) | Enable or disable default API-backed refresh |
77
+ | [`codex-auth config live --interval <seconds>`](./docs/commands/config.md) | Configure live TUI refresh interval |
89
78
 
90
79
  ## Quick Examples
91
80
 
92
81
  ```shell
93
82
  codex-auth list
83
+ codex-auth list --active
94
84
  codex-auth switch
95
85
  codex-auth switch 02
96
86
  codex-auth remove work
97
87
  codex-auth import /path/to/auth.json --alias personal
98
- codex-auth config api disable
99
- codex-auth status
88
+ codex-auth list --skip-api
89
+ ```
90
+
91
+ ## Codex App
92
+
93
+ > [!IMPORTANT]
94
+ > The `app` command is **experimental** and may never become a stable feature.
95
+ >
96
+ > It is designed to enable seamless account switching without restarting the Codex App. By leveraging the `CODEX_CLI_PATH` environment variable, it dynamically injects our managed codext CLI to handle authentication on the fly.
97
+ >
98
+ > The `app` command is constrained by ongoing changes in the official Codex App and [Codex CLI](https://github.com/openai/codex). It may not always take effect and may also break your app.
99
+
100
+ | Command | Description |
101
+ |---------|-------------|
102
+ | [`codex-auth app [--id <id>] [--codex-cli-path <path>]`](./docs/commands/app.md) | Experimental: launch Codex App with detected defaults, CODEX_HOME, CODEX_CLI_PATH, and platform overrides |
103
+
104
+ Support seamless account switching including:
105
+
106
+ - New Chat
107
+ - Restoring or resuming an existing conversation
108
+ - Continuing a previously completed, interrupted, or manually stopped conversation
109
+
110
+ ### Uninstall
111
+
112
+ Remove the npm package:
113
+
114
+ ```shell
115
+ npm uninstall -g @loongphy/codex-auth
100
116
  ```
101
117
 
102
118
  ## Q&A
103
119
 
104
120
  ### Why is my usage limit not refreshing?
105
121
 
106
- 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.
122
+ API-backed refresh is the default. When you pass `--skip-api`, `codex-auth` reads the newest `~/.codex/sessions/**/rollout-*.jsonl` file instead. 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.
107
123
 
108
124
  - Upstream Codex issue: [openai/codex#14880](https://github.com/openai/codex/issues/14880)
109
125
 
110
- You can switch usage limit refresh to the usage API with:
126
+ Run the API-backed default with:
111
127
 
112
128
  ```shell
113
- codex-auth config api enable
129
+ codex-auth list
114
130
  ```
115
131
 
116
- Then confirm the current mode with:
132
+ Run one local-only command with:
117
133
 
118
134
  ```shell
119
- codex-auth status
135
+ codex-auth list --skip-api
120
136
  ```
121
137
 
122
- `status` should show `usage: api`.
123
-
124
138
  Verify with:
125
139
 
126
140
  ```shell
@@ -134,8 +148,8 @@ This project is provided as-is and use is at your own risk.
134
148
  **Usage Data Refresh Source:**
135
149
  `codex-auth` supports two sources for refreshing account usage/usage limit information:
136
150
 
137
- 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. npm installs already satisfy the runtime requirement.
138
- 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.
151
+ 1. **API (default):** 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. npm installs already satisfy the runtime requirement.
152
+ 2. **Local-only:** With per-command `--skip-api`, 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.
139
153
 
140
154
  **API Call Declaration:**
141
- 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.
155
+ By using the default API-backed refresh, 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.3.0-alpha.6",
3
+ "version": "0.3.0-alpha.8",
4
4
  "type": "module",
5
5
  "description": "CLI for switching Codex accounts",
6
6
  "license": "MIT",
@@ -21,12 +21,12 @@
21
21
  "README.md"
22
22
  ],
23
23
  "optionalDependencies": {
24
- "@loongphy/codex-auth-linux-x64": "0.3.0-alpha.6",
25
- "@loongphy/codex-auth-linux-arm64": "0.3.0-alpha.6",
26
- "@loongphy/codex-auth-darwin-x64": "0.3.0-alpha.6",
27
- "@loongphy/codex-auth-darwin-arm64": "0.3.0-alpha.6",
28
- "@loongphy/codex-auth-win32-x64": "0.3.0-alpha.6",
29
- "@loongphy/codex-auth-win32-arm64": "0.3.0-alpha.6"
24
+ "@loongphy/codex-auth-linux-x64": "0.3.0-alpha.8",
25
+ "@loongphy/codex-auth-linux-arm64": "0.3.0-alpha.8",
26
+ "@loongphy/codex-auth-darwin-x64": "0.3.0-alpha.8",
27
+ "@loongphy/codex-auth-darwin-arm64": "0.3.0-alpha.8",
28
+ "@loongphy/codex-auth-win32-x64": "0.3.0-alpha.8",
29
+ "@loongphy/codex-auth-win32-arm64": "0.3.0-alpha.8"
30
30
  },
31
31
  "scripts": {
32
32
  "check:versions": "node scripts/npm/check-versions.mjs",