# LLM Responses ของ Claude แบบเรียลไทม์

**API:** Data API

**Endpoint:** `POST /v1/beta/dataforseo/ai_optimization/claude/llm_responses/live`

**Tags:** DataForSEO

ส่ง `user_prompt` ไปยังโมเดล Claude และคืนคำตอบแบบซิงโครนัส `model_name` ต้องมาจาก `get_dataforseo_ai_claude_llm_responses_models` — ชื่อมีรูปแบบเช่น `claude-sonnet-5` และชื่อที่เดาแล้วดูสมเหตุสมผลจะถูกปฏิเสธ คืนค่า `model_name`, `input_tokens`, `output_tokens`, `reasoning_tokens`, `web_search`, `money_spent`, `datetime`, `items` และ `fan_out_queries` อ่าน `money_spent` ในการตอบกลับเพื่อดูว่าคำสั่งหนึ่งครั้งมีค่าใช้จ่ายจริงเท่าใด ห่อด้วย envelope ของ DataForSEO: ข้อมูลอยู่ใน `tasks[0].result` ผลลัพธ์อยู่ใน `tasks[0].status_code` — คำขอที่ถูกปฏิเสธยังคงคืน HTTP 200

### ข้อมูลอ้างอิงราคา

- การวัดปริมาณการใช้งาน: ต้นทุนการตอบกลับที่รายงาน
- ค่าประมาณคำขออ้างอิง: USD 0.0567
- ตัวคูณอ้างอิงสำหรับลูกค้า: 1.0 ห้ามนำไปใช้ซ้ำกับยอดที่เรียกเก็บจากลูกค้าแล้ว

เป็นข้อมูลเมตาอ้างอิงเท่านั้น ไม่ใช่ใบเสนอราคาสำหรับบัญชี ไม่ใช่ราคาที่รับประกัน และไม่ใช่เพดานการใช้จ่าย เครดิตของทรัพยากรไม่ใช่เครดิต Felo ยอดเรียกเก็บขั้นสุดท้ายเป็นไปตามบันทึกการเรียกเก็บเงินของ Felo

## Related links

