# Perplexity (https://www.librechat.ai/docs/configuration/librechat_yaml/ai_endpoints/perplexity)

Perplexity provides the Sonar family of search-grounded models, used in LibreChat as a custom endpoint.

## Get an API key

Create a key from the [Perplexity API settings](https://www.perplexity.ai/settings/api). Add it to your `.env` file:

```bash filename=".env"
PERPLEXITY_API_KEY=your-api-key
```

## Configuration

Add the endpoint under `endpoints.custom` in your `librechat.yaml`:

```yaml filename="librechat.yaml"
    - name: "Perplexity"
      apiKey: "${PERPLEXITY_API_KEY}"
      baseURL: "https://api.perplexity.ai/"
      models:
        default: [
          "sonar-deep-research",
          "sonar-reasoning-pro",
          "sonar-reasoning",
          "sonar-pro",
          "sonar",
          "r1-1776"
          ]
        fetch: false
      titleConvo: true
      titleModel: "llama-3-sonar-small-32k-chat"
      summarize: false
      summaryModel: "llama-3-sonar-small-32k-chat"
      dropParams: ["stop", "frequency_penalty"]
      modelDisplayLabel: "Perplexity"
```

## Notes

- Fetching the model list is not supported, so keep `fetch: false` and maintain the `default` list manually.
- The API is strict for some models. Fields like `stop` and `frequency_penalty` can cause an error when set to 0, so drop them with [`dropParams`](/docs/configuration/librechat_yaml/object_structure/custom_endpoint#dropparams).
