Live ChatGPT LLM Responses

‌‌
Live ChatGPT LLM Responses endpoint allows you to retrieve structured responses from a specific ChatGPT AI model, based on the input parameters.

checked POST
Pricing

The cost of the task can be calculated on the Pricing page.

All POST data should be sent in the JSON format (UTF-8 encoding). The task setting is done using the POST method. When setting a task, you should send all task parameters in the task array of the generic POST array. You can send up to 2000 API calls per minute, each Live ChatGPT LLM Responses call can contain only one task.

The number of concurrent Live tasks is currently limited to 30 per account for each platform in the LLM Responses.

Execution time for tasks set with the Live ChatGPT LLM Responses endpoint is currently up to 120 seconds.

Below you will find a detailed description of the fields you can use for setting a task.

Description of the fields for setting a task:

Field nameTypeDescription
user_promptstring

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

model_namestring

name of the AI model
required field
model_nameconsists of the actual model name and version name;
if the basic model name is specified, its latest version will be set by default;
for example, if gpt-4.1 is specified, the gpt-4.1-2025-04-14 will be set as model_name automatically;
you can receive the list of available LLM models by making a separate request to the https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/models

max_output_tokensinteger

maximum number of tokens in the AI response
optional field
minimum value for reasoning models (e.g., reasoning is true in the Models endpoint): 1024;
minimum value for non-reasoning models: 16;
maximum value: 4096;
default value: 2048
Note: if web_search is set to true or the reasoning model is specified in the request, the output token count may exceed the specified max_output_tokens limit

temperaturefloat

randomness of the AI response
optional field
higher values make output more diverse;
lower values make output more focused;
minimum value: 0
maximum value: 2
default value: 0.94
Note: not supported in reasoning models

top_pfloat

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.92

Note: top_p cannot be used together with temperature in the same request

web_searchboolean

enable web search
optional field
when enabled, the AI model can access and cite current web information;
default value: false;
Note: refer to the Models endpoint for a list of models that support web_search;

force_web_searchboolean

force AI agent to use web search
optional field
to enable this parameter, web_search must also be enabled;
when enabled, the AI model is forced to access and cite current web information;
default value: false;
Note: even if the parameter is set to true, there is no guarantee web sources will be cited in the response
Note #2: not supported in reasoning models

web_search_country_iso_codestring

ISO country code of the location
optional field
to enable this parameter, web_search must also be enabled;
when enabled, the AI model will search the web from the country you specify;
Note: not supported in o3-mini, o1-pro, o1 models

web_search_citystring

city name of the location
optional field
Note: not supported in o3-mini, o1-pro, o1 models

system_messagestring

instructions for the AI behaviour
optional field
defines the AI's role, tone, or specific behavior
you can specify up to 500 characters in the system_message field

message_chainarray

conversation history
optional field
array of message objects representing previous conversation turns;
each object must contain role and message parameters:
role string with either user or ai role;
message string with message content (max 500 characters);
you can specify the maximum of 10 message objects in the array;
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?"}]

tagstring

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



‌‌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.

Description of the fields in the results array:
Field nameTypeDescription
versionstring

the current version of the API

status_codeinteger

general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions

status_messagestring

general informational message
you can find the full list of general informational messages here

timestring

execution time, seconds

costfloat

total tasks cost, USD

tasks_countinteger

the number of tasks in the tasks array

tasks_errorinteger

the number of tasks in the tasks array returned with an error

tasksarray

array of tasks

    idstring

task identifier
unique task identifier in our system in the UUID format

    status_codeinteger

status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here

    status_messagestring

informational message of the task
you can find the full list of general informational messages here

    timestring

execution time, seconds

    costfloat

cost of the task, USD
includes the base task price plus the money_spent value

    result_countinteger

number of elements in the result array

    patharray

URL path

    dataobject

contains the same parameters that you specified in the POST request

    resultarray

array of results

        model_namestring

name of the AI model used

        input_tokensinteger

number of tokens in the input
total count of tokens processed

        output_tokensinteger

number of tokens in the output
total count of tokens generated in the AI response

        reasoning_tokensinteger

number of reasoning tokens
total count of tokens used to generate reasoning content

        web_searchboolean

indicates if web search was used

        money_spentfloat

cost of AI tokens, USD
the price charged by the third-party AI model provider for according to its Pricing

        datetimestring

date and time when the result was received
in the UTC format: “yyyy-mm-dd hh-mm-ss +00:00”
example:
2019-11-15 12:57:46 +00:00

        itemsarray

array of response items
contains structured AI response data

            reasoningobject

element in the response

                typestring

type of the element = 'reasoning'
Note: this element is supported only in reasoning models and is not guaranteed to be returned

                sectionsarray

reasoning chain sections
array of objects containing the reasoning chain sections generated by the LLM

                    typestring

type of element='summary_text'

                    textstring

text of the reasoning chain section
text of the reasoning chain section summarizing the model's thought process

            messageobject

element in the response

                typestring

