# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '[
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]'curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]
'import requests
url = "https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live"
payload = [
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]
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([
{
system_message: 'communicate as if we are in a business meeting',
message_chain: [
{role: 'user', message: 'Hello, what’s up?'},
{
role: 'ai',
message: 'Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?'
}
],
max_output_tokens: 200,
temperature: 0.3,
top_p: 0.5,
web_search_country_iso_code: 'FR',
model_name: 'sonar',
user_prompt: 'provide information on how relevant the amusement park business is in France now'
}
])
};
fetch('https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live', 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/dataforseo/ai_optimization/perplexity/llm_responses/live",
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([
[
'system_message' => 'communicate as if we are in a business meeting',
'message_chain' => [
[
'role' => 'user',
'message' => 'Hello, what’s up?'
],
[
'role' => 'ai',
'message' => 'Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?'
]
],
'max_output_tokens' => 200,
'temperature' => 0.3,
'top_p' => 0.5,
'web_search_country_iso_code' => 'FR',
'model_name' => 'sonar',
'user_prompt' => 'provide information on how relevant the amusement park business is in France now'
]
]),
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/dataforseo/ai_optimization/perplexity/llm_responses/live"
payload := strings.NewReader("[\n {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\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/dataforseo/ai_optimization/perplexity/llm_responses/live")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live")
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 {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\n }\n]"
response = http.request(request)
puts response.read_body{
"version": "<string>",
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"cost": 123,
"tasks_count": 123,
"tasks_error": 123,
"tasks": [
{
"id": "<string>",
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"cost": 123,
"result_count": 123,
"path": [
"<string>"
],
"data": {},
"result": [
{
"model_name": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"reasoning_tokens": 123,
"web_search": true,
"money_spent": 123,
"datetime": "<string>",
"items": [
{
"sections": [
{
"type": "<string>",
"text": "<string>",
"annotations": [
{
"title": "<string>",
"url": "<string>",
"direct_url": "<string>",
"start_index": 123,
"end_index": 123,
"text": "<string>"
}
]
}
],
"type": "<string>"
}
],
"fan_out_queries": {}
}
]
}
]
}Live Perplexity LLM Responses
Sends a user_prompt to a Perplexity model and returns its reply, synchronously.
# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '[
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]'curl --request POST \
--url https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]
'import requests
url = "https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live"
payload = [
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]
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([
{
system_message: 'communicate as if we are in a business meeting',
message_chain: [
{role: 'user', message: 'Hello, what’s up?'},
{
role: 'ai',
message: 'Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?'
}
],
max_output_tokens: 200,
temperature: 0.3,
top_p: 0.5,
web_search_country_iso_code: 'FR',
model_name: 'sonar',
user_prompt: 'provide information on how relevant the amusement park business is in France now'
}
])
};
fetch('https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live', 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/dataforseo/ai_optimization/perplexity/llm_responses/live",
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([
[
'system_message' => 'communicate as if we are in a business meeting',
'message_chain' => [
[
'role' => 'user',
'message' => 'Hello, what’s up?'
],
[
'role' => 'ai',
'message' => 'Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?'
]
],
'max_output_tokens' => 200,
'temperature' => 0.3,
'top_p' => 0.5,
'web_search_country_iso_code' => 'FR',
'model_name' => 'sonar',
'user_prompt' => 'provide information on how relevant the amusement park business is in France now'
]
]),
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/dataforseo/ai_optimization/perplexity/llm_responses/live"
payload := strings.NewReader("[\n {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\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/dataforseo/ai_optimization/perplexity/llm_responses/live")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live")
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 {\n \"system_message\": \"communicate as if we are in a business meeting\",\n \"message_chain\": [\n {\n \"role\": \"user\",\n \"message\": \"Hello, what’s up?\"\n },\n {\n \"role\": \"ai\",\n \"message\": \"Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?\"\n }\n ],\n \"max_output_tokens\": 200,\n \"temperature\": 0.3,\n \"top_p\": 0.5,\n \"web_search_country_iso_code\": \"FR\",\n \"model_name\": \"sonar\",\n \"user_prompt\": \"provide information on how relevant the amusement park business is in France now\"\n }\n]"
response = http.request(request)
puts response.read_body{
"version": "<string>",
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"cost": 123,
"tasks_count": 123,
"tasks_error": 123,
"tasks": [
{
"id": "<string>",
"status_code": 123,
"status_message": "<string>",
"time": "<string>",
"cost": 123,
"result_count": 123,
"path": [
"<string>"
],
"data": {},
"result": [
{
"model_name": "<string>",
"input_tokens": 123,
"output_tokens": 123,
"reasoning_tokens": 123,
"web_search": true,
"money_spent": 123,
"datetime": "<string>",
"items": [
{
"sections": [
{
"type": "<string>",
"text": "<string>",
"annotations": [
{
"title": "<string>",
"url": "<string>",
"direct_url": "<string>",
"start_index": 123,
"end_index": 123,
"text": "<string>"
}
]
}
],
"type": "<string>"
}
],
"fan_out_queries": {}
}
]
}
]
}user_prompt to a Perplexity model and returns its reply, synchronously. model_name must come from get_dataforseo_ai_perplexity_llm_responses_models - sonar, sonar-pro and sonar-reasoning-pro. web_search_country_iso_code scopes the search, which the other three vendors do not offer. Returns model_name, input_tokens, output_tokens, reasoning_tokens, web_search, money_spent, datetime, items and fan_out_queries. 💰 Billed per call at a flat rate, whatever the reply length. Wrapped in DataForSEO’s envelope: data in tasks[0].result, outcome in tasks[0].status_code - a rejected request still returns HTTP 200. ⚠️ Perplexity searches by default, so its cost varies more with the question than the other vendors’ do - post_perplexity_sonar_deep_research is the documented case of that going badly (CASEBOOK C5).
Example
curl -X POST "https://api.aisa.one/apis/v1/dataforseo/ai_optimization/perplexity/llm_responses/live" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '[{"user_prompt": "...", "model_name": "...", "max_output_tokens": "..."}]'
// Copy this whole block into Claude Code, Codex, Cursor or any coding agent.
// It carries everything needed to connect, authorize and run this example —
// no key to paste, one click of Allow in the browser.
{
"operation_id": "post_dataforseo_ai_perplexity_llm_responses_live",
"arguments": {},
"max_price_usd": 0.05
}
// ── for the agent ─────────────────────────────────────────────────────────
// Register the AIsa MCP server, then call its `use` tool with the JSON above.
// name aisa
// endpoint https://mcp.aisa.one/mcp
// transport streamable-http
// auth OAuth. The server publishes RFC 9728 metadata, so open a
// browser and the user clicks Allow once — nothing to paste.
// If AISA_API_KEY is set, send it as a bearer header instead.
// Use your own MCP mechanism, not a hand-edited config file:
// Codex codex mcp add aisa --url https://mcp.aisa.one/mcp
// Claude Code claude mcp add --transport http -s user aisa https://mcp.aisa.one/mcp
// Cursor / VS Code a "url" entry for https://mcp.aisa.one/mcp in the MCP config
// The server lists five tools over https://mcp.aisa.one/servers worth of APIs:
// search, get_details, use, batch_use, list_categories. search and
// get_details are free; use is billed per call and max_price_usd refuses
// anything above the cap before spending. This operation's full contract —
// every argument, the response shape, the price and the pitfalls — is at
// https://aisa.one/docs/api-reference/dataforseo/post_dataforseo-ai-optimization-perplexity-llm-responses-live.md
// Then run the call and show me the result.
https://mcp.aisa.one/mcp — Claude
Code, Codex, Cursor, VS Code and the rest. Authorization is OAuth: the client
opens a browser, you click Allow once, and there is no key to paste. The
commands per client, and what each call costs, are on
aisa.one/mcp.Cost and request rules
Published reference values are not an account-specific quote or a settled charge. For endpoints supporting X-AISA-Cost-Mode: quote, obtain a free quote for your exact request before execution; reconcile the settled cost with response metadata and Usage Logs. USD amounts use 1,000,000 integer micro-USD per dollar.- Default request reference estimate (USD): 0.0163
- Cost contract: response_usd
- Published reference multiplier: 1.0
- Settlement evidence source: response_body
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
prompt for the AI model
required field
the question or task you want to send to the AI model;
you can specify up to 500 characters in the user_prompt field
name of the AI model
required fieldmodel_nameconsists of the actual model name and version name;
if the basic model name is specified, its latest version will be set by default;
you can receive the list of available LLM models by making a separate request to the following endpoint: https://api.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models
maximum number of tokens in the AI response
optional field
minimum value: 1
maximum value: 4096;
default value: 2048;
Note: if the reasoning model is specified in the request, the output token count may exceed the specified max_output_tokens limit
randomness of the AI response
optional field
higher values make output more diverse
lower values make output more focused
minimum value: 0
maximum value: 1.9
default value: 0.77
diversity of the AI response
optional field
controls diversity of the response by limiting token selection
minimum value: 0
maximum value: 1
default value: 0.9
country code for web search localization
optional field
specify the country ISO code to get localized web search results
Note: available only for Perplexity Sonar models
example: US
instructions for the AI behavior
optional field
defines the AI's role, tone, or specific behavior
you can specify up to 500 characters in the system_message field
conversation history optional field array of message objects representing previous conversation turns; each object must contain: role string with either user or ai role; message string with message content (max 500 characters); you can specify maximum of 10 message objects in the array; Note: for Perplexity models, messages must strictly alternate between user and AI roles (user → ai); example: "message_chain": [{"role":"user","message":"Hello, what’s up?"},{"role":"ai","message":"Hello! I’m doing well, thank you. How can I assist you today?"}]
Show child attributes
Show child attributes
user-defined task identifier
optional field
the character limit is 255
you can use this parameter to identify the task and match it with the result
you will find the specified tag value in the data object of the response
[
{
"system_message": "communicate as if we are in a business meeting",
"message_chain": [
{
"role": "user",
"message": "Hello, what’s up?"
},
{
"role": "ai",
"message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"top_p": 0.5,
"web_search_country_iso_code": "FR",
"model_name": "sonar",
"user_prompt": "provide information on how relevant the amusement park business is in France now"
}
]
Response
Successful operation
the current version of the API
general status code you can find the full list of the response codes here
general informational message you can find the full list of general informational messages here
total execution time, seconds
total tasks cost, USD
the number of tasks in the tasks array
the number of tasks in the tasks array returned with an error
array of tasks
Show child attributes
Show child attributes