Skip to main content
Perplexity offers powerful language models with built-in web search capabilities, enabling advanced research and Q&A functionality. Explore Perplexity’s models here.

Authentication

Set your PERPLEXITY_API_KEY environment variable. Get your key from Perplexity here.
export PERPLEXITY_API_KEY=***

Example

Use Perplexity with your Agent:
from agno.agent import Agent
from agno.models.perplexity import Perplexity

agent = Agent(model=Perplexity(id="sonar-pro"), markdown=True)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story")

View more examples here.

Params

ParameterTypeDefaultDescription
idstr"llama-3.1-sonar-small-128k-online"The id of the Perplexity model to use
namestr"Perplexity"The name of the model
providerstr"Perplexity"The provider of the model
api_keyOptional[str]NoneThe API key for Perplexity (defaults to PERPLEXITY_API_KEY env var)
base_urlstr"https://api.perplexity.ai"The base URL for the Perplexity API
Perplexity also supports the params of OpenAI.
I