Perplexity API
Generate answers and research reports with web citations.
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.
- 型: array object[]messages必須
A list of messages comprising the conversation so far.
- content型: string必須
The content of the message.
- role型: string 列挙値必須
The role of the message author.
値- system
- user
- assistant
- 型: string 列挙値model必須
The Sonar model to use.
値- sonar
- sonar
-pro - sonar
-reasoning -pro - sonar
-deep -research
- 型: numberfrequency
_penalty 最小値:0最大値:2Penalizes new tokens based on their existing frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.
- 型: integermax
_tokens The maximum number of tokens to generate in the response.
- 型: numberpresence
_penalty 最小値:-2最大値:2Penalizes new tokens based on whether they appear in the text so far. Positive values increase the likelihood of talking about new topics.
- 型: booleanreturn
_citations Whether to return citations and search results in the response.
- 型: string 列挙値search
_context Controls how much search context to use. Affects per-request cost.
値- low
- medium
- high
- 型: array string[]search
_domain _filter Limit search to specific domains.
- 型: string 列挙値search
_recency _filter Filter search results by recency.
値- month
- week
- day
- hour
- 型: boolean 列挙値stream定数:false
Only non-streaming JSON responses are covered by this public contract. Set false.
値- false
- 型: numbertemperature最小値:0最大値:2
Sampling temperature between 0 and 2. Lower values make output more focused and deterministic.
- 型: integertop
_k 最小値:0最大値:2048The number of tokens to keep for top-k filtering.
- 型: numbertop
_p 最小値:0最大値:1Nucleus sampling parameter. The model considers tokens with top_p probability mass.
- 型: object · ChatCompletionResponse200
Successful response with AI answer and citations
- 型: array object[]choices
- finish型: string 列挙値
_reason 値- stop
- length
- index型: integer
Integer numbers.
- message型: object
- content型: string
The AI-generated answer, with inline citation references like [1][2].
- role型: string
- 型: array string[]citations
List of source URLs referenced in the answer.
- 型: integercreated
Unix timestamp of when the completion was created.
- 型: stringid
Unique identifier for the completion.
- 型: stringmodel
The model used for the completion.
- 型: stringobject
- 型: array object[]search
_results Detailed search results with titles, snippets, and URLs.
- date型: string
- snippet型: string
- source型: string
- title型: string
- url型: string
- 型: objectusage
- completion型: integer
_tokens Integer numbers.
- prompt型: integer
_tokens Integer numbers.
- search型: string
_context _size - total型: 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-reasoning-pro \
--header "Authorization: Bearer ${FELO_API_KEY:?Set FELO_API_KEY}" \
--header 'Content-Type: application/json' \
--data '{"model": "sonar-reasoning-pro", "messages": [{"role": "user", "content": "Explain when conditional HTTP requests save bandwidth, citing the standards."}], "max_tokens": 2048, "stream": false}'
{
"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
}
}