type of the element = 'message'

                sectionsarray

array of content sections
contains different parts of the AI response

                    typestring

type of element='text'

                    textstring

AI-generated text content

                    annotationsarray

array of references used to generate the response
equals null if the web_search parameter is not set to true
Note: annotations may return empty even when web_search is true, as the AI will attempt to retrieve web information but may not find relevant results

                        titlestring

the domain name or title of the quoted source

                        urlstring

URL of the quoted source

                        start_indexinteger

start of the annotation indexing

                        end_indexinteger

end of the annotation indexing

                        textstring

annotated part of the quoted source

        fan_out_queriesarray

array of fan-out queries
contains related search queries derived from the main query to provide a more comprehensive response


‌‌

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 POST "https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live" 
--header "Authorization: Basic ${cred}"  
--header "Content-Type: application/json" 
--data-raw '[
  {
    "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,
    "model_name": "gpt-4.1-mini",
    "web_search": true,
    "web_search_country_iso_code": "FR",
    "web_search_city": "Paris",
    "user_prompt": "provide information on how relevant the amusement park business is in France now"
  }
]'
<?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();
}
$post_array = array();
// You can set only one task at a time
$post_array[] = array(
        "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,
        "model_name" => "gpt-4.1-mini",
        "web_search" => true,
        "web_search_country_iso_code" => "FR",
        "web_search_city" => "Paris",
        "user_prompt" => "provide information on how relevant the amusement park business is in France now"
);
if (count($post_array) > 0) {
try {
    // POST /v3/serp/google/ai_mode/live/advanced
    // in addition to 'google' and 'ai_mode' you can also set other search engine and type parameters
    // the full list of possible parameters is available in documentation
    $result = $client->post('/v3/ai_optimization/chat_gpt/llm_responses/live', $post_array);
    print_r($result);
    // do something with post 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: 'post',
    url: 'https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live',
    auth: {
        username: 'login',
        password: 'password'
    },
    data: [{
    system_message: encodeURI("communicate as if we are in a business meeting"),
    message_chain: [
      {
        role: "user",
        message: "Hello, what’s up?"
      },
      {
        role: "ai",
        message: encodeURI("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,
    model_name: "gpt-4.1-mini",
    web_search: true,
    web_search_country_iso_code: "FR",
    web_search_city: "Paris",
    user_prompt: encodeURI("provide information on how relevant the amusement park business is in France now")
    }],
    headers: {
        'content-type': 'application/json'
    }
}).then(function (response) {
    var result = response['data']['tasks'];
    // Result data
    console.log(result);
}).catch(function (error) {
    console.log(error);
});
"""
Method: POST
Endpoint: https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live
@see https://docs.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live
"""

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)

post_data = []
post_data.append({
        '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,
        'web_search_country_iso_code': 'FR',
        'web_search_city': 'Paris',
        'model_name': 'gpt-4o',
        'web_search': True,
        'user_prompt': 'provide information on how relevant the amusement park business is in France now'
    })
try:
    response = client.post('/v3/ai_optimization/chat_gpt/llm_responses/live', post_data)
    print(response)
    # do something with post 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: POST
    /// Endpoint: https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live
    /// </summary>
    /// <see href="https://docs.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/live"/>
    
    public static async Task ChatGptLlmResponsesLive()
    {
        var postData = new List<object>();
        // a simple way to set a task, the full list of possible parameters is available in documentation
        postData.Add(new
        {
            system_message = "communicate as if we are in a business meeting",
            message_chain = new object[]
            {
                new
                {
                    role = "user",
                    message = "Hello, what's up?"
                },
                new
                {
                    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,
            web_search_country_iso_code = "FR",
            web_search_city = "Paris",
            model_name = "gpt-4o",
            web_search = true,
            user_prompt = "provide information on how relevant the amusement park business is in France now"
        });

        var content = new StringContent(JsonConvert.SerializeObject(postData), Encoding.UTF8, "application/json");
        using var response = await _httpClient.PostAsync("/v3/ai_optimization/chat_gpt/llm_responses/live", content);
        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.20260717",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "4.8468 sec.",
  "cost": 0.029631,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "07221754-1535-0612-0000-d708c6651bc3",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "4.8305 sec.",
      "cost": 0.029631,
      "result_count": 1,
      "path": [
        "v3",
        "ai_optimization",
        "chat_gpt",
        "llm_responses",
        "live"
      ],
      "data": {
        "api": "ai_optimization",
        "function": "llm_responses",
        "se": "chat_gpt",
        "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?"
          }
        ],
        "temperature": 0.3,
        "top_p": 0.5,
        "web_search_country_iso_code": "FR",
        "web_search_city": "Paris",
        "model_name": "gpt-4.1-mini",
        "web_search": true,
        "user_prompt": "provide information on how relevant the amusement park business is in France now"
      },
      "result": [
        {
          "model_name": "gpt-4.1-mini-2025-04-14",
          "input_tokens": 8174,
          "output_tokens": 476,
          "reasoning_tokens": 0,
          "web_search": true,
          "money_spent": 0.0290312,
          "datetime": "2026-07-22 17:54:30 +00:00",
          "items": [
            {
              "type": "message",
              "sections": [
                {
                  "type": "text",
                  "text": "The amusement park industry in France remains a significant and dynamic sector as of 2024. In 2023, the industry achieved a turnover of approximately €2.5 billion, with major parks like Disneyland Paris, Parc Astérix, Puy du Fou, and Futuroscope accounting for 60% of the total attendance. ([latribune.fr](https://www.latribune.fr/entreprises/tourisme/2024-09-13/entre-creations-et-tensions-le-marche-des-parcs-de-loisirs-en-occitanie-joue-les-montagnes-russes-1006293.html?id=1950717847221315%5C&utm_source=openai))nnNotably, in 2024, Parc Astérix welcomed a record 2.84 million visitors, earning it the title of the best amusement park in France for the third consecutive year. ([ouest-france.fr](https://www.ouest-france.fr/tourisme/le-parc-asterix-est-elu-meilleur-parc-dattractions-de-france-decouvrez-ses-nouveaux-projets-710f3c5a-a5bb-11ef-b03c-14608f7369cf?utm_source=openai)) Similarly, Nigloland attracted 750,000 visitors, placing it among the top five parks in the country. ([parc-attraction-loisirs.fr](https://www.parc-attraction-loisirs.fr/2024/11/12/chiffre-frequentation-2024-nigloland/?utm_source=openai))nnThe Compagnie des Alpes, a leading operator in the sector, reported that its leisure parks generated €570.1 million in revenue in 2023/2024, surpassing the performance of its ski resorts. ([lechotouristique.com](https://www.lechotouristique.com/article/compagnie-des-alpes-pour-la-premiere-fois-les-parcs-de-loisirs-depassent-les-domaines-skiables?utm_source=openai))nnThese developments underscore the continued relevance and growth of the amusement park industry in France, driven by strong consumer demand and ongoing investments in new attractions and experiences. ",
                  "annotations": [
                    {
                      "title": "Entre créations et tensions, le marché des parcs de loisirs en Occitanie joue les montagnes russes",
                      "url": "https://www.latribune.fr/entreprises/tourisme/2024-09-13/entre-creations-et-tensions-le-marche-des-parcs-de-loisirs-en-occitanie-joue-les-montagnes-russes-1006293.html?id=1950717847221315%5C&utm_source=openai",
                      "start_index": 290,
                      "end_index": 516,
                      "text": "([latribune.fr](https://www.latribune.fr/entreprises/tourisme/2024-09-13/entre-creations-et-tensions-le-marche-des-parcs-de-loisirs-en-occitanie-joue-les-montagnes-russes-1006293.html?id=1950717847221315%5C&utm_source=openai))"
                    },
                    {
                      "title": "Le Parc Astérix est élu meilleur parc d’attractions de France : découvrez ses nouveaux projets",
                      "url": "https://www.ouest-france.fr/tourisme/le-parc-asterix-est-elu-meilleur-parc-dattractions-de-france-decouvrez-ses-nouveaux-projets-710f3c5a-a5bb-11ef-b03c-14608f7369cf?utm_source=openai",
                      "start_index": 680,
                      "end_index": 884,
                      "text": "([ouest-france.fr](https://www.ouest-france.fr/tourisme/le-parc-asterix-est-elu-meilleur-parc-dattractions-de-france-decouvrez-ses-nouveaux-projets-710f3c5a-a5bb-11ef-b03c-14608f7369cf?utm_source=openai))"
                    },
                    {
                      "title": "Parc Nigloland : bons chiffres en 2024 et nouveauté annoncée pour 2025",
                      "url": "https://www.parc-attraction-loisirs.fr/2024/11/12/chiffre-frequentation-2024-nigloland/?utm_source=openai",
                      "start_index": 986,
                      "end_index": 1123,
                      "text": "([parc-attraction-loisirs.fr](https://www.parc-attraction-loisirs.fr/2024/11/12/chiffre-frequentation-2024-nigloland/?utm_source=openai))"
                    },
                    {
                      "title": "Compagnie des Alpes : pour la première fois, les parcs de loisirs dépassent les domaines skiables",
                      "url": "https://www.lechotouristique.com/article/compagnie-des-alpes-pour-la-premiere-fois-les-parcs-de-loisirs-depassent-les-domaines-skiables?utm_source=openai",
                      "start_index": 1313,
                      "end_index": 1492,
                      "text": "([lechotouristique.com](https://www.lechotouristique.com/article/compagnie-des-alpes-pour-la-premiere-fois-les-parcs-de-loisirs-depassent-les-domaines-skiables?utm_source=openai))"
                    }
                  ]
                }
              ]
            }
          ],
          "fan_out_queries": [
            "current relevance of amusement park business in France 2024"
          ]
        }
      ]
    }
  ]
}