Perplexity API
Generate answers and research reports with web citations.
Perplexity Sonar Deep Research
Generate a research report using multiple web searches and cited sources. model and messages are required; use model sonar-deep-research for this endpoint. This public contract covers non-streaming JSON responses with stream false. Research can take several minutes and may exceed gateway or client timeouts. Read choices[].message.content, citations and search_results for the report and its sources. usage is not a Felo credit charge.
- Type: array object[]messagesrequired
A list of messages comprising the conversation so far.
- contentType: stringrequired
The content of the message.
- roleType: string enumrequired
The role of the message author.
values- system
- user
- assistant
- Type: string enummodelrequired
The Sonar model to use.
values- sonar
- sonar
-pro - sonar
-reasoning -pro - sonar
-deep -research
- Type: numberfrequency
_penalty min:0max:2Penalizes new tokens based on their existing frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.
- Type: integermax
_tokens The maximum number of tokens to generate in the response.
- Type: numberpresence
_penalty min:-2max:2Penalizes new tokens based on whether they appear in the text so far. Positive values increase the likelihood of talking about new topics.
- Type: booleanreturn
_citations Whether to return citations and search results in the response.
- Type: string enumsearch
_context Controls how much search context to use. Affects per-request cost.
values- low
- medium
- high
- Type: array string[]search
_domain _filter Limit search to specific domains.
- Type: string enumsearch
_recency _filter Filter search results by recency.
values- month
- week
- day
- hour
- Type: boolean enumstreamconst:false
Only non-streaming JSON responses are covered by this public contract. Set false.
values- false
- Type: numbertemperaturemin:0max:2
Sampling temperature between 0 and 2. Lower values make output more focused and deterministic.
- Type: integertop
_k min:0max:2048The number of tokens to keep for top-k filtering.
- Type: numbertop
_p min:0max:1Nucleus sampling parameter. The model considers tokens with top_p probability mass.
- Type: object · ChatCompletionResponse200
Successful response with AI answer and citations
- Type: array object[]choices
- finishType: string enum
_reason values- stop
- length
- indexType: integer
Integer numbers.
- messageType: object
- contentType: string
The AI-generated answer, with inline citation references like [1][2].
- roleType: string
- Type: array string[]citations
List of source URLs referenced in the answer.
- Type: integercreated
Unix timestamp of when the completion was created.
- Type: stringid
Unique identifier for the completion.
- Type: stringmodel
The model used for the completion.
- Type: stringobject
- Type: array object[]search
_results Detailed search results with titles, snippets, and URLs.
- dateType: string
- snippetType: string
- sourceType: string
- titleType: string
- urlType: string
- Type: objectusage
- completionType: integer
_tokens Integer numbers.
- promptType: integer
_tokens Integer numbers.
- searchType: string
_context _size - totalType: integer
_tokens Integer numbers.
application/json - 400
The request could not be processed. Check the request parameters.
- 401
A valid Felo API key is required.
- 402
The request cannot proceed because a billing requirement is not met.
- 403
The account is not permitted to perform this operation.
- 429
A request or spending limit has been reached.
- 502
The service could not complete the request.
- 503
The API or billing service is temporarily unavailable.
- 504
The service timed out while processing the request.
- default
The operation failed. Keep the response request ID when contacting Felo support.
curl --request POST https://openapi.felo.ai/v1/beta/perplexity/sonar-deep-research \
--header "Authorization: Bearer ${FELO_API_KEY:?Set FELO_API_KEY}" \
--header 'Content-Type: application/json' \
--data '{"model": "sonar-deep-research", "messages": [{"role": "user", "content": "Research HTTP caching strategies for public APIs, with references to standards."}], "max_tokens": 4096, "stream": false}'
{
"id": "example-sonar-deep-research-completion",
"model": "sonar-deep-research",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Public API caching combines freshness controls and conditional requests. [1][2]"
},
"finish_reason": "stop"
}
],
"citations": [
"https://www.rfc-editor.org/rfc/rfc9111.html",
"https://www.rfc-editor.org/rfc/rfc9110.html"
],
"search_results": [
{
"title": "HTTP Caching",
"url": "https://www.rfc-editor.org/rfc/rfc9111.html"
},
{
"title": "HTTP Semantics",
"url": "https://www.rfc-editor.org/rfc/rfc9110.html"
}
],
"usage": {
"prompt_tokens": 40,
"completion_tokens": 80,
"total_tokens": 120
}
}