@loongphy/codex-auth-linux-x64 0.3.0-alpha.7 → 0.3.0-alpha.9
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 +73 -44
- package/bin/codex-auth +0 -0
- package/package.json +1 -1
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,40 +12,67 @@ Install with npm:
|
|
|
33
12
|
npm install -g @loongphy/codex-auth
|
|
34
13
|
```
|
|
35
14
|
|
|
36
|
-
|
|
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
|
-
|
|
21
|
+
## Supported Platforms
|
|
43
22
|
|
|
44
|
-
|
|
23
|
+
`codex-auth` works with these Codex clients:
|
|
45
24
|
|
|
46
|
-
|
|
25
|
+
- Codex CLI
|
|
26
|
+
- VS Code extension
|
|
27
|
+
- Codex App
|
|
47
28
|
|
|
48
|
-
|
|
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
|
|
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).
|
|
57
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
|
+
|
|
58
65
|
### Account Management
|
|
59
66
|
|
|
60
67
|
| Command | Description |
|
|
61
68
|
|---------|-------------|
|
|
62
|
-
| [`codex-auth list [--live] [--api\|--skip-api]`](./docs/commands/list.md) | List stored accounts and usage state |
|
|
69
|
+
| [`codex-auth list [--live] [--active] [--api\|--skip-api]`](./docs/commands/list.md) | List stored accounts and usage state |
|
|
63
70
|
| [`codex-auth login [--device-auth]`](./docs/commands/login.md) | Run `codex login`, then add the current account |
|
|
64
71
|
| [`codex-auth switch [--live] [--api\|--skip-api]`](./docs/commands/switch.md) | Switch the active account interactively |
|
|
65
72
|
| [`codex-auth switch <query>`](./docs/commands/switch.md) | Switch directly by row number or account selector |
|
|
66
73
|
| [`codex-auth remove [--live] [--api\|--skip-api]`](./docs/commands/remove.md) | Remove accounts interactively |
|
|
67
74
|
| [`codex-auth remove <query> [<query>...]`](./docs/commands/remove.md) | Remove accounts by selector |
|
|
68
75
|
| [`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
76
|
|
|
71
77
|
### Import and Maintenance
|
|
72
78
|
|
|
@@ -83,44 +89,67 @@ Detailed command documentation lives in [docs/commands/README.md](./docs/command
|
|
|
83
89
|
|
|
84
90
|
| Command | Description |
|
|
85
91
|
|---------|-------------|
|
|
86
|
-
| [`codex-auth config
|
|
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 |
|
|
92
|
+
| [`codex-auth config live --interval <seconds>`](./docs/commands/config.md) | Configure live TUI refresh interval |
|
|
89
93
|
|
|
90
94
|
## Quick Examples
|
|
91
95
|
|
|
92
96
|
```shell
|
|
93
97
|
codex-auth list
|
|
98
|
+
codex-auth list --active
|
|
94
99
|
codex-auth switch
|
|
95
100
|
codex-auth switch 02
|
|
96
101
|
codex-auth remove work
|
|
97
102
|
codex-auth import /path/to/auth.json --alias personal
|
|
98
|
-
codex-auth
|
|
99
|
-
|
|
103
|
+
codex-auth list --skip-api
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Codex App
|
|
107
|
+
|
|
108
|
+
> [!IMPORTANT]
|
|
109
|
+
> The `app` command is **experimental** and may never become a stable feature.
|
|
110
|
+
>
|
|
111
|
+
> 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.
|
|
112
|
+
>
|
|
113
|
+
> 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.
|
|
114
|
+
|
|
115
|
+
| Command | Description |
|
|
116
|
+
|---------|-------------|
|
|
117
|
+
| [`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 |
|
|
118
|
+
|
|
119
|
+
Support seamless account switching including:
|
|
120
|
+
|
|
121
|
+
- New Chat
|
|
122
|
+
- Restoring or resuming an existing conversation
|
|
123
|
+
- Continuing a previously completed, interrupted, or manually stopped conversation
|
|
124
|
+
|
|
125
|
+
### Uninstall
|
|
126
|
+
|
|
127
|
+
Remove the npm package:
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
npm uninstall -g @loongphy/codex-auth
|
|
100
131
|
```
|
|
101
132
|
|
|
102
133
|
## Q&A
|
|
103
134
|
|
|
104
135
|
### Why is my usage limit not refreshing?
|
|
105
136
|
|
|
106
|
-
|
|
137
|
+
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
138
|
|
|
108
139
|
- Upstream Codex issue: [openai/codex#14880](https://github.com/openai/codex/issues/14880)
|
|
109
140
|
|
|
110
|
-
|
|
141
|
+
Run the API-backed default with:
|
|
111
142
|
|
|
112
143
|
```shell
|
|
113
|
-
codex-auth
|
|
144
|
+
codex-auth list
|
|
114
145
|
```
|
|
115
146
|
|
|
116
|
-
|
|
147
|
+
Run one local-only command with:
|
|
117
148
|
|
|
118
149
|
```shell
|
|
119
|
-
codex-auth
|
|
150
|
+
codex-auth list --skip-api
|
|
120
151
|
```
|
|
121
152
|
|
|
122
|
-
`status` should show `usage: api`.
|
|
123
|
-
|
|
124
153
|
Verify with:
|
|
125
154
|
|
|
126
155
|
```shell
|
|
@@ -134,8 +163,8 @@ This project is provided as-is and use is at your own risk.
|
|
|
134
163
|
**Usage Data Refresh Source:**
|
|
135
164
|
`codex-auth` supports two sources for refreshing account usage/usage limit information:
|
|
136
165
|
|
|
137
|
-
1. **API (default):**
|
|
138
|
-
2. **Local-only:**
|
|
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. npm installs already satisfy the runtime requirement.
|
|
167
|
+
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
168
|
|
|
140
169
|
**API Call Declaration:**
|
|
141
|
-
By
|
|
170
|
+
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/bin/codex-auth
CHANGED
|
Binary file
|