Skip to content

Perplexity Search API

Perplexity provides high-quality conversational search. It excels at answering complex questions with citations from diverse web sources.

POST https://llm.siraya.ai/v1/perplexity

Body

model string Required
Use `perplexity-search`.
query string Required
The search query or question.
max_results integer
Maximum number of results to return (default: 10, range: 1-20).
search_recency_filter string
`hour`, `day`, `week`, `month`, or `year`.
curl https://llm.siraya.ai/v1/perplexity \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "model": "perplexity-search",
    "query": "What is the status of the James Webb Space Telescope?",
    "max_results": 5
  }'
import requests

url = "https://llm.siraya.ai/v1/perplexity"
headers = {"Authorization": "Bearer <API_KEY>"}
data = {
    "model": "perplexity-search",
    "query": "What is the status of the James Webb Space Telescope?"
}

response = requests.post(url, headers=headers, json=data)
results = response.json().get("results", [])

Example Response

{
  "results": [
    {
      "title": "James Webb Space Telescope (JWST) NASA",
      "url": "https://webb.nasa.gov/",
      "snippet": "The James Webb Space Telescope is the largest, most powerful space telescope ever built...",
      "date": "2024-03-01",
      "last_updated": "2024-03-05"
    }
  ]
}