# 設定「LLM Responses ChatGPT」任務

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/ai_optimization/chat_gpt/llm_responses/task_post`

**Tags:** DataForSEO

將 ChatGPT 提示排入佇列而不等待回覆，傳回任務 `id`。相較於即時端點，多了 `system_message` 與 `message_chain`，因此可在單一任務中傳送多輪對話。包裝在 DataForSEO 的信封中：資料位於 `tasks[0].result`，結果狀態位於 `tasks[0].status_code`——即使請求遭拒仍會傳回 HTTP 200。⚠️ 並非每個模型都支援排隊——請在 `get_dataforseo_ai_chat_gpt_llm_responses_models` 中確認 `task_post_supported`。以 `get_dataforseo_ai_chat_gpt_llm_responses_fetch` 取回。

### 定價參考

- 計量方式：依回報的回應成本計量。
- 參考請求預估：USD 0.701。
- 參考客戶乘數：1.0。不得再次套用於已結算的客戶金額。

僅供參考的中繼資料，並非帳戶報價、保證價格或消費上限。資源額度並非 Felo 額度。最終費用依 Felo 計費記錄為準。

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **no**

### application/json

Schema:

```json
{
  "type": "array",
  "items": {
    "type": [
      "object",
      "null"
    ],
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "user_prompt": {
            "type": "string",
            "description": "<em>AI 模型的提示詞</em><br><strong>必填欄位</strong><br>要傳送給 AI 模型的問題或任務；<br>在 <code>user_prompt</code> 欄位中最多可指定 <strong>500 個字元</strong>"
          },
          "model_name": {
            "type": "string",
            "description": "<em>AI 模型名稱</em><br><strong>必填欄位</strong><br><code>model_name</code > 由實際模型名稱和版本名稱組成；<br>如果只指定基礎模型名稱，將預設設定其最新版本；<br>例如，指定 <code>gpt-4.1</code> 時，會自動將 <code>gpt-4.1-2025-04-14</code> 設為 <code>model_name</code>；<br>可個別向 <code>https://api.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/models</code> 發出請求，取得可用的 LLM 模型清單"
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>AI 回應中的最大 token 數</em><br>選填欄位<br>推論模型（例如 <a href=\"/v3/ai_optimization/chat_gpt/llm_responses/models/\" target=\"_blank\">Models 端點</a>中 <code>reasoning</code> 為 <code>true</code>）的最小值：<code>1024</code>；<br>非推論模型的最小值：<code>16</code>；<br>最大值：<code>4096</code>；<br>預設值：<code>2048</code>"
          },
          "temperature": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>AI 回應的隨機性</em><br>選填欄位<br>值越高，輸出越多元；<br>值越低，輸出越集中；<br>最小值：<code>0</code><br>最大值：<code>2</code><br>預設值：<code>0.94</code><br><strong>注意：</strong>推論模型不支援"
          },
          "top_p": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>AI 回應的多樣性</em><br>選填欄位 <br>透過限制 token 選擇來控制回應的多樣性；<br>最小值：<code>0</code><br>最大值：<code>1</code> <br>預設值：<code>0.92</code><p><strong>注意：</strong>同一請求中 <code>top_p</code> 不能與 <code>temperature</code> 同時使用"
          },
          "web_search": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>啟用網路搜尋</em><br>選填欄位<br>啟用後，AI 模型可以存取並引用目前的網路資訊；<br>預設值：<code>false</code>；<br><strong>注意：</strong>支援 <code>web_search</code> 的模型清單請參閱 <a href=\"https://docs.dataforseo.com/v3/ai_optimization/chat_gpt/llm_responses/models/\">Models 端點</a>；"
          },
          "force_web_search": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>強制 AI 代理程式使用網路搜尋</em><br>選填欄位<br>要啟用此參數，還必須啟用 <code>web_search</code>；<br>啟用後，AI 模型會被強制存取並引用目前的網路資訊；<br>預設值：<code>false</code>；<br><strong>注意：</strong>即使參數設為 <code>true</code>，也無法保證回應中會引用網路來源 <br><strong>注意 2：</strong>推論模型不支援"
          },
          "web_search_country_iso_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>地點的 ISO 國家代碼</em><br>選填欄位<br>要啟用此參數，還必須啟用 <code>web_search</code>；<br>啟用後，AI 模型將從你指定的國家/地區搜尋網路；<br><strong>注意：</strong><code>o3-mini</code>、<code>o1-pro</code>、<code>o1</code> 模型不支援"
          },
          "web_search_city": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>地點的城市名稱</em><br>選填欄位<br><strong>注意：</strong><code>o3-mini</code>、<code>o1-pro</code>、<code>o1</code> 模型不支援"
          },
          "system_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>AI 行為指令</em><br>選填欄位<br>定義 AI 的角色、語氣或特定行為；<br>在 <code>system_message</code> 欄位中最多可指定 <strong>500 個字元</strong>"
          },
          "message_chain": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": [
                "object",
                "null"
              ],
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "訊息來源使用者的角色"
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "訊息文字"
                    }
                  }
                }
              ]
            },
            "description": "對話歷史\n選填欄位\n代表先前對話輪次的訊息物件陣列；\n每個物件必須包含：\nrole 字串，值為 user 或 ai 角色；\nmessage 字串，包含訊息內容（最多 500 個字元）；\n陣列中最多可指定 10 個訊息物件；\n注意：對於 Perplexity 模型，訊息必須嚴格在 user 與 AI 角色之間交替（user → ai）；\n範例：\n\"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?\"}]"
          },
          "postback_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>用於傳送任務結果的 URL</em><br>選填欄位<br>任務完成後，我們會將其結果以 <code>gzip</code> 格式壓縮，並向你指定的 <code>postback_url</code> 傳送 POST 請求<br>可將 ‘$id’ 字串用作 <code>$id</code> 變數，將 ‘$tag’ 用作經 URL 編碼的 <code>$tag</code> 變數。傳送請求前我們會設定必要的值。<br>範例：<br><code>http://your-server.com/postbackscript?id=$id</code><br><code>http://your-server.com/postbackscript?id=$id&amp;tag=$tag</code><br><strong>注意：</strong><code>postback_url</code> 中的特殊字元會進行 URL 編碼；<br>例如，<code>#</code> 字元會被編碼為 <code>%23</code><p>詳情請參閱我們的 <a href=\"https://dataforseo.com/help-center/pingbacks-postbacks-with-dataforseo-api\" target=\"_blank\" rel=\"noopener noreferrer\">說明中心</a>"
          },
          "pingback_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>任務完成通知 URL</em><br>選填欄位<br>任務完成後，我們會向你指定的 URL 傳送 GET 請求進行通知<br>可將 ‘$id’ 字串用作 <code>$id</code> 變數，將 ‘$tag’ 用作經 URL 編碼的 <code>$tag</code> 變數。傳送請求前我們會設定必要的值<br>範例：<br><code>http://your-server.com/pingscript?id=$id</code><br><code>http://your-server.com/pingscript?id=$id&amp;tag=$tag</code><br><strong>注意：</strong><code>pingback_url</code> 中的特殊字元會進行 URL 編碼；<br>例如，<code>#</code> 字元會被編碼為 <code>%23</code><p>詳情請參閱我們的 <a href=\"https://dataforseo.com/help-center/pingbacks-postbacks-with-dataforseo-api\" target=\"_blank\" rel=\"noopener noreferrer\">說明中心</a>"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>使用者自訂任務識別碼</em><br>選填欄位<br><em>字元數上限為 255</em><br>可使用此參數識別任務，並將其與結果對應<br>可在回應的 <code>data</code> 陣列中找到指定的 <code>tag</code> 值"
          }
        },
        "example": [
          {
            "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?"
              }
            ],
            "model_name": "gpt-4.1-mini",
            "user_prompt": "provide information on how relevant the amusement park business is in France now"
          }
        ]
      }
    ]
  },
  "example": [
    {
      "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?"
        }
      ],
      "model_name": "gpt-4.1-mini",
      "user_prompt": "provide information on how relevant the amusement park business is in France now"
    }
  ]
}
```

## Responses

### 200 — 操作成功

Headers:
- `X-Request-Id` (string) — 聯絡 Felo 支援時需提供的請求識別碼。

**application/json**

Schema: object | null

```json
{
  "type": [
    "object",
    "null"
  ],
  "oneOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostResponseInfo"
    }
  ]
}
```

### 400 — 無法處理該要求。請檢查請求參數。

### 401 — 需要有效的 Felo API 金鑰。

### 402 — 由於未符合計費要求，要求無法繼續。

### 403 — 該帳戶無權執行此操作。

### 429 — 已達到要求或支出上限。

### 502 — 服務無法完成該要求。

### 503 — API 或計費服務暫時無法使用。

### 504 — 服務在處理要求時逾時。

### default — 錯誤回應；上游透傳回應可能採用供應商格式

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostResponseInfo

`#/components/schemas/Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostResponseInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseInfo"
    },
    {
      "type": "object",
      "properties": {
        "tasks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostTaskInfo"
              }
            ]
          },
          "description": "<em>任務陣列</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostTaskInfo

