When making requests to Perplexity, ensure you have the following:
Your AI Gateway Account ID.
Your AI Gateway gateway name.
An active Perplexity API token.
The name of the Perplexity model you want to use.
Examples
cURL
Use Perplexity through OpenAI SDK with JavaScript
Perplexity does not have their own SDK, but they have compatibility with the OpenAI SDK. You can use the OpenAI SDK to make a Perplexity call through AI Gateway as follows:
Was this helpful?
What did you like?
What went wrong?
Thank you for helping improve Cloudflare's documentation!