Perplexity
Perplexity AI provides access to advanced language models designed for reasoning and search-augmented generation. Braintrust integrates seamlessly with Perplexity through direct API access, wrapper functions for automatic tracing, and proxy support.
Setup
To use Perplexity models, configure your Perplexity API key in Braintrust.
- Get a Perplexity API key from Perplexity Console
- Add the Perplexity API key to your organization's AI providers
- Set the Perplexity API key and your Braintrust API key as environment variables
API keys are encrypted using 256-bit AES-GCM encryption and are not stored or logged by Braintrust.
Use Perplexity with Braintrust AI proxy
The Braintrust AI Proxy allows you to access Perplexity models through a unified OpenAI-compatible interface.
Install the braintrust
and openai
packages.
pnpm add braintrust openai
Then, initialize the client and make a request to a Perplexity model via the Braintrust AI Proxy.
Trace logs with Perplexity
Trace your Perplexity LLM calls for observability and monitoring.
When using the Braintrust AI Proxy, API calls are automatically logged to the specified project.
The Braintrust AI Proxy is not required to trace Perplexity API calls. For more control, learn how to customize traces.
Evaluate with Perplexity
Evaluations distill the non-deterministic outputs of Perplexity models into an effective feedback loop that enables you to ship more reliable, higher quality products. Braintrust Eval
is a simple function composed of a dataset of user inputs, a task, and a set of scorers. To learn more about evaluations, see the Experiments guide.
To learn more about tool use, multimodal support, attachments, and masking sensitive data with Perplexity, visit the customize traces guide.
Models and capabilities
Model | Multimodal | Reasoning | Max input | Max output | Input $/1M | Output $/1M |
---|---|---|---|---|---|---|
sonar | ﹣ | ﹣ | $1.00 | $1.00 | ||
sonar-pro | ﹣ | ﹣ | $3.00 | $15.00 | ||
sonar-reasoning | ﹣ | ﹣ | $1.00 | $5.00 | ||
sonar-reasoning-pro | ﹣ | ﹣ | $2.00 | $8.00 | ||
r1-1776 | ﹣ | ﹣ | $2.00 | $8.00 |