Skip to main content
This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.
You can follow their documentation here: https://docs.perplexity.ai/

Gateway Integration

1

Create a Helicone account

Log into helicone or create an account. Once you have an account, you can generate an API key.
2

Create a Perplexity AI account

Log into Perplexity AI or create an account. Once you have an account, you can generate an API key from your dashboard.
3

Set HELICONE_API_KEY and PERPLEXITY_API_KEY as environment variable

HELICONE_API_KEY=<your API key>
PERPLEXITY_API_KEY=<your API key>
4

Modify the base URL and add Auth headers

Replace the following Perplexity AI URL with the Helicone Gateway URL:https://api.perplexity.ai/chat/completions -> https://perplexity.helicone.ai/chat/completionsand then add the following authentication headers:
Authorization: Bearer <your API key>
Now you can access all the models on Perplexity AI with a simple fetch call:

Example

curl --request POST \
  --url https://perplexity.helicone.ai/chat/completions \
  --header "Authorization: Bearer $PERPLEXITY_API_KEY" \
  --header "Helicone-Auth: Bearer $HELICONE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "sonar-pro",
    "messages": [{"role": "user", "content": "Say this is a test"}]
}'
For more information on how to use headers, see Helicone Headers docs. And for more information on how to use Perplexity AI, see Perplexity AI Docs.