feat(quota): add Wafer.ai quota provider (#1312)

* feat(quota): add Wafer.ai quota provider

- New provider: wafer.js fetches from https://pass.wafer.ai/v1/inference/quota
- Auth: reads wafer/wafer-ai/wafer_ai keys from auth file
- Timeout: AbortSignal.timeout(15_000) with timeoutSignal.aborted detection
- Response: parses remaining/limit/overage/usedPercent/window_end/plan_tier
- valueLabel: planTier + remaining/limit + overage suffix
- Window: 5h (18000s) via resolveWindowLabel
- Cross-runtime: added to web registry, UI types, VS Code dispatcher

* fix(quota): wafer provider fixes — auth alias, decompression, logo

- Add 'wafer.ai' auth alias to match actual auth key format
- Use 'Accept-Encoding: identity' header to fix Bun fetch
  decompression issue with Cloudflare-backed responses
- Match copilot valueLabel format: 'planTier · X / Y left'
- Add wafer logo alias so Providers and Usage pages resolve
  to the same wafer.ai logo from models.dev

* style(quota): fix indentation of timeoutSignal declaration

* fix(quota): derive window duration from API instead of hardcoding

Compute windowSeconds from window_end - window_start timestamps,
with WAFER_WINDOW_SECONDS (5h) as fallback if timestamps are missing.

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Lam Nguyen
2026-05-19 17:29:36 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent 6970cb45c0
commit 4cfe7c80a3
8 changed files with 274 additions and 3 deletions
+2
View File
@@ -23,6 +23,8 @@ const LOGO_ALIAS = new Map<string, string>([
['evroc-ai', 'evroc'],
['evrocai', 'evroc'],
['ollama-cloud', 'ollama'],
['wafer-ai', 'wafer.ai'],
['wafer', 'wafer.ai'],
]);
const normalizeProviderId = (providerId: string | null | undefined) => {
@@ -18,6 +18,7 @@ export const QUOTA_PROVIDERS: QuotaProviderMeta[] = [
{ id: 'minimax-cn-coding-plan', name: 'MiniMax Coding Plan (minimaxi.com)' },
{ id: 'minimax-coding-plan', name: 'MiniMax Coding Plan (minimax.io)' },
{ id: 'ollama-cloud', name: 'Ollama Cloud' },
{ id: 'wafer', name: 'Wafer.ai' },
];
export const QUOTA_PROVIDER_MAP = QUOTA_PROVIDERS.reduce<
+2 -1
View File
@@ -12,7 +12,8 @@ export type QuotaProviderId =
| 'zhipuai-coding-plan'
| 'minimax-coding-plan'
| 'minimax-cn-coding-plan'
| 'ollama-cloud';
| 'ollama-cloud'
| 'wafer';
export interface UsageWindow {
usedPercent: number | null;