perplexity
chat
Test your Perplexity API key.
Validate a Perplexity API key and confirm you can call the Sonar online-search models.
Stateless proxy — keys never logged, stored, or persisted. What happens to your key →
Detected
Perplexity
What this key does
Perplexity's API is OpenAI-compatible. The Sonar model family does retrieval-augmented chat using Perplexity's index. Citations come back as part of the response.
How to get a Perplexity API key
- Sign in at perplexity.ai/settings/api.
- Add a payment method (the API requires it).
- Create a key starting with pplx-.
- Paste it here.
Common errors and fixes
- 401 Unauthorized: Key is invalid, revoked, or pasted with extra whitespace. Generate a new key from the provider console and try again.
- 403 Forbidden: Key is valid but lacks permission for this resource. Check project / org / workspace scope, or that billing is set up for this key.
- 429 Too Many Requests: You hit the per-minute or per-day rate limit. Wait a moment and retry, or upgrade your tier.
- 404 Not Found: The endpoint or model id changed. Check the provider docs for the current path and model identifier.
- 5xx: The provider is having issues. Check their status page before assuming the bug is yours.
Security best practices
- Store keys in an env var or secret manager — never commit them to a repo, even a private one.
- Restrict scope: prefer per-project or per-deployment keys over a single root key shared across services.
- Rotate on a schedule (90 days is a sane default) and immediately on suspected leak.
- Audit usage in the provider console after rotation to confirm the old key has zero traffic.
- Set per-key spend limits where the provider supports them, so a leaked key has a bounded blast radius.
Pricing at a glance
Sonar is billed per request plus per token. Sonar Pro is more expensive but includes deeper search.
FAQ
- What's the Sonar model family?
- Perplexity-tuned Llama / Mistral with built-in retrieval over Perplexity's index.
- Is Perplexity OpenAI-compatible?
- Yes — base URL https://api.perplexity.ai.
- Are sources returned in the response?
- Yes — there's a citations array alongside the chat response.
- Can I disable search?
- No — Sonar is search-augmented by design. For pure chat use a different provider.
- What's sonar-reasoning?
- A chain-of-thought variant trained for multi-step retrieval reasoning.
- Is there a free tier?
- No public free tier on the API; pay-as-you-go from the start.
Test other providers
Related reading
- API key security best practices for LLMsHow to store, scope, rotate, and revoke LLM API keys without leaking them through git, logs, or shared environments.
- OpenAI vs Anthropic pricing in 2026A side-by-side breakdown of OpenAI and Anthropic per-token pricing, batch discounts, and prompt-caching savings.