NAVNavbar
cURL php NodeJS Python cSharp

Live Claude LLM Responses

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

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access

<?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,
        "model_name" => "claude-opus-4-0",
        "temperature" => 0.3,
        "top_p" => 0.5,
        "web_search" => true,
        "web_search_country_iso_code" => "FR",
        "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/claude/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;
?>

The above command returns JSON structured like this:

{
  "version": "0.1.20250526",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "37.1234 sec.",
  "cost": 0.49405,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "07181737-1535-0612-0000-ef6b334c1466",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "37.0584 sec.",
      "cost": 0.49405,
      "result_count": 1,
      "path": [
        "v3",
        "ai_optimization",
        "claude",
        "llm_responses",
        "live"
      ],
      "data": {
        "api": "ai_optimization",
        "function": "llm_responses",
        "se": "claude",
        "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",
        "model_name": "claude-opus-4-0",
        "web_search": true,
        "user_prompt": "provide information on how relevant the amusement park business is in France now"
      },
      "result": [
        {
          "model_name": "claude-opus-4-20250514",
          "input_tokens": 27285,
          "output_tokens": 989,
          "web_search": true,
          "money_spent": 0.49345,
          "datetime": "2025-07-18 17:37:59 +00:00",
          "items": [
            {
              "type": "message",
              "sections": [
                {
                  "type": "text",
                  "text": "I'll search for current information about the amusement park business in France.",
                  "annotations": null
                }
              ]
            },
            {
              "type": "message",
              "sections": [
                {
                  "type": "text",
                  "text": "Let me search for more specific information about the French amusement park market and recent trends.",
                  "annotations": null
                }
              ]
            },
            {
              "type": "message",
              "sections": [
                {
                  "type": "text",
                  "text": "Based on my research, I can provide you with comprehensive information about the relevance of the amusement park business in France currently:\n\n## Current State of the French Amusement Park Industry\n\nThe amusement park business in France remains highly relevant and continues to show strong performance in 2024-2025. Here are the key insights:\n\n### Market Performance and Visitor Numbers\n\n",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "The 2024 season was marked by unfavorable weather conditions (very humid), the impact of the Paris Olympics for some parks, and the political context (legislative elections). Despite these challenges, new records were achieved!",
                  "annotations": [
                    {
                      "title": "Classement Parcs d'attractions France ❤️ Top 15 Visiteurs 2024",
                      "url": "https://www.parcs-france.com/classement-parcs-attraction-top20/"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n\nThe top French parks reported impressive visitor numbers for 2024:\n- ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Parc Astérix = 2,842,000 visitors ᐅ Record",
                  "annotations": [
                    {
                      "title": "Classement Parcs d'attractions France ❤️ Top 15 Visiteurs 2024",
                      "url": "https://www.parcs-france.com/classement-parcs-attraction-top20/"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n- ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Puy du Fou = 2,800,000 ᐅ Record",
                  "annotations": [
                    {
                      "title": "Classement Parcs d'attractions France ❤️ Top 15 Visiteurs 2024",
                      "url": "https://www.parcs-france.com/classement-parcs-attraction-top20/"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n- ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Futuroscope = 2,050,000",
                  "annotations": [
                    {
                      "title": "Classement Parcs d'attractions France ❤️ Top 15 Visiteurs 2024",
                      "url": "https://www.parcs-france.com/classement-parcs-attraction-top20/"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n\n### Industry Significance\n\n",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "With a turnover of 3 billion euros, 500 companies and more than 50,000 employees, leisure destinations are a diverse and enduring asset for France.",
                  "annotations": [
                    {
                      "title": "No. 1 amusement park in France | Puy du Fou",
                      "url": "https://www.puydufou.com/france/en/no-1-amusement-park-france"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "The French amusement parks union SNELAC proudly proclaims it: this industry is a real dream machine for its 63 million visitors.",
                  "annotations": [
                    {
                      "title": "No. 1 amusement park in France | Puy du Fou",
                      "url": "https://www.puydufou.com/france/en/no-1-amusement-park-france"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n\n### European Market Context\n\n",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "The amusement parks market in Europe is growing with a significant CAGR from 2025 to 2030.",
                  "annotations": [
                    {
                      "title": "Amusement Parks Market Size, Share | Industry Report, 2030",
                      "url": "https://www.grandviewresearch.com/industry-analysis/amusement-parks-market"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " France plays a crucial role in this growth, hosting several internationally recognized parks.\n\n### Key Success Factors\n\n1. **International Recognition**: ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Winning 9 international awards in just 7 years, Puy du Fou has established itself worldwide as a real leader in the field of shows and parks.",
                  "annotations": [
                    {
                      "title": "No. 1 amusement park in France | Puy du Fou",
                      "url": "https://www.puydufou.com/france/en/no-1-amusement-park-france"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n\n2. **Diverse Offerings**: ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Across France, different venues compete with inventiveness to offer increasingly wild attractions (roller coasters, 4D films...) and ever more grandiose shows.",
                  "annotations": [
                    {
                      "title": "Les 17 parcs d'attractions incontournables en France en 2025",
                      "url": "https://www.fnacspectacles.com/magazine/others/parc-attraction-incontournable-france"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": "\n\n3. **Innovation**: Parks are continuously introducing new attractions, with ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "Winnoland, the most visited amusement park in the 91 region, renewing itself with a new attraction: the Wild West Coaster",
                  "annotations": [
                    {
                      "title": "Amusement parks and funfairs in and around Paris, program and information 2025 - Sortiraparis.com",
                      "url": "https://www.sortiraparis.com/en/what-to-visit-in-paris/walks/guides/50912-amusement-parks-and-funfairs-in-and-around-paris-2024-program"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": " for 2025.\n\n### Future Outlook\n\nThe industry shows strong growth potential with ",
                  "annotations": null
                },
                {
                  "type": "text",
                  "text": "the global amusement parks market size estimated at USD 102.67 billion in 2024 and projected to reach USD 149.32 billion by 2030, growing at a CAGR of 6.1% from 2025 to 2030",
                  "annotations": [
                    {
                      "title": "Amusement Parks Market Size, Share | Industry Report, 2030",
                      "url": "https://www.grandviewresearch.com/industry-analysis/amusement-parks-market"
                    }
                  ]
                },
                {
                  "type": "text",
                  "text": ".\n\n### Conclusion\n\nThe amusement park business in France remains highly relevant and continues to thrive despite recent challenges. With record-breaking attendance figures, significant economic contribution, and continuous innovation, the sector demonstrates strong resilience and growth potential. The industry's ability to attract over 63 million visitors annually and generate 3 billion euros in revenue underscores its importance to France's tourism and entertainment sectors.",
                  "annotations": null
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

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 Claude LLM Responses call can contain only one task.

Execution time for tasks set with the Live Chat GPT 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 name Type Description
user_prompt string 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_name string 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 claude-opus-4-0 is specified, the claude-opus-4-20250514 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/claude/llm_responses/models
max_output_tokens integer maximum number of tokens in the AI response
optional field
minimum value: 1
maximum value: 2048
default value: 2048
Note: when web_search is set to true, the output token count may exceed the specified max_output_tokens limit
temperature float 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
default value: 0.7
top_p float diversity of the AI response
optional field
controls diversity of the response by limiting token selection;
minimum value: 0
maximum value: 1
default value: null
web_search boolean enable web search for current information
optional field
when enabled, the AI model can access and cite current web information;
Note: refer to the Models endpoint for a list of models that support web_search;
default value: false;

force_web_search boolean 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
web_search_country_iso_code string ISO country code of the location
optional field
possible values: 'AR','AT','AU','BE','BR','CA','CH','CL','CN','DE','DK','ES','FI','FR','GB','HK','ID','IN','IT','JP','KR','MX','MY','NL','NO','NZ','PH','PL','PT','RU','SA','SE','TR','TW','US','ZA'
web_search_city string city name of the location
optional field
Note: specify web_search_country_iso_code to use this parameter
system_message string 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_chain array 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?"}]
tag string 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 name Type Description
version string the current version of the API
status_code integer 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_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasks array
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string task identifier
unique task identifier in our system in the UUID format
        status_code integer 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_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
includes the base task price plus the money_spent value
        result_count integer number of elements in the result array
        path array URL path
        data object contains the same parameters that you specified in the POST request
        result array array of results
            model_name string name of the AI model used
            input_tokens integer number of tokens in the input
total count of tokens processed
            output_tokens integer number of tokens in the output
total count of tokens generated in the AI response
            web_search boolean indicates if web search was used
            money_spent float cost of AI tokens, USD
the price charged by the third-party AI model provider for according to its Pricing
            datetime string 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
            items array array of response items
contains structured AI response data
                type string type of the element = ‘message’
                sections array array of content sections
contains different parts of the AI response
                    type string type of element = ‘text’
                    text string AI-generated text content
                    annotations array 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
                       title string the domain name or title of the quoted source
                       url string URL of the quoted source

‌‌