2.9 KiB
summary, read_when
| summary | read_when | |||
|---|---|---|---|---|
| Perplexity provider: browser cookie setup, credits API, recurring/bonus/purchased credit display. |
|
Perplexity Provider
CodexBar reads Perplexity account credit data with a Perplexity web session cookie. It does not use a Perplexity API key and does not support token-cost history.
Setup
- Open Settings -> Providers.
- Enable Perplexity.
- Sign in to perplexity.ai in a supported browser.
- Leave Cookie source on Automatic, or switch to Manual and paste a full
Cookie:header or a bare Perplexity session-token value.
Manual mode accepts these session cookie names:
__Secure-authjs.session-tokenauthjs.session-token__Secure-next-auth.session-tokennext-auth.session-token
You can also provide credentials through the environment:
export PERPLEXITY_SESSION_TOKEN="..."
export PERPLEXITY_COOKIE="__Secure-next-auth.session-token=..."
Data Source
CodexBar requests:
GET https://www.perplexity.ai/rest/billing/credits?version=2.18&source=default
The request sends the resolved Perplexity session cookie, Origin: https://www.perplexity.ai, and
Referer: https://www.perplexity.ai/account/usage.
Automatic mode tries any cached Perplexity cookie first, then imports browser cookies, then falls back to environment variables. Browser-imported cookies are cached and invalid cached cookies are cleared after a rejected request.
Display
- Credits: recurring account credits when Perplexity reports them.
- Bonus credits: promotional or bonus credits.
- Purchased: on-demand purchased credits.
- Renewal: recurring credits use the renewal timestamp when the API returns one.
Purchased credits do not reset, so the menu displays that balance without a reset prefix.
CLI Usage
codexbar usage --provider perplexity --verbose
Troubleshooting
"Perplexity session token is missing"
Sign in to perplexity.ai and refresh CodexBar, or paste a fresh cookie/session token in manual mode.
"Perplexity session token is invalid or expired"
Log out and back in to Perplexity. If manual mode is enabled, paste a new Cookie: header or session-token value.
Credits do not appear
Open Perplexity account usage in the same browser profile and confirm the account has visible credit data.
Related Files
Sources/CodexBarCore/Providers/Perplexity/PerplexityProviderDescriptor.swiftSources/CodexBarCore/Providers/Perplexity/PerplexityUsageFetcher.swiftSources/CodexBarCore/Providers/Perplexity/PerplexityUsageSnapshot.swiftSources/CodexBarCore/Providers/Perplexity/PerplexityCookieHeader.swiftSources/CodexBar/Providers/Perplexity/PerplexityProviderImplementation.swift