@loongphy/codex-auth-linux-arm64 0.2.3-alpha.3
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/LICENSE +21 -0
- package/README.md +314 -0
- package/bin/codex-auth +0 -0
- package/package.json +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-PRESENT Loongphy<https://github.com/loongphy>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# Codex Auth
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
`codex-auth` is a command-line tool for switching Codex accounts.
|
|
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
|
+
## Install
|
|
29
|
+
|
|
30
|
+
Install with npm:
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
npm install -g @loongphy/codex-auth
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can also run it without a global install:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
npx @loongphy/codex-auth list
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
npm packages currently support Linux x64, Linux arm64, macOS x64, macOS arm64, Windows x64, and Windows arm64.
|
|
43
|
+
|
|
44
|
+
> [!NOTE]
|
|
45
|
+
> If you only installed `@loongphy/codex-auth` with npm, you do not need any legacy cleanup steps.
|
|
46
|
+
> Older Bash/PowerShell GitHub-release installs could leave a standalone `codex-auth` binary outside npm's install path.
|
|
47
|
+
> If you previously used those legacy installers, remove the leftover binaries and profile changes during migration.
|
|
48
|
+
> API-backed usage refresh and team-name refresh use Node.js `fetch`.
|
|
49
|
+
> npm installs already satisfy that requirement.
|
|
50
|
+
> Legacy standalone binary installs need Node.js 18+ on `PATH` when `codex-auth config api enable` is used.
|
|
51
|
+
|
|
52
|
+
### Uninstall
|
|
53
|
+
|
|
54
|
+
#### npm
|
|
55
|
+
|
|
56
|
+
Remove the npm package:
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
npm uninstall -g @loongphy/codex-auth
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Legacy Bash Installer
|
|
63
|
+
|
|
64
|
+
For non-npm installs on Linux/macOS/WSL2 only:
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
rm -f ~/.local/bin/codex-auth
|
|
68
|
+
rm -f ~/.local/bin/codex-auth-auto
|
|
69
|
+
sed -i '/# Added by codex-auth installer/,+1d' ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc ~/.zprofile 2>/dev/null || true
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If you used fish, also remove the old profile entry:
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
sed -i '/# Added by codex-auth installer/,+3d' ~/.config/fish/config.fish 2>/dev/null || true
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Legacy PowerShell Installer
|
|
79
|
+
|
|
80
|
+
For non-npm installs on Windows only:
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth.exe" -Force -ErrorAction SilentlyContinue
|
|
84
|
+
Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -ErrorAction SilentlyContinue
|
|
85
|
+
[Environment]::SetEnvironmentVariable(
|
|
86
|
+
"Path",
|
|
87
|
+
(($env:Path -split ';' | Where-Object { $_ -and $_ -ne "$env:LOCALAPPDATA\codex-auth\bin" }) -join ';'),
|
|
88
|
+
"User"
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Commands
|
|
93
|
+
|
|
94
|
+
### Account Management
|
|
95
|
+
|
|
96
|
+
| Command | Description |
|
|
97
|
+
|---------|-------------|
|
|
98
|
+
| `codex-auth list` | List all accounts |
|
|
99
|
+
| `codex-auth login [--device-auth]` | Run `codex login` (optionally with `--device-auth`), then add the current account |
|
|
100
|
+
| `codex-auth switch [<email>]` | Switch active account interactively or by partial match |
|
|
101
|
+
| `codex-auth remove` | Remove accounts with interactive multi-select |
|
|
102
|
+
| `codex-auth status` | Show auto-switch, service, and usage status |
|
|
103
|
+
|
|
104
|
+
### Import
|
|
105
|
+
|
|
106
|
+
| Command | Description |
|
|
107
|
+
|---------|-------------|
|
|
108
|
+
| `codex-auth import <path> [--alias <alias>]` | Import a single file or batch import from a folder |
|
|
109
|
+
| `codex-auth import --cpa [<path>]` | Import [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) (CPA) token JSON |
|
|
110
|
+
| `codex-auth import --purge [<path>]` | Rebuild `registry.json` from existing auth files |
|
|
111
|
+
|
|
112
|
+
### Configuration
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `codex-auth config auto enable\|disable` | Enable or disable background auto-switching |
|
|
117
|
+
| `codex-auth config auto [--5h <%>] [--weekly <%>]` | Set auto-switch thresholds |
|
|
118
|
+
| `codex-auth config api enable\|disable` | Enable or disable both usage refresh and team name refresh API calls |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Examples
|
|
123
|
+
|
|
124
|
+
### List Accounts
|
|
125
|
+
|
|
126
|
+
```shell
|
|
127
|
+
codex-auth list
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Switch Account
|
|
131
|
+
|
|
132
|
+
Interactive: shows email, 5h, weekly, and last activity.
|
|
133
|
+
|
|
134
|
+
```shell
|
|
135
|
+
codex-auth switch
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Before the picker opens, the current active account's usage is refreshed once so the selected row is not stale. The newly selected account is not refreshed after the switch completes.
|
|
139
|
+
|
|
140
|
+

|
|
141
|
+
|
|
142
|
+
Non-interactive: fuzzy match by email or alias.
|
|
143
|
+
|
|
144
|
+
```shell
|
|
145
|
+
codex-auth switch john # match any account containing "john"
|
|
146
|
+
codex-auth switch john@gmail.com # match by full or partial email
|
|
147
|
+
codex-auth switch work # match by alias set during import
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
If the keyword matches multiple accounts, the command falls back to interactive selection. Press `q` to quit without switching.
|
|
151
|
+
|
|
152
|
+
### Remove Accounts
|
|
153
|
+
|
|
154
|
+
```shell
|
|
155
|
+
codex-auth remove
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Login (Add Account)
|
|
159
|
+
|
|
160
|
+
Add the currently logged-in Codex account:
|
|
161
|
+
|
|
162
|
+
```shell
|
|
163
|
+
codex-auth login
|
|
164
|
+
codex-auth login --device-auth
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Import
|
|
168
|
+
|
|
169
|
+
#### Single File
|
|
170
|
+
|
|
171
|
+
```shell
|
|
172
|
+
codex-auth import /path/to/auth.json --alias personal
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Batch Import from a Folder
|
|
176
|
+
|
|
177
|
+
Scans all `.json` files in the directory:
|
|
178
|
+
|
|
179
|
+
```shell
|
|
180
|
+
codex-auth import /path/to/auth-exports
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Typical output:
|
|
184
|
+
|
|
185
|
+
```text
|
|
186
|
+
Scanning /path/to/auth-exports...
|
|
187
|
+
✓ imported token_ryan.taylor.alpha@email.com
|
|
188
|
+
✓ updated token_jane.smith.alpha@email.com
|
|
189
|
+
✗ skipped token_invalid: MalformedJson
|
|
190
|
+
Import Summary: 1 imported, 1 updated, 1 skipped (total 3 files)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`stdout` carries scanning, success, and summary lines. Skipped files and warnings stay on `stderr`.
|
|
194
|
+
|
|
195
|
+
#### Import CLIProxyAPI (CPA) Tokens
|
|
196
|
+
|
|
197
|
+
[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) stores tokens as flat JSON under `~/.cli-proxy-api/`. Import them directly without conversion:
|
|
198
|
+
|
|
199
|
+
```shell
|
|
200
|
+
codex-auth import --cpa # scan default ~/.cli-proxy-api/*.json
|
|
201
|
+
codex-auth import --cpa /path/to/cpa-dir # scan a specific directory
|
|
202
|
+
codex-auth import --cpa /path/to/token.json --alias bob # import a single CPA file
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### Fix Broken Account Data (Rebuild Registry)
|
|
206
|
+
|
|
207
|
+
If `codex-auth list` shows missing accounts or wrong usage data, the internal registry file may be out of sync with the actual auth files on disk. This command re-reads all auth files and rebuilds the registry from scratch:
|
|
208
|
+
|
|
209
|
+
```shell
|
|
210
|
+
codex-auth import --purge # rebuild from ~/.codex/accounts/*.auth.json
|
|
211
|
+
codex-auth import --purge /path/to/auth-exports # rebuild from a specific folder
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
This does not import new files. It repairs the registry index for auth snapshots that already exist on disk.
|
|
215
|
+
|
|
216
|
+
### Show Status
|
|
217
|
+
|
|
218
|
+
```shell
|
|
219
|
+
codex-auth status
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Config
|
|
223
|
+
|
|
224
|
+
#### Auto-Switch
|
|
225
|
+
|
|
226
|
+
Enable or disable:
|
|
227
|
+
|
|
228
|
+
```shell
|
|
229
|
+
codex-auth config auto enable
|
|
230
|
+
codex-auth config auto disable
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
`config auto enable` prints the current usage mode after installing the watcher, so you can immediately see whether auto-switch is running with default API-backed usage or local-only fallback semantics.
|
|
234
|
+
|
|
235
|
+
Adjust thresholds:
|
|
236
|
+
|
|
237
|
+
```shell
|
|
238
|
+
codex-auth config auto --5h 12
|
|
239
|
+
codex-auth config auto --5h 12 --weekly 8
|
|
240
|
+
codex-auth config auto --weekly 8
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
When auto-switching is enabled, a long-running background watcher refreshes the active account's usage and silently switches accounts when:
|
|
244
|
+
|
|
245
|
+
- 5h remaining drops below the configured 5h threshold (default `10%`), or
|
|
246
|
+
- weekly remaining drops below the configured weekly threshold (default `5%`)
|
|
247
|
+
|
|
248
|
+
The managed background worker is long-running on all supported platforms:
|
|
249
|
+
|
|
250
|
+
- Linux/WSL: persistent `systemd --user` service
|
|
251
|
+
- macOS: `LaunchAgent`
|
|
252
|
+
- Windows: scheduled task that launches the long-running helper at logon, restarts it after failures, has no 72-hour execution cap, and also starts it immediately on enable
|
|
253
|
+
|
|
254
|
+
#### Usage Refresh Source
|
|
255
|
+
|
|
256
|
+
API-backed fallback:
|
|
257
|
+
|
|
258
|
+
```shell
|
|
259
|
+
codex-auth config api enable
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Local-only, no usage API calls:
|
|
263
|
+
|
|
264
|
+
```shell
|
|
265
|
+
codex-auth config api disable
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Changing `config api` updates `registry.json` immediately. `api enable` is shown as API mode and `api disable` is shown as local mode.
|
|
269
|
+
|
|
270
|
+
## Q&A
|
|
271
|
+
|
|
272
|
+
### Why is my usage limit not refreshing?
|
|
273
|
+
|
|
274
|
+
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.
|
|
275
|
+
|
|
276
|
+
- Upstream Codex issue: [openai/codex#14880](https://github.com/openai/codex/issues/14880)
|
|
277
|
+
|
|
278
|
+
You can switch usage limit refresh to the usage API with:
|
|
279
|
+
|
|
280
|
+
```shell
|
|
281
|
+
codex-auth config api enable
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Then confirm the current mode with:
|
|
285
|
+
|
|
286
|
+
```shell
|
|
287
|
+
codex-auth status
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
`status` should show `usage: api`.
|
|
291
|
+
|
|
292
|
+
Upgrade notes:
|
|
293
|
+
|
|
294
|
+
- If you are upgrading from `v0.1.x` to the latest `v0.2.x`, API usage refresh is enabled by default.
|
|
295
|
+
- 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
|
+
|
|
297
|
+
Verify with:
|
|
298
|
+
|
|
299
|
+
```shell
|
|
300
|
+
codex exec "say hello"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Disclaimer
|
|
304
|
+
|
|
305
|
+
This project is provided as-is and use is at your own risk.
|
|
306
|
+
|
|
307
|
+
**Usage Data Refresh Source:**
|
|
308
|
+
`codex-auth` supports two sources for refreshing account usage/usage limit information:
|
|
309
|
+
|
|
310
|
+
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.
|
|
311
|
+
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.
|
|
312
|
+
|
|
313
|
+
**API Call Declaration:**
|
|
314
|
+
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/bin/codex-auth
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loongphy/codex-auth-linux-arm64",
|
|
3
|
+
"version": "0.2.3-alpha.3",
|
|
4
|
+
"description": "@loongphy/codex-auth binary for linux arm64",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Loongphy/codex-auth"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/Loongphy/codex-auth",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Loongphy/codex-auth/issues"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"linux"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"arm64"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"bin/",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|