a90dde7737
* Add Perplexity provider Tracks usage-based API credits from Perplexity Pro/Max plans via the /rest/billing/credits endpoint using a browser session cookie. - Three-tier display: recurring credits (monthly), bonus credits (promotional grants), and purchased on-demand credits - Infers plan name (Free/Pro/Max) from recurring credit pool size - Cookie auth: auto browser import from Chrome/Chromium, manual paste, or PERPLEXITY_SESSION_TOKEN / PERPLEXITY_COOKIE env var fallback - Waterfall attribution: recurring → purchased → promotional - Empty credit pools render as depleted bars, not full ones - Login flow opens perplexity.ai/signin with the standard key icon - 10 unit tests covering parsing, waterfall logic, plan inference, empty-pool rendering, and UsageSnapshot conversion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add cookie caching, fix API parsing, and remove keychain deprecation warning - Cache Perplexity session cookies via CookieHeaderCache (matching Claude/Cursor pattern): try cache before browser import, cache on success, clear + retry on 401/403, preserve cache on transient errors - Fix PerplexityCreditGrant.expiresAtTs to be optional — the API returns null for purchased grants, causing parse failures - Remove deprecated kSecUseAuthenticationUIFail (macOS 14+ only needs LAContext.interactionNotAllowed) - Add debug logging for parse failures (raw response preview) - Add 6 tests for cookie cache behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: detect purchased credits from credit_grants array Perplexity now sends purchased credits as a credit_grant with type="purchased" instead of (or in addition to) the top-level current_period_purchased_cents field. Take the larger of the two sources to avoid double-counting while catching either path. Without this fix, 40k purchased credits were invisible to the waterfall calculation, causing bonus credits to show 100% used when they still had ~42% remaining. * Fix Perplexity session cookie handling * Refine Perplexity credit and cookie behavior * Improve Perplexity cookie fallback handling * Fix Perplexity menu and browser session fallback * Fix Perplexity fallback credit selection * Respect Perplexity primary metric selection * Fix Perplexity Linux cookie import * Prefer purchased Perplexity fallback credits --------- Co-authored-by: John Budnick <jmbudnick@Johns-MacBook-Pro.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: John Budnick <BeelixGit@users.noreply.github.com>