@loongphy/codex-auth 0.3.0-alpha.9 → 0.3.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 +12 -17
- package/bin/codex-auth.js +1 -20
- package/package.json +7 -10
package/README.md
CHANGED
|
@@ -47,21 +47,6 @@ After that, you can use `codex-auth login`, or `codex-auth login --device-auth`
|
|
|
47
47
|
|
|
48
48
|
Detailed command documentation lives in [docs/commands/README.md](./docs/commands/README.md).
|
|
49
49
|
|
|
50
|
-
> [!NOTE]
|
|
51
|
-
> This documentation is based on **v0.3.x**. Some commands described here may not be available in the current release.
|
|
52
|
-
>
|
|
53
|
-
> To try the latest features, please install the alpha version via:
|
|
54
|
-
>
|
|
55
|
-
> ```bash
|
|
56
|
-
> npm install -g @loongphy/codex-auth@next
|
|
57
|
-
> ```
|
|
58
|
-
>
|
|
59
|
-
> If you want to downgrade to **v0.2.x**, you may need to manually update the `~/.codex/accounts/registry.json`:
|
|
60
|
-
>
|
|
61
|
-
> ```json
|
|
62
|
-
> "schema_version": 4
|
|
63
|
-
> ```
|
|
64
|
-
|
|
65
50
|
### Account Management
|
|
66
51
|
|
|
67
52
|
| Command | Description |
|
|
@@ -73,6 +58,8 @@ Detailed command documentation lives in [docs/commands/README.md](./docs/command
|
|
|
73
58
|
| [`codex-auth remove [--live] [--api\|--skip-api]`](./docs/commands/remove.md) | Remove accounts interactively |
|
|
74
59
|
| [`codex-auth remove <query> [<query>...]`](./docs/commands/remove.md) | Remove accounts by selector |
|
|
75
60
|
| [`codex-auth remove --all`](./docs/commands/remove.md) | Remove all stored accounts |
|
|
61
|
+
| [`codex-auth alias set <query> <alias>`](./docs/commands/alias.md) | Set an alias for an account |
|
|
62
|
+
| [`codex-auth alias clear <query>`](./docs/commands/alias.md) | Clear the alias for an account |
|
|
76
63
|
|
|
77
64
|
### Import and Maintenance
|
|
78
65
|
|
|
@@ -156,6 +143,10 @@ Verify with:
|
|
|
156
143
|
codex exec "say hello"
|
|
157
144
|
```
|
|
158
145
|
|
|
146
|
+
## Build a GUI with JSON
|
|
147
|
+
|
|
148
|
+
If you are building a GUI on top of the current `codex-auth` client, use the supported `--json` command variants to receive machine-readable results. See the [JSON API documentation](./docs/json-api.md) for supported commands and the compatibility contract.
|
|
149
|
+
|
|
159
150
|
## Disclaimer
|
|
160
151
|
|
|
161
152
|
This project is provided as-is and use is at your own risk.
|
|
@@ -163,8 +154,12 @@ This project is provided as-is and use is at your own risk.
|
|
|
163
154
|
**Usage Data Refresh Source:**
|
|
164
155
|
`codex-auth` supports two sources for refreshing account usage/usage limit information:
|
|
165
156
|
|
|
166
|
-
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.
|
|
157
|
+
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. `curl` must be available at runtime.
|
|
167
158
|
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.
|
|
168
159
|
|
|
169
160
|
**API Call Declaration:**
|
|
170
|
-
By using the default API-backed refresh, this tool will send your ChatGPT access token to OpenAI's servers
|
|
161
|
+
By using the default API-backed refresh, this tool will send your ChatGPT access token to OpenAI's servers for usage limit and team name refresh. The exact endpoints are:
|
|
162
|
+
- `GET https://chatgpt.com/backend-api/wham/usage`
|
|
163
|
+
- `GET https://chatgpt.com/backend-api/accounts`
|
|
164
|
+
|
|
165
|
+
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.js
CHANGED
|
@@ -10,21 +10,6 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
12
|
const rootPackageJsonPath = path.join(__dirname, "..", "package.json");
|
|
13
|
-
const requiredNodeMajor = 22;
|
|
14
|
-
|
|
15
|
-
function ensureSupportedNodeVersion() {
|
|
16
|
-
const major = Number(process.versions?.node?.split(".")[0] ?? 0);
|
|
17
|
-
if (Number.isInteger(major) && major >= requiredNodeMajor) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
console.error(
|
|
22
|
-
`Node.js ${requiredNodeMajor}+ is required to run @loongphy/codex-auth. Current version: ${process.version}.`
|
|
23
|
-
);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
ensureSupportedNodeVersion();
|
|
28
13
|
|
|
29
14
|
const packageMap = {
|
|
30
15
|
"linux:x64": "@loongphy/codex-auth-linux-x64",
|
|
@@ -92,11 +77,7 @@ function resolveBinary() {
|
|
|
92
77
|
|
|
93
78
|
const binaryPath = resolveBinary();
|
|
94
79
|
const child = spawnSync(binaryPath, process.argv.slice(2), {
|
|
95
|
-
stdio: "inherit"
|
|
96
|
-
env: {
|
|
97
|
-
...process.env,
|
|
98
|
-
CODEX_AUTH_NODE_EXECUTABLE: process.execPath
|
|
99
|
-
}
|
|
80
|
+
stdio: "inherit"
|
|
100
81
|
});
|
|
101
82
|
|
|
102
83
|
if (child.error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loongphy/codex-auth",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
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.
|
|
25
|
-
"@loongphy/codex-auth-linux-arm64": "0.3.
|
|
26
|
-
"@loongphy/codex-auth-darwin-x64": "0.3.
|
|
27
|
-
"@loongphy/codex-auth-darwin-arm64": "0.3.
|
|
28
|
-
"@loongphy/codex-auth-win32-x64": "0.3.
|
|
29
|
-
"@loongphy/codex-auth-win32-arm64": "0.3.
|
|
24
|
+
"@loongphy/codex-auth-linux-x64": "0.3.1",
|
|
25
|
+
"@loongphy/codex-auth-linux-arm64": "0.3.1",
|
|
26
|
+
"@loongphy/codex-auth-darwin-x64": "0.3.1",
|
|
27
|
+
"@loongphy/codex-auth-darwin-arm64": "0.3.1",
|
|
28
|
+
"@loongphy/codex-auth-win32-x64": "0.3.1",
|
|
29
|
+
"@loongphy/codex-auth-win32-arm64": "0.3.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"check:versions": "node scripts/npm/check-versions.mjs",
|
|
@@ -35,8 +35,5 @@
|
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=22"
|
|
41
38
|
}
|
|
42
39
|
}
|