Commit Graph
665 Commits
Author SHA1 Message Date
Tam Nhu Tran 7d3a11a452 fix(bar): resolve pre-dev review findings (security gate, honesty, correctness)
Gate /api/bar/* behind the localhost-when-auth-disabled guard (single DRY
choke point) so native quota/tier/cost can't leak on a non-loopback bind with
auth disabled; add a guard test. Delete the dishonest maxRedirections test that
asserted the opposite of the production redirect hardening. Key per-account
today-cost on the local day (matching analytics) instead of UTC. Stop the
inner 429 retry in the Claude usage fetch so the outer cache + circuit breaker
honor Retry-After. Narrow the usage-transformer map type and fix stale
doc-comments; clarify the one-alert-per-reset-window quota rule; gitignore the
local demo scaffolding.
2026-06-09 18:04:31 -04:00
Tam Nhu Tran dbeb0c543a feat(bar): native Claude Code + Codex subscription quota (safe, server-side)
Surface the logged-in Claude Code and Codex subscription quota as first-class
summary rows so the existing gauge and alert engine render them with no new UI.

Claude Code: read the native token (~/.claude/.credentials.json, macOS Keychain
fallback) and reuse the existing Anthropic usage fetch+normalize via a new
token-fed entry point. The /oauth/usage endpoint is hostile to polling, so the
fetch is server-side only behind a 10-minute on-demand cache, in-flight
coalescing, Retry-After + exponential backoff with jitter, a 3-strike circuit
breaker with a 15-minute cooldown, and serve-stale-on-failure; logged-out or
unsupported subscriptions never spend a token call. Codex: zero-network read of
the latest rate_limits from local session rollouts, omitted when absent.
Native rows side-load bounded so a slow or failed fetch degrades to CLIProxy
rows, never an error.
2026-06-09 13:37:38 -04:00
Tam Nhu Tran 5f850c4899 feat(bar): honest quota state and merged multi-source analytics
Derive a tri-state quotaStatus (ok|unsupported|error) per account so a
provider with no quota API renders as 'no quota' with a healthy dot instead
of an alarming bare dash, and treat unsupported as healthy in deriveHealth.

Switch the analytics endpoint off the CLIProxy snapshot, which freezes
whenever the proxy restarts (usage is in-memory only), and onto the merged
daily/hourly usage the dashboard uses. Recent activity from Claude Code,
Codex, and Droid now shows, and a per-surface breakdown answers where usage
goes. Add lastActivityAt, daysSinceLastActivity, hasRecentData and a 30-day
series; per-account today_cost reads null (unknown) rather than a misleading 0.
2026-06-09 11:49:36 -04:00
Tam Nhu Tran 40f32ebbf0 feat(quota): add per-provider tier-lock account selection
Make tier_lock a per-provider map and honor it in findHealthyAccount and
preflightCheck for the selected provider only, so locking one provider never
disables failover for others. Add POST /api/accounts/tier-lock with tier
validation against known tiers, and serialize quota_management on config write
so the lock persists.
2026-06-07 15:32:40 -04:00
Tam Nhu Tran 1867116472 feat(usage): attribute CLIProxy usage to accounts for per-account cost
Carry the CLIProxy auth_index through the usage transformer and aggregator,
build an auth_index->account map from the auth files, and wire it into the
usage syncer so persisted snapshots stamp accountId. Adds getTodayCostByAccount
and a snapshot detail reader. Backward-compatible: accountId is optional and
profile-based aggregation is unchanged.
2026-06-07 15:32:19 -04:00
Sergey Galuza c74ad22bd4 Merge remote-tracking branch 'upstream/dev' into feat/claude-opus-4-8 2026-05-30 22:31:55 +02:00
Kai (Tam Nhu) TranandGitHub dce968fdf7 Merge pull request #1425 from kaitranntt/codex/fix-unvalidated-codex-quota-labels
fix(cliproxy): sanitize Codex quota labels
2026-05-30 16:12:22 -04:00
Kai (Tam Nhu) TranandGitHub 429fcc0d51 Merge pull request #1454 from kaitranntt/codex/fix-email-fallback-parsing-issue
fix(cliproxy): infer emails from alternate token prefixes
2026-05-30 16:11:54 -04:00
Kai (Tam Nhu) TranandGitHub b1c8fbf701 Merge pull request #1417 from kaitranntt/codex/propose-fix-for-proxy-validation-issue
fix: validate browser flags before proxy side effects
2026-05-30 16:10:29 -04:00
Kai (Tam Nhu) TranandGitHub a6ea3f2d19 Merge pull request #1450 from kaitranntt/codex/fix-hidden-stale-default-model-in-live-catalogs
fix: keep live catalog defaults visible
2026-05-30 15:59:59 -04:00
Kai (Tam Nhu) TranandGitHub b2ee234430 Merge pull request #1451 from kaitranntt/codex/propose-fix-for-codex-fallback-issue
fix(cliproxy): prefer explicit Codex free fallbacks
2026-05-30 15:56:02 -04:00
Kai (Tam Nhu) TranandGitHub a9f5f26807 Merge pull request #1446 from kaitranntt/codex/fix-quota-cooldown-auto-resume-logic
fix(cliproxy): preserve manual quota pauses
2026-05-30 15:51:42 -04:00
Tam Nhu Tran bcc68992fa fix(cliproxy): ignore stale executor exit code 2026-05-30 15:48:18 -04:00
Kai (Tam Nhu) TranandGitHub bdea434339 Merge pull request #1429 from kaitranntt/codex/fix-vulnerability-in-self-signed-routing
fix: guard self-signed routing request setup
2026-05-30 15:46:53 -04:00
Tam Nhu Tran 79379a25fe style: format email fallback parsing changes 2026-05-30 15:44:45 -04:00
Tam Nhu Tran a0870aa404 fix(cliproxy): fall back from invalid Codex feature labels 2026-05-30 15:38:50 -04:00
Tam Nhu Tran 8261901b89 style: format live catalog default changes 2026-05-30 15:37:27 -04:00
Kai (Tam Nhu) TranandGitHub f815db391d Merge pull request #1308 from simonsmh/feat/add-qoder-provider
feat(cliproxy): Qoder provider
2026-05-30 15:35:55 -04:00
Kai (Tam Nhu) TranandGitHub 14da76abae fix: redact OAuth trace error messages 2026-05-30 15:28:32 -04:00
Kai (Tam Nhu) TranandTam Nhu Tran 6ecca9b16f fix(cliproxy): preserve manual quota pauses 2026-05-30 15:20:52 -04:00
Tam Nhu Tran 1f1cc056ef test: update proxy resolver coverage 2026-05-30 15:14:34 -04:00
Kai (Tam Nhu) TranandTam Nhu Tran 8114ff016e fix: validate browser flags before proxy side effects 2026-05-30 15:10:03 -04:00
Kai (Tam Nhu) Tran c0cd44ecaa fix(cliproxy): infer emails from alternate token prefixes 2026-05-30 14:57:12 -04:00
Kai (Tam Nhu) Tran 27e1694480 fix(cliproxy): prefer explicit Codex free fallbacks 2026-05-30 14:57:04 -04:00
Kai (Tam Nhu) Tran f9dec01cfd fix: keep live catalog defaults visible 2026-05-30 14:57:02 -04:00
Kai (Tam Nhu) Tran 5807328cb5 fix: guard self-signed routing request setup 2026-05-30 14:54:27 -04:00
Kai (Tam Nhu) Tran 457412277b fix(cliproxy): sanitize Codex quota labels 2026-05-30 14:53:53 -04:00
Kai (Tam Nhu) TranandGitHub aee322ea88 fix: compare cliproxy fork release suffixes (#1419) 2026-05-30 13:42:31 -04:00
Sergey Galuza 357ce8b07a feat(catalog): add Claude Opus 4.8 to Anthropic model registry
Register `claude-opus-4-8` in the cliproxy model catalog, web-server
pricing table, and UI catalog as an additive entry next to 4.7. Defaults
are unchanged (claude provider stays on sonnet-4-6); users opt into 4.8
explicitly via ANTHROPIC_MODEL or the dashboard.

Configuration mirrors 4.7:
- adaptive thinking levels (low through max), max distinct from xhigh
- extendedContext (1M) available
- nativeImageInput
- pricing $5/$25 in/out, $6.25/$0.5 cache

Built [OnSteroids](https://onsteroids.ai)
2026-05-30 17:16:27 +02:00
Kai (Tam Nhu) TranandGitHub 0f0ad4e6ed fix: normalize Codex provider requests
Fixes #1399
Fixes #1406
2026-05-29 10:19:51 -04:00
Kai (Tam Nhu) TranandGitHub d7d5ad2ad2 fix: time out stalled CLIProxy response streams 2026-05-27 11:14:40 -04:00
Kai (Tam Nhu) TranandGitHub 5f1976f69c fix: add CLIProxy account reauthentication 2026-05-27 10:13:03 -04:00
Kai (Tam Nhu) TranandGitHub 4cf840ea0a fix(cliproxy): prevent management key leak on runtime proxy overrides (#1386)
* fix(cliproxy): clear yaml management key on runtime overrides

* style: apply prettier formatting
2026-05-23 22:37:39 -04:00
Kai (Tam Nhu) TranandGitHub f985cec3ff fix(browser): avoid implicit explicit devtools port for config attach (#1369)
* fix(browser): avoid implicit explicit devtools port for config attach

* style: apply prettier formatting
2026-05-23 21:46:04 -04:00
Kai (Tam Nhu) TranandGitHub 210ab761e2 fix(cursor): enforce auth token for anthropic daemon route (#1377) 2026-05-23 21:45:05 -04:00
Kai (Tam Nhu) TranandGitHub b0a754179c fix(codex): cap buffered upstream error response size (#1375) 2026-05-23 21:45:00 -04:00
Kai (Tam Nhu) TranandGitHub e658e838f9 fix(cliproxy): scrub GitLab PAT env after token-login auth (#1360)
* fix(cliproxy): scrub gitlab pat env var after auth handoff

* style: apply prettier formatting
2026-05-23 21:44:35 -04:00
Kai (Tam Nhu) TranandGitHub 9357f4df26 fix(cliproxy): redact generic token query params in oauth trace (#1364) 2026-05-23 21:39:05 -04:00
Kai (Tam Nhu) TranandGitHub 5d27f10367 refactor(cliproxy): remove orphaned bg keepalive wiring (#1353)
Red-team review of #1340 found that backgroundProbe / shouldKeepSessionProxiesAlive /
startKeepAliveWatcher and related types were never reachable: the sole caller
(claude-launcher.ts) passed no hasBackgroundWorkerUsingBaseUrl detector, so
backgroundProbe was always undefined and the keepalive branch never executed.

Remove the unreachable scaffold:
- Delete CLAUDE_BG_WORKER_ARGS, hasClaudeBackgroundWorkerUsingBaseUrl{,InProcessList},
  shouldKeepSessionProxiesAlive, ShouldKeepSessionProxiesAliveOptions, and the
  SessionProxyKeepAliveOptions interface from session-bridge.ts
- Remove the backgroundProbe/startKeepAliveWatcher block and keepalive exit branch
  from setupCleanupHandlers; the function now always calls stopSessionResources on
  Claude exit
- Remove backgroundKeepAliveBaseUrl wiring from claude-launcher.ts
- Remove the execFileSync import (was only used by the deleted ps-based detector)
- Update test file: remove tests for deleted exports, keep placeholder

A trusted bg-worker detector can be re-added in a future PR if the feature is
actually needed; the keepalive logic in shouldKeepSessionProxiesAlive can be
restored then.
2026-05-23 17:29:18 -04:00
Kai (Tam Nhu) TranandGitHub b71fe5dd6e fix(codex-quota): guard feature label type in quota windows (#1346) 2026-05-23 16:55:55 -04:00
Kai (Tam Nhu) TranandGitHub f0ec820054 fix(cliproxy): disable spoofable default bg keepalive probe (#1340) 2026-05-23 16:54:13 -04:00
Kai (Tam Nhu) TranandGitHub 923bfee6fa fix: pause exhausted CLIProxy rotation accounts
Refs #1337
2026-05-23 00:08:53 -04:00
Tam Nhu Tran 30971ebb28 fix: preserve Docker legacy API key during rotation 2026-05-22 16:49:16 -04:00
Tam Nhu Tran 1af6625f5c feat: add OAuth paste-callback traceability 2026-05-22 14:12:53 -04:00
Tam Nhu Tran ba853b159b test: cover qoder base settings 2026-05-22 11:15:24 -04:00
Tam Nhu Tran 29eebff7c5 fix(cliproxy): harden oauth trace snippet redaction 2026-05-22 11:12:37 -04:00
Kai (Tam Nhu) TranandTam Nhu Tran a526eb469a fix(cliproxy): redact token-like oauth trace snippets 2026-05-22 11:11:06 -04:00
b52c0627ca feat(qoder): add model catalog entries for backend and UI
Add Qoder provider models to both backend MODEL_CATALOG and UI
MODEL_CATALOGS with 11 models (5 auto-routing tiers + 6 frontier
models). Frontier models use unified preset mappings except
DeepSeek which routes haiku to Flash.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 20:34:55 +08:00
shiminhao964andClaude Opus 4.7 4973f7a00f test(qoder): add qoder to provider-capabilities test expectations
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 19:40:18 +08:00
Simon Shi 1e60fe186e feat(cliproxy): add Qoder to channel catalog, model routing, and UI
Add Qoder provider to integration layers and dashboard UI:
- Channel-to-provider mapping in catalog-cache
- Model routing owner hints
- Provider editor owner map
- Setup wizard provider list
- Fallback visuals and brand color
2026-05-21 03:06:18 +09:00