Data API / Perplexity / Sonar Reasoning Pro
Perplexity Sonar Reasoning Pro
Analyze a question requiring reasoning supported by web search and citations. model and messages are required; use model sonar-reasoning-pro for this endpoint. This public contract covers non-streaming JSON responses with stream false. Read choices[].message.content, citations and search_results for the answer and its sources. usage is not a Felo credit charge.
Параметры
Параметров пути, запроса и заголовков нет.
Тело запроса
modelstringОбязательныйДопустимые значения: sonar · sonar-pro · sonar-reasoning-pro · sonar-deep-research
The Sonar model to use.
messagesobject[]ОбязательныйA list of messages comprising the conversation so far.
rolestringОбязательныйДопустимые значения: system · user · assistant
The role of the message author.
contentstringОбязательныйThe content of the message.
max_tokensintegerНеобязательныйThe maximum number of tokens to generate in the response.
temperaturenumberНеобязательныйSampling temperature between 0 and 2. Lower values make output more focused and deterministic.
top_pnumberНеобязательныйNucleus sampling parameter. The model considers tokens with top_p probability mass.
top_kintegerНеобязательныйThe number of tokens to keep for top-k filtering.
streambooleanНеобязательныйДопустимые значения: false
Only non-streaming JSON responses are covered by this public contract. Set false.
search_contextstringНеобязательныйДопустимые значения: low · medium · high
Controls how much search context to use. Affects per-request cost.
frequency_penaltynumberНеобязательныйPenalizes new tokens based on their existing frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.
presence_penaltynumberНеобязательныйPenalizes new tokens based on whether they appear in the text so far. Positive values increase the likelihood of talking about new topics.
return_citationsbooleanНеобязательныйWhether to return citations and search results in the response.
search_recency_filterstringНеобязательныйДопустимые значения: month · week · day · hour
Filter search results by recency.
search_domain_filterstring[]НеобязательныйLimit search to specific domains.
Пример запроса
curl -X POST "https://openapi.felo.ai/v1/beta/perplexity/sonar-reasoning-pro" \
-H "Authorization: Bearer $FELO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<string>",
"messages": [
{}
],
"max_tokens": 0,
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stream": false,
"search_context": "<string>"
}'Ответ
Пример ответа
{
"id": "example-sonar-reasoning-pro-completion",
"model": "sonar-reasoning-pro",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A successful cache validation can avoid transferring an unchanged body. [1]"
},
"finish_reason": "stop"
}
],
"citations": [
"https://www.rfc-editor.org/rfc/rfc9110.html"
],
"search_results": [
{
"title": "HTTP Semantics",
"url": "https://www.rfc-editor.org/rfc/rfc9110.html"
}
],
"usage": {
"prompt_tokens": 30,
"completion_tokens": 50,
"total_tokens": 80
}
}Поля ответа
idstringНеобязательныйUnique identifier for the completion.
modelstringНеобязательныйThe model used for the completion.
objectstringНеобязательныйcreatedintegerНеобязательныйUnix timestamp of when the completion was created.
choicesobject[]НеобязательныйindexintegerНеобязательныйmessageobjectНеобязательныйrolestringНеобязательныйcontentstringНеобязательныйThe AI-generated answer, with inline citation references like [1][2].
finish_reasonstringНеобязательныйДопустимые значения: stop · length
citationsstring[]НеобязательныйList of source URLs referenced in the answer.
search_resultsobject[]НеобязательныйDetailed search results with titles, snippets, and URLs.
titlestringНеобязательныйurlstringНеобязательныйsnippetstringНеобязательныйdatestringНеобязательныйsourcestringНеобязательныйusageobjectНеобязательныйprompt_tokensintegerНеобязательныйcompletion_tokensintegerНеобязательныйtotal_tokensintegerНеобязательныйsearch_context_sizestringНеобязательный