> ## Documentation Index
> Fetch the complete documentation index at: https://spacesail.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Perplexity

> Learn how to use Perplexity with Agno.

Perplexity offers powerful language models with built-in web search capabilities, enabling advanced research and Q\&A functionality.

Explore Perplexity’s models [here](https://docs.perplexity.ai/guides/model-cards).

## Authentication

Set your `PERPLEXITY_API_KEY` environment variable. Get your key [from Perplexity here](https://www.perplexity.ai/settings/api).

<CodeGroup>
  ```bash Mac theme={null}
  export PERPLEXITY_API_KEY=***
  ```

  ```bash Windows theme={null}
  setx PERPLEXITY_API_KEY ***
  ```
</CodeGroup>

## Example

Use `Perplexity` with your `Agent`:

<CodeGroup>
  ```python agent.py theme={null}
  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")

  ```
</CodeGroup>

<Note> View more examples [here](/examples/models/perplexity/basic). </Note>

## Params

| Parameter  | Type            | Default                               | Description                                                           |
| ---------- | --------------- | ------------------------------------- | --------------------------------------------------------------------- |
| `id`       | `str`           | `"llama-3.1-sonar-small-128k-online"` | The id of the Perplexity model to use                                 |
| `name`     | `str`           | `"Perplexity"`                        | The name of the model                                                 |
| `provider` | `str`           | `"Perplexity"`                        | The provider of the model                                             |
| `api_key`  | `Optional[str]` | `None`                                | The API key for Perplexity (defaults to PERPLEXITY\_API\_KEY env var) |
| `base_url` | `str`           | `"https://api.perplexity.ai"`         | The base URL for the Perplexity API                                   |

`Perplexity` also supports the params of [OpenAI](/reference/models/openai).
