The cost of the task can be calculated on the Pricing page.
Live Gemini LLM Responses
Live Gemini LLM Responses endpoint allows you to retrieve structured responses from a specific Gemini AI model, based on the input parameters.
Live Gemini LLM Responses endpoint allows you to retrieve structured responses from a specific Gemini AI model, based on the input parameters.
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 Gemini 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 Gemini 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 gemini-1.5-pro is specified, the gemini-1.5-pro-002 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/gemini/llm_responses/models
|
max_output_tokens |
integer | maximum number of tokens in the AI response optional field minimum value: 1maximum value: 2048default value: 2048Note: 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: 0maximum value: 2default value: 1.3 |
top_p |
float | diversity of the AI response optional field controls diversity of the response by limiting token selection minimum value: 0maximum value: 1default value: 0.9 |
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;
|
system_message |
string | 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 |
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 trueNote: 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 | redirect URL to the quoted source contains a Vertex AI redirect that leads to the original source |
fan_out_queries |
array | 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/gemini/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": "gemini-2.5-flash",
"web_search": true,
"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" => "gemini-2.5-flash",
"web_search" => true,
"user_prompt" => "provide information on how relevant the amusement park business is in France now"
);
if (count($post_array) > 0) {
try {
// POST /v3/ai_optimization/gemini/llm_responses/live
// 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/gemini/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/gemini/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: "gemini-2.5-flash",
web_search: true,
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/gemini/llm_responses/live
@see https://docs.dataforseo.com/v3/ai_optimization/gemini/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,
'temperature': 0.3,
'top_p': 0.5,
'model_name': 'gemini-2.5-flash',
'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/gemini/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/gemini/llm_responses/live
/// </summary>
/// <see href="https://docs.dataforseo.com/v3/ai_optimization/gemini/llm_responses/live"/>
public static async Task GeminiLlmResponsesLive()
{
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,
temperature = 0.3,
top_p = 0.5,
model_name = "gemini-2.5-flash",
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/gemini/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.20251208",
"status_code": 20000,
"status_message": "Ok.",
"time": "5.5958 sec.",
"cost": 0.0376568,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "12111456-1535-0612-0000-26ea2dc16c11",
"status_code": 20000,
"status_message": "Ok.",
"time": "5.5290 sec.",
"cost": 0.0376568,
"result_count": 1,
"path": [
"v3",
"ai_optimization",
"gemini",
"llm_responses",
"live"
],
"data": {
"api": "ai_optimization",
"function": "llm_responses",
"se": "gemini",
"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,
"model_name": "gemini-2.5-flash",
"top_p": 0.5,
"web_search": true,
"user_prompt": "provide information on how relevant the amusement park business is in France now"
},
"result": [
{
"model_name": "gemini-2.5-flash",
"input_tokens": 206,
"output_tokens": 798,
"web_search": true,
"money_spent": 0.0370568,
"datetime": "2025-12-11 14:56:47 +00:00",
"items": [
{
"type": "message",
"sections": [
{
"type": "text",
"text": "The amusement park business in France is currently a significant and growing market, demonstrating strong relevance within the leisure and tourism industry.nnHere's a breakdown of its current state:nn**Market Size and Growth:**n* The French amusement parks market generated an estimated revenue of USD 3,249.3 million in 2024.n* It is projected to reach USD 4,274.3 million by 2030, growing at a Compound Annual Growth Rate (CAGR) of 4.4% from 2025 to 2030.n* Another report indicates the France Theme Park Tourism Market size was USD 2033.82 million in 2024 and is projected to reach USD 3849.39 million by 2033, with a CAGR of 7.26% between 2025 and 2033.n* The broader leisure destinations sector in France, which includes amusement parks, has a turnover of 3 billion euros and employs over 50,000 people across 500 companies.nn**Key Drivers and Trends:**n* **Strong Tourism Industry:** France's robust tourism sector, attracting millions of visitors annually, significantly contributes to the amusement park market's growth.n* **Increasing Disposable Income:** Rising disposable income among consumers is leading to increased spending on leisure activities.n* **Changing Consumer Preferences:** There's a growing demand for experiential entertainment and family-oriented leisure activities.n* **Technological Integration:** Parks are investing in augmented reality (AR) and virtual reality (VR) attractions to offer immersive and interactive experiences.n* **Sustainability Focus:** Many parks are implementing eco-friendly practices and sustainability initiatives.n* **Innovation in Attractions:** Continuous expansion and innovation in rides and attractions cater to diverse audiences, including families and thrill-seekers.n* **Development of Hospitality:** Parks are increasingly focusing on developing their hospitality offerings, including themed hotels, to become comprehensive destinations.nn**Competitive Landscape:**n* The French amusement park market is becoming highly competitive.n* Major players like Disneyland Paris, Parc Astérix, Puy du Fou, and Futuroscope dominate the market, accounting for a significant portion of visits to the top European parks.n* Disneyland Paris, in particular, is a major driver of the European amusement park market due to its global popularity.n* In 2023, Disneyland Paris welcomed 10.4 million visitors, making it the #1 park in EMEA and #2 globally. Its Walt Disney Studios Park saw 5.7 million visitors in 2023.n* Puy du Fou is another highly popular park, ranking second in France by visitor numbers in 2023 with over 2.5 million visitors, and is top-rated for customer satisfaction.n* Regional parks often focus on a family-friendly and affordable approach to attract visitors.nn**Post-Pandemic Recovery:**n* After a challenging 2020 due to shutdowns, the market has seen a direct and continuous recovery.n* Average attendance at French parks in 2024 was 15-20% higher than in 2019.nnIn conclusion, the amusement park business in France is a dynamic and thriving sector, driven by strong tourist appeal, evolving consumer demands, and continuous innovation.",
"annotations": [
{
"title": "grandviewresearch.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGh7v1fRFZwvtWdXLLSQs6g6xtu5ZeD-I1435mjDt4EoLLyCtmyTU8GimmxhM7zb76c-yxwlONcoDySHnQ2KFfPujgdAZXO8LFZk851Ur9WaLzoNfARNQ0JbA4ORvsX7OAnVSBxhN1WiS4fZw6XQMVIAEqvUxoERX7iywCW0FNrPDVnMtECr41aKB4="
},
{
"title": "deepmarketinsights.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGLM08MiqQsO4rzsofwSG-QEcEN226loOkdTd2CiPNlU0NJ4kRcu7X35D4mVVsCB6SukMRFI33LMqsH9kksFStFE-7nXyOr7YiZ7pMYSbFaMWvClA7eZWmLd0aPc4NdUHgwE7q9JFkpVAusy_YH-SWbOwSvGxtrJ15F9jHdwAPosdUi4z5ST7OUlw=="
},
{
"title": "puydufou.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFUIfOcXCJdEHywKMrWXfgSSdRmodlUyxGUIRx2AKVojkvzugfs49u2T4MMLrpq-1z_tOYoq4ozWhi7aXtYjR2fPsTo4ARp_rBMeNSvKcp26jbTgxKTYNrmm7oeFQjTlE1rkug9LJwbRnz1Bwls5Q-O_Fh4eM4mvQk="
},
{
"title": "6wresearch.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEUw4Giv1pNf_-CZTpku8tItZcCZmCVpUikRFEqk43PAwYAtaDE48XXctm49tnHJSbhibv3JTr7vOX7rpRoSOTaw5hCJj8hL8kIj2wNnnzeRFP87O7J6wgpU8NVPSprSYky9dhmn1WhjCkRztCfoaefPe2TyhFWPeVNJ8R-ci56QlG-M2E-F3w61OM="
},
{
"title": "kenresearch.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFEjxBpDNE1QmFmYrzsYO2EGjyFIhKywCzcmy9THBnY8qiPZ8yFU3Vfx7KI-UJisPEs7HISfiv9MJ3ZzZ9wde0OZMeRcyoInsPpKWAjwM79IVnz_6XrhrQFlK9qPThZ3g1V-aaLUDuOaoimg78YXXqc4XFxTzJ1M42R1QMHsmZp2dWlszQ="
},
{
"title": "businesscoot.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEm74cgwvacFkZ6jMAeCmyDdxoryPJfaWoHSm5sLa3dMud3HImfssGP97BU1vOodJAnrzmw9BSida9dOX4HTf5KWFk_ZgQJXsT-jFc1R6zAwgW_74QUHiwibUKEimb_-fH9hOEF0vRuux4FojMlOwEPkK2AW1WPMmxtDINef_uV"
},
{
"title": "mousenotifier.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFtKiKaW9PcrSRpKB-4UFqDZg47FfSpIKUHjMf-UhU2pWzG0gYW8lI7ePhBXI9EfYqT2nJze9YO2qLcMefbpFZoD19eCT44dZaKKg1IofNtAMS8vtTvhdpwWjEVc_NX1bfC_guo76Uduq2PB1HmJ-Yntvk="
},
{
"title": "parkworld-online.com",
"url": "https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHB2rvlEFKahIlbzDy8gpMl9EKHySbc_sqUoiAJ_zqKlVXj4L7dVIdSArJxSK2WN1jzvpKcRYdSFXO94N34TY6rFJ5yIl3AsOVnSkVnfm7uwnnZxdOo-Da0sxH_jCu9v98pcV7xurzBPSXE1cH_e-InjDff50qFDJsiN-xLpgbEWbDQdbshwp6XC3L5FYWSvBYX3ZSWmOTFTzs="
}
]
}
]
}
],
"fan_out_queries": [
"amusement park business France current relevance",
"amusement park industry France market size 2023 2024",
"number of amusement parks in France 2023",
"amusement park attendance France 2023",
"trends in French amusement park industry"
]
}
]
}
]
}