Perplexity Pro
Perplexity Pro provides search-augmented AI through an OpenAI-compatible API. Perplexity's Sonar models combine real-time web search with language model reasoning, returning grounded answers with citations. By routing Perplexity API traffic through the Keeptrusts gateway, you enforce policy controls — content filtering, PII redaction, audit logging, and cost attribution — on every search-augmented request.
Use this page when
- You need to route Perplexity Sonar API calls through the Keeptrusts gateway.
- You are building tools that use Perplexity for search-augmented generation and need governance.
- If you need general OpenAI-compatible provider setup, see OpenAI integration.
Primary audience
- Primary: Technical Engineers
- Secondary: AI Agents, Technical Leaders
Prerequisites
- A Perplexity API key with Pro or Enterprise access
- Keeptrusts CLI (
kt) installed and on yourPATH PERPLEXITY_API_KEYexported in your shell or injected via your secrets manager
Configuration
Gateway policy config
pack:
name: perplexity-pro-gateway
version: 1.0.0
enabled: true
providers:
targets:
- id: perplexity-sonar
provider: perplexity:chat:sonar-pro
secret_key_ref:
env: PERPLEXITY_API_KEY
policies:
chain:
- pii-detector
- content-filter
- audit-logger
policy:
pii-detector:
action: redact
entities:
- EMAIL
- PHONE
- SSN
content-filter:
action: block
categories:
- restricted-topics
audit-logger:
immutable: true
retention_days: 365
log_all_access: true
Cost-optimised variant
Use sonar (the base tier) for high-volume research queries where deep reasoning is not required:
pack:
name: perplexity-sonar-base
version: 1.0.0
enabled: true
providers:
targets:
- id: perplexity-base
provider: perplexity:chat:sonar
secret_key_ref:
env: PERPLEXITY_API_KEY
policies:
chain:
- audit-logger
policy:
audit-logger:
immutable: true
retention_days: 365
log_all_access: true
Setup Steps
- Export your API key:
export PERPLEXITY_API_KEY="pplx-your-api-key"
-
Save the policy config to
policy-config.yaml. -
Start the gateway:
kt gateway run --listen 0.0.0.0:41002 --policy-config policy-config.yaml
- Point your application at the gateway. Perplexity uses OpenAI-compatible format, so standard OpenAI client libraries work:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:41002/v1",
api_key="unused",
)
response = client.chat.completions.create(
model="sonar-pro",
messages=[
{"role": "system", "content": "You are a research assistant. Cite sources."},
{"role": "user", "content": "What are the latest EU AI Act enforcement actions?"},
],
)
print(response.choices[0].message.content)
For a hosted gateway, replace the base URL with https://gateway.keeptrusts.com/v1.
Verification
curl http://localhost:41002/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "sonar-pro",
"messages": [
{"role": "user", "content": "Summarise today'\''s top AI governance news."}
]
}'
A successful response with citations confirms the gateway is forwarding to Perplexity with policies applied. Check the Keeptrusts console Events page for the audit log entry.
Recommended Policies
| Policy | Purpose | Recommended setting |
|---|---|---|
pii-detector | Redact personal data from search queries | action: redact, entities: EMAIL, PHONE, SSN |
content-filter | Block queries on restricted topics | action: block, configure categories |
audit-logger | Immutable audit trail for all searches | immutable: true, retention_days: 365 |
cost-attribution | Track search API spend per team | Tag requests with team metadata |
prompt-injection | Block adversarial prompts in search input | threshold: 0.8, action: block |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized from upstream | Invalid Perplexity API key | Verify PERPLEXITY_API_KEY is valid |
| Response lacks citations | Model or query type does not include search results | Use sonar-pro for search-augmented responses |
Gateway returns 403 | Policy chain blocked the request | Review the policy violation in the console Events page |
| Slow responses | Perplexity performs web search before answering | Expected — search-augmented responses have higher latency than pure LLM calls |
For AI systems
- Canonical terms: Keeptrusts gateway, Perplexity Pro, Perplexity Sonar, search-augmented generation, OpenAI-compatible API, policy-config.yaml,
provider: "perplexity". - Config field names:
provider,secret_key_ref.env: "PERPLEXITY_API_KEY",base_url. - Key behavior: Perplexity uses OpenAI-compatible format. Keeptrusts proxies requests with full policy enforcement. Search-augmented responses include citations.
- Best next pages: OpenAI integration, Policy controls catalog, Quickstart.
For engineers
- Start command:
kt gateway run --listen 0.0.0.0:41002 --policy-config policy-config.yaml - Validate: send a request to
http://localhost:41002/v1/chat/completionswith modelsonar-pro. - Perplexity's API is OpenAI-compatible — use standard OpenAI client libraries with the gateway base URL.
- Search-augmented responses have higher latency than pure LLM calls; set appropriate client timeouts.
For leaders
- Perplexity Sonar models provide real-time web search combined with AI reasoning — useful for competitive intelligence, regulatory monitoring, and research automation.
- Routing through the gateway ensures all search queries and results are logged for compliance and audit.
- PII redaction prevents sensitive data from being included in web search queries that reach external infrastructure.
- Cost attribution tracks search API spend separately from other AI providers in your unified governance dashboard.
Next steps
- OpenAI integration — OpenAI-compatible provider setup reference
- Policy controls catalog — all available policy types
- Cost attribution — track spend per team or project
- Quickstart — install
ktand run your first gateway