Skip to content

feat: proxy rotation + custom pool selection, API key quota tracker, Tailscale fix - #77

Open
mahdiwafy wants to merge 2 commits into
Vanszs:mainfrom
mahdiwafy:pr/proxy-key-dashboard-revamp
Open

feat: proxy rotation + custom pool selection, API key quota tracker, Tailscale fix#77
mahdiwafy wants to merge 2 commits into
Vanszs:mainfrom
mahdiwafy:pr/proxy-key-dashboard-revamp

Conversation

@mahdiwafy

Copy link
Copy Markdown

Summary

This PR supersedes #67 and #73, combining their features with additional improvements:

Features

1. Proxy Rotation with Custom Pool Selection

  • Provider-level rotation strategies: none, fill-first, round-robin, random
  • NEW: Checkbox grid UI to select a subset of active proxy pools for rotation (instead of rotating across all pools globally)
  • pickProxyPoolId() accepts targetProxyPoolIds parameter to filter rotation
  • Proxy usage logging: [PROXY] PROVIDER | model | conn=Name | pool=ID | vercel-relay=URL
  • Virtual connection injection for no-auth free providers (unified proxy resolution pipeline)

2. API Key Quota Tracker

  • getApiKeyUsageSnapshot() returns real-time metrics: rpm, rph, rpd, tokens/5h, tokens/day, tokens/week, tokens/month
  • Each metric includes used, limit, percent, and status (ok/warning/danger/blocked)
  • Dashboard card grid with status badges, quota progress bars, and summary stats
  • In-memory rolling counters (apiKeyCounters.js) to avoid DB write amplification

3. Tailscale Loading Fix

  • UI no longer stuck in endless loading when tunnelUrl is empty
  • Login pending state shows warning instead of infinite spinner
  • clearUserAuth() removed from finally block — buttons remain accessible

Superseded PRs

Files Changed

File Changes
connectionProxy.js pickProxyPoolId with targetProxyPoolIds, resolveConnectionProxyConfig, filterTargetProxyPoolIds
NoAuthProxyCard.js Rotation strategy selector, checkbox grid for pool subset, conditional UI
auth.js Proxy pool override, virtual connection injection, API key limit enforcement
EndpointPageClient.js API key card grid, quota progress bars, status badges, Tailscale loading fix
apiKeyUsageRepo.js getApiKeyUsageSnapshot, buildMetric helper
providers/[id]/page.js Render NoAuthProxyCard for all providers
pnpm-lock.yaml duck-duck-scrape dependency

Test Plan

  • Docker image builds (vansrouter:full-merge)
  • Container serves 201 models
  • oc/deepseek-v4-flash-free chat completion → 200
  • Proxy pool logging in container logs
  • API key usage snapshot returns correct metrics
  • Public domain https://router.mahdiwafy.my.id/v1/models → 200
  • Tailscale status endpoint returns valid JSON without hanging

@mahdiwafy mahdiwafy closed this Jul 30, 2026
@mahdiwafy
mahdiwafy force-pushed the pr/proxy-key-dashboard-revamp branch from 09be419 to 8342d58 Compare July 30, 2026 00:35
…r, Tailscale loading fix

- pickProxyPoolId() supports targetProxyPoolIds for subset rotation
- NoAuthProxyCard: checkbox grid for pool selection, conditional UI
- apiKeyUsageRepo: getApiKeyUsageSnapshot with real-time metrics
- EndpointPageClient: card grid with status badges, quota progress bars
- Tailscale: fix endless loading when tunnelUrl is empty
- Supersedes PR Vanszs#67 and Vanszs#73
@mahdiwafy mahdiwafy reopened this Jul 30, 2026
Token Saver (RTK, Headroom, Caveman, Ponytail) settings removed from
the Endpoint & API Keys page. These are now exclusively managed via
the dedicated Token Saver menu at /dashboard/token-saver.

Removed:
- Token Saver card (RTK toggle, Headroom toggle+status, Caveman toggle+levels, Ponytail toggle+levels)
- Headroom Install/Manage modal
- All related state variables, handlers, and computed vars
- locale/caveman sync useEffect and WENYAN_LOCALES import
- Token saver settings loading from loadSettings
@mahdiwafy mahdiwafy closed this Jul 30, 2026
@mahdiwafy
mahdiwafy deleted the pr/proxy-key-dashboard-revamp branch July 30, 2026 05:06
@mahdiwafy
mahdiwafy restored the pr/proxy-key-dashboard-revamp branch July 30, 2026 05:16
@mahdiwafy mahdiwafy reopened this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant