@umer-jahangier/claude-nonstop 0.0.0-stage → 1.16.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +417 -2
  3. package/bin/claude-nonstop.js +14 -0
  4. package/package.json +51 -4
  5. package/src/accounts.js +288 -0
  6. package/src/chatgpt-models.js +64 -0
  7. package/src/checks.js +66 -0
  8. package/src/classify.js +21 -0
  9. package/src/claude.js +252 -0
  10. package/src/cli.js +98 -0
  11. package/src/clients.js +104 -0
  12. package/src/codex.js +145 -0
  13. package/src/commands.js +841 -0
  14. package/src/config.js +60 -0
  15. package/src/connectorcheck.js +88 -0
  16. package/src/desktop.js +267 -0
  17. package/src/desktopadvice.js +111 -0
  18. package/src/directory.json +7197 -0
  19. package/src/elevate.js +39 -0
  20. package/src/events.js +43 -0
  21. package/src/files.js +54 -0
  22. package/src/gateway.js +976 -0
  23. package/src/hosts.js +46 -0
  24. package/src/hostsfile.js +68 -0
  25. package/src/http.js +65 -0
  26. package/src/keys.js +81 -0
  27. package/src/keystore.js +141 -0
  28. package/src/launch.js +233 -0
  29. package/src/marketplace.js +52 -0
  30. package/src/openai-auth.js +249 -0
  31. package/src/paths.js +25 -0
  32. package/src/prompt.js +66 -0
  33. package/src/providers.js +168 -0
  34. package/src/relay.js +78 -0
  35. package/src/server.js +285 -0
  36. package/src/service.js +208 -0
  37. package/src/shell.js +119 -0
  38. package/src/ssh.js +163 -0
  39. package/src/state.js +76 -0
  40. package/src/supervise.js +377 -0
  41. package/src/system.js +105 -0
  42. package/src/tls.js +260 -0
  43. package/src/translate/chat.js +150 -0
  44. package/src/translate/index.js +52 -0
  45. package/src/translate/ir.js +140 -0
  46. package/src/translate/messages.js +333 -0
  47. package/src/translate/responses.js +495 -0
  48. package/src/translate/sse.js +44 -0
  49. package/src/ui/index.html +3206 -0
  50. package/src/ui.js +623 -0
  51. package/src/update.js +122 -0
  52. package/src/usage.js +147 -0
  53. package/src/vault.js +68 -0
  54. package/src/winpath.js +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Muhammad Umer
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 CHANGED
@@ -1,3 +1,418 @@
1
- # Temporary Holding Version
1
+ # claude-nonstop
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Keep Claude Code working through plan limits.** claude-nonstop is a free, open-source tool that keeps Claude Code working when your Claude subscription hits its session or weekly limit: it starts your next session on your next account, and when every account is out, it moves to your API keys, one by one. You keep typing `claude` like always.
4
+
5
+ **Any subscription, any tool.** The same local gateway also takes ChatGPT accounts and OpenAI API keys, and answers Codex, Cursor and any OpenAI-compatible tool as well as Claude Code. A Codex session can run on your Claude subscription; Claude Code can run on your ChatGPT one. See [Other tools and accounts](#other-tools-and-accounts).
6
+
7
+ [![CI](https://github.com/umer-jahangier/claude-nonstop/actions/workflows/ci.yml/badge.svg)](https://github.com/umer-jahangier/claude-nonstop/actions/workflows/ci.yml)
8
+ [![Latest release](https://img.shields.io/github/v/release/umer-jahangier/claude-nonstop)](https://github.com/umer-jahangier/claude-nonstop/releases/latest)
9
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
+ ![macOS · Windows · Linux](https://img.shields.io/badge/platform-macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-lightgrey)
11
+
12
+ **Website:** [umer-jahangier.github.io/claude-nonstop](https://umer-jahangier.github.io/claude-nonstop/) · **Made by** [Muhammad Umer (Umer Jahangier)](https://github.com/umer-jahangier)
13
+
14
+ ```
15
+ account 1 → account 2 → … → API key 1 → API key 2 → …
16
+ ```
17
+
18
+ That's the default order. Mix it however you like (say Work account, then a key, then Main account), and pause any account or key you want kept but not used.
19
+
20
+ <picture>
21
+ <source media="(prefers-color-scheme: light)" srcset="docs/screenshot-light.jpg">
22
+ <img alt="The claude-nonstop web page: the line in use, subscription accounts and API keys in grouped lists, a cable plugged into the live line, a globe showing requests travelling to Anthropic, and live activity." src="docs/screenshot-dark.jpg">
23
+ </picture>
24
+
25
+ ## Contents
26
+
27
+ - [What you get](#what-you-get)
28
+ - [Install](#install)
29
+ - [Set it up in two minutes](#set-it-up-in-two-minutes)
30
+ - [Everyday use](#everyday-use)
31
+ - [The web page](#the-web-page)
32
+ - [The Claude desktop app](#the-claude-desktop-app)
33
+ - [Other tools and accounts](#other-tools-and-accounts)
34
+ - [Commands](#commands)
35
+ - [How it works](#how-it-works)
36
+ - [Security and privacy](#security-and-privacy)
37
+ - [What setup changes on your computer](#what-setup-changes-on-your-computer)
38
+ - [Updating](#updating)
39
+ - [Troubleshooting](#troubleshooting)
40
+ - [Uninstall](#uninstall)
41
+ - [FAQ](#faq)
42
+ - [Advanced options](#advanced-options)
43
+ - [Development](#development)
44
+
45
+ ## What you get
46
+
47
+ - **Subscriptions first.** Every session starts on the first account that still has usage left. API keys are only used once every account is out.
48
+ - **Never stalls at a limit.** If an account runs out in the middle of your work, the same conversation reopens on your next account, then on your API keys, and carries on by itself. With nothing else left, it waits for the reset and continues on its own.
49
+ - **Keys switch mid-request.** A local gateway sends each request with your first working key. If a key runs out of credit, the same request goes out again on the next key, and your session never notices.
50
+ - **Your chats stay.** Every account and key shares one Claude Code history, so it's always the same conversation, and `claude --resume` shows all of them. In the desktop app, your claude.ai chats and earlier sessions can be brought into third-party mode with one import.
51
+ - **One command to install, nothing to configure by hand.** It brings its own Node.js, installs Claude Code if you don't have it, and sets everything up.
52
+ - **A web page at `https://claude.nonstop`** to add accounts and keys, see what's in use, and switch lines by dragging a cable. Dark by default, with Light and Automatic (your computer's setting) one click away.
53
+ - **Works in the terminal and in the Claude desktop app**, on macOS, Windows and Linux.
54
+ - **ChatGPT accounts and OpenAI keys too.** Add them next to your Claude ones. Codex, Cursor and other OpenAI-format tools point at the same gateway, and every tool can run on every line: requests are translated between Anthropic's and OpenAI's formats on the way.
55
+ - **Your secrets stay on your computer, encrypted.** Keys are only ever sent to Anthropic.
56
+ - **Updates itself** from GitHub releases.
57
+
58
+ ## Install
59
+
60
+ Open a terminal and paste one command. You don't need to install anything first.
61
+
62
+ **macOS and Linux**
63
+
64
+ ```bash
65
+ curl -fsSL https://raw.githubusercontent.com/umer-jahangier/claude-nonstop/main/install.sh | sh
66
+ ```
67
+
68
+ **Windows** (in PowerShell)
69
+
70
+ ```powershell
71
+ irm https://raw.githubusercontent.com/umer-jahangier/claude-nonstop/main/install.ps1 | iex
72
+ ```
73
+
74
+ The installer takes about a minute. It:
75
+
76
+ 1. installs claude-nonstop and its own copy of Node.js into `~/.claude-nonstop` (`%USERPROFILE%\.claude-nonstop` on Windows), and installs Claude Code too, or updates it if it's older than 2.1.234;
77
+ 2. gives the web page its short address, `https://claude.nonstop`, with a certificate your computer trusts;
78
+ 3. sets up the Claude desktop app to run on your API keys, if you have it;
79
+ 4. starts the local gateway now, and every time you log in;
80
+ 5. makes plain `claude` go through claude-nonstop;
81
+ 6. opens the web page.
82
+
83
+ ### What you'll be asked
84
+
85
+ Steps 2 and 3 change things outside your home folder, so your computer asks first. All of it is optional: decline anything and the rest still works.
86
+
87
+ | | macOS | Windows | Linux |
88
+ | --- | --- | --- | --- |
89
+ | Short address `claude.nonstop` | Your password, once | One "Allow changes?" confirmation | Your password (sudo), once |
90
+ | Trusted certificate (no "Not secure") | Your password again, to trust it | One "Install this certificate?" confirmation | Nothing to approve (needs `certutil`, see [Troubleshooting](#troubleshooting)) |
91
+ | Claude desktop app | System Settings opens with a profile: double-click it, click **Install** ([why it says "author unknown"](#why-does-macos-say-the-profiles-author-is-unknown)) | Included in the confirmation above | Included in the password prompt above |
92
+
93
+ Say no to the short address and the page lives at `http://claude-nonstop.localhost` instead, which works on every computer with no setup at all.
94
+
95
+ > **Open a new terminal window after installing**, so plain `claude` goes through claude-nonstop.
96
+
97
+ ## Set it up in two minutes
98
+
99
+ 1. **Open the web page.** The installer opens it for you. Later, run `claude-nonstop ui` (it signs you in with a one-time link, so only you can use the page), or go to `https://claude.nonstop`.
100
+ 2. **Add your accounts.** Your normal Claude Code login is already there as **Main account**. For each extra Claude subscription, click **Add Account…**, give it a name, and sign in on Anthropic's page that opens in your browser. As soon as you're signed in, the page checks whether the account has usage left.
101
+ 3. **Add your API keys.** Click **Add API Key…** and paste a key from [platform.claude.com/settings/keys](https://platform.claude.com/settings/keys). Each key is tested as soon as you save it.
102
+
103
+ You never need to press Check. The gateway checks every account and key when it starts, and the page checks again whenever you open it or switch back to it. Anything with a clear answer from the last 5 minutes is skipped. While a check runs, its row shows **Checking…**.
104
+
105
+ That's it. From now on, just run `claude`:
106
+
107
+ ```
108
+ $ claude
109
+ claude-nonstop: checking Main account...
110
+ claude-nonstop: Main account: You've hit your session limit · resets 3:45pm
111
+ claude-nonstop: checking Work...
112
+ claude-nonstop: using Work (subscription)
113
+ ```
114
+
115
+ ## Everyday use
116
+
117
+ - **Just type `claude`.** claude-nonstop picks the first account with usage left, or your first working key when every account is out. Everything else about Claude Code stays the same.
118
+ - **VS Code, Cursor, and any other Claude Code** that reads your user settings use the same gateway. Setup writes the gateway address into Claude Code's settings, so those installs walk your accounts and then your API keys without a separate sign-in. Start a new chat after setup so the editor picks that up. On a machine running as root, setup also turns off bypass-permissions mode, which Claude Code refuses to start with as root.
119
+ - **Hit a limit in the middle of your work?** Nothing to do. claude-nonstop reopens the same conversation on your next account (or your API keys) and tells Claude to continue where it left off. You'll see Claude Code restart for a moment, then the work carries on.
120
+ - **Only one account, or everything is out?** Claude Code waits in the open session and continues the task by itself when your limit resets (shown as *Continuing automatically at 3:45pm*). On API keys, claude-nonstop does the waiting and continues as soon as an account or a key has usage again. Leave the terminal open.
121
+ - **Running on API keys?** When a key runs out, the next key takes over on the very same request.
122
+ - **Want a particular line right now?** On the web page, drag the cable's plug onto it, or choose **Use This Account** / **Use This Key** in its **…** menu. A key switches at once, even mid-session; an account applies to your next session. Click **Use Automatic** to hand control back.
123
+ - **Force a mode for one session:** `claude-nonstop --api` uses only API keys, `claude-nonstop --sub` only subscription accounts.
124
+ - **Keep an eye on it.** The page's **Activity** list shows every request, switch and new session as it happens, and its tab icon turns red when every API key is used up.
125
+
126
+ ## The web page
127
+
128
+ | Part | What it does |
129
+ | --- | --- |
130
+ | Status card | The line in use (or the one your next session starts on), what takes over if it runs out, and whether you're on **Automatic** |
131
+ | Alerts | Anything that needs you: an account that isn't signed in, a used-up key (with a **Top Up** link), no keys yet |
132
+ | Accounts and API keys | One list, tried top to bottom. Drag a line by its **≡** handle (or focus it and press ↑/↓) to mix accounts and keys in any order. Each line has a switch to pause it and a **…** menu: Use This Account/Key, Check Usage or Test Key, Sign In Again, Rename, Pause/Resume, Move Up/Down, Remove. **Test All Keys** tests every key |
133
+ | The cable | Plugged into the line in use. Drag its plug onto another line to switch to it; the plug's light blinks for every request |
134
+ | Globe | A light travels from your computer to Anthropic and back for every gateway request. Drag it to spin it |
135
+ | Activity | Every request, key switch and new session, live |
136
+ | Desktop App tab | Sets up the Claude desktop app with one click, with manual steps as a fallback |
137
+ | Settings tab | Appearance (Dark by default, Light, or Automatic to follow your computer), how long a used-up key or a limited account is skipped, and what's set up on this computer |
138
+
139
+ **Addresses.** Any of these opens the page:
140
+
141
+ | Address | When |
142
+ | --- | --- |
143
+ | `https://claude.nonstop` (or `https://claude-nonstop`) | After setup added the short address. `http://` sends you to `https://` |
144
+ | `http://claude-nonstop.localhost` | Always works, no setup needed |
145
+ | `http://claude-nonstop.localhost:43117` | Always works too, even if something else on your computer already uses port 80 or 443 |
146
+
147
+ ## The Claude desktop app
148
+
149
+ The desktop app can run on your subscription accounts and API keys through claude-nonstop, switching between them as lines run out, while a plain Claude.ai sign-in stays one click away on its sign-in screen.
150
+
151
+ The installer sets it up for you using the settings locations Anthropic documents for the app ([configuration reference](https://claude.com/docs/third-party/claude-desktop/configuration-format)):
152
+
153
+ - **Windows:** registry policy under `HKLM\SOFTWARE\Policies\Claude`, in the installer's one confirmation.
154
+ - **Linux:** `/etc/claude-desktop/managed-settings.json`, in the installer's one password prompt.
155
+ - **macOS:** a configuration profile. macOS only lets you approve profiles yourself, so System Settings opens with it: double-click **claude-nonstop for the Claude desktop app**, then click **Install**. (If you closed it, it's under **System Settings → General → Device Management**.) macOS will say *"The author of this profile is unknown"*: that's expected, and [here's why](#why-does-macos-say-the-profiles-author-is-unknown).
156
+
157
+ Then **quit and reopen the desktop app.** Its sign-in screen offers the third-party option, which runs on your API keys through claude-nonstop, and **Claude.ai** for your subscription. Pick the third-party option when your subscription is out.
158
+
159
+ **In third-party mode the desktop app walks your order too.** Each request goes out on the first subscription account with usage left, on that account's own Claude Code sign-in; when an account hits its limit, the same request goes out again on the next line, and when every account is out, on your API keys. The cable, **Use This Account** and your order apply to the desktop app just as to the terminal. The page's **Desktop app** line shows the account or key it's on.
160
+
161
+ **Usage left.** Each account's line shows how much of its plan is used: the session (its 5-hour window) and the week, with when each resets, read from the same place Claude Code's `/usage` reads, with that account's own sign-in. It refreshes every 5 minutes while the gateway runs, with every account check, and when the page opens; `claude-nonstop status` shows it too. API keys have no such readout: Anthropic shows a key's credit only in the [Console](https://platform.claude.com/settings/billing), so a key's line shows its last test instead.
162
+
163
+ **Switch alerts.** claude-nonstop watches the account your desktop app signs in to (pick it on the page's **Settings → Claude desktop app**; the Main account by default). While the app is open it checks that account at most every 10 minutes, and when the advice changes it tells you on the page and with a notification: *"SXL-Acc reached its limit: switch the desktop app to the third-party option"*, then later *"SXL-Acc has usage again: switch back to Claude.ai to stop spending API credit"*. If no key can take over either, it says so instead. The switch itself is yours to make on the app's sign-in screen. Turn the alerts off with **Switch alerts**.
164
+
165
+ **API keys are used as plain API.** Every request the gateway sends on a key goes out as an ordinary API request, with no Claude Code identity in its headers or its system prompt, so it's billed as plain API use: credit that lists only *API* under **Applies to** (promotional credit, say) works. Subscription accounts are different: Anthropic takes only Claude Code's own requests on a sign-in, so those go out as Claude Code.
166
+
167
+ **SSH sessions in the desktop app.** In third-party mode the app refuses SSH sessions while the gateway is at 127.0.0.1, because Claude Code on the server would have to reach it. `claude-nonstop ssh add <host>` sets a server up for them: it points `claude.nonstop` at 127.0.0.1 there and adds the gateway's certificate authority to its trust store (root or password-free sudo needed), and the gateway then keeps a reverse tunnel open to it, so the server's `127.0.0.1:43118` leads back to the gateway on this computer. The desktop app is given `https://claude.nonstop:43118`, which works on both machines. `claude-nonstop ssh` shows each server's tunnel, and `claude-nonstop ssh remove <host>` undoes it.
168
+
169
+ **Your chats come along.** Third-party mode keeps its own history, separate from claude.ai. claude-nonstop turns on Anthropic's [import](https://claude.com/docs/third-party/claude-desktop/import): in the desktop app, open **Settings → Import & export → Import…** to bring over your claude.ai chats and projects and the Code and Cowork sessions already on this computer. A new chat also offers the import when it finds earlier sessions. It's a copy: your claude.ai history stays where it is, and running it again adds only what's new.
170
+
171
+ **Browser, extensions, plugins and connectors work as before.** Third-party mode turns some of these off unless they're switched on, so claude-nonstop switches them on: the built-in browser in Code sessions (with its address bar, not just the localhost preview), desktop extensions, and Anthropic's plugin marketplace in Claude Code. The app also hides its connector directory and its Add button in third-party mode, so claude-nonstop brings the directory back as a plugin marketplace: open **Directory → Organization → nonstop-connectors** in the desktop app to browse the 480 connectors from [Anthropic's connector directory](https://claude.com/connectors) that work in third-party mode (Canva, Notion, Figma, Linear, Atlassian, Miro and more), install the ones you want, and sign in to each when you first use it. The list lives in this repository's [`connectors`](connectors) folder and the app fetches updates by itself. For a server that isn't in the directory, add it on the page's **Desktop App** tab or with `claude-nonstop connectors add <name> <https-url>`; on a Mac, each change to that list means approving the updated profile in System Settings. Connectors made by Anthropic itself (such as Gmail, Google Drive or Microsoft 365) only work on the Claude.ai sign-in.
172
+
173
+ Installed the desktop app later? Run `claude-nonstop desktop`, or click **Set Up Automatically** on the page's **Desktop App** tab.
174
+
175
+ ## Other tools and accounts
176
+
177
+ The gateway speaks three formats: Anthropic's Messages API (`/v1/messages`, Claude Code and the Claude desktop app), OpenAI's Responses API (`/v1/responses`, Codex) and OpenAI's Chat Completions API (`/v1/chat/completions`, Cursor and most OpenAI-compatible tools). A request in any of them walks your order and goes out on the first line with usage left, whatever service that line is on. Same format and service: it goes through as it came. Different: it's translated on the way out and the answer translated on the way back, tool calls, images and streaming included. A request for a model from the other service (say `gpt-5.5` arriving at a Claude account) goes to that line's default model, `claude-sonnet-5-5` and `gpt-5.5` unless you change `models` in the web page's **Settings** or `config.json`.
178
+
179
+ **ChatGPT accounts.** `claude-nonstop accounts add "Work" --chatgpt`, or **Add Account…** on the web page and pick **ChatGPT**. OpenAI's own sign-in page opens, the way Codex signs in; the sign-in lands in claude-nonstop's encrypted vault and renews itself. Already signed in to Codex on this computer? Add `--import-codex` (or tick the box on the page) to take that sign-in over instead. Requests on a ChatGPT account go to the Codex backend as Codex, which is the only way OpenAI takes a subscription sign-in. Usage comes back with every answer and shows on the account's line like a Claude account's. The Codex backend serves only the models on its own list for the account (GPT-6 names at the time of writing, which it may change at any point): claude-nonstop asks each account for that list and sends the model a tool asked for when it's there, otherwise the account's first choice, so a tool asking for an older or a Claude name still gets an answer. `/v1/models` lists them.
180
+
181
+ **OpenAI API keys.** Paste one where you'd paste a Claude key; it's told apart by how it looks (`sk-…` rather than `sk-ant-api…`). Keys next to each other in the order still work as one team, even across services.
182
+
183
+ **Codex.** When Codex (the `codex` command or the Codex app) is on this computer, `claude-nonstop setup` points it at the gateway by writing a `claude-nonstop` model provider into `~/.codex/config.toml` and selecting it; `claude-nonstop connect codex` does the same on its own, and `claude-nonstop uninstall` puts Codex's earlier model settings back. Codex then needs no OpenAI sign-in: run `codex` as usual and its requests go out on whichever line is next, a Claude account included. The lines it writes:
184
+
185
+ ```toml
186
+ model = "gpt-5.5"
187
+ model_provider = "claude-nonstop"
188
+
189
+ [model_providers.claude-nonstop]
190
+ name = "claude-nonstop"
191
+ base_url = "http://127.0.0.1:43117/v1"
192
+ wire_api = "responses"
193
+ experimental_bearer_token = "<gateway token>"
194
+ requires_openai_auth = false
195
+ ```
196
+
197
+ **Cursor.** In Cursor's model settings turn on **Override OpenAI Base URL**, enter `http://127.0.0.1:43117/v1` and the gateway token as the API key (`claude-nonstop connect cursor` prints both). This is Cursor's own-key mode, which Cursor limits: Tab completions and some agent features stay off, and requests still pass through Cursor's servers.
198
+
199
+ **Anything else** that takes an OpenAI base address: `OPENAI_BASE_URL=http://127.0.0.1:43117/v1` and `OPENAI_API_KEY=<gateway token>`.
200
+
201
+ **Claude Code on a ChatGPT account.** When a session starts on a ChatGPT line (or moves to one at a limit), claude-nonstop runs Claude Code through the gateway on that account, so Claude Code keeps working on GPT answers. The reverse happens by itself too: Codex pointed at the gateway runs on your Claude accounts when they're next in your order.
202
+
203
+ ## Commands
204
+
205
+ | Command | What it does |
206
+ | --- | --- |
207
+ | `claude` | Claude Code through claude-nonstop (after setup) |
208
+ | `claude-nonstop [claude args]` | The same, without the shortcut |
209
+ | `claude-nonstop --api [args]` | Use API keys only |
210
+ | `claude-nonstop --sub [args]` | Use subscription accounts only |
211
+ | `claude-nonstop ui` | Open the web page |
212
+ | `claude-nonstop status` | What's set up, what's in use, and your order |
213
+ | `claude-nonstop move <n> up\|down` | Move account or key n (its number in `status`) one place |
214
+ | `claude-nonstop pause <n>` / `resume <n>` | Stop using account or key n without removing it, or use it again |
215
+ | `claude-nonstop keys` | Test every API key |
216
+ | `claude-nonstop keys add [name]` | Save a Claude or OpenAI key (typed hidden, or piped on stdin) |
217
+ | `claude-nonstop keys remove <n>` | Remove key number n |
218
+ | `claude-nonstop accounts` | List accounts and who each one is signed in as |
219
+ | `claude-nonstop accounts add [name]` | Add a Claude account and sign in to it |
220
+ | `claude-nonstop accounts add [name] --chatgpt` | Add a ChatGPT account and sign in to it (`--import-codex` takes Codex's existing sign-in) |
221
+ | `claude-nonstop connect [codex\|cursor]` | Point Codex at the gateway (done by setup too), and show how to point Cursor or any OpenAI-compatible tool at it |
222
+ | `claude-nonstop accounts login <n>` | Sign in to account n again |
223
+ | `claude-nonstop accounts check` | Check which accounts have usage left |
224
+ | `claude-nonstop accounts on <n>` / `off <n>` | Turn account n on or off |
225
+ | `claude-nonstop accounts remove <n>` | Sign out of account n and remove it |
226
+ | `claude-nonstop desktop` | Set up the Claude desktop app |
227
+ | `claude-nonstop connectors` | List the connectors the desktop app shows when it runs on your API keys |
228
+ | `claude-nonstop connectors add <name> <https-url>` | Add a connector (signs in with OAuth; `--no-oauth` for servers without sign-in) |
229
+ | `claude-nonstop connectors remove <name>` | Remove a connector |
230
+ | `claude-nonstop setup` | Run the whole setup again (safe to repeat) |
231
+ | `claude-nonstop service install` / `uninstall` | Start the gateway at login, or stop doing so |
232
+ | `claude-nonstop shell install` / `uninstall` | Make plain `claude` go through claude-nonstop, or undo it |
233
+ | `claude-nonstop update` | Install the newest version now |
234
+ | `claude-nonstop uninstall [--purge]` | Remove claude-nonstop (`--purge` also deletes your saved keys and accounts) |
235
+
236
+ Claude Code's own subcommands (`claude mcp`, `claude doctor`, `claude update`, `claude --version`, …) pass straight through.
237
+
238
+ ## How it works
239
+
240
+ **Your order.** Accounts and keys sit in one list that you arrange, for example Work account, then a key, then Main account. A session starts on the first line with usage left and moves down the list as lines run out. A paused line keeps its place and its sign-in or key, but is skipped until you resume it. Keys next to each other in the list work as a team: when one runs out, the gateway sends the request again on the next one, mid-request. When the whole team is out, the session moves on to the line after it.
241
+
242
+ **Choosing an account.** Before a session starts, claude-nonstop asks each account, in order, whether it has usage left. Each check is one tiny Haiku request run by Claude Code itself. An account that hit its limit is skipped for 10 minutes before it's asked again (change this in **Settings**).
243
+
244
+ **Extra accounts.** Each extra account is its own Claude Code configuration folder (`CLAUDE_CONFIG_DIR`, the [documented way](https://code.claude.com/docs/en/authentication#log-in-with-multiple-accounts) to stay signed in to several accounts). You sign in on Anthropic's own page, and Claude Code stores the login in its own credential store; claude-nonstop never sees or stores subscription credentials. Your history, settings, plugins, skills and MCP servers are shared by every account, so they all feel the same and `claude -c` works across them.
245
+
246
+ **Mid-session.** claude-nonstop starts Claude Code with a few background hooks ([`StopFailure`](https://code.claude.com/docs/en/hooks#stopfailure) and friends, documented Claude Code features). When a turn stops on a usage limit or a used-up key, the hook tells claude-nonstop, which checks the next lines in your relay. If one has usage, it reopens the same conversation there with `claude --resume <session> "Continue where you left off."`, keeping the flags you started with. If nothing has usage, it leaves the session alone: on a claude.ai account, Claude Code's own [automatic continue](https://code.claude.com/docs/en/interactive-mode.md#wait-for-a-usage-limit-to-reset) picks the task up at the reset; on API keys, claude-nonstop checks again every few minutes and reopens the conversation when something frees up. Your own hooks and `--settings` keep working alongside.
247
+
248
+ **Back to your subscription.** In Automatic mode, a session that ended up on API keys doesn't stay there: every 5 minutes claude-nonstop asks the accounts above the keys in your order whether they have usage again, and when one does, the conversation moves back to it as soon as Claude finishes its current turn (`claude --resume <session>`, with nothing typed for you). When you've plugged the cable into a line yourself, sessions stay on it.
249
+
250
+ **API keys.** Claude Code talks to the gateway at `http://127.0.0.1:43117`, which forwards each request to Anthropic with your first working key. A key that answers *credit balance too low*, *spend limit reached*, *invalid* or *not allowed* is marked used up, the same request is sent again on the next key, and the used-up key is skipped for 30 minutes before it's tried again, in case you topped it up. If the gateway isn't running, claude-nonstop hands Claude Code a key helper instead, which picks a key again every two minutes.
251
+
252
+ **Rate limits (429) and outages (5xx)** stay on the current key: keys in one organization share one rate limit, and Claude Code already retries these. If your keys belong to separate organizations and you'd like rate-limited keys skipped too, change one line in [`src/classify.js`](src/classify.js).
253
+
254
+ ## Security and privacy
255
+
256
+ - **Everything runs on your computer.** The gateway and the web page accept connections from this computer only, and answer only to their own names.
257
+ - **API keys are encrypted at rest** (AES-256-GCM). The encryption key is held by the macOS Keychain, Windows DPAPI or the Linux Secret Service; headless Linux machines without one fall back to a file only you can read, and the page tells you when that's the case.
258
+ - **Keys are only sent to the service they belong to**: Claude keys to `api.anthropic.com`, OpenAI keys to `api.openai.com`, ChatGPT sign-ins to `chatgpt.com`. After you save a key, only a masked form is ever shown again.
259
+ - **The web page needs a one-time link** from `claude-nonstop ui`, which becomes an HttpOnly, SameSite=Strict cookie. Every request also carries a header other websites can't send, so pages you visit can't reach it.
260
+ - **The gateway has its own random token**, so other programs on your computer can't spend your keys.
261
+ - **HTTPS uses a certificate made on your computer.** The certificate authority that signs it is used once, for this computer's own names, and its private key is thrown away immediately: it's never saved, so it can never sign anything else. Uninstalling removes it from your trusted certificates.
262
+ - **The globe's "This computer" spot is guessed from your timezone** inside the page. It's never sent anywhere.
263
+ - **No telemetry.** The only outside connections claude-nonstop makes are to Anthropic and OpenAI (your requests, sign-ins and the account checks) and to GitHub (to check for updates).
264
+
265
+ ## What setup changes on your computer
266
+
267
+ Nothing is hidden. Here's everything, and how each part is undone:
268
+
269
+ | What | Where | Undone by |
270
+ | --- | --- | --- |
271
+ | The app, its Node.js, your encrypted keys and settings | `~/.claude-nonstop` | `claude-nonstop uninstall --purge` |
272
+ | The `claude` shortcut | A marked block in your zsh, bash and fish startup files; on Windows, a `claude.cmd` placed first on your user PATH | `claude-nonstop shell uninstall` |
273
+ | Codex's model provider | `model`, `model_provider` and a `[model_providers.claude-nonstop]` table in `~/.codex/config.toml` (earlier values kept in `~/.claude-nonstop/codex.json`) | `claude-nonstop uninstall` |
274
+ | Start at login | macOS LaunchAgent `dev.claude-nonstop.gateway`; Linux systemd user service `claude-nonstop` (or an autostart entry); Windows `HKCU\…\Run` entry | `claude-nonstop service uninstall` |
275
+ | Short address | A marked block in your hosts file (`/etc/hosts`, or `C:\Windows\System32\drivers\etc\hosts`) | `claude-nonstop uninstall` |
276
+ | Trusted certificate | macOS login keychain; Windows current-user root store; Linux browser certificate stores | `claude-nonstop uninstall` |
277
+ | Desktop app settings | macOS profile; Windows `HKLM\SOFTWARE\Policies\Claude`; Linux `/etc/claude-desktop/managed-settings.json` | `claude-nonstop uninstall` (macOS: remove the profile in System Settings → General → Device Management) |
278
+ | Linux only: permission to use ports 80 and 443 | Given to claude-nonstop's own Node.js, never a system-wide one | Removed with `~/.claude-nonstop` |
279
+
280
+ ## Updating
281
+
282
+ claude-nonstop checks GitHub for a new release every hour (and a minute after it starts) and installs it by itself, so you rarely need to do anything. To update right now:
283
+
284
+ ```bash
285
+ claude-nonstop update
286
+ ```
287
+
288
+ Running the install command again also updates. It skips everything that's still set up, so it normally asks nothing.
289
+
290
+ ## Troubleshooting
291
+
292
+ Start with `claude-nonstop status`: it shows what's set up, what's in use and how each account and key last checked out.
293
+
294
+ - **Plain `claude` doesn't go through claude-nonstop.** Open a new terminal window. If it still doesn't, run `claude-nonstop shell install` and open another one.
295
+ - **The page doesn't open.** Make sure the gateway runs: `claude-nonstop service install` starts it now and at every login. Then run `claude-nonstop ui`. `http://claude-nonstop.localhost` always works as a fallback.
296
+ - **`claude.nonstop` isn't found, or shows "Not secure".** Run `claude-nonstop setup` again and allow the prompts. Typing it into the address bar for the first time? Include `https://`, so the browser doesn't search for it.
297
+ - **Linux: the certificate wasn't trusted.** Browsers there read certificates through NSS. Install its tools (`sudo apt install libnss3-tools` on Debian and Ubuntu, `sudo dnf install nss-tools` on Fedora), then run `claude-nonstop setup` again.
298
+ - **A session didn't continue by itself after a limit.** Check `claude-nonstop status`: the **Claude Code** line should show 2.1.234 or newer (run `claude update` if not). Keep the terminal open while it waits, and start sessions with `claude` (or `claude-nonstop`) so claude-nonstop can look after them.
299
+ - **An account says "Not signed in".** Click **Sign In…** in its alert, or run `claude-nonstop accounts login <n>`.
300
+ - **Every key shows "Used up".** Top one up at [platform.claude.com/settings/billing](https://platform.claude.com/settings/billing), then click **Test Now** on it, or **Forget All Cooldowns** in **Settings**.
301
+ - **The desktop app doesn't offer the third-party option.** Quit it completely and reopen it. On macOS, check the profile is installed under **System Settings → General → Device Management**. Then run `claude-nonstop status`: the **Desktop app** line should say it's set up.
302
+ - **The desktop app says "Gateway was unreachable".** The gateway isn't running: run `claude-nonstop service install`.
303
+ - **Something else uses port 80 or 443.** claude-nonstop leaves it alone and serves the page on port 43117 instead; `claude-nonstop ui` opens the right address, and `http://claude-nonstop.localhost:43117` always works.
304
+ - **Logs.** `~/.claude-nonstop/claude-nonstop.log` (which line was chosen, key switches) and `~/.claude-nonstop/gateway.log`.
305
+
306
+ ## Uninstall
307
+
308
+ ```bash
309
+ claude-nonstop uninstall # keeps your saved keys and accounts
310
+ claude-nonstop uninstall --purge # also deletes them
311
+ ```
312
+
313
+ This stops the gateway, removes the `claude` shortcut, the short address, the trusted certificate and the desktop app settings (on macOS, remove the profile in **System Settings → General → Device Management**), and tells you about anything it couldn't undo. Installed with npm? Finish with `npm uninstall -g @umer-jahangier/claude-nonstop`.
314
+
315
+ ## FAQ
316
+
317
+ ### What is claude-nonstop?
318
+
319
+ A free, open-source (MIT) tool that keeps Claude Code, Codex and the Claude desktop app working through usage limits. When the account you're on hits its session or weekly limit, it moves your work to the next account in your order, then to your API keys. It runs on Claude and ChatGPT accounts and on Anthropic and OpenAI API keys, on macOS, Windows and Linux.
320
+
321
+ ### Who makes claude-nonstop?
322
+
323
+ [Muhammad Umer](https://umer-jahangier.github.io/) (Umer Jahangier, [@umer-jahangier](https://github.com/umer-jahangier) on GitHub), an AI and full-stack engineer in Lahore, Pakistan. Issues and pull requests are welcome [here](https://github.com/umer-jahangier/claude-nonstop/issues).
324
+
325
+ ### How do I keep using Claude Code after hitting the usage limit?
326
+
327
+ Add a second account or an API key. When the account you're on hits its limit, claude-nonstop reopens the same conversation on the next line in your order with `claude --resume` and tells Claude to continue where it left off. With only one account, Claude Code waits in the open session and continues by itself when the limit resets.
328
+
329
+ ### Is this the `claude-nonstop` package on npm?
330
+
331
+ No. Several unrelated projects share the name, including the npm package called plain `claude-nonstop`, by another author. This one is [umer-jahangier/claude-nonstop](https://github.com/umer-jahangier/claude-nonstop), and on npm it's [`@umer-jahangier/claude-nonstop`](https://www.npmjs.com/package/@umer-jahangier/claude-nonstop). The one-line command in [Install](#install) is the recommended way: it updates itself from this repository's releases.
332
+
333
+ ### Is this allowed?
334
+
335
+ claude-nonstop runs the unmodified Claude Code and uses only documented features. Every account and key you add must be your own: each teammate installs claude-nonstop and adds their own. Sharing a subscription account between people is against Anthropic's and OpenAI's terms.
336
+
337
+ Running one service's subscription from another company's tool (Codex on a Claude account, Claude Code on a ChatGPT account) is your call to make: both providers take a subscription only from their own client, so the gateway presents each request as that client. Their terms don't cover this, and either could stop accepting it or act on the account. Use it with that in mind.
338
+
339
+ ### Why does it ask for my password?
340
+
341
+ Only for the short address, the trusted certificate and the desktop app settings, which live outside your home folder. Decline and everything else still works, at `http://claude-nonstop.localhost`.
342
+
343
+ ### Why does macOS say the profile's author is unknown?
344
+
345
+ When you install the desktop app profile, macOS shows *"The author of this profile is unknown. Make sure you trust the sender before installing."* It says this about **every profile that isn't digitally signed**, whatever is inside.
346
+
347
+ The claude-nonstop profile isn't signed because it's made on your own Mac during setup: it holds your computer's private gateway key, so no one could sign it in advance. It's safe to install, and you can check exactly what it does before you click **Install**:
348
+
349
+ - **What it contains:** six settings for the Claude desktop app. Its third-party provider is set to *gateway*, the gateway address is `http://127.0.0.1:43117` (this computer), the gateway key is your local claude-nonstop token, the auth scheme is *bearer*, the import of your earlier chats is turned on, and Code sessions may reach any site (`coworkEgressAllowedHosts` set to `["*"]`, so the app doesn't force strict sandbox mode). Turn **Strict sandbox** on in the web page's **Settings** to keep that restriction instead. In System Settings, click the profile, then **Settings** to see them.
350
+ - **What it doesn't do:** it installs no certificates, changes no system settings, and touches no other app.
351
+ - **Undoing it:** remove it any time in **System Settings → General → Device Management**. The file is also saved at `~/.claude-nonstop/claude-nonstop-desktop.mobileconfig` if you'd like to read it.
352
+
353
+ Rather not install a profile at all? Set the desktop app up by hand with the values on the page's **Desktop App** tab.
354
+
355
+ ### Will I still see limit messages?
356
+
357
+ Only when every account and key is out. When one line runs out, Claude Code may show its limit notice for a second or two while the conversation reopens on the next line; then it carries on. When everything is out, you'll see Claude Code's own *Continuing automatically at …* line while it waits for the reset.
358
+
359
+ ### Do I need API keys?
360
+
361
+ No. With only subscription accounts, claude-nonstop moves from one to the next. Keys are the fallback for when every account is out.
362
+
363
+ ### Does it change how Claude Code behaves?
364
+
365
+ No. It picks which account or key a session uses, then runs Claude Code as usual.
366
+
367
+ ### Can my teammates use it?
368
+
369
+ Yes. Send them this page; each of them installs it and adds their own accounts and keys.
370
+
371
+ ## Advanced options
372
+
373
+ **Installer environment variables:**
374
+
375
+ | Variable | Effect |
376
+ | --- | --- |
377
+ | `CLAUDE_NONSTOP_SKIP_CLAUDE=1` | Don't install Claude Code |
378
+ | `CLAUDE_NONSTOP_REF=<tag or commit>` | Install a specific version instead of the latest release |
379
+ | `CLAUDE_NONSTOP_SETUP_ARGS="…"` | Flags to pass to `claude-nonstop setup` (see below) |
380
+ | `CLAUDE_NONSTOP_BIN_DIR=<dir>` | macOS and Linux: where to put the `claude-nonstop` command (default `~/.local/bin`) |
381
+
382
+ For example, to install without the shortcut and without opening the page:
383
+
384
+ ```bash
385
+ curl -fsSL https://raw.githubusercontent.com/umer-jahangier/claude-nonstop/main/install.sh | CLAUDE_NONSTOP_SETUP_ARGS="--yes --no-shell --no-open" sh
386
+ ```
387
+
388
+ **`claude-nonstop setup` flags:**
389
+
390
+ | Flag | Effect |
391
+ | --- | --- |
392
+ | `--yes` | Don't ask questions |
393
+ | `--no-open` | Don't open the web page at the end |
394
+ | `--no-service` | Don't start the gateway at login |
395
+ | `--no-shell` | Don't make plain `claude` go through claude-nonstop |
396
+ | `--no-hosts` | Skip the short address (and with it, HTTPS) |
397
+ | `--no-desktop` | Don't set up the Claude desktop app |
398
+ | `--no-system` | Skip everything that needs administrator rights |
399
+
400
+ **Other environment variables:** `CLAUDE_NONSTOP_HOME` moves the data folder (default `~/.claude-nonstop`); `CLAUDE_NONSTOP_PORT` changes the gateway port (default `43117`).
401
+
402
+ **Prefer npm?** `npm install -g @umer-jahangier/claude-nonstop`, then run `claude-nonstop setup`. The command is still `claude-nonstop`. (This needs Node.js 18 or newer, and doesn't update itself: update with the same `npm install -g`.) Not the unscoped `claude-nonstop` package, which is an unrelated project.
403
+
404
+ ## Development
405
+
406
+ ```bash
407
+ git clone https://github.com/umer-jahangier/claude-nonstop
408
+ cd claude-nonstop
409
+ npm test
410
+ ```
411
+
412
+ No dependencies. Tests run against a fake Claude API and a fake `claude` binary, and CI runs them on macOS, Windows and Linux with Node 18, 20 and 22, plus the installers end to end. The web page is a single file, [`src/ui/index.html`](src/ui/index.html); its design system is in [`DESIGN.md`](DESIGN.md).
413
+
414
+ The connector marketplace is generated. To refresh it from claude.com/connectors (each server is checked for how it signs in), run `node scripts/build-directory.js && node scripts/build-marketplace.js`, then `claude plugin validate connectors`.
415
+
416
+ ---
417
+
418
+ claude-nonstop is made by [Muhammad Umer (Umer Jahangier)](https://umer-jahangier.github.io/). It's an independent project and isn't affiliated with or endorsed by Anthropic or OpenAI. Claude and Claude Code are trademarks of Anthropic; ChatGPT and Codex are trademarks of OpenAI. MIT licensed.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { main } = require('../src/cli');
5
+
6
+ main(process.argv.slice(2)).then(
7
+ (code) => {
8
+ if (typeof code === 'number') process.exitCode = code;
9
+ },
10
+ (err) => {
11
+ process.stderr.write(`claude-nonstop: ${err && err.message ? err.message : err}\n`);
12
+ process.exitCode = 1;
13
+ },
14
+ );
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@umer-jahangier/claude-nonstop",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.16.1",
4
+ "description": "Keep Claude Code, Codex and the Claude desktop app working through usage limits: when a subscription hits its session or weekly limit, claude-nonstop moves to your next account, then to your API keys, one by one.",
5
+ "author": {
6
+ "name": "Muhammad Umer (Umer Jahangier)",
7
+ "email": "umer.jahangier@gmail.com",
8
+ "url": "https://umer-jahangier.github.io/"
9
+ },
10
+ "bin": {
11
+ "claude-nonstop": "bin/claude-nonstop.js"
12
+ },
13
+ "files": [
14
+ "bin",
15
+ "src",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "engines": {
23
+ "node": ">=18"
24
+ },
25
+ "scripts": {
26
+ "test": "node --test"
27
+ },
28
+ "keywords": [
29
+ "claude-nonstop",
30
+ "claude",
31
+ "claude-code",
32
+ "claude-desktop",
33
+ "anthropic",
34
+ "codex",
35
+ "openai",
36
+ "chatgpt",
37
+ "api-keys",
38
+ "multi-account",
39
+ "account-switching",
40
+ "failover",
41
+ "rate-limit",
42
+ "usage-limit",
43
+ "llm-gateway",
44
+ "cli"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/umer-jahangier/claude-nonstop.git"
49
+ },
50
+ "homepage": "https://umer-jahangier.github.io/claude-nonstop/",
51
+ "bugs": "https://github.com/umer-jahangier/claude-nonstop/issues",
52
+ "license": "MIT"
53
+ }