Your account will not be charged for using this API
You will receive the list of available Perplexity AI models by calling this API.
As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.
| Field name | Type | Description |
|---|---|---|
version | string | the current version of the API |
status_code | integer | general status code |
status_message | string | general informational message |
time | string | execution time, seconds |
cost | float | total tasks cost, USD |
tasks_count | integer | the number of tasks in the |
tasks_error | integer | the number of tasks in the |
tasks | array | array of tasks |
id | string | task identifier |
status_code | integer | status code of the task |
status_message | string | informational message of the task |
time | string | execution time, seconds |
cost | float | cost of the task, USD |
result_count | integer | number of elements in the |
path | array | URL path |
data | object | contains the parameters passed in the URL of the GET request |
result | array | array of results |
model_name | string | name of the AI model |
reasoning | boolean | indicates if the AI model supports reasoning |
web_search_supported | boolean | web search support for the AI model |
task_post_supported | boolean | indicates if Standard (POST-GET) data retrieval is supported |
Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access
# Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
login="login"
password="password"
cred="$(printf ${login}:${password} | base64)"
curl --location --request GET "https://api.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models"
--header "Authorization: Basic ${cred}"
--header "Content-Type: application/json"
--data-raw ""<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
try {
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
$client = new RestClient($api_url, null, 'login', 'password');
} catch (RestClientException $e) {
echo "n";
print "HTTP code: {$e->getHttpCode()}n";
print "Error code: {$e->getCode()}n";
print "Message: {$e->getMessage()}n";
print $e->getTraceAsString();
echo "n";
exit();
}
try {
// using this method you can get a list of ai models
// GET /v3/ai_optimization/perplexity/llm_responses/models
// the full list of possible parameters is available in documentation
$result = $client->get('/v3/serp/google/ai_mode/languages');
print_r($result);
// do something with result
} catch (RestClientException $e) {
echo "n";
print "HTTP code: {$e->getHttpCode()}n";
print "Error code: {$e->getCode()}n";
print "Message: {$e->getMessage()}n";
print $e->getTraceAsString();
echo "n";
}
$client = null;
?>const axios = require('axios');
axios({
method: 'get',
url: 'https://api.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models',
auth: {
username: 'login',
password: 'password'
},
data: [{
version: "v3"
}],
headers: {
'content-type': 'application/json'
}
}).then(function (response) {
var result = response['data']['tasks'][0]['result'];
// Result data
console.log(result);
}).catch(function (error) {
console.log(error);
});"""
Method: GET
Endpoint: https://api.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models
@see https://docs.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models
"""
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../../')))
from lib.client import RestClient
from lib.config import username, password
client = RestClient(username, password)
try:
response = client.get('/v3/ai_optimization/perplexity/llm_responses/models')
print(response)
# do something with get result
except Exception as e:
print(f'An error occurred: {e}')using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace DataForSeoSdk;
public class AiOptimization
{
private static readonly HttpClient _httpClient;
static AiOptimization()
{
_httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.dataforseo.com/")
};
_httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Basic", ApiConfig.Base64Auth);
}
/// <summary>
/// Method: GET
/// Endpoint: https://api.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models
/// </summary>
/// <see href="https://docs.dataforseo.com/v3/ai_optimization/perplexity/llm_responses/models"/>
public static async Task PerplexityLlmResponsesModels()
{
using var response = await _httpClient.GetAsync("/v3/ai_optimization/perplexity/llm_responses/models");
var result = JsonConvert.DeserializeObject<dynamic>(await response.Content.ReadAsStringAsync());
// you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
if (result.status_code == 20000)
{
// do something with result
Console.WriteLine(result);
}
else
Console.WriteLine($"error. Code: {result.status_code} Message: {result.status_message}");
}The above command returns JSON structured like this:
{
"version": "0.1.20260116",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0483 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01211658-1535-0616-0000-f1bf0834d610",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0000 sec.",
"cost": 0,
"result_count": 3,
"path": [
"v3",
"ai_optimization",
"perplexity",
"llm_responses",
"models"
],
"data": {
"api": "ai_optimization",
"function": "llm_responses",
"se": "perplexity"
},
"result": [
{
"model_name": "sonar-reasoning-pro",
"reasoning": true,
"web_search_supported": true,
"task_post_supported": false
},
{
"model_name": "sonar-pro",
"reasoning": false,
"web_search_supported": true,
"task_post_supported": false
},
{
"model_name": "sonar",
"reasoning": false,
"web_search_supported": true,
"task_post_supported": false
}
]
}
]
}