- [endpoint Models](<https://docs.dataforseo.com/v3/ai_optimization/claude/llm_responses/models/>)
- [ราคา](<https://docs.anthropic.com/en/docs/about-claude/pricing>)

## 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>ระบุได้<strong>สูงสุด 500 อักขระ</strong>ในฟิลด์ <code>user_prompt</code>"
          },
          "model_name": {
            "type": "string",
            "description": "<em>ชื่อโมเดล AI</em><br><strong>ฟิลด์ที่จำเป็น</strong><br><code>model_name</code > ประกอบด้วยชื่อโมเดลจริงและชื่อเวอร์ชัน;<br>หากระบุเฉพาะชื่อโมเดลพื้นฐาน ระบบจะใช้เวอร์ชันล่าสุดเป็นค่าเริ่มต้น;<br>ตัวอย่างเช่น หากระบุ <code>claude-opus-4-0</code> ระบบจะตั้ง <code>claude-opus-4-20250514</code> เป็น <code>model_name</code> โดยอัตโนมัติ;<br>คุณสามารถรับรายการโมเดล LLM ที่ใช้ได้โดยส่งคำขอแยกไปที่ <code>https://api.dataforseo.com/v3/ai_optimization/claude/llm_responses/models</code>"
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "<em>จำนวนโทเคนสูงสุดในการตอบกลับของ AI</em><br>ฟิลด์ไม่บังคับ<br>ค่าต่ำสุด: <code>1</code>;<br>ค่าสูงสุด: <code>4096</code>;<br>ค่าเริ่มต้น: <code>2048</code>;<br><strong>หมายเหตุ:</strong> หากตั้ง <code>web_search</code> เป็น <code>true</code> หรือระบุโมเดล reasoning ในคำขอ จำนวนโทเคนเอาต์พุตอาจเกินขีดจำกัด <code>max_output_tokens</code> ที่ระบุ<br><strong>หมายเหตุ 2:</strong> หากตั้ง <code>use_reasoning</code> เป็น <code>true</code> ค่าต่ำสุดของ <code>max_output_tokens</code> คือ <code>1025</code>"
          },
          "temperature": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>ความสุ่มของการตอบกลับของ AI</em><br>ฟิลด์ไม่บังคับ<br>ค่าที่สูงขึ้นทำให้เอาต์พุตหลากหลายขึ้น; <br>ค่าที่ต่ำลงทำให้เอาต์พุตโฟกัสมากขึ้น;<br>ค่าต่ำสุด: <code>0</code><br>ค่าสูงสุด: <code>1</code><br>ค่าเริ่มต้น: <code>0.7</code><p><strong>หมายเหตุ:</strong> <code>temperature</code> ใช้ร่วมกับ <code>top_p</code> ในคำขอเดียวกันไม่ได้"
          },
          "top_p": {
            "type": [
              "number",
              "null"
            ],
            "description": "<em>ความหลากหลายของการตอบกลับของ AI</em><br>ฟิลด์ไม่บังคับ <br>ควบคุมความหลากหลายของการตอบกลับโดยจำกัดการเลือกโทเคน;<br>ค่าต่ำสุด: <code>0</code><br>ค่าสูงสุด: <code>1</code> <br>ค่าเริ่มต้น: <code>null</code><p><strong>หมายเหตุ:</strong> <code>top_p</code> ใช้ร่วมกับ <code>temperature</code> ในคำขอเดียวกันไม่ได้"
          },
          "web_search": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>เปิดการค้นหาเว็บสำหรับข้อมูลปัจจุบัน</em><br>ฟิลด์ไม่บังคับ<br>เมื่อเปิดใช้งาน โมเดล AI สามารถเข้าถึงและอ้างอิงข้อมูลเว็บปัจจุบัน;<br><strong>หมายเหตุ:</strong> ดูรายการโมเดลที่รองรับ <code>web_search</code> ได้ที่endpoint Models; <br>ค่าเริ่มต้น: <code>false</code>;<br>ค่าใช้จ่ายของพารามิเตอร์นี้คำนวณได้จากหน้าราคา"
          },
          "force_web_search": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>บังคับให้ AI agent ใช้การค้นหาเว็บ</em><br>ฟิลด์ไม่บังคับ<br>หากต้องการเปิดพารามิเตอร์นี้ ต้องเปิด <code>web_search</code> ด้วย;<br>เมื่อเปิดใช้งาน โมเดล AI จะถูกบังคับให้เข้าถึงและอ้างอิงข้อมูลเว็บปัจจุบัน;<br>ค่าเริ่มต้น: <code>false</code>;<br><strong>หมายเหตุ:</strong> แม้ตั้งค่าเป็น <code>true</code> ก็ไม่รับประกันว่าจะมีการอ้างอิงแหล่งเว็บในการตอบกลับ"
          },
          "web_search_country_iso_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>รหัสประเทศ ISO ของสถานที่ที่ใช้ค้นเว็บ</em><br>ฟิลด์ไม่บังคับ<br>ค่าที่เป็นไปได้: <code>'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'</code>"
          },
          "web_search_city": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ชื่อเมืองของสถานที่ที่ใช้ค้นเว็บ</em><br>ฟิลด์ไม่บังคับ<br>"
          },
          "system_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>คำสั่งสำหรับพฤติกรรมของ AI</em><br>ฟิลด์ไม่บังคับ<br>กำหนดบทบาท โทน หรือพฤติกรรมเฉพาะของ AI;<br>ระบุได้<strong>สูงสุด 500 อักขระ</strong>ในฟิลด์ <code>system_message</code>"
          },
          "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?\"}]"
          },
          "use_reasoning": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "<em>เปิดใช้ reasoning สำหรับโมเดล AI</em><br>ฟิลด์ไม่บังคับ<br>เมื่อเปิดใช้งาน โมเดลจะทำ reasoning ก่อนสร้างการตอบกลับ<br>ดูรายการโมเดลที่รองรับ <code>reasoning</code> ได้ที่endpoint Models<br>ค่าเริ่มต้น: <code>false</code><br><strong>หมายเหตุ:</strong> หากตั้งเป็น <code>true</code> ค่าต่ำสุดของ <code>max_output_tokens</code> คือ <code>1025</code><br><strong>หมายเหตุ 2:</strong> หากตั้งเป็น <code>true</code> ต้องตั้ง <code>force_web_search</code> เป็น <code>false</code><br><strong>หมายเหตุ 3:</strong> หากตั้งเป็น <code>true</code> จะใช้ <code>temperature</code> และ <code>top_p</code> ไม่ได้"
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "<em>ตัวระบุงานที่ผู้ใช้กำหนด</em><br>ฟิลด์ไม่บังคับ<br><em>จำกัด 255 อักขระ</em><br>ใช้พารามิเตอร์นี้เพื่อระบุงานและจับคู่กับผลลัพธ์<br>คุณจะพบค่า <code>tag</code> ที่ระบุในออบเจ็กต์ <code>data</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?"
              }
            ],
            "max_output_tokens": 200,
            "model_name": "claude-opus-4-0",
            "temperature": 0.3,
            "web_search": true,
            "web_search_country_iso_code": "FR",
            "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?"
        }
      ],
      "max_output_tokens": 200,
      "model_name": "claude-opus-4-0",
      "temperature": 0.3,
      "web_search": true,
      "web_search_country_iso_code": "FR",
      "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_AiOptimizationClaudeLlmResponsesLiveResponseInfo"
    }
  ]
}
```

### 400 — ไม่สามารถประมวลผลคำขอได้ ตรวจสอบพารามิเตอร์ของคำขอ

### 401 — จำเป็นต้องใช้คีย์ API ของ Felo ที่ถูกต้อง

### 402 — ไม่สามารถดำเนินการตามคำขอได้ เนื่องจากไม่เป็นไปตามข้อกำหนดด้านการเรียกเก็บเงิน

### 403 — บัญชีไม่ได้รับอนุญาตให้ดำเนินการนี้

### 429 — ถึงขีดจำกัดคำขอหรือการใช้จ่ายแล้ว

### 502 — บริการไม่สามารถดำเนินการตามคำขอให้เสร็จสิ้นได้

### 503 — API หรือบริการเรียกเก็บเงินไม่พร้อมใช้งานชั่วคราว

### 504 — บริการหมดเวลาระหว่างประมวลผลคำขอ

### default — การตอบกลับข้อผิดพลาด; การตอบกลับที่ส่งผ่านจากต้นทางอาจใช้รูปแบบของผู้ให้บริการ

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResponseInfo

`#/components/schemas/Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResponseInfo`

