APIMaster.ai
Data APIs/DataForSEO/GEO & AI search analytics
Available

Request Gemini model answers (submit task)

Gemini LLM Responses API allows you to retrieve structured responses from a specific Gemini model, based on the input parameters.

POST/v1/dataforseo/ai_optimization/gemini/llm_responses/task_post

Request parameters

ParameterTypeMeaning
max_output_tokensOptional or conditionalintegermaximum number of tokens in the AI response
message_chainOptional or conditionalarrayconversation history
model_nameRequiredstringname of the AI model
pingback_urlOptional or conditionalstringnotification URL of a completed task
postback_urlOptional or conditionalstringURL for sending task results
system_messageOptional or conditionalstringinstructions for the AI behavior
tagOptional or conditionalstringuser-defined task identifier
temperatureOptional or conditionalnumberrandomness of the AI response
top_pOptional or conditionalnumberdiversity of the AI response
use_reasoningOptional or conditionalbooleanenable reasoning for the AI model
user_promptRequiredstringprompt for the AI model
web_searchOptional or conditionalbooleanenable web search for current information

Response

The JSON response includes status_code, status_message, tasks and task results. Check both the HTTP status and each task's status_code. A depth of 10 can include special search blocks, so it does not always mean ten organic links. The response's cost field is native API data; your final APIMaster fee is shown in the response headers and usage log.

task_post creates a task. Save its task ID, then use the matching tasks_ready and task_get APIs. Task results are private to the account that created them.

Model-restricted API keys must allow dataforseo. Callback URLs are not supported; retrieve asynchronous results with task_get.

Pricing and settlement

$0.73605Estimated price

Reference prices use example parameters and default account pricing, checked 2026-12-01. Actual fees vary with parameters, data volume and account pricing; the settled amount is final.

Request a free estimate before running a call. An estimate is not a fixed price or a hard spending cap. Your fee uses the actual settled usage and your account's current group multiplier once. The estimated amount is reserved from your wallet; unused funds are returned after settlement. Model subscriptions and trial credits do not cover these calls.

Use a unique Idempotency-Key for each intended call. Keep the same key and parameters when recovering a call. If the outcome or fee is pending, query /v1/data-requests/{request_id}; do not start another paid call with a new key.

400: invalid parameters; 401: invalid or expired key; 403: key permissions; 402: insufficient wallet or key quota; 409: idempotency conflict or request pending; 429: rate limit; 502/503: request or settlement unavailable. For every failure, preserve the request ID and check settlement before repeating a paid operation.

Code examples

curl --request POST 'https://apimaster.ai/v1/dataforseo/ai_optimization/gemini/llm_responses/task_post' \
  --header 'Authorization: Bearer YOUR_APIMASTER_KEY' \
  --header 'Idempotency-Key: YOUR_UNIQUE_REQUEST_KEY' \
  --header 'Content-Type: application/json' \
  --data '[
  {
    "message_chain": [
      {
        "message": "Hello, what’s up?",
        "role": "user"
      },
      {
        "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?",
        "role": "ai"
      }
    ],
    "model_name": "gemini-2.5-flash",
    "system_message": "communicate as if we are in a business meeting",
    "user_prompt": "provide information on how relevant the amusement park business is in France now"
  }
]'
Download OpenAPI schema

Related APIs