Sonar Reasoning Pro — 具备搜索功能的思维链推理
curl --request POST \
--url https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "sonar-reasoning-pro",
"messages": [
{
"role": "user",
"content": "Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro"
payload = {
"model": "sonar-reasoning-pro",
"messages": [
{
"role": "user",
"content": "Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'sonar-reasoning-pro',
messages: [
{
role: 'user',
content: 'Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'sonar-reasoning-pro',
'messages' => [
[
'role' => 'user',
'content' => 'Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro"
payload := strings.NewReader("{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
}
}
],
"citations": [
"<string>"
],
"search_results": [
{
"title": "<string>",
"url": "<string>",
"snippet": "<string>",
"date": "<string>",
"source": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"search_context_size": "<string>"
}
}Perplexity API
Sonar 推理专业版
Sonar Reasoning Pro — 具备搜索功能的思维链推理
POST
https://api.aisa.one/apis/v1
/
perplexity
/
sonar-reasoning-pro
Sonar Reasoning Pro — 具备搜索功能的思维链推理
curl --request POST \
--url https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "sonar-reasoning-pro",
"messages": [
{
"role": "user",
"content": "Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro"
payload = {
"model": "sonar-reasoning-pro",
"messages": [
{
"role": "user",
"content": "Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'sonar-reasoning-pro',
messages: [
{
role: 'user',
content: 'Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'sonar-reasoning-pro',
'messages' => [
[
'role' => 'user',
'content' => 'Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro"
payload := strings.NewReader("{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"sonar-reasoning-pro\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"object": "chat.completion",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
}
}
],
"citations": [
"<string>"
],
"search_results": [
{
"title": "<string>",
"url": "<string>",
"snippet": "<string>",
"date": "<string>",
"source": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"search_context_size": "<string>"
}
}Sonar Reasoning Pro 将思维链(CoT)推理与网络搜索相结合,提供由实时来源支持的精确分步分析。
最适合: 分析任务、复杂推理,以及具有事实依据的分步问题解决。
模型:
sonar-reasoning-pro
示例
curl -X POST "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sonar-reasoning-pro",
"messages": [
{"role": "user", "content": "Analyze whether Tesla stock is overvalued based on current P/E ratio compared to industry averages"}
]
}'
响应
响应遵循 OpenAI 聊天补全格式,并包含额外的citations 和 search_results 字段。由于思维链过程,推理模型可能会生成更长的输出。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
要使用的 Sonar 模型。
可用选项:
sonar, sonar-pro, sonar-reasoning-pro, sonar-deep-research 由截至目前的对话内容组成的消息列表。
Show child attributes
Show child attributes
响应中要生成的最大词元数。
介于 0 和 2 之间的采样温度。较低的值会使输出更集中且更具确定性。
必填范围:
0 <= x <= 2核采样参数。模型会考虑累计概率质量达到 top_p 的词元。
必填范围:
0 <= x <= 1用于 top-k 筛选的保留词元数。
必填范围:
0 <= x <= 2048是否使用服务器发送事件以流式方式返回响应。
控制使用的搜索上下文量。会影响单次请求的成本。
可用选项:
low, medium, high 根据新词元目前在文本中的出现频率对其施加惩罚。正值会降低逐字重复同一行的可能性。
必填范围:
0 <= x <= 2根据新词元此前是否已出现在文本中对其施加惩罚。正值会提高谈论新主题的可能性。
必填范围:
-2 <= x <= 2是否在响应中返回引用和搜索结果。
按时效性筛选搜索结果。
可用选项:
month, week, day, hour 将搜索限制在特定域名。
响应
200 - application/json
包含 AI 答案和引用的成功响应
⌘I