codexhop 1.0.0__py3-none-any.whl
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.
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codexhop
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Use several ChatGPT accounts with OpenAI Codex on one machine: hop the saved login in one command, or run a different account in each terminal. One file, no dependencies.
|
|
5
|
+
Author-email: Ebenworks <contact@ebenworks.co>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/psychofict/codexhop
|
|
8
|
+
Project-URL: Repository, https://github.com/psychofict/codexhop
|
|
9
|
+
Project-URL: Documentation, https://github.com/psychofict/codexhop#readme
|
|
10
|
+
Project-URL: Changelog, https://github.com/psychofict/codexhop/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Security policy, https://github.com/psychofict/codexhop/blob/main/SECURITY.md
|
|
12
|
+
Project-URL: Issues, https://github.com/psychofict/codexhop/issues
|
|
13
|
+
Project-URL: Author, https://ebenworks.co/
|
|
14
|
+
Keywords: codex,openai-codex,codex-cli,chatgpt,account-switcher,multi-account,chatgpt-plus,chatgpt-pro,chatgpt-business,oauth,credentials,cli,developer-tools,productivity,shell,terminal,ai,llm
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
|
|
28
|
+
Classifier: Topic :: Terminals
|
|
29
|
+
Classifier: Topic :: Utilities
|
|
30
|
+
Requires-Python: >=3.9
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/psychofict/codexhop/main/assets/cover.png" alt="codexhop: hop OpenAI Codex between ChatGPT accounts" width="820">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://github.com/psychofict/codexhop/actions/workflows/ci.yml"><img src="https://github.com/psychofict/codexhop/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
41
|
+
<a href="https://github.com/psychofict/codexhop/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-MIT-FC5F00" alt="MIT licence"></a>
|
|
42
|
+
<img src="https://img.shields.io/badge/python-3.9%2B-FC5F00" alt="Python 3.9 or newer">
|
|
43
|
+
<img src="https://img.shields.io/badge/dependencies-none-FC5F00" alt="No dependencies">
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
codexhop lets you use several ChatGPT accounts with OpenAI Codex on one machine,
|
|
47
|
+
such as a personal plan and a seat in your company's workspace. It saves each
|
|
48
|
+
account's Codex login, swaps the live one in one command, and can run a
|
|
49
|
+
different account in each terminal.
|
|
50
|
+
|
|
51
|
+
The whole tool is one Python file with no dependencies. A browser opens only
|
|
52
|
+
when you add an account.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
$ chop
|
|
56
|
+
NAME EMAIL PLAN 5H USED
|
|
57
|
+
1. home me@gmail.com plus 4%
|
|
58
|
+
2. * work me@company.com business 62%
|
|
59
|
+
|
|
60
|
+
hop to which? [1-2, Enter to stay] 1
|
|
61
|
+
switched to home (me@gmail.com, plus)
|
|
62
|
+
new `codex` sessions start as this account.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`chop` is the short name the shell glue gives `codexhop`. The 5H USED column is
|
|
66
|
+
the last reading `chop usage` saved, so the menu comes up at once.
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pipx install codexhop # or: pip install --user codexhop
|
|
72
|
+
eval "$(codexhop shell-init)" # the `chop` alias and tab completion
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Put the `eval` line in your `~/.bashrc` or `~/.zshrc` and open a new terminal.
|
|
76
|
+
It needs Python 3.9 or newer and Codex, on Linux or macOS. For the newest code
|
|
77
|
+
from GitHub instead, use `pipx install git+https://github.com/psychofict/codexhop`.
|
|
78
|
+
|
|
79
|
+
To install from a clone instead, run `./install.sh`. It links
|
|
80
|
+
`~/.local/bin/codexhop` to the clone and adds the same line to your shell rc. If
|
|
81
|
+
`chop` is taken on your machine, `codexhop shell-init --alias NAME` picks
|
|
82
|
+
another name.
|
|
83
|
+
|
|
84
|
+
Then save the login you already have, and add the others:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
chop save home # names whatever is logged in right now
|
|
88
|
+
chop add work # signs in as a second account, aside from the live one
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`chop add` runs `codex login` in a private temporary Codex home, so your live
|
|
92
|
+
login is untouched while you sign in. If your browser is signed in to ChatGPT as
|
|
93
|
+
another account, that is the one you get. Open the link in a private window, or
|
|
94
|
+
use `chop add work --device-auth`.
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
chop work # new codex sessions start as work
|
|
100
|
+
chop run home # codex as home in this terminal only; arguments after the name go to codex
|
|
101
|
+
chop usage # 5-hour and weekly usage for every account
|
|
102
|
+
chop next home work # hop to whichever of the others has room in its 5-hour window
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| Command | What it does |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `chop` | list the accounts and ask which one to hop to |
|
|
108
|
+
| `chop <name>` | hop to that account |
|
|
109
|
+
| `chop add <name>` | sign in as another account and save it |
|
|
110
|
+
| `chop save [name]` | save the login you have now |
|
|
111
|
+
| `chop run <name> [...]` | run `codex` as that account in this terminal only |
|
|
112
|
+
| `chop usage [name]` | 5-hour and weekly usage, with reset times |
|
|
113
|
+
| `chop next [names]` | hop to another login in the list that has 5-hour room ([how it picks](https://github.com/psychofict/codexhop/blob/main/docs/commands.md#chop-next-names)) |
|
|
114
|
+
| `chop whoami` | who the live login is, read from the login itself |
|
|
115
|
+
| `chop list --long` | token expiry, last renewal and save date per account |
|
|
116
|
+
| `chop renew [name]` | renew the saved logins that are due |
|
|
117
|
+
| `chop doctor [--fix]` | check the setup and repair what it can |
|
|
118
|
+
| `chop rm`, `chop rename` | delete or rename a saved account |
|
|
119
|
+
|
|
120
|
+
The [command reference](https://github.com/psychofict/codexhop/blob/main/docs/commands.md)
|
|
121
|
+
covers every command, flag, setting, file and exit status.
|
|
122
|
+
|
|
123
|
+
### One account per terminal
|
|
124
|
+
|
|
125
|
+
`chop run work` starts `codex` as `work` in this terminal, while every other
|
|
126
|
+
terminal keeps the live login.
|
|
127
|
+
|
|
128
|
+
The session gets its own Codex home. That home holds the account's login and
|
|
129
|
+
links to everything else in yours, so the session has your config, rules,
|
|
130
|
+
skills and history, and `codex resume` sees the same conversations. When the
|
|
131
|
+
session ends, a login it renewed is saved back.
|
|
132
|
+
|
|
133
|
+
### Usage for every account
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
$ chop usage
|
|
137
|
+
NAME 5 HOURS WEEK NOTE
|
|
138
|
+
* home 4% resets 3h19m 18% resets 23h59m
|
|
139
|
+
work 62% resets 2h09m 41% resets 23h59m
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The figures come from the endpoint Codex reads an account's rate limits from. A
|
|
143
|
+
reading under
|
|
144
|
+
a minute old is shown again without asking, and a server that asks for a pause
|
|
145
|
+
is not asked again until the pause is over.
|
|
146
|
+
|
|
147
|
+
An idle account whose access token has run out is renewed first, so every
|
|
148
|
+
account can be read, not only the live one.
|
|
149
|
+
|
|
150
|
+
## What happens to sessions that are already open
|
|
151
|
+
|
|
152
|
+
A hop changes the login new `codex` sessions start with. A session that is
|
|
153
|
+
already open keeps the login it started with until that login's access token is
|
|
154
|
+
within 5 minutes of running out, about 10 days after its last renewal. Then it
|
|
155
|
+
stops with "signed in to another account. Please sign in again."
|
|
156
|
+
|
|
157
|
+
The exception is two logins in one workspace: there the open session moves to
|
|
158
|
+
the new login at that point.
|
|
159
|
+
|
|
160
|
+
This was measured with Codex 0.160.1 and 0.166.0, and
|
|
161
|
+
[How it works](https://github.com/psychofict/codexhop/blob/main/docs/how-it-works.md#what-open-sessions-do)
|
|
162
|
+
has the cases and the script. The hop tells you how long the open sessions have.
|
|
163
|
+
Start a new session to move over; `codex resume` reopens the conversation in it.
|
|
164
|
+
|
|
165
|
+
When a session is about to renew the live login, the hop stops and says so. A
|
|
166
|
+
hop that lands during that renewal can cost the account its login, because
|
|
167
|
+
Codex 0.166.0 drops the renewed tokens and 0.160.1 saves them under the new
|
|
168
|
+
account's workspace id. Let the session make its next request first, or pass
|
|
169
|
+
`--yes`.
|
|
170
|
+
|
|
171
|
+
## How it works
|
|
172
|
+
|
|
173
|
+
Codex keeps its login in `~/.codex/auth.json`. codexhop keeps one copy of that
|
|
174
|
+
file per account in `~/.codex/codexhop/accounts/`, mode 600, and copies the one
|
|
175
|
+
you want into place.
|
|
176
|
+
|
|
177
|
+
Which account a login belongs to is read from the login's own ID token (email,
|
|
178
|
+
ChatGPT user and workspace), so listing, hopping and `whoami` need no network.
|
|
179
|
+
During the swap codexhop holds `auth.lock`, the lock Codex 0.166.0 takes around
|
|
180
|
+
its own writes. The outgoing login is filed under the right account first, so a
|
|
181
|
+
renewal Codex has already saved is never overwritten.
|
|
182
|
+
|
|
183
|
+
[How it works](https://github.com/psychofict/codexhop/blob/main/docs/how-it-works.md)
|
|
184
|
+
goes through it step by step.
|
|
185
|
+
|
|
186
|
+
## Before you hop
|
|
187
|
+
|
|
188
|
+
- Codex can keep its login in the system keyring instead of `auth.json`. The
|
|
189
|
+
file is the default; if yours is set to `keyring` or `auto`, codexhop says how
|
|
190
|
+
to switch back.
|
|
191
|
+
- Codex before 0.164.0 does not check, when it saves a renewal, that
|
|
192
|
+
`auth.json` still holds the same login (the check first appears in Codex's
|
|
193
|
+
source at rust-v0.164.0). `chop doctor` warns about it, and
|
|
194
|
+
`chop doctor --fix` repairs a file that got mixed up. Upgrading Codex closes
|
|
195
|
+
the gap.
|
|
196
|
+
- `CODEX_ACCESS_TOKEN`, and `CODEX_API_KEY` in `codex exec`, take the place of
|
|
197
|
+
the saved login. `chop whoami` and `chop doctor` warn when either is set.
|
|
198
|
+
- codexhop changes nothing about what each account may do. Use each one within
|
|
199
|
+
OpenAI's terms of use.
|
|
200
|
+
|
|
201
|
+
## FAQ
|
|
202
|
+
|
|
203
|
+
**Does codexhop send my login anywhere?** Only to OpenAI, and only to renew it
|
|
204
|
+
(`auth.openai.com`) or to read usage (`chatgpt.com`), when a command needs to.
|
|
205
|
+
`CODEXHOP_OFFLINE=1` turns both off.
|
|
206
|
+
[SECURITY.md](https://github.com/psychofict/codexhop/blob/main/SECURITY.md)
|
|
207
|
+
lists what the tool holds and how it protects it.
|
|
208
|
+
|
|
209
|
+
**Can I hop between a ChatGPT login and an API key?** Yes. `chop add work
|
|
210
|
+
--with-api-key` reads the key from standard input, and the result hops like any
|
|
211
|
+
other account.
|
|
212
|
+
|
|
213
|
+
**Does it switch accounts by itself when one runs out?** No. `chop next` hops
|
|
214
|
+
to another login with room in its 5-hour window, but only when you run it.
|
|
215
|
+
|
|
216
|
+
**Two accounts with the same email?** One email in two ChatGPT workspaces is two
|
|
217
|
+
logins, and codexhop keeps them apart. `chop list` adds a WORKSPACE column when
|
|
218
|
+
that happens.
|
|
219
|
+
|
|
220
|
+
**Windows?** Windows is not supported. codexhop runs on Linux and macOS.
|
|
221
|
+
|
|
222
|
+
## Contributing and licence
|
|
223
|
+
|
|
224
|
+
Issues and pull requests are welcome. Start with
|
|
225
|
+
[CONTRIBUTING.md](https://github.com/psychofict/codexhop/blob/main/CONTRIBUTING.md),
|
|
226
|
+
and report anything that could expose a login through
|
|
227
|
+
[SECURITY.md](https://github.com/psychofict/codexhop/blob/main/SECURITY.md).
|
|
228
|
+
|
|
229
|
+
codexhop is built by [Ebenworks](https://ebenworks.co/), which also makes
|
|
230
|
+
[claudehop](https://github.com/psychofict/claudehop) for Claude Code.
|
|
231
|
+
|
|
232
|
+
MIT licence. Not affiliated with, endorsed by, or sponsored by OpenAI. "OpenAI",
|
|
233
|
+
"Codex" and "ChatGPT" are trademarks of OpenAI, used here only to say what this
|
|
234
|
+
works with.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
codexhop.py,sha256=VDAqSAMuVpx7kYKLaodaRmN2rIKPNmIHHoR290j-Nas,97138
|
|
2
|
+
codexhop-1.0.0.dist-info/licenses/LICENSE,sha256=fW4--GIfdgllYdgzngz7rN8E9BM27OVinheASvq8ccY,1066
|
|
3
|
+
codexhop-1.0.0.dist-info/METADATA,sha256=yhoHIQsnWsxvnpSEzB_AI2e4mwoJEsxCe4cdPf9C_RM,10860
|
|
4
|
+
codexhop-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
codexhop-1.0.0.dist-info/entry_points.txt,sha256=9zoT9qChv0fWD5-eYp0ZHRJ0aWMyi-8j1DFUgKMX6go,51
|
|
6
|
+
codexhop-1.0.0.dist-info/top_level.txt,sha256=ZMiM8ItIHehi2y5a64K_7oWzQw2IFjxY7K6L-Vp4LaY,9
|
|
7
|
+
codexhop-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ebenworks
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
codexhop
|