Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c932edbee2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let primaryPercent = recurringTotal > 0 | ||
| ? min(100, max(0, recurringUsed / recurringTotal * 100)) | ||
| : 0.0 |
There was a problem hiding this comment.
Mark zero recurring credits as fully used
When recurringTotal is 0, this branch sets primaryPercent to 0.0, which renders the recurring bar as full even though there are no recurring credits available. This affects free/expired accounts (or any response without recurring grants) and contradicts the empty-pool handling used for promo/purchased bars, so the UI reports the recurring pool in the opposite state.
Useful? React with 👍 / 👎.
| let raw = environment["PERPLEXITY_SESSION_TOKEN"] | ||
| ?? environment["perplexity_session_token"] | ||
| ?? environment["PERPLEXITY_COOKIE"] | ||
| return self.cleaned(raw) |
There was a problem hiding this comment.
Parse PERPLEXITY_COOKIE as cookie header
This reader accepts PERPLEXITY_COOKIE but returns it verbatim as a session token; if users provide a full cookie header (which the variable name strongly implies), the fetcher later wraps it again as __Secure-next-auth.session-token=<value>, producing a malformed Cookie header and authentication failures. PERPLEXITY_COOKIE should be normalized through the same token-extraction path used for manual cookie input.
Useful? React with 👍 / 👎.
2b10371 to
db8342c
Compare
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>
db8342c to
fabc673
Compare
Worked with Claude Code to add Perplexity Max usage tracking to CodexBar. Seems to work for me but I am sure there are things I missed.
What this adds
/rest/billing/creditsusing a browser session cookie (auto-imported from Chrome/Chromium on macOS, or set manually via cookie header /PERPLEXITY_SESSION_TOKENenv var)UsageSnapshotconversionTest plan
bash Scripts/compile_and_run.shswift test --filter PerplexityUsageFetcherTests🤖 Generated with Claude Code