> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 设置“LLM Responses Gemini”任务

> Gemini LLM Responses 端点允许你根据输入参数，从指定的 Gemini 模型获取结构化响应。



## OpenAPI

````yaml openapi/zh/dataforseo.json POST /dataforseo/ai_optimization/gemini/llm_responses/task_post
openapi: 3.0.3
info:
  title: DataForSEO API
  version: 1.0.0
  description: 通过 AIsa 统一网关提供的 DataForSEO API 端点。
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - BearerAuth: []
paths:
  /dataforseo/ai_optimization/gemini/llm_responses/task_post:
    post:
      summary: 设置“LLM Responses Gemini”任务
      description: Gemini LLM Responses 端点允许你根据输入参数，从指定的 Gemini 模型获取结构化响应。
      operationId: post_dataforseo_ai_optimization_gemini_llm_responses_task_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                user_prompt:
                  type: string
                  description: >-
                    AI 模型的提示词，必填字段；您希望发送给 AI 模型的问题或任务；可在 user_prompt 字段中指定最多 500
                    个字符
                model_name:
                  type: string
                  description: >-
                    AI 模型名称，必填字段；model_name
                    由实际模型名称和版本名称组成；如果指定基础模型名称，默认使用其最新版本；例如，如果指定
                    gemini-1.5-pro，将自动把 gemini-1.5-pro-002 设置为
                    model_name；你可以单独请求
                    https://api.dataforseo.com/v3/ai_optimization/gemini/llm_responses/models，以获取可用
                    LLM 模型的列表
                max_output_tokens:
                  type: integer
                  description: >-
                    AI 响应中的最大词元数，可选字段。最小值：1；最大值：4096；默认值：2048；注意：如果 web_search
                    设置为 true，或请求中指定了推理模型，则输出词元数可能超过指定的 max_output_tokens 限制。注意
                    #2：如果 use_reasoning 设置为 true，则 max_output_tokens 的最小值为 1024。
                temperature:
                  type: number
                  description: AI 响应的随机性。可选字段；值越高，输出越多样；值越低，输出越集中。最小值：0；最大值：2；默认值：1.3
                top_p:
                  type: number
                  description: AI 响应的多样性；可选字段，通过限制词元选择来控制响应的多样性；最小值：0；最大值：1；默认值：0.9。
                web_search:
                  type: boolean
                  description: >-
                    启用网络搜索以获取当前信息；可选字段。启用后，AI 模型可以访问并引用当前网络信息；注意：有关支持 web_search
                    的模型列表，请参阅 Models 端点；默认值：false；该参数的费用可在 Pricing 页面计算
                system_message:
                  type: string
                  description: >-
                    AI 行为指令，可选字段，用于定义 AI 的角色、语气或特定行为；可在 system_message 字段中指定最多
                    500 个字符
                message_chain:
                  type: array
                  items:
                    type: string
                  description: >-
                    对话历史，可选字段。表示之前对话轮次的消息对象数组；每个对象必须包含 role 和 message 参数：role
                    字符串，值为 user 或 ai 角色；message 字符串，包含消息内容（最多 500 个字符）；数组中最多可以指定
                    10 个消息对象；示例："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?"}]
                use_reasoning:
                  type: boolean
                  description: >-
                    为 AI 模型启用推理；可选字段；启用后，模型将在生成响应前进行推理；有关支持推理的模型列表，请参阅 Models
                    端点；默认值：false；注意：如果设置为 true，max_output_tokens 的最小值为 1024；注意
                    #2：对于 Gemini Pro 模型，use_reasoning 将自动设置为 true
                tag:
                  type: string
                  description: >-
                    用户定义的任务标识符。可选字段。字符数限制为 255。您可以使用此参数标识任务并将其与结果匹配；您将在响应的 data
                    对象中找到指定的 tag 值
                postback_url:
                  type: string
                  description: >-
                    用于发送任务结果的 URL，可选字段；任务完成后，我们会向指定的 postback_url 发送 POST
                    请求，其结果采用 gzip 格式压缩；可以使用字符串 ‘$id’ 作为 $id 变量，并使用 ‘$tag’ 作为经过
                    URL 编码的 $tag
                    变量。我们会在发送请求前设置必要的值。示例：http://your-server.com/postbackscript?id=$id
                    http://your-server.com/postbackscript?id=$id&tag=$tag
                    注意：postback_url 中的特殊字符将经过 URL 编码；例如，# 字符将被编码为
                    %23；有关更多信息，请参阅我们的帮助中心
                pingback_url:
                  type: string
                  description: >-
                    已完成任务的通知 URL。可选字段。任务完成后，我们将通过向您指定的 URL 发送 GET
                    请求来通知您。您可以使用字符串 ‘$id’ 作为 $id 变量，并使用 ‘$tag’ 作为经过 urlencoded
                    编码的 $tag
                    变量。我们会在发送请求前设置必要的值。示例：http://your-server.com/pingscript?id=$id
                    http://your-server.com/pingscript?id=$id&tag=$tag
                    注意：pingback_url 中的特殊字符将经过 urlencoded 编码；例如，# 字符将被编码为
                    %23。请在我们的帮助中心了解更多信息
              required:
                - user_prompt
                - model_name
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: string
                    description: API 的当前版本
                  status_code:
                    type: integer
                    description: 通用状态码；您可以在此处查看完整的响应码列表。注意：我们强烈建议设计必要的系统来处理相关异常或错误情况
                  status_message:
                    type: string
                    description: 常规信息消息；可在此处查看常规信息消息的完整列表
                  time:
                    type: string
                    description: 执行时间（秒）
                  cost:
                    type: number
                    description: 任务总成本（美元）
                  tasks_count:
                    type: integer
                    description: tasksarray 中的任务数量
                  tasks_error:
                    type: integer
                    description: 返回错误的 tasks 数组中的任务数量
                  tasks:
                    type: array
                    items:
                      type: string
                    description: 任务数组
                  tasks.id:
                    type: string
                    description: 系统中的唯一任务标识符，采用 UUID 格式
                  tasks.status_code:
                    type: integer
                    description: DataForSEO 生成的任务状态码；取值范围为：10000-60000，完整的响应码列表可在此处查看
                  tasks.status_message:
                    type: string
                    description: 任务的信息性消息，你可以在此处查看通用信息性消息的完整列表
                  tasks.time:
                    type: string
                    description: 执行时间（秒）
                  tasks.cost:
                    type: number
                    description: 任务成本（美元）
                  tasks.result_count:
                    type: integer
                    description: 结果数组中的元素数量
                  tasks.path:
                    type: array
                    items:
                      type: string
                    description: URL 路径
                  tasks.data:
                    type: object
                    description: 包含您在 POST 请求中指定的相同参数
                  tasks.result:
                    type: array
                    items:
                      type: string
                    description: 结果数组；在此情况下，该值将为 null
        '400':
          description: 错误请求
        '401':
          description: 未授权
        '429':
          description: 超出速率限制
        '500':
          description: 内部服务器错误
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````