How to get your Perplexity API usage, balance and spend programmatically
What the Perplexity API exposes
| Signal | Perplexity |
|---|---|
| Balance | No |
| Spend history | No |
| Cost breakdown | No |
| Plan and quota | No |
| Cost on each response | Yes, the exact USD |
| Rate-limit headers | None |
| Credential | API key |
Call it yourself
Credential. A Perplexity API key. Argus validates it with a 1-token sonar completion.
What each response carries
{
"id": "6f0e…",
"model": "sonar",
"usage": {
"prompt_tokens": 12,
"completion_tokens": 240,
"cost": { "total_cost": 0.0061 }
}
}Trimmed to the fields Argus reads. Values are examples.
No billing API, so measure from your side
Argus can't poll a Perplexity balance, so spend is the sum of usage.cost.total_cost the SDK reads off each response.
Gotchas
- A zero balance returns 401. It looks exactly like a bad key.
- Auto-reload is optional and off by default.
- Cost is per-token plus a per-request fee that scales with search context size, so token counts alone undercount.
- No rate-limit headers. Limits rise through tiers 0–5 by cumulative purchases.
How Perplexity charges
Prepaid credits: per-token cost plus a per-request fee that scales with search context size. Tiers 0–5 by cumulative purchases raise rate limits.
- Tier 0: 50 RPM (sonar)
- Tier 5: 4,000 RPM
At zero. Zero balance → 401 (looks like a bad key!); auto-reload optional, off by default.
- requests per minute, per key. Per model per tier; no rate-limit headers.
Or let Argus track it
Paste the key once. Argus keeps the ledger, and your coding agent reads it through the MCP server.
- With the SDK, records the cost Perplexity reports on each response, so every call is itemized at its exact price.
- Emails you on low balance, days to zero, a spend spike, or projected overage.
- Hands all of it to your coding agent over MCP, so it can ask what a run cost or how much runway is left without leaving the editor.
> what has perplexity cost today, and how long until it runs out?
get_overview → perplexity: mtd spend, burn per day, days to zero
get_request_costs { "provider": "perplexity", "limit": 25 }
get_advisories → credits_low, spend_spike, rate_limit_low …Questions
- Does Perplexity have an API for its balance?
- Perplexity's API credit balance is only in the console; there's no verified endpoint for it. Every response reports its own cost in usage.cost.total_cost, so per-call spend is exact.
- Can I get Perplexity spend per day from the API?
- Not as a series. Each response reports its own cost, so sum it per day yourself, or let Argus do it.
- What happens when Perplexity credits run out?
- Zero balance → 401 (looks like a bad key!); auto-reload optional, off by default. Auto-recharge is available.
- What key does Argus need for Perplexity?
- A Perplexity API key. Argus validates it with a 1-token sonar completion.
Related
Daily buckets, async settlement, cache pricing, per-request fees and charges that only bill on a match. Where the numbers drift, and how to reconcile them.
The status code and error each provider returns at zero balance. Several look like rate limits or bad keys, so they get retried instead of fixed.
The balance call for each provider, side by side.
Pricing and limits verified 2026-07-20 against docs.perplexity.ai/getting-started/pricing, docs.perplexity.ai/guides/usage-tiers. Endpoints are the ones the Argus Perplexity connector calls.
Connect a provider key, point Claude Code or Cursor at the Argus MCP server, and ask what the last run cost.