Did you follow this tutorial to setup:
https://docs.llamaindex.ai/en/latest/examples/llm/perplexity/?h=perpl ?
If you could share a traceback that will help to understand better.
You get 400 when your request has missing items that are required.
There could be multiple factors for this:
- Perplexity may have updated their API which may not be reflecting on llama-index.
- You may be leaving something while setting up.