@rikcodes/teamclaude 1.1.14-rik.2 → 1.1.19-rik.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 +8 -29
- package/package.json +11 -3
- package/src/account-manager.js +1739 -219
- package/src/account-pairing.js +144 -13
- package/src/adaptive-distribution.js +406 -0
- package/src/admission-gate.js +59 -0
- package/src/alias.js +38 -7
- package/src/backend-quota.js +129 -0
- package/src/band-decision.js +171 -0
- package/src/cache-control-sanitize.js +134 -0
- package/src/classification-path.js +81 -0
- package/src/claude-env.js +25 -19
- package/src/client-usage.js +12 -3
- package/src/codex-auth.js +48 -31
- package/src/config.js +148 -28
- package/src/dashboard.js +373 -10
- package/src/event-loop-monitor.js +47 -0
- package/src/forward-target.js +183 -0
- package/src/identity.js +65 -12
- package/src/index.js +428 -191
- package/src/mitm.js +207 -14
- package/src/model.js +6 -0
- package/src/oauth.js +85 -57
- package/src/prober.js +79 -5
- package/src/provider.js +75 -1
- package/src/quota-summary.js +123 -0
- package/src/resolve-accounts.js +8 -5
- package/src/rollover.js +21 -0
- package/src/server.js +1020 -112
- package/src/service.js +38 -4
- package/src/session-tracker.js +167 -6
- package/src/status-renderer.js +194 -26
- package/src/sx.js +46 -10
- package/src/sync-accounts.js +37 -10
- package/src/tui-remote.js +74 -11
- package/src/tui.js +225 -67
- package/src/updater.js +91 -20
- package/src/upstream-fetch.js +108 -10
- package/src/upstream-proxy.js +16 -12
- package/src/warmer.js +205 -18
- package/src/warmup-schedule.js +236 -0
- package/src/x509.js +15 -8
package/README.md
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
# TeamClaude
|
|
2
2
|
|
|
3
|
-
> **Fork notice (rikbrown).** This fork adds
|
|
4
|
-
> [KarpelesLab/teamclaude](https://github.com/KarpelesLab/teamclaude):
|
|
3
|
+
> **Fork notice (rikbrown).** This fork adds two features on top of
|
|
4
|
+
> [KarpelesLab/teamclaude](https://github.com/KarpelesLab/teamclaude), currently based on upstream 1.1.19:
|
|
5
5
|
>
|
|
6
6
|
> - **[OpenAI models via a Codex sidecar](docs/openai.md)** (`sidecars` + `customModels`, opt-in):
|
|
7
7
|
> route `gpt-*` requests through a supervised local translating proxy to a ChatGPT subscription,
|
|
8
8
|
> under real model names — `/model gpt-5.6-sol` in the picker and typed, correct 272k context
|
|
9
9
|
> sizing, and dispatchable GPT subagents — while Claude traffic stays on the Claude accounts.
|
|
10
|
-
> - **[Soonest-weekly rotation](docs/routing.md#soonest-weekly-rotation)** (`soonestWeekly`, opt-in): rank
|
|
11
|
-
> equal-priority accounts by the weekly window that governs the requested model, continuously — preempt the
|
|
12
|
-
> current account when another resets more than `poolHours` sooner, and balance `distributeSessions` within
|
|
13
|
-
> that pool instead of across all accounts. Spends the quota closest to refreshing first, so a window no
|
|
14
|
-
> longer rolls over with quota unspent. Applied live on config reload.
|
|
15
10
|
> - **[Burn-rate projection](docs/quota.md#burn-rate-projection)** (`projection`, on by default): sample each
|
|
16
11
|
> bucket's consumption over a rolling window and tag every account row with whichever window binds
|
|
17
12
|
> first — `Ses TTL 38m` when it runs out before it resets, `Wk 22% unspent` when the reset arrives
|
|
@@ -36,9 +31,9 @@
|
|
|
36
31
|
[](https://nodejs.org)
|
|
37
32
|
[](LICENSE)
|
|
38
33
|
|
|
39
|
-
Multi-account
|
|
34
|
+
Multi-account proxy for [Claude Code](https://claude.ai/claude-code) and [Codex](https://github.com/openai/codex): it pools Claude Max, ChatGPT/Codex, API-key and third-party backend accounts, and rotates on quota.
|
|
40
35
|
|
|
41
|
-
It sits between
|
|
36
|
+
It sits between the coding agent and the provider's API, holds several accounts, and moves to the next one when the current account gets close to its session or weekly limit. The session keeps running instead of stopping on a 429. Claude accounts serve Claude Code, Codex accounts serve the Codex CLI, and both pools share one proxy.
|
|
42
37
|
|
|
43
38
|

|
|
44
39
|
|
|
@@ -54,18 +49,11 @@ teamclaude server # start the proxy, shows the TUI
|
|
|
54
49
|
teamclaude run # in another terminal: Claude Code through the proxy
|
|
55
50
|
```
|
|
56
51
|
|
|
57
|
-
Already logged into Claude Code? `teamclaude import` takes its credentials instead of a fresh OAuth round. API keys, and one email holding accounts in several orgs, are covered in [docs/accounts.md](docs/accounts.md).
|
|
58
|
-
|
|
59
|
-
`teamclaude run` does not require a separate Claude Code login for normal API
|
|
60
|
-
requests. When there is no usable local Claude OAuth (no login, or one that can
|
|
61
|
-
no longer be refreshed), proxy credential mode supplies a local-only bootstrap
|
|
62
|
-
key; the proxy replaces that placeholder
|
|
63
|
-
with the selected TeamClaude account credential before forwarding.
|
|
52
|
+
Already logged into Claude Code? `teamclaude import` takes its credentials instead of a fresh OAuth round. A container image is on GHCR — see [Running in a container](docs/usage.md#running-in-a-container). API keys, and one email holding accounts in several orgs, are covered in [docs/accounts.md](docs/accounts.md).
|
|
64
53
|
|
|
65
54
|
## What it does
|
|
66
55
|
|
|
67
56
|
- Rotates to the next account when the 5h session or 7d weekly bucket reaches the threshold (98% by default), preferring the account whose weekly quota resets soonest.
|
|
68
|
-
- Optionally spends the account whose weekly window resets soonest **first**, preempting the current account when another resets more than `poolHours` sooner, so a window stops rolling over with quota unspent (`soonestWeekly`, this fork).
|
|
69
57
|
- Projects each quota window's burn rate against its reset, so a row says `Ses TTL 38m · Wk 22% unspent` instead of leaving you to read it off a bar (`projection`, this fork).
|
|
70
58
|
- Tracks the per-model weekly cap separately, so an account out of Fable quota is skipped for Fable requests and still serves Opus and Sonnet.
|
|
71
59
|
- Tells a spent quota bucket apart from a per-minute rate limit and only rotates on the first one. Rotating on a rate limit would just move the burst to the next account and drop the warm cache, so it paces the same account instead.
|
|
@@ -74,6 +62,7 @@ with the selected TeamClaude account credential before forwarding.
|
|
|
74
62
|
- Catches hardcoded `api.anthropic.com` endpoints (the Claude Design MCP, for one) through a local MITM forward proxy, not only what `ANTHROPIC_BASE_URL` covers.
|
|
75
63
|
- Holds the request open until quota resets instead of returning 429 when every account is spent, so an unattended run finishes on its own (`holdSeconds`, off by default).
|
|
76
64
|
- Refreshes OAuth tokens before they expire and writes them back to config. Client refreshes pass through untouched.
|
|
65
|
+
- Pools OpenAI Codex subscriptions alongside Claude accounts (experimental): the Codex CLI is routed through the same proxy, by config or transparently through the MITM proxy, and rotates on its own quota.
|
|
77
66
|
- Takes any Anthropic-compatible API (DeepSeek, GLM) as a low-priority fallback for when the Claude accounts are done.
|
|
78
67
|
- Serves OpenAI models next to Claude ones — a supervised local sidecar translates `gpt-*` requests onto a ChatGPT subscription, with real model names in `/model` and GPT subagents dispatchable from a Claude parent (`sidecars` + `customModels`, this fork).
|
|
79
68
|
- No dependencies. Node built-ins only.
|
|
@@ -178,16 +167,6 @@ Claude Code prints one `[claude-code:unrecognized_model]` line to stderr for eac
|
|
|
178
167
|
|
|
179
168
|
Full details: [docs/openai.md](docs/openai.md).
|
|
180
169
|
|
|
181
|
-
### Soonest-weekly rotation
|
|
182
|
-
|
|
183
|
-
Default selection is sticky. It re-ranks only when the current account is exhausted, so a weekly window can expire with unused quota. `soonestWeekly` re-ranks continuously. Among equal-priority accounts, the one whose governing weekly window resets soonest is used first. It preempts the current account when another account resets more than `poolHours` sooner.
|
|
184
|
-
|
|
185
|
-
```json
|
|
186
|
-
"soonestWeekly": { "enabled": true, "poolHours": 12 }
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
`distributeSessions` works with this setting. New sessions balance across that pool instead of across all equal-priority accounts. Both settings take effect when the configuration reloads (upstream applies `distributeSessions` only at startup). Details: [Routing](docs/routing.md#soonest-weekly-rotation).
|
|
190
|
-
|
|
191
170
|
### Burn-rate projection
|
|
192
171
|
|
|
193
172
|
This feature is on by default. Each account row shows which window binds first: `Ses TTL 38m` when the session bucket runs out before it resets, or `Wk 22% unspent` when the weekly reset arrives first and that amount of quota expires. This is a readout only; no selection code reads it. Tune or disable it with `projection: { enabled, windowMinutes, wasteFloor }`. Details: [Quota](docs/quota.md#burn-rate-projection).
|
|
@@ -196,7 +175,7 @@ This feature is on by default. Each account row shows which window binds first:
|
|
|
196
175
|
|
|
197
176
|
| Page | Contents |
|
|
198
177
|
| --- | --- |
|
|
199
|
-
| [Accounts](docs/accounts.md) | OAuth login, import, API keys, multiple orgs, third-party backends |
|
|
178
|
+
| [Accounts](docs/accounts.md) | OAuth login, import, API keys, multiple orgs, Codex accounts, third-party backends |
|
|
200
179
|
| [Usage](docs/usage.md) | Server and TUI, running Claude Code, shell alias, command reference, logging |
|
|
201
180
|
| [Routing](docs/routing.md) | Rotation, the two kinds of 429, storm control, model routes, session spreading, pinning, prompt cache |
|
|
202
181
|
| [Quota](docs/quota.md) | Quota probe, keep-warm, holding on exhaustion |
|
|
@@ -207,7 +186,7 @@ This feature is on by default. Each account row shows which window binds first:
|
|
|
207
186
|
|
|
208
187
|
## Releasing this fork
|
|
209
188
|
|
|
210
|
-
Versions are `<upstream base>-rik.<n>`, e.g. `1.1.
|
|
189
|
+
Versions are `<upstream base>-rik.<n>`, e.g. `1.1.19-rik.1`. The self-updater orders that tail and installs only that shape (`x.y.z` or `x.y.z-rik.N`), so every publish reaches existing installs within a day.
|
|
211
190
|
|
|
212
191
|
1. Rebase onto the upstream release you want as the base, if any.
|
|
213
192
|
2. Bump `version` in `package.json` and commit.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rikcodes/teamclaude",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Multi-account Claude
|
|
3
|
+
"version": "1.1.19-rik.1",
|
|
4
|
+
"description": "Multi-account proxy for Claude Code and Codex: pools Claude Max, ChatGPT/Codex, API-key and third-party backend accounts, and rotates on quota",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -18,9 +18,17 @@
|
|
|
18
18
|
"keywords": [
|
|
19
19
|
"claude",
|
|
20
20
|
"anthropic",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"codex",
|
|
23
|
+
"openai",
|
|
24
|
+
"chatgpt",
|
|
25
|
+
"deepseek",
|
|
21
26
|
"proxy",
|
|
22
27
|
"load-balancer",
|
|
23
|
-
"multi-account"
|
|
28
|
+
"multi-account",
|
|
29
|
+
"quota",
|
|
30
|
+
"rate-limiting",
|
|
31
|
+
"cli"
|
|
24
32
|
],
|
|
25
33
|
"license": "MIT",
|
|
26
34
|
"repository": {
|