```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_AiOptimizationClaudeLlmResponsesLiveTaskInfo"
              }
            ]
          },
          "description": "<em>อาร์เรย์ของงาน</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResultInfo

`#/components/schemas/Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResultInfo`

```json
{
  "type": "object",
  "properties": {
    "model_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>ชื่อของโมเดล AI ที่ใช้</em>"
    },
    "input_tokens": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>จำนวนโทเคนในอินพุต</em><br>จำนวนโทเคนทั้งหมดที่ประมวลผล"
    },
    "output_tokens": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>จำนวนโทเคนในเอาต์พุต</em><br>จำนวนโทเคนทั้งหมดที่สร้างในการตอบกลับของ AI"
    },
    "reasoning_tokens": {
      "type": [
        "integer",
        "null"
      ],
      "description": "<em>จำนวนโทเคนการให้เหตุผล</em><br>จำนวนโทเคนทั้งหมดที่ใช้สร้างเนื้อหาการให้เหตุผล"
    },
    "web_search": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "<em>ระบุว่ามีการใช้การค้นหาเว็บหรือไม่</em>"
    },
    "money_spent": {
      "type": [
        "number",
        "null"
      ],
      "description": "<em>ต้นทุนของโทเคน AI, USD</em><br>ราคาที่ผู้ให้บริการโมเดล AI บุคคลที่สามเรียกเก็บตามราคาของตน"
    },
    "datetime": {
      "type": [
        "string",
        "null"
      ],
      "description": "<em>วันที่และเวลาที่ได้รับผลลัพธ์</em><br>ในรูปแบบ UTC: “yyyy-mm-dd hh-mm-ss +00:00”<br>ตัวอย่าง:<br><code class=\"long-string\">2019-11-15 12:57:46 +00:00</code>"
    },
    "items": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "object",
          "null"
        ],
        "oneOf": [
          {
            "$ref": "#/components/schemas/Response36Afe1097B20_BaseAiOptimizationLlmResponseElementItem"
          }
        ]
      },
      "description": "<em>อาร์เรย์ของรายการตอบกลับ</em><br>มีข้อมูลการตอบกลับของ AI ที่มีโครงสร้าง"
    },
    "fan_out_queries": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "description": "<em>อาร์เรย์ของคำค้นแบบ fan-out</em><br>มีคำค้นที่เกี่ยวข้องซึ่งได้มาจากคำค้นหลักเพื่อให้การตอบกลับครอบคลุมมากขึ้น"
    }
  }
}
```

### Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveTaskInfo

`#/components/schemas/Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveTaskInfo`

```json
{
  "type": "object",
  "allOf": [
    {
      "$ref": "#/components/schemas/Response36Afe1097B20_BaseResponseTaskInfo"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": [
              "object",
              "null"
            ],
            "oneOf": [
              {
                "$ref": "#/components/schemas/Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResultInfo"
              }
            ]
          },
          "description": "<em>อาร์เรย์ของผลลัพธ์</em>"
        }
      }
    }
  ]
}
```

### Response36Afe1097B20_BaseAiOptimizationLlmResponseElementItem

`#/components/schemas/Response36Afe1097B20_BaseAiOptimizationLlmResponseElementItem`

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": [
        "string",
        "null"
      ],
      "description": "ประเภทขององค์ประกอบ"
    }
  },
  "additionalProperties": false,
  "discriminator": {
    "propertyName": "type",
    "mapping": {
      "reasoning": "#/components/schemas/Response36Afe1097B20_ReasoningAiOptimizationLlmResponseElementItem",
      "message": "#/components/schemas/Response36Afe1097B20_MessageAiOptimizationLlmResponseElementItem"
    }
  }
}
```

### 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": "ค่าใช้จ่ายรวมของงาน, USD",
      "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": "ค่าใช้จ่ายรวมของงาน, USD",
      "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"
    }
  }
}
```