`#/components/schemas/Response36Afe1097B20_AiOptimizationChatGptLlmResponsesTaskPostTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "object",
            "null"
          ],
          "description": "<em>結果陣列</em><br>在此情況下，該值將為 <code>null</code>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_BaseResponseInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseInfo`

```json
{
  "properties": {
    "version": {
      "type": [
        "string",
        "null"
      ],
      "description": "API 的目前版本"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "一般狀態碼\n完整回應碼清單請見此處"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "一般資訊訊息\n完整的一般資訊訊息清單請見此處"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "總執行時間，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任務總費用，美元",
      "format": "double"
    },
    "tasks_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 陣列中的任務數",
      "format": "int64"
    },
    "tasks_error": {
      "type": [
        "integer",
        "null"
      ],
      "description": "tasks 陣列中傳回錯誤的任務數",
      "format": "int64"
    }
  }
}
```

### Response36Afe1097B20_BaseResponseTaskInfo

`#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo`

```json
{
  "properties": {
    "id": {
      "type": [
        "string",
        "null"
      ],
      "description": "任務識別碼\n我們系統中 UUID 格式的唯一任務識別碼"
    },
    "status_code": {
      "type": [
        "integer",
        "null"
      ],
      "description": "任務的狀態碼\n由 DataForSEO 產生，範圍如下：10000-60000\n完整回應碼清單請見此處"
    },
    "status_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "任務的資訊訊息\n完整的一般資訊訊息清單請見此處"
    },
    "time": {
      "type": [
        "string",
        "null"
      ],
      "description": "執行時間，秒"
    },
    "cost": {
      "type": [
        "number",
        "null"
      ],
      "description": "任務總費用，美元",
      "format": "double"
    },
    "result_count": {
      "type": [
        "integer",
        "null"
      ],
      "description": "result 陣列中的元素數",
      "format": "int64"
    },
    "path": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "URL 路徑"
    },
    "data": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "object",
          "null"
        ]
      },
      "description": "包含你在 POST 請求中指定的相同參數"
    }
  }
}
```
